Isis 3.0 Application Source Code Reference |
Home |
00001 #include "Isis.h" 00002 00003 #include <iostream> 00004 00005 #include "geos/geom/MultiPolygon.h" 00006 #include "UserInterface.h" 00007 #include "Filename.h" 00008 #include "Cube.h" 00009 #include "ImagePolygon.h" 00010 #include "PolygonTools.h" 00011 00012 using namespace std; 00013 using namespace Isis; 00014 00015 void IsisMain() { 00016 00017 00018 UserInterface &ui = Application::GetUserInterface(); 00019 00020 Cube cube; 00021 cube.open(ui.GetFilename("FROM")); 00022 ImagePolygon poly; 00023 poly.Create(cube); 00024 00025 geos::geom::MultiPolygon *mPolygon = poly.Polys(); 00026 00027 std::string polyString; 00028 00029 if(ui.WasEntered("LABEL")) { 00030 string fid = ui.GetString("LABEL"); 00031 polyString = PolygonTools::ToGML(mPolygon, fid); 00032 } 00033 else { 00034 polyString = PolygonTools::ToGML(mPolygon); 00035 } 00036 00037 string outfile; 00038 ofstream fout; 00039 if(ui.WasEntered("TO")) { 00040 outfile = ui.GetFilename("TO"); 00041 } 00042 else { 00043 Filename inputFile = ui.GetFilename("FROM"); 00044 inputFile.RemoveExtension(); 00045 inputFile.AddExtension("gml"); 00046 outfile = inputFile.Name(); 00047 } 00048 fout.open(outfile.c_str()); 00049 00050 fout << polyString << endl; 00051 00052 // fout.open(Filename(outfile).Expanded().c_str(),ios::out); 00053 fout.close(); 00054 00055 00056 00057 } 00058 00059 00060