QGIS API Documentation
2.11.0Master

A geometry is the spatial representation of a feature. More...
#include <qgsgeometry.h>
Classes  
class  Error 
Public Member Functions  
QgsGeometry ()  
Constructor. More...  
QgsGeometry (const QgsGeometry &)  
Copy constructor will prompt a deep copy of the object. More...  
QgsGeometry (QgsAbstractGeometryV2 *geom)  
Creates a geometry from an abstract geometry object. More...  
~QgsGeometry ()  
Destructor. More...  
int  addPart (const QList< QgsPoint > &points, QGis::GeometryType geomType=QGis::UnknownGeometry) 
Adds a new island polygon to a multipolygon feature. More...  
int  addPart (QgsAbstractGeometryV2 *part) 
Adds a new part to this geometry (takes ownership) More...  
int  addPart (GEOSGeometry *newPart) 
Adds a new island polygon to a multipolygon feature. More...  
int  addPart (const QgsGeometry *newPart) 
Adds a new island polygon to a multipolygon feature. More...  
int  addRing (const QList< QgsPoint > &ring) 
Adds a new ring to this geometry. More...  
int  addRing (QgsCurveV2 *ring) 
Adds a new ring to this geometry. More...  
void  adjacentVertices (int atVertex, int &beforeVertex, int &afterVertex) const 
Returns the indexes of the vertices before and after the given vertex index. More...  
double  area () const 
Returns the area of the geometry using GEOS. More...  
QList< QgsGeometry * >  asGeometryCollection () const 
Return contents of the geometry as a list of geometries. More...  
const GEOSGeometry *  asGeos () const 
Returns a geos geometry. More...  
QgsMultiPoint  asMultiPoint () const 
Return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list. More...  
QgsMultiPolygon  asMultiPolygon () const 
Return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty list. More...  
QgsMultiPolyline  asMultiPolyline () const 
Return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list. More...  
QgsPoint  asPoint () const 
Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0,0]. More...  
QgsPolygon  asPolygon () const 
Return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list. More...  
QgsPolyline  asPolyline () const 
Return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list. More...  
QPointF  asQPointF () const 
Return contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF. More...  
QPolygonF  asQPolygonF () const 
Return contents of the geometry as a QPolygonF. More...  
const unsigned char *  asWkb () const 
Returns the buffer containing this geometry in WKB format. More...  
int  avoidIntersections (QMap< QgsVectorLayer *, QSet< QgsFeatureId > > ignoreFeatures=(QMap< QgsVectorLayer *, QSet< QgsFeatureId > >())) 
Modifies geometry to avoid intersections with the layers specified in project properties. More...  
QgsRectangle  boundingBox () const 
Returns the bounding box of this feature. More...  
QgsGeometry *  buffer (double distance, int segments) const 
Returns a buffer region around this geometry having the given width and with a specified number of segments used to approximate curves. More...  
QgsGeometry *  buffer (double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit) const 
Returns a buffer region around the geometry, with additional style options. More...  
QgsGeometry *  centroid () const 
Returns the center of mass of a geometry. More...  
double  closestSegmentWithContext (const QgsPoint &point, QgsPoint &minDistPoint, int &afterVertex, double *leftOf=0, double epsilon=DEFAULT_SEGMENT_EPSILON) const 
Searches for the closest segment of geometry to the given point. More...  
QgsPoint  closestVertex (const QgsPoint &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist) const 
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point and the indices of the vertices before/after. More...  
double  closestVertexWithContext (const QgsPoint &point, int &atVertex) const 
Searches for the closest vertex in this geometry to the given point. More...  
QgsGeometry *  combine (const QgsGeometry *geometry) const 
Returns a geometry representing all the points in this geometry and other (a union geometry operation). More...  
bool  contains (const QgsPoint *p) const 
Test for containment of a point (uses GEOS) More...  
bool  contains (const QgsGeometry *geometry) const 
Test for if geometry is contained in another (uses GEOS) More...  
bool  convertToMultiType () 
Converts single type geometry into multitype geometry e.g. More...  
void  convertToStraightSegment () 
Converts the geometry to straight line segments, if it is a curved geometry type. More...  
QgsGeometry *  convertToType (QGis::GeometryType destType, bool destMultipart=false) const 
Try to convert the geometry to the requested type. More...  
QgsGeometry *  convexHull () const 
Returns the smallest convex polygon that contains all the points in the geometry. More...  
bool  crosses (const QgsGeometry *geometry) const 
Test for if geometry crosses another (uses GEOS) More...  
bool  deletePart (int partNum) 
Delete part identified by the part number. More...  
bool  deleteRing (int ringNum, int partNum=0) 
Delete a ring in polygon or multipolygon. More...  
bool  deleteVertex (int atVertex) 
Deletes the vertex at the given position number and item (first number is index 0) Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point), or if the number of remaining verticies in the linestring would be less than two. More...  
QgsGeometry *  difference (const QgsGeometry *geometry) const 
Returns a geometry representing the points making up this geometry that do not make up other. More...  
bool  disjoint (const QgsGeometry *geometry) const 
Test for if geometry is disjoint of another (uses GEOS) More...  
double  distance (const QgsGeometry &geom) const 
Returns the minimum distanace between this geometry and another geometry, using GEOS. More...  
void  draw (QPainter &p) const 
Draws the geometry onto a QPainter. More...  
bool  equals (const QgsGeometry *geometry) const 
Test for if geometry equals another (uses GEOS) More...  
QString  exportToGeoJSON (const int &precision=17) const 
Exports the geometry to GeoJSON. More...  
QString  exportToWkt (const int &precision=17) const 
Exports the geometry to WKT. More...  
void  fromGeos (GEOSGeometry *geos) 
Set the geometry, feeding in a geometry in GEOS format. More...  
void  fromWkb (unsigned char *wkb, size_t length) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary and the buffer's length. More...  
const QgsAbstractGeometryV2 *  geometry () const 
Returns the underlying geometry store. More...  
bool  insertVertex (double x, double y, int beforeVertex) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted. More...  
QgsGeometry *  interpolate (double distance) const 
QgsGeometry *  intersection (const QgsGeometry *geometry) const 
Returns a geometry representing the points shared by this geometry and other. More...  
bool  intersects (const QgsRectangle &r) const 
Test for intersection with a rectangle (uses GEOS) More...  
bool  intersects (const QgsGeometry *geometry) const 
Test for intersection with a geometry (uses GEOS) More...  
bool  isEmpty () const 
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry). More...  
bool  isGeosEmpty () const 
Check if the geometry is empty using GEOS. More...  
bool  isGeosEqual (const QgsGeometry &) const 
Compares the geometry with another geometry using GEOS. More...  
bool  isGeosValid () const 
Checks validity of the geometry using GEOS. More...  
bool  isMultipart () const 
Returns true if WKB of the geometry is of WKBMulti* type. More...  
double  length () const 
Returns the length of geometry using GEOS. More...  
int  makeDifference (const QgsGeometry *other) 
Changes this geometry such that it does not intersect the other geometry. More...  
void  mapToPixel (const QgsMapToPixel &mtp) 
Transforms the geometry from map units to pixels in place. More...  
bool  moveVertex (double x, double y, int atVertex) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...  
bool  moveVertex (const QgsPointV2 &p, int atVertex) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...  
QgsGeometry *  offsetCurve (double distance, int segments, int joinStyle, double mitreLimit) const 
Returns an offset line at a given distance and side from an input line. More...  
QgsGeometry &  operator= (QgsGeometry const &rhs) 
Assignments will prompt a deep copy of the object. More...  
bool  overlaps (const QgsGeometry *geometry) const 
Test for if geometry overlaps another (uses GEOS) More...  
QgsGeometry *  pointOnSurface () const 
Returns a point within a geometry. More...  
bool  requiresConversionToStraightSegments () const 
Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments. More...  
int  reshapeGeometry (const QList< QgsPoint > &reshapeWithLine) 
Replaces a part of this geometry with another line. More...  
int  rotate (double rotation, const QgsPoint ¢er) 
Rotate this geometry around the Z axis. More...  
void  setGeometry (QgsAbstractGeometryV2 *geometry) 
Sets the underlying geometry store. More...  
QgsGeometry *  simplify (double tolerance) const 
Returns a simplified version of this geometry using a specified tolerance value. More...  
QgsGeometry *  smooth (const unsigned int iterations=1, const double offset=0.25) const 
Smooths a geometry by rounding off corners using the Chaikin algorithm. More...  
QgsPolyline  smoothLine (const QgsPolyline &polyline, const unsigned int iterations=1, const double offset=0.25) const 
Smooths a polyline using the Chaikin algorithm. More...  
QgsPolygon  smoothPolygon (const QgsPolygon &polygon, const unsigned int iterations=1, const double offset=0.25) const 
Smooths a polygon using the Chaikin algorithm. More...  
int  splitGeometry (const QList< QgsPoint > &splitLine, QList< QgsGeometry * > &newGeometries, bool topological, QList< QgsPoint > &topologyTestPoints) 
Splits this geometry according to a given line. More...  
double  sqrDistToVertexAt (QgsPoint &point, int atVertex) const 
Returns the squared cartesian distance between the given point to the given vertex index (vertex at the given position number, ring and item (first number is index 0)) More...  
QgsGeometry *  symDifference (const QgsGeometry *geometry) const 
Returns a Geometry representing the points making up this Geometry that do not make up other. More...  
bool  touches (const QgsGeometry *geometry) const 
Test for if geometry touch another (uses GEOS) More...  
int  transform (const QgsCoordinateTransform &ct) 
Transform this geometry as described by CoordinateTransform ct. More...  
int  transform (const QTransform &ct) 
Transform this geometry as described by QTransform ct. More...  
int  translate (double dx, double dy) 
Translate this geometry by dx, dy. More...  
QGis::GeometryType  type () const 
Returns type of the geometry as a QGis::GeometryType. More...  
void  validateGeometry (QList< Error > &errors) 
Validate geometry and produce a list of geometry errors. More...  
QgsPoint  vertexAt (int atVertex) const 
Returns coordinates of a vertex. More...  
bool  vertexIdFromVertexNr (int nr, QgsVertexId &id) const 
Calculates the vertex ID from a vertex number. More...  
int  vertexNrFromVertexId (const QgsVertexId &i) const 
Returns the vertex number corresponding to a vertex idd. More...  
bool  within (const QgsGeometry *geometry) const 
Test for if geometry is within another (uses GEOS) More...  
size_t  wkbSize () const 
Returns the size of the WKB in asWkb(). More...  
QGis::WkbType  wkbType () const 
Returns type of the geometry as a WKB type (point / linestring / polygon etc.) More...  
Static Public Member Functions  
static bool  compare (const QgsPolyline &p1, const QgsPolyline &p2, double epsilon=4 *DBL_EPSILON) 
Compares two polylines for equality within a specified tolerance. More...  
static bool  compare (const QgsPolygon &p1, const QgsPolygon &p2, double epsilon=4 *DBL_EPSILON) 
Compares two polygons for equality within a specified tolerance. More...  
static bool  compare (const QgsMultiPolygon &p1, const QgsMultiPolygon &p2, double epsilon=4 *DBL_EPSILON) 
Compares two multipolygons for equality within a specified tolerance. More...  
static void  convertPointList (const QList< QgsPoint > &input, QList< QgsPointV2 > &output) 
static void  convertPointList (const QList< QgsPointV2 > &input, QList< QgsPoint > &output) 
static QgsGeometryEngine *  createGeometryEngine (const QgsAbstractGeometryV2 *geometry) 
Creates and returns a new geometry engine. More...  
static QgsPolygon  createPolygonFromQPolygonF (const QPolygonF &polygon) 
Creates a QgsPolygon from a QPolygonF. More...  
static QgsPolyline  createPolylineFromQPolygonF (const QPolygonF &polygon) 
Creates a QgsPolyline from a QPolygonF. More...  
static QgsGeometry *  fromMultiPoint (const QgsMultiPoint &multipoint) 
Creates a new geometry from a QgsMultiPoint object. More...  
static QgsGeometry *  fromMultiPolygon (const QgsMultiPolygon &multipoly) 
Creates a new geometry from a QgsMultiPolygon. More...  
static QgsGeometry *  fromMultiPolyline (const QgsMultiPolyline &multiline) 
Creates a new geometry from a QgsMultiPolyline object. More...  
static QgsGeometry *  fromPoint (const QgsPoint &point) 
Creates a new geometry from a QgsPoint object. More...  
static QgsGeometry *  fromPolygon (const QgsPolygon &polygon) 
Creates a new geometry from a QgsPolygon. More...  
static QgsGeometry *  fromPolyline (const QgsPolyline &polyline) 
Creates a new geometry from a QgsPolyline object. More...  
static QgsGeometry *  fromQPointF (const QPointF &point) 
Construct geometry from a QPointF. More...  
static QgsGeometry *  fromQPolygonF (const QPolygonF &polygon) 
Construct geometry from a QPolygonF. More...  
static QgsGeometry *  fromRect (const QgsRectangle &rect) 
Creates a new geometry from a QgsRectangle. More...  
static QgsGeometry *  fromWkt (QString wkt) 
Creates a new geometry from a WKT string. More...  
static GEOSContextHandle_t  getGEOSHandler () 
Return GEOS context handle. More...  
static QgsGeometry *  unaryUnion (const QList< QgsGeometry * > &geometryList) 
Compute the unary union on a list of geometries. More...  
A geometry is the spatial representation of a feature.
Since QGIS 2.10, QgsGeometry acts as a generic container for geometry objects. QgsGeometry is implicitly shared, so making copies of geometries is inexpensive. The geometry container class can also be stored inside a QVariant object.
The actual geometry representation is stored as a QgsAbstractGeometryV2 within the container, and can be accessed via the geometry method or set using the setGeometry method.
Definition at line 75 of file qgsgeometry.h.
QgsGeometry::QgsGeometry  (  ) 
Constructor.
Definition at line 64 of file qgsgeometry.cpp.
QgsGeometry::QgsGeometry  (  const QgsGeometry &  other  ) 
Copy constructor will prompt a deep copy of the object.
Definition at line 85 of file qgsgeometry.cpp.
QgsGeometry::QgsGeometry  (  QgsAbstractGeometryV2 *  geom  ) 
Creates a geometry from an abstract geometry object.
Ownership of geom is transferred.
Definition at line 79 of file qgsgeometry.cpp.
QgsGeometry::~QgsGeometry  (  ) 
Destructor.
Definition at line 68 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  const QList< QgsPoint > &  points, 
QGis::GeometryType  geomType = QGis::UnknownGeometry 

) 
Adds a new island polygon to a multipolygon feature.
Definition at line 563 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  QgsAbstractGeometryV2 *  part  ) 
Adds a new part to this geometry (takes ownership)
Definition at line 607 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  GEOSGeometry *  newPart  ) 
Adds a new island polygon to a multipolygon feature.
Definition at line 624 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  const QgsGeometry *  newPart  ) 
Adds a new island polygon to a multipolygon feature.
Definition at line 614 of file qgsgeometry.cpp.
Adds a new ring to this geometry.
This makes only sense for polygon and multipolygons.
Definition at line 537 of file qgsgeometry.cpp.
int QgsGeometry::addRing  (  QgsCurveV2 *  ring  ) 
Adds a new ring to this geometry.
This makes only sense for polygon and multipolygons.
Definition at line 549 of file qgsgeometry.cpp.
void QgsGeometry::adjacentVertices  (  int  atVertex, 
int &  beforeVertex,  
int &  afterVertex  
)  const 
Returns the indexes of the vertices before and after the given vertex index.
This function takes into account the following factors:
Definition at line 376 of file qgsgeometry.cpp.
double QgsGeometry::area  (  )  const 
Returns the area of the geometry using GEOS.
Definition at line 1142 of file qgsgeometry.cpp.
QList< QgsGeometry * > QgsGeometry::asGeometryCollection  (  )  const 
Return contents of the geometry as a list of geometries.
Definition at line 1377 of file qgsgeometry.cpp.
const GEOSGeometry * QgsGeometry::asGeos  (  )  const 
Returns a geos geometry.
QgsGeometry retains ownership of the geometry, so the returned object should not be deleted.
Definition at line 297 of file qgsgeometry.cpp.
QgsMultiPoint QgsGeometry::asMultiPoint  (  )  const 
Return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list.
Definition at line 1026 of file qgsgeometry.cpp.
QgsMultiPolygon QgsGeometry::asMultiPolygon  (  )  const 
Return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty list.
Definition at line 1099 of file qgsgeometry.cpp.
QgsMultiPolyline QgsGeometry::asMultiPolyline  (  )  const 
Return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list.
Definition at line 1050 of file qgsgeometry.cpp.
QgsPoint QgsGeometry::asPoint  (  )  const 
Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0,0].
Definition at line 932 of file qgsgeometry.cpp.
QgsPolygon QgsGeometry::asPolygon  (  )  const 
Return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list.
Definition at line 992 of file qgsgeometry.cpp.
QgsPolyline QgsGeometry::asPolyline  (  )  const 
Return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list.
Definition at line 947 of file qgsgeometry.cpp.
QPointF QgsGeometry::asQPointF  (  )  const 
Return contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF.
Definition at line 1402 of file qgsgeometry.cpp.
QPolygonF QgsGeometry::asQPolygonF  (  )  const 
Return contents of the geometry as a QPolygonF.
If geometry is a linestring, then the result will be an open QPolygonF. If the geometry is a polygon, then the result will be a closed QPolygonF of the geometry's exterior ring.
Definition at line 1408 of file qgsgeometry.cpp.
const unsigned char * QgsGeometry::asWkb  (  )  const 
Returns the buffer containing this geometry in WKB format.
You may wish to use in conjunction with wkbSize().
Definition at line 269 of file qgsgeometry.cpp.
int QgsGeometry::avoidIntersections  (  QMap< QgsVectorLayer *, QSet< QgsFeatureId > >  ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() )  ) 
Modifies geometry to avoid intersections with the layers specified in project properties.
ignoreFeatures  possibility to give a list of features where intersections should be ignored (not available in python bindings) 
Definition at line 1468 of file qgsgeometry.cpp.
QgsRectangle QgsGeometry::boundingBox  (  )  const 
Returns the bounding box of this feature.
Definition at line 753 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::buffer  (  double  distance, 
int  segments  
)  const 
Returns a buffer region around this geometry having the given width and with a specified number of segments used to approximate curves.
Definition at line 1185 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::buffer  (  double  distance, 
int  segments,  
int  endCapStyle,  
int  joinStyle,  
double  mitreLimit  
)  const 
Returns a buffer region around the geometry, with additional style options.
distance  buffer distance 
segments  For round joins, number of segments to approximate quartercircle 
endCapStyle  Round (1) / Flat (2) / Square (3) end cap style 
joinStyle  Round (1) / Mitre (2) / Bevel (3) join style 
mitreLimit  Limit on the mitre ratio used for very sharp corners 
Definition at line 1201 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::centroid  (  )  const 
Returns the center of mass of a geometry.
Definition at line 1249 of file qgsgeometry.cpp.
double QgsGeometry::closestSegmentWithContext  (  const QgsPoint &  point, 
QgsPoint &  minDistPoint,  
int &  afterVertex,  
double *  leftOf = 0 , 

double  epsilon = DEFAULT_SEGMENT_EPSILON 

)  const 
Searches for the closest segment of geometry to the given point.
point  Specifies the point for search 
minDistPoint  Receives the nearest point on the segment 
afterVertex  Receives index of the vertex after the closest segment. The vertex before the closest segment is always afterVertex  1 
leftOf  Out: 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 (added in 1.8) 
Definition at line 509 of file qgsgeometry.cpp.
QgsPoint QgsGeometry::closestVertex  (  const QgsPoint &  point, 
int &  atVertex,  
int &  beforeVertex,  
int &  afterVertex,  
double &  sqrDist  
)  const 
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point and the indices of the vertices before/after.
The vertices before/after are 1 if not present
Definition at line 354 of file qgsgeometry.cpp.
double QgsGeometry::closestVertexWithContext  (  const QgsPoint &  point, 
int &  atVertex  
)  const 
Searches for the closest vertex in this geometry to the given point.
point  Specifiest the point for search 
atVertex  Receives index of the closest vertex 
Definition at line 495 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::combine  (  const QgsGeometry *  geometry  )  const 
Returns a geometry representing all the points in this geometry and other (a union geometry operation).
Definition at line 1326 of file qgsgeometry.cpp.

