本文整理汇总了C++中DOMElement::getPreviousSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMElement::getPreviousSibling方法的具体用法?C++ DOMElement::getPreviousSibling怎么用?C++ DOMElement::getPreviousSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::getPreviousSibling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
OGRLineString *getLineString(DOMElement *elem, int bAsLinearRing) {
// elem -> POLYLINE
OGRLineString *ls;
if (bAsLinearRing)
ls = new OGRLinearRing();
else
ls = new OGRLineString();
DOMElement *lineElem = (DOMElement *)elem->getFirstChild();
while (lineElem != NULL) {
char* pszTagName = XMLString::transcode(lineElem->getTagName());
if (cmpStr(ILI2_COORD, pszTagName) == 0)
{
OGRPoint* poPoint = getPoint(lineElem);
ls->addPoint(poPoint);
delete poPoint;
}
else if (cmpStr(ILI2_ARC, pszTagName) == 0) {
// end point
OGRPoint *ptEnd = new OGRPoint();
// point on the arc
OGRPoint *ptOnArc = new OGRPoint();
// radius
double radius = 0;
DOMElement *arcElem = (DOMElement *)lineElem->getFirstChild();
while (arcElem != NULL) {
char* pszTagName = XMLString::transcode(arcElem->getTagName());
char* pszObjValue = getObjValue(arcElem);
if (cmpStr("C1", pszTagName) == 0)
ptEnd->setX(atof(pszObjValue));
else if (cmpStr("C2", pszTagName) == 0)
ptEnd->setY(atof(pszObjValue));
else if (cmpStr("C3", pszTagName) == 0)
ptEnd->setZ(atof(pszObjValue));
else if (cmpStr("A1", pszTagName) == 0)
ptOnArc->setX(atof(pszObjValue));
else if (cmpStr("A2", pszTagName) == 0)
ptOnArc->setY(atof(pszObjValue));
else if (cmpStr("A3", pszTagName) == 0)
ptOnArc->setZ(atof(pszObjValue));
else if (cmpStr("R", pszTagName) == 0)
radius = atof(pszObjValue);
CPLFree(pszObjValue);
XMLString::release(&pszTagName);
arcElem = (DOMElement *)arcElem->getNextSibling();
}
ptEnd->flattenTo2D();
ptOnArc->flattenTo2D();
OGRPoint *ptStart = getPoint((DOMElement *)lineElem->getPreviousSibling()); // COORD or ARC
interpolateArc(ls, ptStart, ptOnArc, ptEnd, PI/180);
delete ptStart;
delete ptEnd;
delete ptOnArc;
} /* else { // FIXME StructureValue in Polyline not yet supported
} */
XMLString::release(&pszTagName);
lineElem = (DOMElement *)lineElem->getNextSibling();
}
return ls;
}
示例2: if
static OGRCompoundCurve *getPolyline(DOMElement *elem) {
// elem -> POLYLINE
OGRCompoundCurve *ogrCurve = new OGRCompoundCurve();
OGRLineString *ls = new OGRLineString();
DOMElement *lineElem = (DOMElement *)elem->getFirstChild();
while (lineElem != NULL) {
char* pszTagName = XMLString::transcode(lineElem->getTagName());
if (cmpStr(ILI2_COORD, pszTagName) == 0)
{
OGRPoint* poPoint = getPoint(lineElem);
ls->addPoint(poPoint);
delete poPoint;
}
else if (cmpStr(ILI2_ARC, pszTagName) == 0) {
//Finish line and start arc
if (ls->getNumPoints() > 1) {
ogrCurve->addCurveDirectly(ls);
ls = new OGRLineString();
} else {
ls->empty();
}
OGRCircularString *arc = new OGRCircularString();
// end point
OGRPoint *ptEnd = new OGRPoint();
// point on the arc
OGRPoint *ptOnArc = new OGRPoint();
// radius
// double radius = 0;
DOMElement *arcElem = (DOMElement *)lineElem->getFirstChild();
while (arcElem != NULL) {
char* pszTagName2 = XMLString::transcode(arcElem->getTagName());
char* pszObjValue = getObjValue(arcElem);
if (cmpStr("C1", pszTagName2) == 0)
ptEnd->setX(CPLAtof(pszObjValue));
else if (cmpStr("C2", pszTagName2) == 0)
ptEnd->setY(CPLAtof(pszObjValue));
else if (cmpStr("C3", pszTagName2) == 0)
ptEnd->setZ(CPLAtof(pszObjValue));
else if (cmpStr("A1", pszTagName2) == 0)
ptOnArc->setX(CPLAtof(pszObjValue));
else if (cmpStr("A2", pszTagName2) == 0)
ptOnArc->setY(CPLAtof(pszObjValue));
else if (cmpStr("A3", pszTagName2) == 0)
ptOnArc->setZ(CPLAtof(pszObjValue));
else if (cmpStr("R", pszTagName2) == 0) {
// radius = CPLAtof(pszObjValue);
}
CPLFree(pszObjValue);
XMLString::release(&pszTagName2);
arcElem = (DOMElement *)arcElem->getNextSibling();
}
OGRPoint *ptStart = getPoint((DOMElement *)lineElem->getPreviousSibling()); // COORD or ARC
arc->addPoint(ptStart);
arc->addPoint(ptOnArc);
arc->addPoint(ptEnd);
ogrCurve->addCurveDirectly(arc);
delete ptStart;
delete ptEnd;
delete ptOnArc;
} /* else { // TODO: StructureValue in Polyline not yet supported
} */
XMLString::release(&pszTagName);
lineElem = (DOMElement *)lineElem->getNextSibling();
}
if (ls->getNumPoints() > 1) {
ogrCurve->addCurveDirectly(ls);
}
else {
delete ls;
}
return ogrCurve;
}