本文整理汇总了C++中OGR_SRSNode::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ OGR_SRSNode::AddChild方法的具体用法?C++ OGR_SRSNode::AddChild怎么用?C++ OGR_SRSNode::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGR_SRSNode
的用法示例。
在下文中一共展示了OGR_SRSNode::AddChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
OGR_SRSNode *OGR_SRSNode::Clone() const
{
OGR_SRSNode *poNew = new OGR_SRSNode( pszValue );
for( int i = 0; i < nChildren; i++ )
{
poNew->AddChild( papoChildNodes[i]->Clone() );
}
return poNew;
}
示例2: importXMLUnits
static void importXMLUnits(CPLXMLNode *psSrcXML, const char *pszClass,
OGRSpatialReference *poSRS, const char *pszTarget)
{
const char *pszUnitName, *pszUnitsPer;
OGR_SRSNode *poNode = poSRS->GetAttrNode(pszTarget);
OGR_SRSNode *poUnits;
CPLAssert(EQUAL(pszClass, "AngularUnit")
|| EQUAL(pszClass, "LinearUnit"));
psSrcXML = CPLGetXMLNode(psSrcXML, pszClass);
if (psSrcXML == NULL)
goto DefaultTarget;
pszUnitName = CPLGetXMLValue(psSrcXML, "NameSet.name", "unnamed");
if (EQUAL(pszClass, "AngularUnit"))
pszUnitsPer = CPLGetXMLValue(psSrcXML, "radiansPerUnit", NULL);
else
pszUnitsPer = CPLGetXMLValue(psSrcXML, "metresPerUnit", NULL);
if (pszUnitsPer == NULL)
{
CPLDebug("OGR_SRS_XML",
"Missing PerUnit value for %s.",
pszClass);
goto DefaultTarget;
}
if (poNode == NULL)
{
CPLDebug("OGR_SRS_XML", "Can't find %s in importXMLUnits.",
pszTarget);
goto DefaultTarget;
}
if (poNode->FindChild("UNIT") != -1)
{
poUnits = poNode->GetChild(poNode->FindChild("UNIT"));
poUnits->GetChild(0)->SetValue(pszUnitName);
poUnits->GetChild(1)->SetValue(pszUnitsPer);
}
else
{
poUnits = new OGR_SRSNode("UNIT");
poUnits->AddChild(new OGR_SRSNode(pszUnitName));
poUnits->AddChild(new OGR_SRSNode(pszUnitsPer));
poNode->AddChild(poUnits);
}
return;
DefaultTarget:
poUnits = new OGR_SRSNode("UNIT");
if (EQUAL(pszClass, "AngularUnit"))
{
poUnits->AddChild(new OGR_SRSNode(SRS_UA_DEGREE));
poUnits->AddChild(new OGR_SRSNode(SRS_UA_DEGREE_CONV));
}
else
{
poUnits->AddChild(new OGR_SRSNode(SRS_UL_METER));
poUnits->AddChild(new OGR_SRSNode("1.0"));
}
poNode->AddChild(poUnits);
}