当前位置: 首页>>代码示例>>C++>>正文


C++ CSG_MetaData类代码示例

本文整理汇总了C++中CSG_MetaData的典型用法代码示例。如果您正苦于以下问题:C++ CSG_MetaData类的具体用法?C++ CSG_MetaData怎么用?C++ CSG_MetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CSG_MetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Name

//---------------------------------------------------------
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 );
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例2: CSG_String

//---------------------------------------------------------
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 );
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: Ins_Child

CSG_MetaData * CSG_MetaData::Ins_Child(const CSG_MetaData &MetaData, int Position, bool bAddChildren)
{
	CSG_MetaData	*pChild	= Ins_Child(Position);

	if( pChild )
	{
		pChild->Assign(MetaData, bAddChildren);
	}

	return( pChild );
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:11,代码来源:metadata.cpp

示例4: Parameters

//---------------------------------------------------------
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 );
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例5: 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 );
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:27,代码来源:metadata.cpp

示例6: Process_Set_Text

//---------------------------------------------------------
int CTL_Extract::Read_ToolChain(const SG_Char *File, CSG_Table &Elements)
{
	//-----------------------------------------------------
	CSG_MetaData	Chain;

	if( Chain.Load(File) )
	{
		Process_Set_Text(CSG_String::Format("%s: %s", SG_T("scanning"), File));

		//-------------------------------------------------
		if( Chain.Cmp_Name("toolchains") )
		{
			GET_XML_CONTENT(Chain, "name"       );
			GET_XML_CONTENT(Chain, "menu"       );
		//	GET_XML_CONTENT(Chain, "description");

			return( 1 );
		}

		//-------------------------------------------------
		if( Chain.Cmp_Name("toolchain") )
		{
			GET_XML_CONTENT(Chain, "name"       );
			GET_XML_CONTENT(Chain, "menu"       );
		//	GET_XML_CONTENT(Chain, "description");

			if( Chain("parameters") )
			{
				for(int i=0; i<Chain["parameters"].Get_Children_Count(); i++)
				{
					const CSG_MetaData	&Parameter	= Chain["parameters"][i];

					GET_XML_CONTENT(Parameter, "name"       );
					GET_XML_CONTENT(Parameter, "description");
				}
			}

			return( 1 );
		}
	}

	return( 0 );
}
开发者ID:,项目名称:,代码行数:44,代码来源:

示例7: Request