static 
Compares two polylines for equality within a specified tolerance.
p1  first polyline 
p2  second polyline 
epsilon  maximum difference for coordinates between the polylines 
Definition at line 1774 of file qgsgeometry.cpp.

static 
Compares two polygons for equality within a specified tolerance.
p1  first polygon 
p2  second polygon 
epsilon  maximum difference for coordinates between the polygons 
Definition at line 1787 of file qgsgeometry.cpp.

static 
Compares two multipolygons for equality within a specified tolerance.
p1  first multipolygon 
p2  second multipolygon 
epsilon  maximum difference for coordinates between the multipolygons 
Definition at line 1801 of file qgsgeometry.cpp.
bool QgsGeometry::contains  (  const QgsPoint *  p  )  const 
Test for containment of a point (uses GEOS)
Definition at line 781 of file qgsgeometry.cpp.
bool QgsGeometry::contains  (  const QgsGeometry *  geometry  )  const 
Test for if geometry is contained in another (uses GEOS)
Definition at line 793 of file qgsgeometry.cpp.

static 
Definition at line 1683 of file qgsgeometry.cpp.

static 
Definition at line 1693 of file qgsgeometry.cpp.
bool QgsGeometry::convertToMultiType  (  ) 
Converts single type geometry into multitype geometry e.g.
a polygon into a multipolygon geometry with one polygon If it is already a multipart geometry, it will return true and not change the geometry.
Definition at line 906 of file qgsgeometry.cpp.
void QgsGeometry::convertToStraightSegment  (  ) 
Converts the geometry to straight line segments, if it is a curved geometry type.
Definition at line 1541 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::convertToType  (  QGis::GeometryType  destType, 
bool  destMultipart = false 

)  const 
Try to convert the geometry to the requested type.
destType  the geometry type to be converted to 
destMultipart  determines if the output geometry will be multipart or not 
Definition at line 888 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::convexHull  (  )  const 
Returns the smallest convex polygon that contains all the points in the geometry.
Definition at line 1283 of file qgsgeometry.cpp.

