QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Geometry collection. More...
#include <qgsgeometrycollectionv2.h>
Public Member Functions | |
QgsGeometryCollectionV2 () | |
QgsGeometryCollectionV2 (const QgsGeometryCollectionV2 &c) | |
virtual | ~QgsGeometryCollectionV2 () |
virtual bool | addGeometry (QgsAbstractGeometryV2 *g) |
Adds a geometry and takes ownership. More... | |
virtual bool | addMValue (double mValue=0) override |
Adds a measure to the geometry, initialized to a preset value. More... | |
virtual bool | addZValue (double zValue=0) override |
Adds a z-dimension to the geometry, initialized to a preset value. More... | |
virtual double | area () const override |
Returns the area of the geometry. More... | |
QDomElement | asGML2 (QDomDocument &doc, int precision=17, const QString &ns="gml") const override |
Returns a GML2 representation of the geometry. More... | |
QDomElement | asGML3 (QDomDocument &doc, int precision=17, const QString &ns="gml") const override |
Returns a GML3 representation of the geometry. More... | |
QString | asJSON (int precision=17) const override |
Returns a GeoJSON representation of the geometry. More... | |
unsigned char * | asWkb (int &binarySize) const override |
Returns a WKB representation of the geometry. More... | |
QString | asWkt (int precision=17) const override |
Returns a WKT representation of the geometry. More... | |
virtual QgsAbstractGeometryV2 * | boundary () const override |
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). More... | |
virtual QgsRectangle | boundingBox () const override |
Returns the minimal bounding box for the geometry. More... | |
virtual void | clear () override |
Clears the geometry, ie reset it to a null geometry. More... | |
virtual QgsGeometryCollectionV2 * | clone () const override |
Clones the geometry by performing a deep copy. More... | |
virtual double | closestSegment (const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon) const override |
Searches for the closest segment of the geometry to a given point. More... | |
virtual QgsCoordinateSequenceV2 | coordinateSequence () const override |
Retrieves the sequence of geometries, rings and nodes. More... | |
virtual bool | deleteVertex (QgsVertexId position) override |
Deletes a vertex within the geometry. More... | |
virtual int | dimension () const override |
Returns the inherent dimension of the geometry. More... | |
virtual void | draw (QPainter &p) const override |
Draws the geometry using the specified QPainter. More... | |
virtual bool | dropMValue () override |
Drops any measure values which exist in the geometry. More... | |
virtual bool | dropZValue () override |
Drops any z-dimensions which exist in the geometry. More... | |
bool | fromWkb (QgsConstWkbPtr wkb) override |
Sets the geometry from a WKB string. More... | |
virtual bool | fromWkt (const QString &wkt) override |
Sets the geometry from a WKT string. More... | |
const QgsAbstractGeometryV2 * | geometryN (int n) const |
Returns a const reference to a geometry from within the collection. More... | |
QgsAbstractGeometryV2 * | geometryN (int n) |
Returns a geometry from within the collection. More... | |
virtual QString | geometryType () const override |
Returns a unique string representing the geometry type. More... | |
bool | hasCurvedSegments () const override |
Returns true if the geometry contains curved segments. More... | |
virtual bool | insertGeometry (QgsAbstractGeometryV2 *g, int index) |
Inserts a geometry before a specified index and takes ownership. More... | |
virtual bool | insertVertex (QgsVertexId position, const QgsPointV2 &vertex) override |
Inserts a vertex into the geometry. More... | |
virtual double | length () const override |
Returns the length of the geometry. More... | |
virtual bool | moveVertex (QgsVertexId position, const QgsPointV2 &newPos) override |
Moves a vertex within the geometry. More... | |
virtual int | nCoordinates () const override |
Returns the number of nodes contained in the geometry. More... | |
bool | nextVertex (QgsVertexId &id, QgsPointV2 &vertex) const override |
Returns next vertex id and coordinates. More... | |
int | numGeometries () const |
Returns the number of geometries within the collection. More... | |
QgsGeometryCollectionV2 & | operator= (const QgsGeometryCollectionV2 &c) |
virtual int | partCount () const override |
Returns count of parts contained in the geometry. More... | |
virtual double | perimeter () const override |
Returns the perimeter of the geometry. More... | |
virtual bool | removeGeometry (int nr) |
Removes a geometry from the collection. More... | |
virtual int | ringCount (int part=0) const override |
QgsAbstractGeometryV2 * | segmentize (double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override |
Returns a geometry without curves. More... | |
virtual void | transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) override |
Transforms the geometry using a coordinate transform. More... | |
void | transform (const QTransform &t) override |
Transforms the geometry using a QTransform object. More... | |
double | vertexAngle (QgsVertexId vertex) const override |
Returns approximate rotation angle for a vertex. More... | |
virtual QgsPointV2 | vertexAt (QgsVertexId id) const override |
Returns the point corresponding to a specified vertex id. More... | |
virtual int | vertexCount (int part=0, int ring=0) const override |
int | wkbSize () const override |
Returns the size of the WKB representation of the geometry. More... | |
Public Member Functions inherited from QgsAbstractGeometryV2 | |
QgsAbstractGeometryV2 () | |
QgsAbstractGeometryV2 (const QgsAbstractGeometryV2 &geom) | |
virtual | ~QgsAbstractGeometryV2 () |
virtual QgsPointV2 | centroid () const |
Returns the centroid of the geometry. More... | |
virtual bool | convertTo (QgsWKBTypes::Type type) |
Converts the geometry to a specified type. More... | |
bool | is3D () const |
Returns true if the geometry is 3D and contains a z-value. More... | |
bool | isEmpty () const |
Returns true if the geometry is empty. More... | |
bool | isMeasure () const |
Returns true if the geometry contains m values. More... | |
virtual QgsAbstractGeometryV2 & | operator= (const QgsAbstractGeometryV2 &geom) |
virtual QgsAbstractGeometryV2 * | toCurveType () const |
Returns the geometry converted to the more generic curve type. More... | |
QgsWKBTypes::Type | wkbType () const |
Returns the WKB type of the geometry. More... | |
QString | wktTypeStr () const |
Returns the WKT type string of the geometry. More... | |
Protected Member Functions | |
virtual QgsRectangle | calculateBoundingBox () const override |
Default calculator for the minimal bounding box for the geometry. More... | |
virtual void | clearCache () const override |
Clears any cached parameters associated with the geometry, eg bounding boxes. More... | |
bool | fromCollectionWkt (const QString &wkt, const QList< QgsAbstractGeometryV2 *> &subtypes, const QString &defaultChildWkbType=QString()) |
Reads a collection from a WKT string. More... | |
virtual bool | wktOmitChildType () const |
Returns whether child type names are omitted from Wkt representations of the collection. More... | |
Protected Member Functions inherited from QgsAbstractGeometryV2 | |
void | setZMTypeFromSubGeometry (const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType) |
Updates the geometry type based on whether sub geometries contain z or m values. More... | |
Protected Attributes | |
QVector< QgsAbstractGeometryV2 *> | mGeometries |
Protected Attributes inherited from QgsAbstractGeometryV2 | |
QgsWKBTypes::Type | mWkbType |
Additional Inherited Members | |
Public Types inherited from QgsAbstractGeometryV2 | |
enum | SegmentationToleranceType { MaximumAngle = 0, MaximumDifference } |
Segmentation tolerance as maximum angle or maximum difference between approximation and circle. More... | |
Geometry collection.
Definition at line 29 of file qgsgeometrycollectionv2.h.
QgsGeometryCollectionV2::QgsGeometryCollectionV2 | ( | ) |
Definition at line 30 of file qgsgeometrycollectionv2.cpp.
QgsGeometryCollectionV2::QgsGeometryCollectionV2 | ( | const QgsGeometryCollectionV2 & | c | ) |
Definition at line 35 of file qgsgeometrycollectionv2.cpp.
|
virtual |
Definition at line 61 of file qgsgeometrycollectionv2.cpp.
|
virtual |
Adds a geometry and takes ownership.
Returns true in case of success.
Reimplemented in QgsMultiPointV2, QgsMultiSurfaceV2, QgsMultiCurveV2, QgsMultiLineStringV2, and QgsMultiPolygonV2.
Definition at line 99 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Adds a measure to the geometry, initialized to a preset value.
mValue | initial m-value for all nodes |
Implements QgsAbstractGeometryV2.
Definition at line 631 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Adds a z-dimension to the geometry, initialized to a preset value.
zValue | initial z-value for all nodes |
Implements QgsAbstractGeometryV2.
Definition at line 616 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the area of the geometry.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 490 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns a GML2 representation of the geometry.
doc | DOM document |
precision | number of decimal places for coordinates |
ns | XML namespace |
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 288 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns a GML3 representation of the geometry.
doc | DOM document |
precision | number of decimal places for coordinates |
ns | XML namespace |
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 300 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns a GeoJSON representation of the geometry.
precision | number of decimal places for coordinates |
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 312 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns a WKB representation of the geometry.
binarySize | will be set to the size of the returned WKB string |
Implements QgsAbstractGeometryV2.
Definition at line 246 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns a WKT representation of the geometry.
precision | number of decimal places for coordinates |
Implements QgsAbstractGeometryV2.
Definition at line 268 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon.
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiPolygonV2, QgsMultiPointV2, and QgsMultiSurfaceV2.
Definition at line 78 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the minimal bounding box for the geometry.
Implements QgsAbstractGeometryV2.
Definition at line 327 of file qgsgeometrycollectionv2.cpp.
|
overrideprotectedvirtual |
Default calculator for the minimal bounding box for the geometry.
Derived classes should override this method if a more efficient bounding box calculation is available.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 336 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Clears the geometry, ie reset it to a null geometry.
Implements QgsAbstractGeometryV2.
Definition at line 71 of file qgsgeometrycollectionv2.cpp.
|
inlineoverrideprotectedvirtual |
Clears any cached parameters associated with the geometry, eg bounding boxes.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 144 of file qgsgeometrycollectionv2.h.
|
overridevirtual |
Clones the geometry by performing a deep copy.
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 66 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Searches for the closest segment of the geometry to a given point.
pt | specifies the point to find closest segment to |
segmentPt | storage for the closest point within the geometry |
vertexAfter | storage for the ID of the vertex at the end of the closest segment |
leftOf | returns whether the point lies on the left side of the nearest segment (true if point is to left of segment, false if point is to right of segment) |
epsilon | epsilon for segment snapping |
Implements QgsAbstractGeometryV2.
Definition at line 388 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Retrieves the sequence of geometries, rings and nodes.
Implements QgsAbstractGeometryV2.
Definition at line 352 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Deletes a vertex within the geometry.
position | vertex id for vertex to delete |
Implements QgsAbstractGeometryV2.
Definition at line 451 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the inherent dimension of the geometry.
For example, this is 0 for a point geometry, 1 for a linestring and 2 for a polygon.
Implements QgsAbstractGeometryV2.
Definition at line 135 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Draws the geometry using the specified QPainter.
p | destination QPainter |
Implements QgsAbstractGeometryV2.
Definition at line 179 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Drops any measure values which exist in the geometry.
Implements QgsAbstractGeometryV2.
Definition at line 661 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Drops any z-dimensions which exist in the geometry.
Implements QgsAbstractGeometryV2.
Definition at line 647 of file qgsgeometrycollectionv2.cpp.
|
protected |
Reads a collection from a WKT string.
Definition at line 512 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Sets the geometry from a WKB string.
Implements QgsAbstractGeometryV2.
Definition at line 188 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Sets the geometry from a WKT string.
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 223 of file qgsgeometrycollectionv2.cpp.
const QgsAbstractGeometryV2 * QgsGeometryCollectionV2::geometryN | ( | int | n | ) | const |
Returns a const reference to a geometry from within the collection.
n | index of geometry to return |
Definition at line 88 of file qgsgeometrycollectionv2.cpp.
QgsAbstractGeometryV2 * QgsGeometryCollectionV2::geometryN | ( | int | n | ) |
Returns a geometry from within the collection.
n | index of geometry to return |
Definition at line 93 of file qgsgeometrycollectionv2.cpp.
|
inlineoverridevirtual |
Returns a unique string representing the geometry type.
Implements QgsAbstractGeometryV2.
Reimplemented in QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
Definition at line 55 of file qgsgeometrycollectionv2.h.
|
overridevirtual |
Returns true if the geometry contains curved segments.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 569 of file qgsgeometrycollectionv2.cpp.
|
virtual |
Inserts a geometry before a specified index and takes ownership.
Returns true in case of success.
g | geometry to insert. Ownership is transferred to the collection. |
index | position to insert geometry before |
Definition at line 111 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Inserts a vertex into the geometry.
position | vertex id for position of inserted vertex |
vertex | vertex to insert |
Implements QgsAbstractGeometryV2.
Definition at line 421 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the length of the geometry.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 479 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Moves a vertex within the geometry.
position | vertex id for vertex to move |
newPos | new position of vertex |
Implements QgsAbstractGeometryV2.
Definition at line 436 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns the number of nodes contained in the geometry.
Reimplemented from QgsAbstractGeometryV2.
Reimplemented in QgsMultiPointV2.
Definition at line 372 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns next vertex id and coordinates.
id | initial value should be the starting vertex id. The next vertex id will be stored in this variable if found. |
vertex | container for found node |
Implements QgsAbstractGeometryV2.
Definition at line 393 of file qgsgeometrycollectionv2.cpp.
int QgsGeometryCollectionV2::numGeometries | ( | ) | const |
Returns the number of geometries within the collection.
Definition at line 83 of file qgsgeometrycollectionv2.cpp.
QgsGeometryCollectionV2 & QgsGeometryCollectionV2::operator= | ( | const QgsGeometryCollectionV2 & | c | ) |
Definition at line 45 of file qgsgeometrycollectionv2.cpp.
|
inlineoverridevirtual |
Returns count of parts contained in the geometry.
Implements QgsAbstractGeometryV2.
Definition at line 123 of file qgsgeometrycollectionv2.h.
|
overridevirtual |
Returns the perimeter of the geometry.
Reimplemented from QgsAbstractGeometryV2.
Definition at line 501 of file qgsgeometrycollectionv2.cpp.
|
virtual |
Removes a geometry from the collection.
nr | index of geometry to remove |
Definition at line 123 of file qgsgeometrycollectionv2.cpp.
|
inlineoverridevirtual |
Implements QgsAbstractGeometryV2.
Definition at line 122 of file qgsgeometrycollectionv2.h.
|
overridevirtual |
Returns a geometry without curves.
Caller takes ownership
tolerance | segmentation tolerance |
toleranceType | maximum segmentation angle or maximum difference between approximation and curve |
Reimplemented from QgsAbstractGeometryV2.
Definition at line 582 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Transforms the geometry using a coordinate transform.
ct | coordinate transform |
d | transformation direction |
transformZ | set to true to also transform z coordinates. This requires that the z coordinates in the geometry represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and are expressed in its vertical units (generally meters). If false, then z coordinates will not be changed by the transform. |
Implements QgsAbstractGeometryV2.
Definition at line 150 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Transforms the geometry using a QTransform object.
t | QTransform transformation |
Implements QgsAbstractGeometryV2.
Definition at line 159 of file qgsgeometrycollectionv2.cpp.
|
overridevirtual |
Returns approximate rotation angle for a vertex.
Usually average angle between adjacent segments.
vertex | the vertex id |
Implements QgsAbstractGeometryV2.
Definition at line 600 of file qgsgeometrycollectionv2.cpp.
|
inlineoverridevirtual |
Returns the point corresponding to a specified vertex id.
Implements QgsAbstractGeometryV2.
Definition at line 124 of file qgsgeometrycollectionv2.h.
|
inlineoverridevirtual |
Implements QgsAbstractGeometryV2.
Definition at line 121 of file qgsgeometrycollectionv2.h.
|
overridevirtual |
Returns the size of the WKB representation of the geometry.
Implements QgsAbstractGeometryV2.
Definition at line 233 of file qgsgeometrycollectionv2.cpp.
|
inlineprotectedvirtual |
Returns whether child type names are omitted from Wkt representations of the collection.
Reimplemented in QgsMultiPolygonV2, QgsMultiLineStringV2, and QgsMultiPointV2.
Definition at line 137 of file qgsgeometrycollectionv2.h.
|
protected |
Definition at line 132 of file qgsgeometrycollectionv2.h.