QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Abstract base class for all geometries. More...
#include <qgsabstractgeometryv2.h>
Public Types | |
enum | SegmentationToleranceType { MaximumAngle = 0, MaximumDifference } |
Segmentation tolerance as maximum angle or maximum difference between approximation and circle. More... | |
Public Member Functions | |
QgsAbstractGeometryV2 () | |
QgsAbstractGeometryV2 (const QgsAbstractGeometryV2 &geom) | |
virtual | ~QgsAbstractGeometryV2 () |
virtual bool | addMValue (double mValue=0)=0 |
Adds a measure to the geometry, initialized to a preset value. More... | |
virtual bool | addZValue (double zValue=0)=0 |
Adds a z-dimension to the geometry, initialized to a preset value. More... | |
virtual double | area () const |
Returns the area of the geometry. More... | |
virtual QDomElement | asGML2 (QDomDocument &doc, int precision=17, const QString &ns="gml") const =0 |
Returns a GML2 representation of the geometry. More... | |
virtual QDomElement | asGML3 (QDomDocument &doc, int precision=17, const QString &ns="gml") const =0 |
Returns a GML3 representation of the geometry. More... | |
virtual QString | asJSON (int precision=17) const =0 |
Returns a GeoJSON representation of the geometry. More... | |
virtual unsigned char * | asWkb (int &binarySize) const =0 |
Returns a WKB representation of the geometry. More... | |
virtual QString | asWkt (int precision=17) const =0 |
Returns a WKT representation of the geometry. More... | |
virtual QgsAbstractGeometryV2 * | boundary () const =0 |
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). More... | |
virtual QgsRectangle | boundingBox () const =0 |
Returns the minimal bounding box for the geometry. More... | |
virtual QgsPointV2 | centroid () const |
Returns the centroid of the geometry. More... | |
virtual void | clear ()=0 |
Clears the geometry, ie reset it to a null geometry. More... | |
virtual QgsAbstractGeometryV2 * | clone () const =0 |
Clones the geometry by performing a deep copy. More... | |
virtual double | closestSegment (const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon) const =0 |
Searches for the closest segment of the geometry to a given point. More... | |
virtual bool | convertTo (QgsWKBTypes::Type type) |
Converts the geometry to a specified type. More... | |
virtual QgsCoordinateSequenceV2 | coordinateSequence () const =0 |
Retrieves the sequence of geometries, rings and nodes. More... | |
virtual bool | deleteVertex (QgsVertexId position)=0 |
Deletes a vertex within the geometry. More... | |
virtual int | dimension () const =0 |
Returns the inherent dimension of the geometry. More... | |
virtual void | draw (QPainter &p) const =0 |
Draws the geometry using the specified QPainter. More... | |
virtual bool | dropMValue ()=0 |
Drops any measure values which exist in the geometry. More... | |
virtual bool | dropZValue ()=0 |
Drops any z-dimensions which exist in the geometry. More... | |
virtual bool | fromWkb (QgsConstWkbPtr wkb)=0 |
Sets the geometry from a WKB string. More... | |
virtual bool | fromWkt (const QString &wkt)=0 |
Sets the geometry from a WKT string. More... | |
virtual QString | geometryType () const =0 |
Returns a unique string representing the geometry type. More... | |
virtual bool | hasCurvedSegments () const |
Returns true if the geometry contains curved segments. More... | |
virtual bool | insertVertex (QgsVertexId position, const QgsPointV2 &vertex)=0 |
Inserts a vertex into the geometry. 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 double | length () const |
Returns the length of the geometry. More... | |
virtual bool | moveVertex (QgsVertexId position, const QgsPointV2 &newPos)=0 |
Moves a vertex within the geometry. More... | |
virtual int | nCoordinates () const |
Returns the number of nodes contained in the geometry. More... | |
virtual bool | nextVertex (QgsVertexId &id, QgsPointV2 &vertex) const =0 |
Returns next vertex id and coordinates. More... | |
virtual QgsAbstractGeometryV2 & | operator= (const QgsAbstractGeometryV2 &geom) |
virtual int | partCount () const =0 |
Returns count of parts contained in the geometry. More... | |
virtual double | perimeter () const |
Returns the perimeter of the geometry. More... | |
virtual int | ringCount (int part=0) const =0 |
virtual QgsAbstractGeometryV2 * | segmentize (double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const |
Returns a version of the geometry without curves. More... | |
virtual QgsAbstractGeometryV2 * | toCurveType () const |
Returns the geometry converted to the more generic curve type. More... | |
virtual void | transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform, bool transformZ=false)=0 |
Transforms the geometry using a coordinate transform. More... | |
virtual void | transform (const QTransform &t)=0 |
Transforms the geometry using a QTransform object. More... | |
virtual double | vertexAngle (QgsVertexId vertex) const =0 |
Returns approximate angle at a vertex. More... | |
virtual QgsPointV2 | vertexAt (QgsVertexId id) const =0 |
Returns the point corresponding to a specified vertex id. More... | |
virtual int | vertexCount (int part=0, int ring=0) const =0 |
virtual int | wkbSize () const =0 |
Returns the size of the WKB representation of the geometry. 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 |
Default calculator for the minimal bounding box for the geometry. More... | |
virtual void | clearCache () const |
Clears any cached parameters associated with the geometry, eg bounding boxes. More... | |
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 | |
QgsWKBTypes::Type | mWkbType |
Abstract base class for all geometries.
Definition at line 43 of file qgsabstractgeometryv2.h.
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
Enumerator | |
---|---|
MaximumAngle | |
MaximumDifference |
Definition at line 48 of file qgsabstractgeometryv2.h.
QgsAbstractGeometryV2::QgsAbstractGeometryV2 | ( | ) |
Definition at line 25 of file qgsabstractgeometryv2.cpp.
|
virtual |
Definition at line 29 of file qgsabstractgeometryv2.cpp.
QgsAbstractGeometryV2::QgsAbstractGeometryV2 | ( | const QgsAbstractGeometryV2 & | geom | ) |
Definition at line 33 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Adds a measure to the geometry, initialized to a preset value.
mValue | initial m-value for all nodes |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCompoundCurveV2.
|
pure virtual |
Adds a z-dimension to the geometry, initialized to a preset value.
zValue | initial z-value for all nodes |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCompoundCurveV2.
|
inlinevirtual |
Returns the area of the geometry.
Reimplemented in QgsGeometryCollectionV2, and QgsCurvePolygonV2.
Definition at line 296 of file qgsabstractgeometryv2.h.
|
pure virtual |
Returns a GML2 representation of the geometry.
doc | DOM document |
precision | number of decimal places for coordinates |
ns | XML namespace |
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a GML3 representation of the geometry.
doc | DOM document |
precision | number of decimal places for coordinates |
ns | XML namespace |
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a GeoJSON representation of the geometry.
precision | number of decimal places for coordinates |
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a WKB representation of the geometry.
binarySize | will be set to the size of the returned WKB string |
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, and QgsPolygonV2.
|
pure virtual |
Returns a WKT representation of the geometry.
precision | number of decimal places for coordinates |
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, and QgsCurvePolygonV2.
|
pure virtual |
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.
Implemented in QgsPointV2, QgsCurveV2, QgsPolygonV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, QgsMultiCurveV2, QgsMultiPolygonV2, QgsMultiPointV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns the minimal bounding box for the geometry.
Implemented in QgsPointV2, QgsCurveV2, QgsGeometryCollectionV2, and QgsSurfaceV2.
|
protectedvirtual |
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 in QgsLineStringV2, QgsGeometryCollectionV2, QgsCircularStringV2, QgsCurvePolygonV2, and QgsCompoundCurveV2.
Definition at line 111 of file qgsabstractgeometryv2.cpp.
|
virtual |
Returns the centroid of the geometry.
Reimplemented in QgsLineStringV2.
Definition at line 163 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Clears the geometry, ie reset it to a null geometry.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, and QgsPolygonV2.
|
inlineprotectedvirtual |
Clears any cached parameters associated with the geometry, eg bounding boxes.
Reimplemented in QgsGeometryCollectionV2, QgsCurveV2, and QgsSurfaceV2.
Definition at line 393 of file qgsabstractgeometryv2.h.
|
pure virtual |
Clones the geometry by performing a deep copy.
Implemented in QgsPointV2, QgsLineStringV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsCurveV2, QgsPolygonV2, QgsGeometryCollectionV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
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 |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, and QgsGeometryCollectionV2.
|
virtual |
Converts the geometry to a specified type.
Reimplemented in QgsLineStringV2, and QgsPointV2.
Definition at line 215 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Retrieves the sequence of geometries, rings and nodes.
Implemented in QgsPointV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, and QgsCurveV2.
|
pure virtual |
Deletes a vertex within the geometry.
position | vertex id for vertex to delete |
Implemented in QgsLineStringV2, QgsPointV2, QgsGeometryCollectionV2, QgsCircularStringV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
|
pure virtual |
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.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, and QgsCurvePolygonV2.
|
pure virtual |
Draws the geometry using the specified QPainter.
p | destination QPainter |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, and QgsGeometryCollectionV2.
|
pure virtual |
Drops any measure values which exist in the geometry.
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
|
pure virtual |
Drops any z-dimensions which exist in the geometry.
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
|
pure virtual |
Sets the geometry from a WKB string.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, and QgsPolygonV2.
|
pure virtual |
Sets the geometry from a WKT string.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a unique string representing the geometry type.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, QgsPolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
inlinevirtual |
Returns true if the geometry contains curved segments.
Reimplemented in QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
Definition at line 307 of file qgsabstractgeometryv2.h.
|
pure virtual |
Inserts a vertex into the geometry.
position | vertex id for position of inserted vertex |
vertex | vertex to insert |
Implemented in QgsLineStringV2, QgsPointV2, QgsGeometryCollectionV2, QgsCircularStringV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
bool QgsAbstractGeometryV2::is3D | ( | ) | const |
Returns true if the geometry is 3D and contains a z-value.
Definition at line 48 of file qgsabstractgeometryv2.cpp.
bool QgsAbstractGeometryV2::isEmpty | ( | ) | const |
Returns true if the geometry is empty.
Definition at line 246 of file qgsabstractgeometryv2.cpp.
bool QgsAbstractGeometryV2::isMeasure | ( | ) | const |
Returns true if the geometry contains m values.
Definition at line 53 of file qgsabstractgeometryv2.cpp.
|
inlinevirtual |
Returns the length of the geometry.
Reimplemented in QgsLineStringV2, QgsGeometryCollectionV2, QgsCircularStringV2, and QgsCompoundCurveV2.
Definition at line 284 of file qgsabstractgeometryv2.h.
|
pure virtual |
Moves a vertex within the geometry.
position | vertex id for vertex to move |
newPos | new position of vertex |
Implemented in QgsLineStringV2, QgsPointV2, QgsGeometryCollectionV2, QgsCircularStringV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
|
virtual |
Returns the number of nodes contained in the geometry.
Reimplemented in QgsPointV2, QgsLineStringV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, and QgsMultiPointV2.
Definition at line 138 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
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 |
Implemented in QgsPointV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, and QgsCurveV2.
|
virtual |
Definition at line 38 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Returns count of parts contained in the geometry.
Implemented in QgsPointV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCurveV2.
|
inlinevirtual |
Returns the perimeter of the geometry.
Reimplemented in QgsGeometryCollectionV2, and QgsCurvePolygonV2.
Definition at line 290 of file qgsabstractgeometryv2.h.
|
pure virtual |
Implemented in QgsPointV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCurveV2.
|
virtual |
Returns a version of the geometry without curves.
Caller takes ownership of the returned geometry.
tolerance | segmentation tolerance |
toleranceType | maximum segmentation angle or maximum difference between approximation and curve |
Reimplemented in QgsGeometryCollectionV2, QgsCurveV2, and QgsCurvePolygonV2.
Definition at line 254 of file qgsabstractgeometryv2.cpp.
|
protected |
Updates the geometry type based on whether sub geometries contain z or m values.
Definition at line 69 of file qgsabstractgeometryv2.cpp.
|
inlinevirtual |
Returns the geometry converted to the more generic curve type.
E.g. QgsLineStringV2 -> QgsCompoundCurveV2, QgsPolygonV2 -> QgsCurvePolygonV2, QgsMultiLineStringV2 -> QgsMultiCurveV2, QgsMultiPolygonV2 -> QgsMultiSurfaceV2
Reimplemented in QgsLineStringV2, QgsPolygonV2, QgsMultiLineStringV2, and QgsMultiPolygonV2.
Definition at line 320 of file qgsabstractgeometryv2.h.
|
pure virtual |
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. |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, and QgsGeometryCollectionV2.
|
pure virtual |
Transforms the geometry using a QTransform object.
t | QTransform transformation |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, and QgsGeometryCollectionV2.
|
pure virtual |
Returns approximate angle at a vertex.
This is usually the average angle between adjacent segments, and can be pictured as the orientation of a line following the curvature of the geometry at the specified vertex.
vertex | the vertex id |
Implemented in QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, and QgsCurvePolygonV2.
|
pure virtual |
Returns the point corresponding to a specified vertex id.
Implemented in QgsPointV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCurveV2.
|
pure virtual |
Implemented in QgsPointV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCurveV2.
|
pure virtual |
Returns the size of the WKB representation of the geometry.
Implemented in QgsPointV2, QgsLineStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsCurvePolygonV2, and QgsPolygonV2.
|
inline |
Returns the WKB type of the geometry.
Definition at line 88 of file qgsabstractgeometryv2.h.
QString QgsAbstractGeometryV2::wktTypeStr | ( | ) | const |
Returns the WKT type string of the geometry.
Definition at line 153 of file qgsabstractgeometryv2.cpp.
|
protected |
Definition at line 380 of file qgsabstractgeometryv2.h.