Skip to content
Permalink
Browse files

Ensure multisurface dimensionality is respected when adding new surfaces

  • Loading branch information
nyalldawson committed Sep 26, 2017
1 parent ed90bf4 commit 31730f43be57e65fde5e06e9df45223d8bd98815
@@ -26,25 +26,16 @@ class QgsMultiSurface: QgsGeometryCollection

virtual QgsMultiSurface *toCurveType() const /Factory/;


virtual bool fromWkt( const QString &wkt );


virtual QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;

virtual QString asJSON( int precision = 17 ) const;



virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

%Docstring
Adds a geometry and takes ownership. Returns true in case of success
:rtype: bool
%End

virtual QgsAbstractGeometry *boundary() const /Factory/;


@@ -140,7 +140,19 @@ bool QgsMultiSurface::addGeometry( QgsAbstractGeometry *g )
return false;
}

setZMTypeFromSubGeometry( g, QgsWkbTypes::MultiSurface );
if ( mGeometries.empty() )
{
setZMTypeFromSubGeometry( g, QgsWkbTypes::MultiSurface );
}
if ( is3D() && !g->is3D() )
g->addZValue();
else if ( !is3D() && g->is3D() )
g->dropZValue();
if ( isMeasure() && !g->isMeasure() )
g->addMValue();
else if ( !isMeasure() && g->isMeasure() )
g->dropMValue();

return QgsGeometryCollection::addGeometry( g );
}

@@ -32,20 +32,11 @@ class CORE_EXPORT QgsMultiSurface: public QgsGeometryCollection
QString geometryType() const override;
QgsMultiSurface *clone() const override SIP_FACTORY;
QgsMultiSurface *toCurveType() const override SIP_FACTORY;

bool fromWkt( const QString &wkt ) override;

// inherited: int wkbSize() const;
// inherited: unsigned char* asWkb( int& binarySize ) const;
// inherited: QString asWkt( int precision = 17 ) const;
QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
QDomElement asGML3( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const override;
QString asJSON( int precision = 17 ) const override;


//! Adds a geometry and takes ownership. Returns true in case of success
bool addGeometry( QgsAbstractGeometry *g SIP_TRANSFER ) override;

QgsAbstractGeometry *boundary() const override SIP_FACTORY;

#ifndef SIP_RUN

0 comments on commit 31730f4

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