static 
Creates and returns a new geometry engine.
Definition at line 2241 of file qgsgeometry.cpp.

static 
Creates a QgsPolygon from a QPolygonF.
polygon  source polygon 
Definition at line 1756 of file qgsgeometry.cpp.

static 
Creates a QgsPolyline from a QPolygonF.
polygon  source polygon 
Definition at line 1763 of file qgsgeometry.cpp.
bool QgsGeometry::crosses  (  const QgsGeometry *  geometry  )  const 
Test for if geometry crosses another (uses GEOS)
Definition at line 859 of file qgsgeometry.cpp.
bool QgsGeometry::deletePart  (  int  partNum  ) 
Delete part identified by the part number.
Definition at line 1449 of file qgsgeometry.cpp.
bool QgsGeometry::deleteRing  (  int  ringNum, 
int  partNum = 0 

) 
Delete a ring in polygon or multipolygon.
Ring 0 is outer ring and can't be deleted.
Definition at line 1437 of file qgsgeometry.cpp.
bool QgsGeometry::deleteVertex  (  int  atVertex  ) 
Deletes the vertex at the given position number and item (first number is index 0) Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point), or if the number of remaining verticies in the linestring would be less than two.
It is up to the caller to distinguish between these error conditions. (Or maybe we add another method to this object to help make the distinction?)
Definition at line 434 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::difference  (  const QgsGeometry *  geometry  )  const 
Returns a geometry representing the points making up this geometry that do not make up other.
Definition at line 1343 of file qgsgeometry.cpp.
bool QgsGeometry::disjoint  (  const QgsGeometry *  geometry  )  const 
Test for if geometry is disjoint of another (uses GEOS)
Definition at line 804 of file qgsgeometry.cpp.
double QgsGeometry::distance  (  const QgsGeometry &  geom  )  const 
Returns the minimum distanace between this geometry and another geometry, using GEOS.
geom  geometry to find minimum distance to 
Definition at line 1174 of file qgsgeometry.cpp.
void QgsGeometry::draw  (  QPainter &  p  )  const 
Draws the geometry onto a QPainter.
p  destination QPainter 
Definition at line 1612 of file qgsgeometry.cpp.
bool QgsGeometry::equals  (  const QgsGeometry *  geometry  )  const 
Test for if geometry equals another (uses GEOS)
Definition at line 815 of file qgsgeometry.cpp.
QString QgsGeometry::exportToGeoJSON  (  const int &  precision = 17  )  const 
Exports the geometry to GeoJSON.
Definition at line 879 of file qgsgeometry.cpp.
QString QgsGeometry::exportToWkt  (  const int &  precision = 17  )  const 
Exports the geometry to WKT.
Definition at line 870 of file qgsgeometry.cpp.
void QgsGeometry::fromGeos  (  GEOSGeometry *  geos  ) 
Set the geometry, feeding in a geometry in GEOS format.
This class will take ownership of the buffer.
Definition at line 343 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPoint object.
Definition at line 204 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPolygon.
Definition at line 224 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPolyline object.
Definition at line 214 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPoint object.
Definition at line 174 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPolygon.
Definition at line 194 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPolyline object.
Definition at line 184 of file qgsgeometry.cpp.

