本文整理汇总了C++中CSG_MetaData::Cmp_Property方法的典型用法代码示例。如果您正苦于以下问题:C++ CSG_MetaData::Cmp_Property方法的具体用法?C++ CSG_MetaData::Cmp_Property怎么用?C++ CSG_MetaData::Cmp_Property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSG_MetaData
的用法示例。
在下文中一共展示了CSG_MetaData::Cmp_Property方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _Load_Data
//---------------------------------------------------------
bool CWKSP_Project::_Load_Data(CSG_MetaData &Entry, const wxString &ProjectDir, bool bLoad, const CSG_String &Version)
{
if( !Entry.Cmp_Name("DATASET") || !Entry("FILE") || Entry["FILE"].Get_Content().is_Empty() )
{
return( false );
}
TSG_Data_Object_Type Type =
Entry.Cmp_Property("type", "GRID" ) ? SG_DATAOBJECT_TYPE_Grid
: Entry.Cmp_Property("type", "GRIDS" ) ? SG_DATAOBJECT_TYPE_Grids
: Entry.Cmp_Property("type", "TABLE" ) ? SG_DATAOBJECT_TYPE_Table
: Entry.Cmp_Property("type", "SHAPES") ? SG_DATAOBJECT_TYPE_Shapes
: Entry.Cmp_Property("type", "TIN" ) ? SG_DATAOBJECT_TYPE_TIN
: Entry.Cmp_Property("type", "POINTS") ? SG_DATAOBJECT_TYPE_PointCloud
: SG_DATAOBJECT_TYPE_Undefined;
if( Type == SG_DATAOBJECT_TYPE_Undefined )
{
return( false );
}
//-----------------------------------------------------
wxString File = Entry("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 = NULL;
if( bLoad )
{
if( Type == SG_DATAOBJECT_TYPE_Grid && Entry("PARAMETERS"))
{
for(int i=0; i<Entry["PARAMETERS"].Get_Children_Count() && !pItem; i++)
{
if( Entry["PARAMETERS"][i].Cmp_Property("id", "FILE_CACHE") )
{
bool bCached = Entry["PARAMETERS"][i].Cmp_Content("TRUE", true);
pItem = g_pData->Add(SG_Create_Grid(&File, SG_DATATYPE_Undefined, bCached));
}
}
}
}
if( !pItem )
{
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(':').CmpNoCase("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);
//-----------------------------------------------------
if( SG_Compare_Version(Version, "7.0.0") < 0 ) // inter-version-compatibility
{
CSG_Parameter *pParameter = pItem->Get_Parameter("COLORS_TYPE");
if( pParameter && Type == SG_DATAOBJECT_TYPE_Grid )
{
//.........这里部分代码省略.........
示例2: _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 );
}