Skip to content

Commit df0b842

Browse files
committed
geometry sip sync
1 parent 78ecddb commit df0b842

File tree

2 files changed

+128
-67
lines changed

2 files changed

+128
-67
lines changed

python/core/geometry/qgsgeometry.sip

+105-41
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,36 @@ class QgsGeometry
3434
/** copy constructor will prompt a deep copy of the object */
3535
QgsGeometry( const QgsGeometry & );
3636

37-
QgsGeometry( QgsAbstractGeometryV2* geom /Transfer/ );
38-
37+
/** Creates a geometry from an abstract geometry object.
38+
* @note added in QGIS 2.10
39+
*/
40+
QgsGeometry( QgsAbstractGeometryV2* geom );
3941

4042
//! Destructor
4143
~QgsGeometry();
4244

45+
/** Returns the underlying geometry store.
46+
* @note added in QGIS 2.10
47+
*/
4348
const QgsAbstractGeometryV2* geometry() const;
4449

45-
/** static method that creates geometry from Wkt */
50+
/** Creates a new geometry from a WKT string */
4651
static QgsGeometry* fromWkt( QString wkt ) /Factory/;
47-
48-
/** construct geometry from a point */
52+
/** Creates a new geometry from a QgsPoint object*/
4953
static QgsGeometry* fromPoint( const QgsPoint& point ) /Factory/;
50-
/** construct geometry from a multipoint */
54+
/** Creates a new geometry from a QgsMultiPoint object */
5155
static QgsGeometry* fromMultiPoint( const QgsMultiPoint& multipoint ) /Factory/;
52-
/** construct geometry from a polyline */
56+
/** Creates a new geometry from a QgsPolyline object */
5357
static QgsGeometry* fromPolyline( const QgsPolyline& polyline ) /Factory/;
54-
/** construct geometry from a multipolyline*/
58+
/** Creates a new geometry from a QgsMultiPolyline object*/
5559
static QgsGeometry* fromMultiPolyline( const QgsMultiPolyline& multiline ) /Factory/;
56-
/** construct geometry from a polygon */
60+
/** Creates a new geometry from a QgsPolygon */
5761
static QgsGeometry* fromPolygon( const QgsPolygon& polygon ) /Factory/;
58-
/** construct geometry from a multipolygon */
62+
/** Creates a new geometry from a QgsMultiPolygon */
5963
static QgsGeometry* fromMultiPolygon( const QgsMultiPolygon& multipoly ) /Factory/;
60-
/** construct geometry from a rectangle */
64+
/** Creates a new geometry from a QgsRectangle */
6165
static QgsGeometry* fromRect( const QgsRectangle& rect ) /Factory/;
66+
6267
/**
6368
Set the geometry, feeding in a geometry in GEOS format.
6469
This class will take ownership of the buffer.
@@ -80,6 +85,7 @@ class QgsGeometry
8085
/**
8186
Returns the buffer containing this geometry in WKB format.
8287
You may wish to use in conjunction with wkbSize().
88+
@see wkbSize
8389
*/
8490
SIP_PYOBJECT asWkb();
8591
%MethodCode
@@ -88,49 +94,57 @@ class QgsGeometry
8894

8995
/**
9096
* Returns the size of the WKB in asWkb().
97+
* @see asWkb
9198
*/
9299
size_t wkbSize() const;
93100

94-
/**Returns a geos geomtry. QgsGeometry keeps ownership, don't delete the returned object!
101+
/** Returns a geos geometry. QgsGeometry retains ownership of the geometry, so the returned object should not be deleted.
95102
@note this method was added in version 1.1
96103
@note not available in python bindings
97104
*/
98105
// const GEOSGeometry* asGeos() const;
99106

100-
/** Returns type of wkb (point / linestring / polygon etc.) */
107+
/** Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
108+
* @see type
109+
*/
101110
QGis::WkbType wkbType() const;
102111

103-
/** Returns type of the vector */
112+
/** Returns type of the geometry as a QGis::GeometryType
113+
* @see wkbType
114+
*/
104115
QGis::GeometryType type() const;
105116

106-
/** Returns true if wkb of the geometry is of WKBMulti* type */
117+
/** Returns true if WKB of the geometry is of WKBMulti* type */
107118
bool isMultipart() const;
108119

109-
/** compare geometries using GEOS
120+
/** Compares the geometry with another geometry using GEOS
110121
@note added in 1.5
111122
*/
112123
bool isGeosEqual( const QgsGeometry& ) const;
113124

114-
/** check validity using GEOS
125+
/** Checks validity of the geometry using GEOS
115126
@note added in 1.5
116127
*/
117128
bool isGeosValid() const;
118129

119-
/** check if geometry is empty using GEOS
130+
/** Check if the geometry is empty using GEOS
120131
@note added in 1.5
121132
*/
122133
bool isGeosEmpty() const;
123134