static 
Construct geometry from a QPointF.
point  source QPointF 
Definition at line 1739 of file qgsgeometry.cpp.

static 
Construct geometry from a QPolygonF.
If the polygon is closed than the resultant geometry will be a polygon, if it is open than the geometry will be a polyline.
polygon  source QPolygonF 
Definition at line 1744 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsRectangle.
Definition at line 234 of file qgsgeometry.cpp.
void QgsGeometry::fromWkb  (  unsigned char *  wkb, 
size_t  length  
) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary and the buffer's length.
This class will take ownership of the buffer.
Definition at line 249 of file qgsgeometry.cpp.

static 
Creates a new geometry from a WKT string.
Definition at line 164 of file qgsgeometry.cpp.
const QgsAbstractGeometryV2 * QgsGeometry::geometry  (  )  const 
Returns the underlying geometry store.
Definition at line 137 of file qgsgeometry.cpp.

static 
Return GEOS context handle.
Definition at line 1734 of file qgsgeometry.cpp.
bool QgsGeometry::insertVertex  (  double  x, 
double  y,  
int  beforeVertex  
) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted.
Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point). It is up to the caller to distinguish between these error conditions. (Or maybe we add another method to this object to help make the distinction?)
Definition at line 453 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::interpolate  (  double  distance  )  const 
Definition at line 1298 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::intersection  (  const QgsGeometry *  geometry  )  const 
Returns a geometry representing the points shared by this geometry and other.
Definition at line 1313 of file qgsgeometry.cpp.
bool QgsGeometry::intersects  (  const QgsRectangle &  r  )  const 
Test for intersection with a rectangle (uses GEOS)
Definition at line 762 of file qgsgeometry.cpp.
bool QgsGeometry::intersects  (  const QgsGeometry *  geometry  )  const 
Test for intersection with a geometry (uses GEOS)
Definition at line 770 of file qgsgeometry.cpp.
bool QgsGeometry::isEmpty  (  )  const 
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry).
Definition at line 159 of file qgsgeometry.cpp.
bool QgsGeometry::isGeosEmpty  (  )  const 
Check if the geometry is empty using GEOS.
Definition at line 1512 of file qgsgeometry.cpp.
bool QgsGeometry::isGeosEqual  (  const QgsGeometry &  g  )  const 
Compares the geometry with another geometry using GEOS.
Definition at line 1501 of file qgsgeometry.cpp.
bool QgsGeometry::isGeosValid  (  )  const 
Checks validity of the geometry using GEOS.
Definition at line 1490 of file qgsgeometry.cpp.
bool QgsGeometry::isMultipart  (  )  const 
Returns true if WKB of the geometry is of WKBMulti* type.
Definition at line 334 of file qgsgeometry.cpp.
double QgsGeometry::length  (  )  const 
Returns the length of geometry using GEOS.
Definition at line 1164 of file qgsgeometry.cpp.
int QgsGeometry::makeDifference  (  const QgsGeometry *  other  ) 
Changes this geometry such that it does not intersect the other geometry.
other  geometry that should not be intersect 
Definition at line 730 of file qgsgeometry.cpp.
void QgsGeometry::mapToPixel  (  const QgsMapToPixel &  mtp  ) 
Transforms the geometry from map units to pixels in place.
mtp  map to pixel transform 
Definition at line 1591 of file qgsgeometry.cpp.
bool QgsGeometry::moveVertex  (  double  x, 
double  y,  
int  atVertex  
) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates.
Returns false if atVertex does not correspond to a valid vertex on this geometry
Definition at line 396 of file qgsgeometry.cpp.
bool QgsGeometry::moveVertex  (  const QgsPointV2 &  p, 
int  atVertex  
) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates.
Returns false if atVertex does not correspond to a valid vertex on this geometry
Definition at line 415 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::offsetCurve  (  double  distance, 
int  segments,  
int  joinStyle,  
double  mitreLimit  
)  const 
Returns an offset line at a given distance and side from an input line.
See buffer() method for details on parameters.
Definition at line 1217 of file qgsgeometry.cpp.
QgsGeometry & QgsGeometry::operator=  (  QgsGeometry const &  rhs  ) 
Assignments will prompt a deep copy of the object.
Definition at line 91 of file qgsgeometry.cpp.
bool QgsGeometry::overlaps  (  const QgsGeometry *  geometry  )  const 
Test for if geometry overlaps another (uses GEOS)
Definition at line 837 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::pointOnSurface  (  )  const 
Returns a point within a geometry.
Definition at line 1266 of file qgsgeometry.cpp.
bool QgsGeometry::requiresConversionToStraightSegments  (  )  const 
Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments.
Definition at line 1555 of file qgsgeometry.cpp.
Replaces a part of this geometry with another line.
Definition at line 704 of file qgsgeometry.cpp.
int QgsGeometry::rotate  (  double  rotation, 
const QgsPoint &  center  
) 
Rotate this geometry around the Z axis.
rotation  clockwise rotation in degrees 
center  rotation center 
Definition at line 652 of file qgsgeometry.cpp.
void QgsGeometry::setGeometry  (  QgsAbstractGeometryV2 *  geometry  ) 
Sets the underlying geometry store.
Ownership of geometry is transferred.
Definition at line 146 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::simplify  (  double  tolerance  )  const 
Returns a simplified version of this geometry using a specified tolerance value.
Definition at line 1233 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::smooth  (  const unsigned int  iterations = 1 , 
const double  offset = 0.25 

)  const 
Smooths a geometry by rounding off corners using the Chaikin algorithm.
This operation roughly doubles the number of vertices in a geometry.
iterations  number of smoothing iterations to run. More iterations results in a smoother geometry 
offset  fraction of line to create new vertices along, between 0 and 1.0 eg the default value of 0.25 will create new vertices 25% and 75% along each line segment of the geometry for each iteration. Smaller values result in "tighter" smoothing. 
Definition at line 1814 of file qgsgeometry.cpp.
QgsPolyline QgsGeometry::smoothLine  (  const QgsPolyline &  polyline, 
const unsigned int  iterations = 1 , 

const double  offset = 0.25 

)  const 
Smooths a polyline using the Chaikin algorithm.
Definition at line 1879 of file qgsgeometry.cpp.
QgsPolygon QgsGeometry::smoothPolygon  (  const QgsPolygon &  polygon, 
const unsigned int  iterations = 1 , 

const double  offset = 0.25 

)  const 
Smooths a polygon using the Chaikin algorithm.
Definition at line 1897 of file qgsgeometry.cpp.
int QgsGeometry::splitGeometry  (  const QList< QgsPoint > &  splitLine, 
QList< QgsGeometry * > &  newGeometries,  
bool  topological,  
QList< QgsPoint > &  topologyTestPoints  
) 
Splits this geometry according to a given line.
splitLine  the line that splits the geometry  
[out]  newGeometries  list of new geometries that have been created with the split 
topological  true if topological editing is enabled  
[out]  topologyTestPoints  points that need to be tested for topological completeness in the dataset 
Definition at line 669 of file qgsgeometry.cpp.
double QgsGeometry::sqrDistToVertexAt  (  QgsPoint &  point, 
int  atVertex  
)  const 
Returns the squared cartesian distance between the given point to the given vertex index (vertex at the given position number, ring and item (first number is index 0))
Definition at line 489 of file qgsgeometry.cpp.
QgsGeometry * QgsGeometry::symDifference  (  const QgsGeometry *  geometry  )  const 
Returns a Geometry representing the points making up this Geometry that do not make up other.
Definition at line 1360 of file qgsgeometry.cpp.
bool QgsGeometry::touches  (  const QgsGeometry *  geometry  )  const 
Test for if geometry touch another (uses GEOS)
Definition at line 826 of file qgsgeometry.cpp.
int QgsGeometry::transform  (  const QgsCoordinateTransform &  ct  ) 
Transform this geometry as described by CoordinateTransform ct.
Definition at line 1565 of file qgsgeometry.cpp.
int QgsGeometry::transform  (  const QTransform &  ct  ) 
Transform this geometry as described by QTransform ct.
Definition at line 1578 of file qgsgeometry.cpp.
int QgsGeometry::translate  (  double  dx, 
double  dy  
) 
Translate this geometry by dx, dy.
Definition at line 638 of file qgsgeometry.cpp.
QGis::GeometryType QgsGeometry::type  (  )  const 
Returns type of the geometry as a QGis::GeometryType.
Definition at line 325 of file qgsgeometry.cpp.

