Skip to content
Permalink
Browse files

Remove python bindings for QgsGeos, move createGeometryEngine() from …

…edit utils to QgsGeometry class
  • Loading branch information
mhugent committed Jun 25, 2015
1 parent a3441d1 commit 7b31f8a02f47455bcffddbaea9e69ca642c7c878
@@ -283,7 +283,6 @@
%Include geometry/qgscurvev2.sip
%Include geometry/qgsgeometrycollectionv2.sip
%Include geometry/qgsgeometryengine.sip
%Include geometry/qgsgeos.sip
%Include geometry/qgslinestringv2.sip
%Include geometry/qgsmulticurvev2.sip
%Include geometry/qgsmultilinestringv2.sip
@@ -680,5 +680,9 @@ class QgsGeometry
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;
/**Smooths a polyline using the Chaikin algorithm*/
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;

/** Creates and returns a new geometry engine*/
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Jun 25, 2015

Member

@mhugent Looks good, but should there not be a /Factory/ annotation?

This comment has been minimized.

Copy link
@mhugent

mhugent Jun 25, 2015

Author Contributor

Right, the factory annotation is needed. Thanks for the hint.


}; // class QgsGeometry

This file was deleted.

@@ -2230,6 +2230,11 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const
}
}

QgsGeometryEngine* QgsGeometry::createGeometryEngine( const QgsAbstractGeometryV2* geometry )
{
return new QgsGeos( geometry );
}

QDataStream& operator<<( QDataStream& out, const QgsGeometry& geometry )
{
QByteArray byteArray = QByteArray::fromRawData(( char * )geometry.asWkb(), geometry.wkbSize() ); // does not copy data and does not take ownership
@@ -723,6 +723,10 @@ class CORE_EXPORT QgsGeometry
/**Smooths a polyline using the Chaikin algorithm*/
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;

/** Creates and returns a new geometry engine
*/
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );

private:

QgsGeometryPrivate* d; //implicitely shared data pointer
@@ -62,7 +62,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometryV2* geom, QgsCurveV2* ring
delete ring; return 3;
}

QScopedPointer<QgsGeometryEngine> ringGeom( createGeometryEngine( ring ) );
QScopedPointer<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring ) );
ringGeom->prepareGeometry();

//for each polygon, test if inside outer ring and no intersection with other interior ring
@@ -215,7 +215,7 @@ bool QgsGeometryEditUtils::deletePart( QgsAbstractGeometryV2* geom, int partNum

QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometryV2& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures )
{
QScopedPointer<QgsGeometryEngine> geomEngine( createGeometryEngine( &geom ) );
QScopedPointer<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
if ( geomEngine.isNull() )
{
return 0;
@@ -285,8 +285,3 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra
delete combinedGeometries;
return diffGeom;
}

QgsGeometryEngine* QgsGeometryEditUtils::createGeometryEngine( const QgsAbstractGeometryV2* geometry )
{
return new QgsGeos( geometry );
}
@@ -57,10 +57,6 @@ class QgsGeometryEditUtils
* @param ignoreFeatures map of layer to feature id of features to ignore
*/
static QgsAbstractGeometryV2* avoidIntersections( const QgsAbstractGeometryV2& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );

/** Creates and returns a new geometry engine
*/
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );
};

#endif // QGSGEOMETRYEDITUTILS_H

0 comments on commit 7b31f8a

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