//---------------------------------------------------------
bool CSG_HTTP::Request(const CSG_String &Request, CSG_MetaData &Answer)
{
	wxInputStream *pStream = _Request(Request); if( !pStream ) { return( false ); }

	wxXmlDocument	XML;

	if( !XML.Load(*pStream) )
	{
		delete(pStream);

		return( false );
	}

	Answer.Destroy();	Answer._Load(XML.GetRoot());

	delete(pStream);

	return( true );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:20,代码来源:metadata.cpp

示例8: return

//---------------------------------------------------------
bool CWKSP_Project::_Save_Map(CSG_MetaData &Entry, const wxString &ProjectDir, CWKSP_Map *pMap)
{
	if( !pMap )
	{
		return( false );
	}

	CSG_MetaData	*pEntry	= Entry.Add_Child("MAP");

	pEntry->Add_Child("XMIN", pMap->Get_Extent().Get_XMin());
	pEntry->Add_Child("XMAX", pMap->Get_Extent().Get_XMax());
	pEntry->Add_Child("YMIN", pMap->Get_Extent().Get_YMin());
	pEntry->Add_Child("YMAX", pMap->Get_Extent().Get_YMax());

	pMap->Get_Parameters()->Serialize(*pEntry->Add_Child("PARAMETERS"), true);

	pEntry	= pEntry->Add_Child("LAYERS");

	for(int i=pMap->Get_Count()-1; i>=0; i--)
	{
		if( pMap->Get_Item(i)->Get_Type() == WKSP_ITEM_Map_Layer )
		{
			CSG_Data_Object	*pObject	= ((CWKSP_Map_Layer *)pMap->Get_Item(i))->Get_Layer()->Get_Object();

			if( pObject && pObject->Get_File_Name(false) && *pObject->Get_File_Name(false) )
			{
				wxString	FileName(pObject->Get_File_Name(false));

				if( FileName.Find("PGSQL") == 0 )
				{
					pEntry->Add_Child("FILE", &FileName);
				}
				else if( wxFileExists(FileName) )
				{
					pEntry->Add_Child("FILE", SG_File_Get_Path_Relative(&ProjectDir, &FileName));
				}
			}
		}

		else if( pMap->Get_Item(i)->Get_Type() == WKSP_ITEM_Map_Graticule )
		{
			((CWKSP_Map_Graticule *)pMap->Get_Item(i))->Save(*pEntry);
		}

		else if( pMap->Get_Item(i)->Get_Type() == WKSP_ITEM_Map_BaseMap )
		{
			((CWKSP_Map_BaseMap   *)pMap->Get_Item(i))->Save(*pEntry);
		}
	}

	return( true );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:53,代码来源:project.cpp

示例9: Add_Children

//---------------------------------------------------------
bool CSG_MetaData::Add_Children(const CSG_MetaData &MetaData)
{
	if( &MetaData != this )
	{
		for(int i=0; i<MetaData.Get_Children_Count(); i++)
		{
			Add_Child(MetaData[i], true);
		}
	}

	return( true );
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:13,代码来源:metadata.cpp

示例10: 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 );
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:23,代码来源:metadata.cpp

示例11: _Load_DBConnections

//---------------------------------------------------------
bool CWKSP_Project::_Load_DBConnections(CSG_MetaData &Data)
{
	int			i;
	CSG_Strings	Connections;

	for(i=0; i<Data.Get_Children_Count(); i++)
	{
		CSG_String	Connection(Data[i].Get_Child("FILE") ? Data[i].Get_Child("FILE")->Get_Content() : "");

		if( !Connection.BeforeFirst(':').CmpNoCase("PGSQL") )
		{
			Connection	= Connection.AfterFirst(':');	CSG_String	Host  (Connection.BeforeFirst(':'));
			Connection	= Connection.AfterFirst(':');	CSG_String	Port  (Connection.BeforeFirst(':'));
			Connection	= Connection.AfterFirst(':');	CSG_String	DBName(Connection.BeforeFirst(':'));

			Connection	= Host + ":" + Port + ":" + DBName;

			bool	bAdd	= true;

			for(int j=0; j<Connections.Get_Count() && bAdd; j++)
			{
				if( !Connection.Cmp(Connections[j]) )
				{
					bAdd	= false;
				}
			}

			if( bAdd )
			{
				Connections	+= Connection;
			}
		}
	}

	for(i=0; i<Connections.Get_Count(); i++)
	{
		CSG_String	Host  (Connections[i].BeforeFirst(':'));
		CSG_String	Port  (Connections[i].AfterFirst (':').BeforeLast(':'));
		CSG_String	DBName(Connections[i].AfterLast  (':'));

		if( !PGSQL_Connect(Host, Port, DBName) )
		{
			return( false );
		}
	}

	return( true );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:49,代码来源:project.cpp

示例12: Request

//---------------------------------------------------------
bool CSG_CURL::Request(const CSG_String &Request, CSG_MetaData &Answer)
{
	CSG_String	_Answer;

	return( CSG_CURL::Request(Request, _Answer) && Answer.from_XML(_Answer) );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:7,代码来源:sg_curl.cpp

示例13: Save

//---------------------------------------------------------
bool CWKSP_Map_Graticule::Save(CSG_MetaData &Entry)
{
	return( m_Parameters.Serialize(*Entry.Add_Child("GRATICULE"), true) );
}
开发者ID:,项目名称:,代码行数:5,代码来源:

示例14: Destroy

//---------------------------------------------------------
bool CSG_MetaData::from_JSON(const CSG_String &JSON)
{
	Destroy();

	Set_Name("root");

	CSG_MetaData	*pNode	= this;

	const SG_Char	*pc	= JSON.c_str();

	while( *pc )
	{
		CSG_String	Element;

		for(bool bQuota=false;;)
		{
			SG_Char c = *pc++;
			
			if( !c || c == '\n' ) { break; } else
			{
				if( c == '\"' )
				{
					Element += c; bQuota = !bQuota;
				}
				else if( bQuota || (c != ' ' && c != '\t' && c != ',') )
				{
					Element += c;
				}
			}
		}

		//-------------------------------------------------
		if( Element.is_Empty() )
		{
			// nop
		}
		else if( Element.Find('[') >= 0 )	// array begins
		{
			pNode	= pNode->Add_Child(Element.AfterFirst('\"').BeforeFirst('\"'));

			pNode->Add_Property("array", 1);
		}
		else if( Element.Find(']') >= 0 )	// array ends
		{
			if( pNode != this )
			{
				pNode	= pNode->Get_Parent();
			}
		}
		else if( Element.Find('{') >= 0 )	// object begins
		{
			Element	= Element.AfterFirst('\"').BeforeFirst('\"');

			if( !Element.is_Empty() )
			{
				pNode	= pNode->Add_Child(Element);
			}
			else if( pNode->Get_Property("array") )
			{
				pNode	= pNode->Add_Child(CSG_String::Format("%d", pNode->Get_Children_Count()));
			}
		}
		else if( Element.Find('}') >= 0 )	// object ends
		{
			if( pNode != this )
			{
				pNode	= pNode->Get_Parent();
			}
		}
		else
		{
			CSG_String	Key  (Element.AfterFirst('\"').BeforeFirst('\"'));
			CSG_String	Value(Element.AfterFirst(':'));

			if( Value.Find('\"') > -1 )
			{
				Value	= Value.AfterFirst('\"').BeforeFirst('\"');
			}

			pNode->Add_Child(Key, Value);
		}
	}

	return( true );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:86,代码来源:metadata.cpp

示例15: Destroy

//---------------------------------------------------------
bool CWMS_Capabilities::Create(const CSG_String &Server, const CSG_String &Version)
{
	Destroy();

	int	i;

	CSG_String	s	= "http://" + Server;

	s	+= "?SERVICE=WMS";
	s	+= "&VERSION=" + Version;
	s	+= "&REQUEST=GetCapabilities";

	CSG_MetaData	Capabilities;

	if( !Capabilities.Create(s) )
	{
		return( false );
	}

	//-----------------------------------------------------
	if( !Capabilities.Get_Property("version", m_Version) || !Capabilities("Service") || !Capabilities("Capability") )
	{
		return( false );
	}

	const CSG_MetaData	&Service	= Capabilities["Service"];

	CAP_GET_STRING(Service, "Name"      , m_Name      ,  true);
	CAP_GET_STRING(Service, "Title"     , m_Title     ,  true);
	CAP_GET_STRING(Service, "Abstract"  , m_Abstract  ,  true);

	CAP_GET____INT(Service, "LayerLimit", m_LayerLimit, false);

	CAP_GET____INT(Service, "MaxWidth"  , m_MaxWidth  , false);
	CAP_GET____INT(Service, "MaxHeight" , m_MaxHeight , false);

	//-----------------------------------------------------
	if( !Capabilities["Capability"]("Request") || !Capabilities["Capability"]["Request"](V_MAP(m_Version)) )
	{
		return( false );
	}

	const CSG_MetaData	&GetMap	= Capabilities["Capability"]["Request"][V_MAP(m_Version)];

	for(i=0; i<GetMap.Get_Children_Count(); i++)
	{
		if( GetMap[i].Cmp_Name   ("Format"    )
		&& (GetMap[i].Cmp_Content("image/png" )
		||  GetMap[i].Cmp_Content("image/jpeg")
		||  GetMap[i].Cmp_Content("image/gif" )
		||  GetMap[i].Cmp_Content("image/tiff")) )
		{
			m_Formats	+= GetMap[i].Get_Content() + "|";
		}
	}

	//-----------------------------------------------------
	if( !Capabilities["Capability"]("Layer") )
	{
		return( false );
	}

	const CSG_MetaData	&Layer	= Capabilities["Capability"]["Layer"];

	if( m_Version.Cmp("1.3.0") == 0 )
	{
		if( !Layer("EX_GeographicBoundingBox") )
		{
			return( false );
		}

		CAP_GET_DOUBLE(Layer["EX_GeographicBoundingBox"], "westBoundLongitude", m_Extent.xMin, true);
		CAP_GET_DOUBLE(Layer["EX_GeographicBoundingBox"], "eastBoundLongitude", m_Extent.xMax, true);
		CAP_GET_DOUBLE(Layer["EX_GeographicBoundingBox"], "southBoundLatitude", m_Extent.yMin, true);
		CAP_GET_DOUBLE(Layer["EX_GeographicBoundingBox"], "northBoundLatitude", m_Extent.yMax, true);
	}
	else // version < 1.3.0
	{
		if( !Layer("LatLonBoundingBox")
		||  !Layer["LatLonBoundingBox"].Get_Property("minx", m_Extent.xMin)
		||  !Layer["LatLonBoundingBox"].Get_Property("maxx", m_Extent.xMax)
		||  !Layer["LatLonBoundingBox"].Get_Property("miny", m_Extent.yMin)
		||  !Layer["LatLonBoundingBox"].Get_Property("maxy", m_Extent.yMax) )
		{
			return( false );
		}
	}

	for(i=0; i<Layer.Get_Children_Count(); i++)
	{
		if( Layer[i].Cmp_Name(V_SRS(m_Version)) )
		{
			m_Projections	+= Layer[i].Get_Content() + "|";
		}

		else if( Layer[i].Cmp_Name("Layer") )
		{
			m_Layers_Name	+= Layer[i].Get_Content("Name" );
			m_Layers_Title	+= Layer[i].Get_Content("Title");
//.........这里部分代码省略.........
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:101,代码来源:wms_import.cpp


注:本文中的CSG_MetaData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。