QGIS API Documentation
2.12.0-Lyon
|
Abstract base class for all geometries. More...
#include <qgsabstractgeometryv2.h>
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... | |
QgsRectangle | boundingBox () const |
Returns the minimal bounding box for the geometry. More... | |
virtual QgsRectangle | calculateBoundingBox () const |
Calculates 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 void | coordinateSequence (QList< QList< QList< QgsPointV2 > > > &coord) const =0 |
Retrieves the sequence of geometries, rings and nodes. More... | |
virtual bool | deleteVertex (const 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 | fromWkb (const unsigned char *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 (const 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 (const QgsVertexId &position, const QgsPointV2 &newPos)=0 |
Moves a vertex within the geometry. More... | |
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 |
virtual double | perimeter () const |
Returns the perimeter of the geometry. More... | |
virtual int | ringCount (int part=0) const =0 |
virtual QgsAbstractGeometryV2 * | segmentize () const |
Returns a version of the geometry without curves. More... | |
virtual void | transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform)=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 (const QgsVertexId &vertex) const =0 |
Returns approximate rotation angle for a vertex. More... | |
virtual QgsPointV2 | vertexAt (const 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 | |
void | setZMTypeFromSubGeometry (const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType) |
Updates the geometry type based on whether sub geometries contain z or m values. More... | |
Static Protected Member Functions | |
static bool | readWkbHeader (QgsConstWkbPtr &wkbPtr, QgsWKBTypes::Type &wkbType, bool &endianSwap, QgsWKBTypes::Type expectedType) |
Reads a WKB header and tests its validity. More... | |
Protected Attributes | |
QgsRectangle | mBoundingBox |
QgsWKBTypes::Type | mWkbType |
Abstract base class for all geometries.
Definition at line 41 of file qgsabstractgeometryv2.h.
QgsAbstractGeometryV2::QgsAbstractGeometryV2 | ( | ) |
Definition at line 24 of file qgsabstractgeometryv2.cpp.
|
virtual |
Definition at line 28 of file qgsabstractgeometryv2.cpp.
QgsAbstractGeometryV2::QgsAbstractGeometryV2 | ( | const QgsAbstractGeometryV2 & | geom | ) |
Definition at line 32 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 QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
|
pure virtual |
Adds a z-dimension to the geometry, initialized to a preset value.
zValue | initial z-value for all nodes |
Implemented in QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
|
inlinevirtual |
Returns the area of the geometry.
Reimplemented in QgsGeometryCollectionV2, and QgsCurvePolygonV2.
Definition at line 278 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 QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, 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 QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a GeoJSON representation of the geometry.
precision | number of decimal places for coordinates |
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, 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 QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, and QgsPolygonV2.
|
pure virtual |
Returns a WKT representation of the geometry.
precision | number of decimal places for coordinates |
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, and QgsLineStringV2.
QgsRectangle QgsAbstractGeometryV2::boundingBox | ( | ) | const |
Returns the minimal bounding box for the geometry.
Definition at line 47 of file qgsabstractgeometryv2.cpp.
|
virtual |
Calculates the minimal bounding box for the geometry.
Derived classes should override this method to return the correct bounding box.
Reimplemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, and QgsCircularStringV2.
Definition at line 105 of file qgsabstractgeometryv2.cpp.
|
virtual |
Returns the centroid of the geometry.
Definition at line 185 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Clears the geometry, ie reset it to a null geometry.
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsLineStringV2, QgsPointV2, and QgsCircularStringV2.
|
pure virtual |
Clones the geometry by performing a deep copy.
Implemented in QgsCurvePolygonV2, QgsCompoundCurveV2, QgsLineStringV2, QgsPointV2, QgsCircularStringV2, QgsGeometryCollectionV2, QgsPolygonV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Searches for the closest segment of the geometry to a given point.
pt | Specifies the point for search |
segmentPt | storage for the closest point within the geometry |
vertexAfter | storage for the id of the vertex after the closest segment |
leftOf | returns if the point lies on the left of right side of the segment ( < 0 means left, > 0 means right ) |
epsilon | epsilon for segment snapping |
Implemented in QgsCircularStringV2, QgsCompoundCurveV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
|
pure virtual |
Retrieves the sequence of geometries, rings and nodes.
coord | destination for coordinate sequence. |
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsCurveV2, and QgsPointV2.
|
pure virtual |
Deletes a vertex within the geometry.
position | vertex id for vertex to delete |
Implemented in QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
|
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, QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsLineStringV2, and QgsCircularStringV2.
|
pure virtual |
Draws the geometry using the specified QPainter.
p | destination QPainter |
Implemented in QgsCircularStringV2, QgsCompoundCurveV2, QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
|
pure virtual |
Sets the geometry from a WKB string.
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, and QgsPolygonV2.
|
pure virtual |
Sets the geometry from a WKT string.
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, QgsMultiCurveV2, QgsMultiLineStringV2, QgsMultiPointV2, QgsMultiPolygonV2, and QgsMultiSurfaceV2.
|
pure virtual |
Returns a unique string representing the geometry type.
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsLineStringV2, QgsCircularStringV2, 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 289 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 QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
bool QgsAbstractGeometryV2::is3D | ( | ) | const |
Returns true if the geometry is 3D and contains a z-value.
Definition at line 56 of file qgsabstractgeometryv2.cpp.
bool QgsAbstractGeometryV2::isEmpty | ( | ) | const |
Returns true if the geometry is empty.
Definition at line 232 of file qgsabstractgeometryv2.cpp.
bool QgsAbstractGeometryV2::isMeasure | ( | ) | const |
Returns true if the geometry contains m values.
Definition at line 61 of file qgsabstractgeometryv2.cpp.
|
inlinevirtual |
Returns the length of the geometry.
Reimplemented in QgsGeometryCollectionV2, QgsCircularStringV2, QgsCompoundCurveV2, and QgsLineStringV2.
Definition at line 266 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 QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsPointV2, and QgsLineStringV2.
int QgsAbstractGeometryV2::nCoordinates | ( | ) | const |
Returns the number of nodes contained in the geometry.
Definition at line 132 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 QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsCurveV2.
|
virtual |
Definition at line 37 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsCurveV2.
|
inlinevirtual |
Returns the perimeter of the geometry.
Reimplemented in QgsGeometryCollectionV2, and QgsCurvePolygonV2.
Definition at line 272 of file qgsabstractgeometryv2.h.
|
staticprotected |
Reads a WKB header and tests its validity.
wkbPtr | |
wkbType | destination for WKB type from header |
endianSwap | will be set to true if endian from WKB must be swapped to match QGIS platform endianness |
expectedType | expected WKB type |
Definition at line 162 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsCurveV2.
|
inlinevirtual |
Returns a version of the geometry without curves.
Caller takes ownership of the returned geometry.
Reimplemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, and QgsCurveV2.
Definition at line 294 of file qgsabstractgeometryv2.h.
|
protected |
Updates the geometry type based on whether sub geometries contain z or m values.
Definition at line 77 of file qgsabstractgeometryv2.cpp.
|
pure virtual |
Transforms the geometry using a coordinate transform.
ct | coordinate transform |
d | transformation direction |
Implemented in QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, QgsPointV2, and QgsLineStringV2.
|
pure virtual |
Transforms the geometry using a QTransform object.
t | QTransform transformation |
Implemented in QgsCircularStringV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsGeometryCollectionV2, QgsPointV2, and QgsLineStringV2.
|
pure virtual |
Returns approximate rotation angle for a vertex.
Usually average angle between adjacent segments.
vertex | the vertex id |
Implemented in QgsCircularStringV2, QgsGeometryCollectionV2, QgsCompoundCurveV2, QgsCurvePolygonV2, QgsLineStringV2, and QgsPointV2.
|
pure virtual |
Returns the point corresponding to a specified vertex id.
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsCurveV2.
|
pure virtual |
Implemented in QgsGeometryCollectionV2, QgsCurvePolygonV2, QgsPointV2, and QgsCurveV2.
|
pure virtual |
Returns the size of the WKB representation of the geometry.
Implemented in QgsGeometryCollectionV2, QgsPointV2, QgsCurvePolygonV2, QgsCompoundCurveV2, QgsCircularStringV2, QgsLineStringV2, and QgsPolygonV2.
|
inline |
Returns the WKB type of the geometry.
Definition at line 83 of file qgsabstractgeometryv2.h.
QString QgsAbstractGeometryV2::wktTypeStr | ( | ) | const |
Returns the WKT type string of the geometry.
Definition at line 152 of file qgsabstractgeometryv2.cpp.
|
mutableprotected |
Definition at line 323 of file qgsabstractgeometryv2.h.
|
protected |
Definition at line 322 of file qgsabstractgeometryv2.h.