124-
/** get area of geometry using GEOS
135+
/** Returns the area of the geometry using GEOS
125136
@note added in 1.5
126137
*/
127138
double area() const;
128139

129-
/** get length of geometry using GEOS
140+
/** Returns the length of geometry using GEOS
130141
@note added in 1.5
131142
*/
132143
double length() const;
133144

145+
/** Returns the minimum distanace between this geometry and another geometry, using GEOS
146+
* @param geom geometry to find minimum distance to
147+
*/
134148
double distance( const QgsGeometry& geom ) const;
135149

136150
/**
@@ -243,31 +257,30 @@ class QgsGeometry
243257
not disjoint with existing polygons of the feature*/
244258
int addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType = QGis::UnknownGeometry );
245259

260+
/**Adds a new part to this geometry (takes ownership)
261+
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
262+
not disjoint with existing polygons of the feature*/
263+
int addPart( QgsCurveV2* part /Transfer/ );
264+
246265
/**Adds a new island polygon to a multipolygon feature
247266
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
248267
not disjoint with existing polygons of the feature
249268
@note not available in python bindings
250269
*/
251270
// int addPart( GEOSGeometry *newPart );
252271

253-
/**Adds a new part to this geometry (takes ownership)
254-
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
255-
not disjoint with existing polygons of the feature*/
256-
int addPart( QgsCurveV2* part /Transfer/ );
257-
258-
259272
/**Adds a new island polygon to a multipolygon feature
260273
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
261274
not disjoint with existing polygons of the feature
262-
@note available in python bindings as addPartGeometry (added in 2.1)
275+
@note available in python bindings as addPartGeometry (added in 2.2)
263276
*/
264277
int addPart( const QgsGeometry *newPart /Transfer/ ) /PyName=addPartGeometry/;
265278

266279
/**Translate this geometry by dx, dy
267280
@return 0 in case of success*/
268281
int translate( double dx, double dy );
269282

270-
/**Transform this geometry as described by CoordinateTranasform ct
283+
/**Transform this geometry as described by CoordinateTransform ct
271284
@return 0 in case of success*/
272285
int transform( const QgsCoordinateTransform& ct );
273286

@@ -283,8 +296,7 @@ class QgsGeometry
283296
@return 0 in case of success*/
284297
int rotate( double rotation, const QgsPoint& center );
285298

286-
/**Splits this geometry according to a given line. Note that the geometry is only split once. If there are several intersections
287-
between geometry and splitLine, only the first one is considered.
299+
/**Splits this geometry according to a given line.
288300
@param splitLine the line that splits the geometry
289301
@param[out] newGeometries list of new geometries that have been created with the split
290302
@param topological true if topological editing is enabled
@@ -303,7 +315,7 @@ class QgsGeometry
303315
/**Changes this geometry such that it does not intersect the other geometry
304316
@param other geometry that should not be intersect
305317
@return 0 in case of success*/
306-
int makeDifference( QgsGeometry* other );
318+
int makeDifference( const QgsGeometry* other );
307319

308320
/**Returns the bounding box of this feature*/
309321
QgsRectangle boundingBox() const;
@@ -350,6 +362,7 @@ class QgsGeometry
350362
QgsGeometry* buffer( double distance, int segments ) const /Factory/;
351363

352364
/** Returns a buffer region around the geometry, with additional style options.
365+
* @param distance buffer distance
353366
* @param segments For round joins, number of segments to approximate quarter-circle
354367
* @param endCapStyle Round (1) / Flat (2) / Square (3) end cap style
355368
* @param joinStyle Round (1) / Mitre (2) / Bevel (3) join style
@@ -386,18 +399,18 @@ class QgsGeometry
386399
QgsGeometry* interpolate( double distance ) /Factory/;
387400

388401
/** Returns a geometry representing the points shared by this geometry and other. */
389-
QgsGeometry* intersection( QgsGeometry* geometry ) const /Factory/;
402+
QgsGeometry* intersection( const QgsGeometry* geometry ) const /Factory/;
390403

391404
/** Returns a geometry representing all the points in this geometry and other (a
392405
* union geometry operation).
393406
* @note this operation is not called union since its a reserved word in C++.*/
394-
QgsGeometry* combine( QgsGeometry* geometry ) const /Factory/;
407+
QgsGeometry* combine( const QgsGeometry* geometry ) const /Factory/;
395408

396409
/** Returns a geometry representing the points making up this geometry that do not make up other. */
397-
QgsGeometry* difference( QgsGeometry* geometry ) const /Factory/;
410+
QgsGeometry* difference( const QgsGeometry* geometry ) const /Factory/;
398411

