@@ -70,46 +70,167 @@ class QgsAbstractGeometryV2
70
70
QgsAbstractGeometryV2( const QgsAbstractGeometryV2& geom );
71
71
//virtual QgsAbstractGeometryV2& operator=( const QgsAbstractGeometryV2& geom );
72
72
73
+ /** Clones the geometry by performing a deep copy
74
+ */
73
75
virtual QgsAbstractGeometryV2* clone() const = 0;
76
+
77
+ /** Clears the geometry, ie reset it to a null geometry
78
+ */
74
79
virtual void clear() = 0;
75
80
81
+ /** Returns the minimal bounding box for the geometry
82
+ */
76
83
QgsRectangle boundingBox() const;
77
84
85
+ /** Calculates the minimal bounding box for the geometry. Derived classes should override this method
86
+ * to return the correct bounding box.
87
+ */
88
+ virtual QgsRectangle calculateBoundingBox() const;
89
+
78
90
//mm-sql interface
91
+ /** Returns the inherent dimension of the geometry. For example, this is 0 for a point geometry,
92
+ * 1 for a linestring and 2 for a polygon.
93
+ */
79
94
virtual int dimension() const = 0;
80
95
//virtual int coordDim() const { return mCoordDimension; }
96
+
97
+ /** Returns a unique string representing the geometry type.
98
+ * @see wkbType
99
+ * @see wktTypeStr
100
+ */
81
101
virtual QString geometryType() const = 0;
102
+
103
+ /** Returns the WKB type of the geometry.
104
+ * @see geometryType
105
+ * @see wktTypeStr
106
+ */
82
107
QgsWKBTypes::Type wkbType() const;
108
+
109
+ /** Returns the WKT type string of the geometry.
110
+ * @see geometryType
111
+ * @see wkbType
112
+ */
83
113
QString wktTypeStr() const;
114
+
115
+ /** Returns true if the geometry is 3D and contains a z-value.
116
+ * @see isMeasure
117
+ */
84
118
bool is3D() const;
119
+
120
+ /** Returns true if the geometry contains m values.
121
+ * @see is3D
122
+ */
85
123
bool isMeasure() const;
86
124
87
125
//import
126
+
127
+ /** Sets the geometry from a WKB string.
128
+ * @see fromWkt
129
+ */
88
130
virtual bool fromWkb( const unsigned char * wkb ) = 0;
131
+
132
+ /** Sets the geometry from a WKT string.
133
+ * @see fromWkb
134
+ */
89
135
virtual bool fromWkt( const QString& wkt ) = 0;
90
136
91
137
//export
138
+
139
+ /** Returns the size of the WKB representation of the geometry.
140
+ * @see asWkb
141
+ */
92
142
virtual int wkbSize() const = 0;
143
+
144
+ /** Returns a WKB representation of the geometry.
145
+ * @param binarySize will be set to the size of the returned WKB string
146
+ * @see wkbSize
147
+ * @see asWkt
148
+ * @see asGML2
149
+ * @see asGML3
150
+ * @see asJSON
151
+ */
93
152
virtual unsigned char* asWkb( int& binarySize ) const = 0;
153
+
154
+ /** Returns a WKT representation of the geometry.
155
+ * @param precision number of decimal places for coordinates
156
+ * @see asWkb
157
+ * @see asGML2
158
+ * @see asGML3
159
+ * @see asJSON
160
+ */
94
161
virtual QString asWkt( int precision = 17 ) const = 0;
162
+
163
+ /** Returns a GML2 representation of the geometry.
164
+ * @param doc DOM document
165
+ * @param precision number of decimal places for coordinates
166
+ * @param ns XML namespace
167
+ * @see asWkb
168
+ * @see asWkt
169
+ * @see asGML3
170
+ * @see asJSON
171
+ */
95
172
virtual QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const = 0;
173
+
174
+ /** Returns a GML3 representation of the geometry.
175
+ * @param doc DOM document
176
+ * @param precision number of decimal places for coordinates
177
+ * @param ns XML namespace
178
+ * @see asWkb
179
+ * @see asWkt
180
+ * @see asGML2
181
+ * @see asJSON
182
+ */
96
183
virtual QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const = 0;
97
- virtual QString asJSON( int precision = 17 ) const = 0;
98
184
99
- virtual QgsRectangle calculateBoundingBox() const;
185
+ /** Returns a GeoJSON representation of the geometry.
186
+ * @param precision number of decimal places for coordinates
187
+ * @see asWkb
188
+ * @see asWkt
189
+ * @see asGML2
190
+ * @see asGML3
191
+ */
192
+ virtual QString asJSON( int precision = 17 ) const = 0;
100
193
101
194
//render pipeline
195
+
196
+ /** Transforms the geometry using a coordinate transform
197
+ * @param ct coordinate transform
198
+ @param d transformation direction
199
+ */
102
200
virtual void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform ) = 0;
201
+
202
+ /** Transforms the geometry using a QTransform object
203
+ * @param t QTransform transformation
204
+ */
103
205
virtual void transform( const QTransform& t ) = 0;
206
+
207
+
104
208
//virtual void clip( const QgsRectangle& rect );
209
+
210
+ /** Draws the geometry using the specified QPainter.
211
+ * @param p destination QPainter
212
+ */
105
213
virtual void draw( QPainter& p ) const = 0;
106
214
107
215
/** Returns next vertex id and coordinates
108
- @return false if at end*/
216
+ * @param id initial value should be the starting vertex id. The next vertex id will be stored
217
+ * in this variable if found.
218
+ * @param vertex container for found node
219
+ * @return false if at end
220
+ */
109
221
virtual bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const = 0;
110
222
223
+ /** Retrieves the sequence of geometries, rings and nodes.
224
+ * @param coord destination for coordinate sequence.
225
+ */
111
226
virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const = 0;
227
+
228
+ /** Returns the number of nodes contained in the geometry
229
+ */
112
230
int nCoordinates() const;
231
+
232
+ /** Returns the point corresponding to a specified vertex id
233
+ */
113
234
virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const = 0;
114
235
115
236
/** Searches for the closest segment of the geometry to a given point.
@@ -121,11 +242,34 @@ class QgsAbstractGeometryV2
121
242
* @param epsilon epsilon for segment snapping
122
243
* @returns squared distance to closest segment
123
244
*/
124
- virtual double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const = 0;
245
+ virtual double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const = 0;
125
246
126
247
//low-level editing
248
+
249
+ /** Inserts a vertex into the geometry
250
+ * @param position vertex id for position of inserted vertex
251
+ * @param vertex vertex to insert
252
+ * @returns true if insert was successful
253
+ * @see moveVertex
254
+ * @see deleteVertex
255
+ */
127
256
virtual bool insertVertex( const QgsVertexId& position, const QgsPointV2& vertex ) = 0;
257
+
258
+ /** Moves a vertex within the geometry
259
+ * @param position vertex id for vertex to move
260
+ * @param newPos new position of vertex
261
+ * @returns true if move was successful
262
+ * @see insertVertex
263
+ * @see deleteVertex
264
+ */
128
265
virtual bool moveVertex( const QgsVertexId& position, const QgsPointV2& newPos ) = 0;
266
+
267
+ /** Deletes a vertex within the geometry
268
+ * @param position vertex id for vertex to delete
269
+ * @returns true if delete was successful
270
+ * @see insertVertex
271
+ * @see moveVertex
272
+ */
129
273
virtual bool deleteVertex( const QgsVertexId& position ) = 0;
130
274
131
275
/** Returns the length of the geometry.
@@ -146,15 +290,20 @@ class QgsAbstractGeometryV2
146
290
*/
147
291
virtual double area() const;
148
292
149
- /** Returns the centroid of the geometry*/
293
+ /** Returns the centroid of the geometry */
150
294
virtual QgsPointV2 centroid() const;
151
295
152
296
/** Returns true if the geometry is empty
153
297
*/
154
298
bool isEmpty() const;
155
299
300
+ /** Returns true if the geometry contains curved segments
301
+ */
156
302
virtual bool hasCurvedSegments() const;
157
- /** Returns a geometry without curves. Caller takes ownership*/
303
+
304
+ /** Returns a version of the geometry without curves. Caller takes ownership of
305
+ * the returned geometry.
306
+ */
158
307
virtual QgsAbstractGeometryV2* segmentize() const /Factory/;
159
308
160
309
/** Returns approximate angle at a vertex. This is usually the average angle between adjacent
@@ -165,8 +314,8 @@ class QgsAbstractGeometryV2
165
314
*/
166
315
virtual double vertexAngle( const QgsVertexId& vertex ) const = 0;
167
316
168
- virtual int vertexCount(int part = 0, int ring = 0) const = 0;
169
- virtual int ringCount(int part = 0) const = 0;
317
+ virtual int vertexCount( int part = 0, int ring = 0 ) const = 0;
318
+ virtual int ringCount( int part = 0 ) const = 0;
170
319
171
320
/** Returns count of parts contained in the geometry.
172
321
* @see vertexCount
@@ -178,15 +327,17 @@ class QgsAbstractGeometryV2
178
327
* @param zValue initial z-value for all nodes
179
328
* @returns true on success
180
329
* @note added in QGIS 2.12
181
- * @see addMValue
330
+ * @see dropZValue()
331
+ * @see addMValue()
182
332
*/
183
333
virtual bool addZValue( double zValue = 0 ) = 0;
184
334
185
335
/** Adds a measure to the geometry, initialized to a preset value.
186
336
* @param mValue initial m-value for all nodes
187
337
* @returns true on success
188
338
* @note added in QGIS 2.12
189
- * @see addZValue
339
+ * @see dropMValue()
340
+ * @see addZValue()
190
341
*/
191
342
virtual bool addMValue( double mValue = 0 ) = 0;
192
343
0 commit comments