mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Remove python bindings for QgsGeos, move createGeometryEngine() from edit utils to QgsGeometry class
This commit is contained in:
parent
a3441d1802
commit
7b31f8a02f
@ -283,7 +283,6 @@
|
|||||||
%Include geometry/qgscurvev2.sip
|
%Include geometry/qgscurvev2.sip
|
||||||
%Include geometry/qgsgeometrycollectionv2.sip
|
%Include geometry/qgsgeometrycollectionv2.sip
|
||||||
%Include geometry/qgsgeometryengine.sip
|
%Include geometry/qgsgeometryengine.sip
|
||||||
%Include geometry/qgsgeos.sip
|
|
||||||
%Include geometry/qgslinestringv2.sip
|
%Include geometry/qgslinestringv2.sip
|
||||||
%Include geometry/qgsmulticurvev2.sip
|
%Include geometry/qgsmulticurvev2.sip
|
||||||
%Include geometry/qgsmultilinestringv2.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;
|
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;
|
||||||
/**Smooths a polyline using the Chaikin algorithm*/
|
/**Smooths a polyline using the Chaikin algorithm*/
|
||||||
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;
|
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 );
|
||||||
|
|
||||||
}; // class QgsGeometry
|
}; // class QgsGeometry
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
class QgsGeos: public QgsGeometryEngine
|
|
||||||
{
|
|
||||||
%TypeHeaderCode
|
|
||||||
#include <qgsgeos.h>
|
|
||||||
%End
|
|
||||||
|
|
||||||
public:
|
|
||||||
QgsGeos( const QgsAbstractGeometryV2* geometry );
|
|
||||||
~QgsGeos();
|
|
||||||
|
|
||||||
/**Removes caches*/
|
|
||||||
void geometryChanged();
|
|
||||||
void prepareGeometry();
|
|
||||||
|
|
||||||
QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom ) const ;
|
|
||||||
QgsAbstractGeometryV2* combine( const QList< const QgsAbstractGeometryV2* > ) const;
|
|
||||||
QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
QgsAbstractGeometryV2* buffer( double distance, int segments ) const;
|
|
||||||
QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit ) const;
|
|
||||||
QgsAbstractGeometryV2* simplify( double tolerance ) const;
|
|
||||||
QgsAbstractGeometryV2* interpolate( double distance ) const;
|
|
||||||
bool centroid( QgsPointV2& pt ) const;
|
|
||||||
bool pointOnSurface( QgsPointV2& pt ) const;
|
|
||||||
QgsAbstractGeometryV2* convexHull() const;
|
|
||||||
double distance( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool intersects( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool touches( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool crosses( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool within( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool overlaps( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool contains( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool disjoint( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
double area() const;
|
|
||||||
double length() const;
|
|
||||||
bool isValid() const;
|
|
||||||
bool isEqual( const QgsAbstractGeometryV2& geom ) const;
|
|
||||||
bool isEmpty() const;
|
|
||||||
|
|
||||||
QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const;
|
|
||||||
QgsAbstractGeometryV2* reshapeGeometry( const QgsLineStringV2& reshapeWithLine, int* errorCode ) const;
|
|
||||||
};
|
|
@ -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 )
|
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
|
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*/
|
/**Smooths a polyline using the Chaikin algorithm*/
|
||||||
QgsPolyline smoothLine( const QgsPolyline &polyline, const unsigned int iterations = 1, const double offset = 0.25 ) const;
|
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:
|
private:
|
||||||
|
|
||||||
QgsGeometryPrivate* d; //implicitely shared data pointer
|
QgsGeometryPrivate* d; //implicitely shared data pointer
|
||||||
|
@ -62,7 +62,7 @@ int QgsGeometryEditUtils::addRing( QgsAbstractGeometryV2* geom, QgsCurveV2* ring
|
|||||||
delete ring; return 3;
|
delete ring; return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QgsGeometryEngine> ringGeom( createGeometryEngine( ring ) );
|
QScopedPointer<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring ) );
|
||||||
ringGeom->prepareGeometry();
|
ringGeom->prepareGeometry();
|
||||||
|
|
||||||
//for each polygon, test if inside outer ring and no intersection with other interior ring
|
//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 )
|
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() )
|
if ( geomEngine.isNull() )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -285,8 +285,3 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra
|
|||||||
delete combinedGeometries;
|
delete combinedGeometries;
|
||||||
return diffGeom;
|
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
|
* @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> >() ) );
|
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
|
#endif // QGSGEOMETRYEDITUTILS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user