Skip to content
Permalink
Browse files

Enable gml3 curve output for compoundcurve and some fixes for gml3 ou…

…tput in general
  • Loading branch information
mhugent committed Feb 14, 2017
1 parent dedeb9c commit 93645a3ba56254a989e71e4f4b6c1b9b6ea20f95
@@ -248,33 +248,16 @@ QDomElement QgsCompoundCurve::asGML2( QDomDocument& doc, int precision, const QS

QDomElement QgsCompoundCurve::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
QDomElement elemCurve = doc.createElementNS( ns, QStringLiteral( "Curve" ) );

QDomElement elemSegments = doc.createElementNS( ns, QStringLiteral( "segments" ) );

QDomElement compoundCurveElem = doc.createElementNS( ns, QStringLiteral( "CompositeCurve" ) );
Q_FOREACH ( const QgsCurve* curve, mCurves )
{
if ( dynamic_cast<const QgsLineString*>( curve ) )
{
QgsPointSequence pts;
curve->points( pts );

QDomElement elemLineStringSegment = doc.createElementNS( ns, QStringLiteral( "LineStringSegment" ) );
elemLineStringSegment.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
elemSegments.appendChild( elemLineStringSegment );
}
else if ( dynamic_cast<const QgsCircularString*>( curve ) )
{
QgsPointSequence pts;
curve->points( pts );

QDomElement elemArcString = doc.createElementNS( ns, QStringLiteral( "ArcString" ) );
elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
elemSegments.appendChild( elemArcString );
}
QDomElement curveMemberElem = doc.createElementNS( ns, QStringLiteral( "curveMember" ) );
QDomElement curveElem = curve->asGML3( doc, precision, ns );
curveMemberElem.appendChild( curveElem );
compoundCurveElem.appendChild( curveMemberElem );
}
elemCurve.appendChild( elemSegments );
return elemCurve;

return compoundCurveElem;
}

QString QgsCompoundCurve::asJSON( int precision ) const
@@ -308,18 +308,26 @@ QDomElement QgsCurvePolygon::asGML3( QDomDocument& doc, int precision, const QSt
{
QDomElement elemCurvePolygon = doc.createElementNS( ns, QStringLiteral( "Polygon" ) );
QDomElement elemExterior = doc.createElementNS( ns, QStringLiteral( "exterior" ) );
QDomElement outerRing = exteriorRing()->asGML2( doc, precision, ns );
outerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
elemExterior.appendChild( outerRing );
QDomElement curveElem = exteriorRing()->asGML3( doc, precision, ns );
if ( curveElem.tagName() == "LineString" )
{
curveElem.setTagName( QStringLiteral( "LinearRing" ) );
}
elemExterior.appendChild( curveElem );
elemCurvePolygon.appendChild( elemExterior );

elemCurvePolygon.appendChild( elemExterior );
QDomElement elemInterior = doc.createElementNS( ns, QStringLiteral( "interior" ) );
for ( int i = 0, n = numInteriorRings(); i < n; ++i )
{
QDomElement innerRing = interiorRing( i )->asGML2( doc, precision, ns );
innerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
QDomElement elemInterior = doc.createElementNS( ns, QStringLiteral( "interior" ) );
QDomElement innerRing = interiorRing( i )->asGML3( doc, precision, ns );
if ( innerRing.tagName() == "LineString" )
{
innerRing.setTagName( QStringLiteral( "LinearRing" ) );
}
elemInterior.appendChild( innerRing );
elemCurvePolygon.appendChild( elemInterior );
}
elemCurvePolygon.appendChild( elemInterior );
return elemCurvePolygon;
}

@@ -207,14 +207,9 @@ QDomElement QgsLineString::asGML3( QDomDocument& doc, int precision, const QStri
QgsPointSequence pts;
points( pts );

QDomElement elemCurve = doc.createElementNS( ns, QStringLiteral( "Curve" ) );
QDomElement elemSegments = doc.createElementNS( ns, QStringLiteral( "segments" ) );
QDomElement elemArcString = doc.createElementNS( ns, QStringLiteral( "LineStringSegment" ) );
elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
elemSegments.appendChild( elemArcString );
elemCurve.appendChild( elemSegments );

return elemCurve;
QDomElement elemLineString = doc.createElementNS( ns, QStringLiteral( "LineString" ) );
elemLineString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
return elemLineString;
}

QString QgsLineString::asJSON( int precision ) const
@@ -60,7 +60,7 @@ QDomElement QgsMultiLineString::asGML2( QDomDocument& doc, int precision, const

QDomElement QgsMultiLineString::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiLineString" ) );
QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );
Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
{
if ( dynamic_cast<const QgsLineString*>( geom ) )

0 comments on commit 93645a3

Please sign in to comment.
You can’t perform that action at this time.