Skip to content

Commit 7b31f8a

Browse files
committedJun 25, 2015
Remove python bindings for QgsGeos, move createGeometryEngine() from edit utils to QgsGeometry class
1 parent a3441d1 commit 7b31f8a

File tree

7 files changed

+15
-55
lines changed

7 files changed

+15
-55
lines changed
 

‎python/core/core.sip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@
283283
%Include geometry/qgscurvev2.sip
284284
%Include geometry/qgsgeometrycollectionv2.sip
285285
%Include geometry/qgsgeometryengine.sip
286-
%Include geometry/qgsgeos.sip
287286
%Include geometry/qgslinestringv2.sip
288287
%Include geometry/qgsmulticurvev2.sip
289288
%Include geometry/qgsmultilinestringv2.sip

‎python/core/geometry/qgsgeometry.sip

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,5 +680,9 @@ class QgsGeometry
680680
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;
681681
/**Smooths a polyline using the Chaikin algorithm*/
682682
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;
683+
684+
/** Creates and returns a new geometry engine*/
685+
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );
Code has comments. Press enter to view.
686+
683687
}; // class QgsGeometry
684688

‎python/core/geometry/qgsgeos.sip

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,11 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const
22302230
}
22312231
}
22322232

2233+
QgsGeometryEngine* QgsGeometry::createGeometryEngine( const QgsAbstractGeometryV2* geometry )
2234+
{
2235+
return new QgsGeos( geometry );
2236+
}
2237+
22332238
QDataStream& operator<<( QDataStream& out, const QgsGeometry& geometry )
22342239
{
22352240
QByteArray byteArray = QByteArray::fromRawData(( char * )geometry.asWkb(), geometry.wkbSize() ); // does not copy data and does not take ownership

‎src/core/geometry/qgsgeometry.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,10 @@ class CORE_EXPORT QgsGeometry
723723
/**Smooths a polyline using the Chaikin algorithm*/
724724
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;
725725

726+
/** Creates and returns a new geometry engine
727+
*/
728+
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );
729+
726730
private:
727731

728732
QgsGeometryPrivate* d; //implicitely shared data pointer

‎src/core/geometry/qgsgeometryeditutils.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometryV2* geom, QgsCurveV2* ring
6262
delete ring; return 3;
6363
}
6464

65-
QScopedPointer<QgsGeometryEngine> ringGeom( createGeometryEngine( ring ) );
65+
QScopedPointer<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring ) );
6666
ringGeom->prepareGeometry();
6767

6868
//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
215215

216216
QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometryV2& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures )
217217
{
218-
QScopedPointer<QgsGeometryEngine> geomEngine( createGeometryEngine( &geom ) );
218+
QScopedPointer<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
219219
if ( geomEngine.isNull() )
220220
{
221221
return 0;
@@ -285,8 +285,3 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra
285285
delete combinedGeometries;
286286
return diffGeom;
287287
}
288-
289-
QgsGeometryEngine* QgsGeometryEditUtils::createGeometryEngine( const QgsAbstractGeometryV2* geometry )
290-
{
291-
return new QgsGeos( geometry );
292-
}

‎src/core/geometry/qgsgeometryeditutils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class QgsGeometryEditUtils
5757
* @param ignoreFeatures map of layer to feature id of features to ignore
5858
*/
5959
static QgsAbstractGeometryV2* avoidIntersections( const QgsAbstractGeometryV2& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
60-
61-
/** Creates and returns a new geometry engine
62-
*/
63-
static QgsGeometryEngine* createGeometryEngine( const QgsAbstractGeometryV2* geometry );
6460
};
6561

6662
#endif // QGSGEOMETRYEDITUTILS_H

0 commit comments

Comments
 (0)
Please sign in to comment.