static 
Compute the unary union on a list of geometries.
May be faster than an iterative union on a set of geometries.
geometryList  a list of QgsGeometry* as input 
Definition at line 1523 of file qgsgeometry.cpp.
Validate geometry and produce a list of geometry errors.
Definition at line 1485 of file qgsgeometry.cpp.
QgsPoint QgsGeometry::vertexAt  (  int  atVertex  )  const 
Returns coordinates of a vertex.
atVertex  index of the vertex 
Definition at line 472 of file qgsgeometry.cpp.
bool QgsGeometry::vertexIdFromVertexNr  (  int  nr, 
QgsVertexId &  id  
)  const 
Calculates the vertex ID from a vertex number.
nr  vertex number 
id  reference to QgsVertexId for storing result 
Definition at line 1620 of file qgsgeometry.cpp.
int QgsGeometry::vertexNrFromVertexId  (  const QgsVertexId &  i  )  const 
Returns the vertex number corresponding to a vertex idd.
i  vertex id 
Definition at line 1653 of file qgsgeometry.cpp.
bool QgsGeometry::within  (  const QgsGeometry *  geometry  )  const 
Test for if geometry is within another (uses GEOS)
Definition at line 848 of file qgsgeometry.cpp.
size_t QgsGeometry::wkbSize  (  )  const 
Returns the size of the WKB in asWkb().
Definition at line 283 of file qgsgeometry.cpp.
QGis::WkbType QgsGeometry::wkbType  (  )  const 
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
Definition at line 312 of file qgsgeometry.cpp.