399412
/** Returns a Geometry representing the points making up this Geometry that do not make up other. */
400-
QgsGeometry* symDifference( QgsGeometry* geometry ) const /Factory/;
413+
QgsGeometry* symDifference( const QgsGeometry* geometry ) const /Factory/;
401414

402415
/** Exports the geometry to WKT
403416
* @note precision parameter added in 2.4
@@ -464,13 +477,13 @@ class QgsGeometry
464477
*/
465478
QPolygonF asQPolygonF() const;
466479

467-
/** delete a ring in polygon or multipolygon.
480+
/** Delete a ring in polygon or multipolygon.
468481
Ring 0 is outer ring and can't be deleted.
469482
@return true on success
470483
@note added in version 1.2 */
471484
bool deleteRing( int ringNum, int partNum = 0 );
472485

473-
/** delete part identified by the part number
486+
/** Delete part identified by the part number
474487
@return true on success
475488
@note added in version 1.2 */
476489
bool deletePart( int partNum );
@@ -514,21 +527,61 @@ class QgsGeometry
514527
*/
515528
static QgsGeometry *unaryUnion( const QList<QgsGeometry*>& geometryList ) /Factory/;
516529

530+
/** Converts the geometry to straight line segments, if it is a curved geometry type.
531+
* @note added in QGIS 2.10
532+
* @see requiresConversionToStraightSegments
533+
*/
534+
void convertToStraightSegment();
535+
517536
/** Returns true if the geometry is a curved geometry type which requires conversion to
518537
* display as straight line segments.
519538
* @note added in QGIS 2.10
520539
* @see convertToStraightSegment
521540
*/
522541
bool requiresConversionToStraightSegments() const;
523542

543+
/** Transforms the geometry from map units to pixels in place.
544+
* @param mtp map to pixel transform
545+
* @note added in QGIS 2.10
546+
*/
524547
void mapToPixel( const QgsMapToPixel& mtp );
525-
526-
//void clip( const QgsRectangle& rect );
548+
549+
// not implemented for 2.10
550+
/** Clips the geometry using the specified rectangle
551+
* @param rect clip rectangle
552+
* @note added in QGIS 2.10
553+
*/
554+
// void clip( const QgsRectangle& rect );
555+
556+
/** Draws the geometry onto a QPainter
557+
* @param p destination QPainter
558+
* @note added in QGIS 2.10
559+
*/
527560
void draw( QPainter& p ) const;
528561

562+
/** Calculates the vertex ID from a vertex number
563+
* @param nr vertex number
564+
* @param id reference to QgsVertexId for storing result
565+
* @returns true if vertex was found
566+
* @note added in QGIS 2.10
567+
* @see vertexNrFromVertexId
568+
*/
529569
bool vertexIdFromVertexNr( int nr, QgsVertexId& id ) const;
570+
571+
/** Returns the vertex number corresponding to a vertex idd
572+
* @param i vertex id
573+
* @returns vertex number
574+
* @note added in QGIS 2.10
575+
* @see vertexIdFromVertexNr
576+
*/
530577
int vertexNrFromVertexId( const QgsVertexId& i ) const;
531578

579+
/** return GEOS context handle
580+
* @note added in 2.6
581+
* @note not available in Python
582+
*/
583+
// static GEOSContextHandle_t getGEOSHandler();
584+
532585
/**Construct geometry from a QPointF
533586
* @param point source QPointF
534587
* @note added in QGIS 2.7
@@ -542,9 +595,20 @@ class QgsGeometry
542595
* @note added in QGIS 2.7
543596
*/
544597
static QgsGeometry* fromQPolygonF( const QPolygonF& polygon ) /Factory/;
598+
599+
/** Creates a QgsPolyline from a QPolygonF.
600+
* @param polygon source polygon
601+
* @returns QgsPolyline
602+
* @see createPolygonFromQPolygonF
603+
*/
545604
static QgsPolyline createPolylineFromQPolygonF( const QPolygonF &polygon ) /Factory/;
546-
static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) /Factory/;
547605

606+
/** Creates a QgsPolygon from a QPolygonF.
607+
* @param polygon source polygon
608+
* @returns QgsPolygon
609+
* @see createPolylineFromQPolygonF
610+
*/
611+
static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) /Factory/;
548612

549613
/** Compares two polylines for equality within a specified tolerance.
550614
* @param p1 first polyline
@@ -586,7 +650,7 @@ class QgsGeometry
586650
* of the geometry for each iteration. Smaller values result in "tighter" smoothing.
587651
* @note added in 2.9
588652
*/
589-
QgsGeometry* smooth( const unsigned int iterations, const double offset ) const;
653+
QgsGeometry* smooth( const unsigned int iterations, const double offset ) const;
590654

591655
/**Smooths a polygon using the Chaikin algorithm*/
592656
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;

0 commit comments

Comments
 (0)