本文整理汇总了C++中CSG_MetaData::Get_Name方法的典型用法代码示例。如果您正苦于以下问题:C++ CSG_MetaData::Get_Name方法的具体用法?C++ CSG_MetaData::Get_Name怎么用?C++ CSG_MetaData::Get_Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSG_MetaData
的用法示例。
在下文中一共展示了CSG_MetaData::Get_Name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: On_Execute
//---------------------------------------------------------
bool CGPX_Import::On_Execute(void)
{
CSG_Shapes *pWay;
CSG_MetaData GPX;
//-----------------------------------------------------
m_Name = Parameters("FILE") ->asString();
m_pShapes = Parameters("SHAPES") ->asShapesList();
m_bTime = Parameters("TIME") ->asBool();
//-----------------------------------------------------
if( !GPX.Create(m_Name) || GPX.Get_Name().CmpNoCase(SG_T("gpx")) )
{
return( false );
}
//-----------------------------------------------------
pWay = SG_Create_Shapes(SHAPE_TYPE_Point, m_Name);
m_Name = SG_File_Get_Name(m_Name, false);
m_pShapes->Del_Items();
//-----------------------------------------------------
for(int i=0; i<GPX.Get_Children_Count(); i++)
{
CSG_MetaData *pChild = GPX.Get_Child(i);
if( pChild->Get_Name().CmpNoCase(SG_T("wpt")) == 0 )
{
Add_Point(pChild, pWay);
}
else if( pChild->Get_Name().CmpNoCase(SG_T("rte")) == 0 )
{
Add_Route(pChild);
}
else if( pChild->Get_Name().CmpNoCase(SG_T("trk")) == 0 )
{
Add_Track(pChild);
}
}
//-----------------------------------------------------
if( pWay->Get_Count() > 0 )
{
m_pShapes->Add_Item(pWay);
}
else
{
delete(pWay);
}
return( m_pShapes->Get_Count() > 0 );
}
示例2: Add_Point
//---------------------------------------------------------
bool CGPX_Import::Add_Point(CSG_MetaData *pNode, CSG_Shapes *pPoints)
{
const SG_Char *cString;
TSG_Point Point;
if( (cString = pNode->Get_Property(SG_T("lon"))) != NULL && CSG_String(cString).asDouble(Point.x)
&& (cString = pNode->Get_Property(SG_T("lat"))) != NULL && CSG_String(cString).asDouble(Point.y)
&& Add_Fields(pNode, pPoints) )
{
CSG_Shape *pPoint = pPoints->Add_Shape();
pPoint->Add_Point(Point, 0);
for(int i=0; i<pNode->Get_Children_Count(); i++)
{
CSG_MetaData *pChild = pNode->Get_Child(i);
pPoint->Set_Value(pChild->Get_Name(), pChild->Get_Content());
}
if( m_bTime )
{
double h = CSG_String(pPoint->asString(SG_T("time"))).AfterFirst(SG_T('T')).asDouble();
double m = CSG_String(pPoint->asString(SG_T("time"))).AfterFirst(SG_T(':')).asDouble();
double s = CSG_String(pPoint->asString(SG_T("time"))).AfterLast (SG_T(':')).asDouble();
pPoint->Set_Value(SG_T("dtime"), h + m / 60.0 + s / 3600.0);
}
return( true );
}
return( false );
}
示例3: Add_Track
//---------------------------------------------------------
bool CGPX_Import::Add_Track(CSG_MetaData *pTrack)
{
// <name> xsd:string
// <cmt> xsd:string
// <desc> xsd:string
// <src> xsd:string
// <link> linkType
// <number> xsd:nonNegativeInteger
// <type> xsd:string
CSG_MetaData *pSegment = pTrack->Get_Child(SG_T("trkseg"));
if( pSegment )
{
CSG_String Name(GET_CONTENT(pTrack, "name", "Track Segment"));
CSG_Shapes *pPoints = SG_Create_Shapes(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s [%s]"), m_Name.c_str(), Name.c_str()));
m_pShapes->Add_Item(pPoints);
for(int i=0; i<pSegment->Get_Children_Count(); i++)
{
CSG_MetaData *pChild = pSegment->Get_Child(i);
if( pChild->Get_Name().CmpNoCase(SG_T("trkpt")) == 0 )
{
Add_Point(pChild, pPoints);
}
}
return( true );
}
return( false );
}
示例4: Assign
//---------------------------------------------------------
bool CSG_MetaData::Assign(const CSG_MetaData &MetaData, bool bAppend)
{
int i;
if( !bAppend )
{
Destroy();
Set_Name (MetaData.Get_Name ());
Set_Content (MetaData.Get_Content());
//-------------------------------------------------
for(i=0; i<MetaData.Get_Property_Count(); i++)
{
Add_Property(MetaData.Get_Property_Name(i), MetaData.Get_Property(i));
}
}
//-----------------------------------------------------
for(i=0; i<MetaData.Get_Children_Count(); i++)
{
Add_Child()->Assign(*MetaData.Get_Child(i), false);
}
return( true );
}
示例5: Assign
//---------------------------------------------------------
bool CSG_MetaData::Assign(const CSG_MetaData &MetaData, bool bAddChildren)
{
if( &MetaData != this )
{
Destroy();
Set_Name (MetaData.Get_Name ());
Set_Content (MetaData.Get_Content());
for(int i=0; i<MetaData.Get_Property_Count(); i++)
{
Add_Property(MetaData.Get_Property_Name(i), MetaData.Get_Property(i));
}
if( bAddChildren )
{
Add_Children(MetaData);
}
}
return( true );
}
示例6: On_Execute
//---------------------------------------------------------
bool CPointCloud_Create_Tileshape_From_SPCVF::On_Execute(void)
{
CSG_String sFileName;
CSG_Shapes *pShapes;
CSG_MetaData SPCVF;
CSG_String sPathSPCVF, sFilePath;
int iPoints;
double dBBoxXMin, dBBoxYMin, dBBoxXMax, dBBoxYMax;
//-----------------------------------------------------
sFileName = Parameters("FILENAME")->asString();
pShapes = Parameters("TILE_SHP")->asShapes();
//-----------------------------------------------------
if( !SPCVF.Create(sFileName) || SPCVF.Get_Name().CmpNoCase(SG_T("SPCVFDataset")) )
{
SG_UI_Msg_Add_Error(_TL("Please provide a valid *.scpvf file!"));
return( false );
}
//-----------------------------------------------------
CSG_String sMethodPaths;
SPCVF.Get_Property(SG_T("Paths"), sMethodPaths);
if( !sMethodPaths.CmpNoCase(SG_T("absolute")) )
{
sPathSPCVF = SG_T("");
}
else if( !sMethodPaths.CmpNoCase(SG_T("relative")) )
{
sPathSPCVF = SG_File_Get_Path(sFileName);
sPathSPCVF.Replace(SG_T("\\"), SG_T("/"));
}
else
{
SG_UI_Msg_Add_Error(_TL("Encountered invalid path description in *.spcvf file!"));
return( false );
}
//-----------------------------------------------------
pShapes->Destroy();
pShapes->Add_Field(_TL("ID"), SG_DATATYPE_Int);
pShapes->Add_Field(_TL("Filepath"), SG_DATATYPE_String);
pShapes->Add_Field(_TL("File"), SG_DATATYPE_String);
pShapes->Add_Field(_TL("Points"), SG_DATATYPE_Int);
pShapes->Set_Name(CSG_String::Format(_TL("Tileshape_%s"), SG_File_Get_Name(sFileName, false).c_str()));
//-----------------------------------------------------
CSG_MetaData *pDatasets = SPCVF.Get_Child(SG_T("Datasets"));
for(int i=0; i<pDatasets->Get_Children_Count(); i++)
{
CSG_MetaData *pDataset = pDatasets->Get_Child(i);
CSG_MetaData *pBBox = pDataset->Get_Child(SG_T("BBox"));
pDataset->Get_Property(SG_T("File"), sFilePath);
pDataset->Get_Property(SG_T("Points"), iPoints);
pBBox->Get_Property(SG_T("XMin"), dBBoxXMin);
pBBox->Get_Property(SG_T("YMin"), dBBoxYMin);
pBBox->Get_Property(SG_T("XMax"), dBBoxXMax);
pBBox->Get_Property(SG_T("YMax"), dBBoxYMax);
//-----------------------------------------------------
CSG_Shape *pShape = pShapes->Add_Shape();
pShape->Add_Point(dBBoxXMin, dBBoxYMin);
pShape->Add_Point(dBBoxXMin, dBBoxYMax);
pShape->Add_Point(dBBoxXMax, dBBoxYMax);
pShape->Add_Point(dBBoxXMax, dBBoxYMin);
pShape->Set_Value(0, i + 1);
if( sPathSPCVF.Length() == 0 ) // absolute paths
{
pShape->Set_Value(1, sFilePath.BeforeLast('/'));
pShape->Set_Value(2, sFilePath.AfterLast('/'));
}
else // relative paths
{
pShape->Set_Value(1, sPathSPCVF);
pShape->Set_Value(2, sFilePath);
}
pShape->Set_Value(3, iPoints);
}
//-----------------------------------------------------
return( true );
//.........这里部分代码省略.........
示例7: _Add_History_OLD
//---------------------------------------------------------
bool CACTIVE_History::_Add_History_OLD(wxTreeItemId Parent, CSG_MetaData &Data)
{
if( !Parent.IsOk() )
{
return( false );
}
//-----------------------------------------------------
CSG_MetaData *pTool = Data("MODULE");
if( !pTool )
{
if( Data.Get_Children_Count() > 0 )
{
for(int i=0; i<Data.Get_Children_Count(); i++)
{
CSG_MetaData *pEntry = Data.Get_Child(i);
if( pEntry->Get_Children_Count() > 0 )
{
_Add_History_OLD(AppendItem(Parent, wxString::Format("%s", pEntry->Get_Name().c_str()), IMG_NODE), *pEntry);
}
else if( !pEntry->Get_Name().Cmp(SG_T("FILE")) )
{
AppendItem(Parent, wxString::Format("%s", pEntry->Get_Content().c_str()), IMG_FILE);
}
else
{
AppendItem(Parent, wxString::Format("[%s] %s", pEntry->Get_Name().c_str(), pEntry->Get_Content().c_str()), IMG_ENTRY);
}
}
}
else
{
AppendItem(Parent, Data.Get_Name().c_str(), IMG_FILE);
}
}
//-----------------------------------------------------
else
{
int i;
wxTreeItemId Tool = AppendItem(Parent, pTool->Get_Content().c_str(), IMG_TOOL);
//-------------------------------------------------
wxTreeItemId Options = AppendItem(Tool, _TL("Options"), IMG_ENTRY);
for(i=0; i<Data.Get_Children_Count(); i++) // Options
{
CSG_MetaData *pEntry = Data.Get_Child(i);
CSG_String Name = pEntry->Get_Property("name");
TSG_Parameter_Type Type = SG_Parameter_Type_Get_Type(pEntry->Get_Property("type"));
if( !pEntry->Get_Name().Cmp("OPTION") )
{
switch( Type )
{
case PARAMETER_TYPE_Bool:
case PARAMETER_TYPE_Int:
case PARAMETER_TYPE_Double:
case PARAMETER_TYPE_Degree:
case PARAMETER_TYPE_Date:
case PARAMETER_TYPE_Choice:
case PARAMETER_TYPE_Range:
case PARAMETER_TYPE_Table_Field:
case PARAMETER_TYPE_Table_Fields:
case PARAMETER_TYPE_String:
case PARAMETER_TYPE_Text:
case PARAMETER_TYPE_FilePath:
AppendItem(Options, wxString::Format("%s [%s]", Name.c_str(), pEntry->Get_Content().c_str()), IMG_ENTRY);
break;
case PARAMETER_TYPE_Grid_System:
if( pEntry->Get_Children_Count() == 0 )
{
AppendItem(Options, wxString::Format("%s [%s]", Name.c_str(), pEntry->Get_Content().c_str()), IMG_ENTRY);
}
break;
case PARAMETER_TYPE_FixedTable:
case PARAMETER_TYPE_Parameters:
break;
default:
break;
}
}
}
if( ItemHasChildren(Options) )
{
Expand(Options);
}
else
{
// Delete(Options);
SetItemText(Options, _TL("No Options"));
}
//.........这里部分代码省略.........
示例8: _Load_Map
//---------------------------------------------------------
bool CWKSP_Project::_Load_Map(CSG_MetaData &Entry, const wxString &ProjectDir)
{
TSG_Rect Extent;
if( Entry.Get_Name().Cmp("MAP")
|| !Entry.Get_Child("XMIN") || !Entry.Get_Child("XMIN")->Get_Content().asDouble(Extent.xMin)
|| !Entry.Get_Child("XMAX") || !Entry.Get_Child("XMAX")->Get_Content().asDouble(Extent.xMax)
|| !Entry.Get_Child("YMIN") || !Entry.Get_Child("YMIN")->Get_Content().asDouble(Extent.yMin)
|| !Entry.Get_Child("YMAX") || !Entry.Get_Child("YMAX")->Get_Content().asDouble(Extent.yMax) )
{
return( false );
}
//-----------------------------------------------------
CSG_MetaData *pNode = Entry.Get_Child("LAYERS");
if( pNode == NULL || pNode->Get_Children_Count() <= 0 )
{
return( false );
}
//-----------------------------------------------------
int i, n;
for(i=0, n=0; i<pNode->Get_Children_Count(); i++)
{
if( !pNode->Get_Child(i)->Get_Name().Cmp("FILE") )
{
wxString FileName(pNode->Get_Child(i)->Get_Content().w_str());
if( FileName.Find("PGSQL") != 0 )
{
FileName = Get_FilePath_Absolute(ProjectDir, FileName);
}
CWKSP_Base_Item *pItem = _Get_byFileName(FileName);
if( pItem &&
( pItem->Get_Type() == WKSP_ITEM_Grid
|| pItem->Get_Type() == WKSP_ITEM_TIN
|| pItem->Get_Type() == WKSP_ITEM_PointCloud
|| pItem->Get_Type() == WKSP_ITEM_Shapes) )
{
n++;
}
}
}
if( n == 0 )
{
return( false );
}
//-----------------------------------------------------
CWKSP_Map *pMap = new CWKSP_Map;
for(int i=0; i<pNode->Get_Children_Count(); i++)
{
if( !pNode->Get_Child(i)->Get_Name().Cmp("FILE") )
{
wxString FileName(pNode->Get_Child(i)->Get_Content().w_str());
if( FileName.Find("PGSQL") != 0 )
{
FileName = Get_FilePath_Absolute(ProjectDir, FileName);
}
CWKSP_Base_Item *pItem = _Get_byFileName(FileName);
if( pItem &&
( pItem->Get_Type() == WKSP_ITEM_Grid
|| pItem->Get_Type() == WKSP_ITEM_TIN
|| pItem->Get_Type() == WKSP_ITEM_PointCloud
|| pItem->Get_Type() == WKSP_ITEM_Shapes) )
{
g_pMaps->Add((CWKSP_Layer *)pItem, pMap);
}
}
else
{
pMap->Add_Graticule(pNode->Get_Child(i));
}
}
//-----------------------------------------------------
if( Entry.Get_Child("PARAMETERS") && pMap->Get_Parameters()->Serialize(*Entry.Get_Child("PARAMETERS"), false) )
{
pMap->Parameters_Changed();
}
pMap->Set_Extent(Extent, true);
pMap->View_Show(true);
return( true );
}
示例9: _Load_Data
//---------------------------------------------------------
bool CWKSP_Project::_Load_Data(CSG_MetaData &Entry, const wxString &ProjectDir, bool bLoad, const CSG_String &Version)
{
if( Entry.Get_Name().Cmp("DATASET") || !Entry.Get_Child("FILE") || Entry.Get_Child("FILE")->Get_Content().is_Empty() )
{
return( false );
}
TSG_Data_Object_Type Type =
Entry.Cmp_Property("type", "GRID" ) ? DATAOBJECT_TYPE_Grid
: Entry.Cmp_Property("type", "TABLE" ) ? DATAOBJECT_TYPE_Table
: Entry.Cmp_Property("type", "SHAPES") ? DATAOBJECT_TYPE_Shapes
: Entry.Cmp_Property("type", "TIN" ) ? DATAOBJECT_TYPE_TIN
: Entry.Cmp_Property("type", "POINTS") ? DATAOBJECT_TYPE_PointCloud
: DATAOBJECT_TYPE_Undefined;
if( Type == DATAOBJECT_TYPE_Undefined )
{
return( false );
}
//-----------------------------------------------------
wxString File = Entry.Get_Child("FILE")->Get_Content().c_str();
if( File.Find("PGSQL") != 0 && wxFileExists(Get_FilePath_Absolute(ProjectDir, File)) )
{
File = Get_FilePath_Absolute(ProjectDir, File);
}
CWKSP_Base_Item *pItem = bLoad ? g_pData->Open(File, Type) : _Get_byFileName(File);
if( !pItem || !pItem->Get_Parameters() || !Entry.Get_Child("PARAMETERS") )
{
if( bLoad )
{
MSG_Error_Add(wxString::Format("%s [%s]", _TL("failed to load data"), File.c_str()));
}
return( false );
}
//-----------------------------------------------------
CSG_MetaData *pEntry = Entry("PARAMETERS");
for(int i=0; i<pEntry->Get_Children_Count(); i++)
{
if( !pEntry->Get_Child(i)->Get_Name().CmpNoCase("DATA") && !pEntry->Get_Child(i)->Get_Content().is_Empty() && pEntry->Get_Child(i)->Get_Content().BeforeFirst(':').Cmp("PGSQL") )
{
wxString File(Get_FilePath_Absolute(ProjectDir, pEntry->Get_Child(i)->Get_Content().w_str()));
pEntry->Get_Child(i)->Set_Content(&File);
// if( SG_Compare_SAGA_Version(Version) < 0 )
{
if( pEntry->Get_Child(i)->Cmp_Property("id", "OVERLAY_1") )
{
pEntry->Get_Child(i)->Set_Property("id", "OVERLAY_G");
}
if( pEntry->Get_Child(i)->Cmp_Property("id", "OVERLAY_2") )
{
pEntry->Get_Child(i)->Set_Property("id", "OVERLAY_B");
}
}
}
}
pItem->Get_Parameters()->Serialize(*Entry.Get_Child("PARAMETERS"), false);
pItem->Parameters_Changed();
return( true );
}