本文整理汇总了C++中CSG_MetaData::Set_Name方法的典型用法代码示例。如果您正苦于以下问题:C++ CSG_MetaData::Set_Name方法的具体用法?C++ CSG_MetaData::Set_Name怎么用?C++ CSG_MetaData::Set_Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSG_MetaData
的用法示例。
在下文中一共展示了CSG_MetaData::Set_Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: On_Execute
//---------------------------------------------------------
bool CGPX_Export::On_Execute(void)
{
int iEle, iName, iCmt, iDesc;
CSG_String File;
CSG_MetaData GPX;
CSG_Shapes *pShapes;
//-----------------------------------------------------
File = Parameters("FILE") ->asString();
pShapes = Parameters("SHAPES") ->asShapes();
iEle = Parameters("ELE") ->asInt(); if( iEle >= pShapes->Get_Field_Count() ) iEle = -1;
iName = Parameters("NAME") ->asInt(); if( iName >= pShapes->Get_Field_Count() ) iName = -1;
iCmt = Parameters("CMT") ->asInt(); if( iCmt >= pShapes->Get_Field_Count() ) iCmt = -1;
iDesc = Parameters("DESC") ->asInt(); if( iDesc >= pShapes->Get_Field_Count() ) iDesc = -1;
//-----------------------------------------------------
GPX.Set_Name(SG_T("gpx"));
GPX.Add_Property(SG_T("version") , SG_T("1.0"));
GPX.Add_Property(SG_T("creator") , SG_T("SAGA - System for Automated Geoscientific Analyses - http://www.saga-gis.org"));
GPX.Add_Property(SG_T("xmlns:xsi") , SG_T("http://www.w3.org/2001/XMLSchema-instance"));
GPX.Add_Property(SG_T("xmlns") , SG_T("http://www.topografix.com/GPX/1/0"));
GPX.Add_Property(SG_T("xsi:schemaLocation") , SG_T("http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd"));
for(int iShape=0; iShape<pShapes->Get_Count(); iShape++)
{
CSG_Shape *pShape = pShapes->Get_Shape(iShape);
for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
{
CSG_MetaData *pPoint = GPX.Add_Child(SG_T("wpt"));
pPoint->Add_Property(SG_T("lon"), pShape->Get_Point(iPoint, iPart).x);
pPoint->Add_Property(SG_T("lat"), pShape->Get_Point(iPoint, iPart).y);
if( iEle > 0 ) pPoint->Add_Child(SG_T("ele" ), pShape->asString(iEle));
if( iName > 0 ) pPoint->Add_Child(SG_T("name"), pShape->asString(iName));
if( iCmt > 0 ) pPoint->Add_Child(SG_T("cmt" ), pShape->asString(iCmt));
if( iDesc > 0 ) pPoint->Add_Child(SG_T("desc"), pShape->asString(iDesc));
}
}
}
//-----------------------------------------------------
if( !GPX.Save(File) )
{
return( false );
}
//-----------------------------------------------------
return( true );
}
示例2: On_Execute
//.........这里部分代码省略.........
}
}
}
//-------------------------------------------------
CSG_String fName(Parameters("FILE")->asString());
if( !SG_File_Cmp_Extension(fName, SG_T("bmp"))
&& !SG_File_Cmp_Extension(fName, SG_T("jpg"))
&& !SG_File_Cmp_Extension(fName, SG_T("pcx"))
&& !SG_File_Cmp_Extension(fName, SG_T("png"))
&& !SG_File_Cmp_Extension(fName, SG_T("tif")) )
{
fName = SG_File_Make_Path(NULL, fName, SG_T("png"));
Parameters("FILE")->Set_Value(fName);
}
//-----------------------------------------------------
wxImageHandler *pImgHandler = NULL;
if( !SG_UI_Get_Window_Main() )
{
if( SG_File_Cmp_Extension(fName, SG_T("jpg")) )
pImgHandler = new wxJPEGHandler;
else if( SG_File_Cmp_Extension(fName, SG_T("pcx")) )
pImgHandler = new wxPCXHandler;
else if( SG_File_Cmp_Extension(fName, SG_T("tif")) )
pImgHandler = new wxTIFFHandler;
#ifdef _SAGA_MSW
else if( SG_File_Cmp_Extension(fName, SG_T("bmp")) )
pImgHandler = new wxBMPHandler;
#endif
else // if( SG_File_Cmp_Extension(fName, SG_T("png")) )
pImgHandler = new wxPNGHandler;
wxImage::AddHandler(pImgHandler);
}
if( !Image.SaveFile(fName.c_str()) )
{
Error_Set(CSG_String::Format(SG_T("%s [%s]"), _TL("could not save image file"), fName.c_str()));
return( false );
}
pGrid->Get_Projection().Save(SG_File_Make_Path(NULL, fName, SG_T("prj")), SG_PROJ_FMT_WKT);
//-----------------------------------------------------
CSG_File Stream;
if( SG_File_Cmp_Extension(fName, SG_T("bmp")) ) Stream.Open(SG_File_Make_Path(NULL, fName, SG_T("bpw")), SG_FILE_W, false);
else if( SG_File_Cmp_Extension(fName, SG_T("jpg")) ) Stream.Open(SG_File_Make_Path(NULL, fName, SG_T("jgw")), SG_FILE_W, false);
else if( SG_File_Cmp_Extension(fName, SG_T("pcx")) ) Stream.Open(SG_File_Make_Path(NULL, fName, SG_T("pxw")), SG_FILE_W, false);
else if( SG_File_Cmp_Extension(fName, SG_T("png")) ) Stream.Open(SG_File_Make_Path(NULL, fName, SG_T("pgw")), SG_FILE_W, false);
else if( SG_File_Cmp_Extension(fName, SG_T("tif")) ) Stream.Open(SG_File_Make_Path(NULL, fName, SG_T("tfw")), SG_FILE_W, false);
if( Stream.is_Open() )
{
Stream.Printf(SG_T("%.10f\n%f\n%f\n%.10f\n%.10f\n%.10f\n"),
pGrid->Get_Cellsize(),
0.0, 0.0,
-pGrid->Get_Cellsize(),
pGrid->Get_XMin(),
pGrid->Get_YMax()
);
}
//-----------------------------------------------------
if( Parameters("FILE_KML")->asBool() )
{
CSG_MetaData KML; KML.Set_Name("kml"); KML.Add_Property("xmlns", "http://www.opengis.net/kml/2.2");
// CSG_MetaData *pFolder = KML.Add_Child("Folder");
// pFolder->Add_Child("name" , "Raster exported from SAGA");
// pFolder->Add_Child("description", "System for Automated Geoscientific Analyses - www.saga-gis.org");
// CSG_MetaData *pOverlay = pFolder->Add_Child("GroundOverlay");
CSG_MetaData *pOverlay = KML.Add_Child("GroundOverlay");
pOverlay->Add_Child("name" , pGrid->Get_Name());
pOverlay->Add_Child("description", pGrid->Get_Description());
pOverlay->Add_Child("Icon" )->Add_Child("href", SG_File_Get_Name(fName, true));
pOverlay->Add_Child("LatLonBox" );
pOverlay->Get_Child("LatLonBox" )->Add_Child("north", pGrid->Get_YMax());
pOverlay->Get_Child("LatLonBox" )->Add_Child("south", pGrid->Get_YMin());
pOverlay->Get_Child("LatLonBox" )->Add_Child("east" , pGrid->Get_XMax());
pOverlay->Get_Child("LatLonBox" )->Add_Child("west" , pGrid->Get_XMin());
KML.Save(fName, SG_T("kml"));
}
//-----------------------------------------------------
if( !SG_UI_Get_Window_Main() && pImgHandler != NULL)
{
wxImage::RemoveHandler(pImgHandler->GetName());
}
//-----------------------------------------------------
return( true );
}