QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Public Member Functions | List of all members
QgsPolygonV2 Class Reference

Polygon geometry type. More...

#include <qgspolygonv2.h>

Inheritance diagram for QgsPolygonV2:
Inheritance graph
[legend]

Public Member Functions

 QgsPolygonV2 ()
 
void addInteriorRing (QgsCurveV2 *ring) override
 Adds an interior ring to the geometry (takes ownership) More...
 
unsigned char * asWkb (int &binarySize) const override
 Returns a WKB representation of the geometry. More...
 
virtual QgsAbstractGeometryV2boundary () const override
 Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). More...
 
void clear () override
 Clears the geometry, ie reset it to a null geometry. More...
 
virtual QgsPolygonV2clone () const override
 Clones the geometry by performing a deep copy. More...
 
virtual bool fromWkb (QgsConstWkbPtr wkb) override
 Sets the geometry from a WKB string. More...
 
virtual QString geometryType () const override
 Returns a unique string representing the geometry type. More...
 
bool operator!= (const QgsPolygonV2 &other) const
 
bool operator== (const QgsPolygonV2 &other) const
 
virtual void setExteriorRing (QgsCurveV2 *ring) override
 Sets the exterior ring of the polygon. More...
 
QgsPolygonV2surfaceToPolygon () const override
 
QgsAbstractGeometryV2toCurveType () const override
 Returns the geometry converted to the more generic curve type QgsCurvePolygonV2. More...
 
int wkbSize () const override
 Returns the size of the WKB representation of the geometry. More...
 
- Public Member Functions inherited from QgsCurvePolygonV2
 QgsCurvePolygonV2 ()
 
 QgsCurvePolygonV2 (const QgsCurvePolygonV2 &p)
 
 ~QgsCurvePolygonV2 ()
 
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...
 
QString asWkt (int precision=17) const override
 Returns a WKT representation of the geometry. More...
 
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...
 
const QgsCurveV2exteriorRing () const
 
virtual bool fromWkt (const QString &wkt) override
 Sets the geometry from a WKT string. More...
 
bool hasCurvedSegments () const override
 Returns true if the geometry contains curved segments. More...
 
virtual bool insertVertex (QgsVertexId position, const QgsPointV2 &vertex) override
 Inserts a vertex into the geometry. More...
 
const QgsCurveV2interiorRing (int i) const
 
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 numInteriorRings () const
 
QgsCurvePolygonV2operator= (const QgsCurvePolygonV2 &p)
 
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...
 
bool removeInteriorRing (int nr)
 Removes ring. More...
 
virtual int ringCount (int=0) const override
 
QgsAbstractGeometryV2segmentize (double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
 Returns a geometry without curves. More...
 
void setInteriorRings (const QList< QgsCurveV2 * > &rings)
 Sets all interior rings (takes ownership) More...
 
virtual QgsPolygonV2toPolygon (double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const
 Returns a new polygon geometry corresponding to a segmentized approximation of the curve. More...
 
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=0, int ring=0) const override
 
- Public Member Functions inherited from QgsSurfaceV2
virtual QgsRectangle boundingBox () const override
 Returns the minimal bounding box for 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 double length () const
 Returns the length of the geometry. More...
 
virtual QgsAbstractGeometryV2operator= (const QgsAbstractGeometryV2 &geom)
 
QgsWKBTypes::Type wkbType () const
 Returns the WKB type of the geometry. More...
 
QString wktTypeStr () const
 Returns the WKT type string of the geometry. More...
 

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...
 
- Protected Member Functions inherited from QgsCurvePolygonV2
virtual QgsRectangle calculateBoundingBox () const override
 Default calculator for the minimal bounding box for the geometry. More...
 
- Protected Member Functions inherited from QgsSurfaceV2
virtual void clearCache () const override
 Clears any cached parameters associated with the geometry, eg bounding boxes. 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 inherited from QgsCurvePolygonV2
QgsCurveV2mExteriorRing
 
QList< QgsCurveV2 * > mInteriorRings
 
- Protected Attributes inherited from QgsSurfaceV2
QgsRectangle mBoundingBox
 
QgsCoordinateSequenceV2 mCoordinateSequence
 
- Protected Attributes inherited from QgsAbstractGeometryV2
QgsWKBTypes::Type mWkbType
 

Detailed Description

Polygon geometry type.

Note
added in QGIS 2.10
this API is not considered stable and may change for 2.12

Definition at line 29 of file qgspolygonv2.h.

Constructor & Destructor Documentation

QgsPolygonV2::QgsPolygonV2 ( )

Definition at line 25 of file qgspolygonv2.cpp.

Member Function Documentation

void QgsPolygonV2::addInteriorRing ( QgsCurveV2 ring)
overridevirtual

Adds an interior ring to the geometry (takes ownership)

Reimplemented from QgsCurvePolygonV2.

Definition at line 179 of file qgspolygonv2.cpp.

unsigned char * QgsPolygonV2::asWkb ( int &  binarySize) const
overridevirtual

Returns a WKB representation of the geometry.

Parameters
binarySizewill be set to the size of the returned WKB string
See also
wkbSize
asWkt
asGML2
asGML3
asJSON

Reimplemented from QgsCurvePolygonV2.

Definition at line 155 of file qgspolygonv2.cpp.

QgsAbstractGeometryV2 * QgsPolygonV2::boundary ( ) const
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.

Returns
boundary for geometry. May be null for some geometry types.
Note
added in QGIS 2.18

Reimplemented from QgsCurvePolygonV2.

Definition at line 246 of file qgspolygonv2.cpp.

void QgsPolygonV2::clear ( )
overridevirtual

Clears the geometry, ie reset it to a null geometry.

Reimplemented from QgsCurvePolygonV2.

Definition at line 74 of file qgspolygonv2.cpp.

QgsPolygonV2 * QgsPolygonV2::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Reimplemented from QgsCurvePolygonV2.

Definition at line 69 of file qgspolygonv2.cpp.

bool QgsPolygonV2::fromWkb ( QgsConstWkbPtr  wkb)
overridevirtual

Sets the geometry from a WKB string.

See also
fromWkt

Reimplemented from QgsCurvePolygonV2.

Definition at line 80 of file qgspolygonv2.cpp.

virtual QString QgsPolygonV2::geometryType ( ) const
inlineoverridevirtual

Returns a unique string representing the geometry type.

See also
wkbType
wktTypeStr

Reimplemented from QgsCurvePolygonV2.

Definition at line 37 of file qgspolygonv2.h.

bool QgsPolygonV2::operator!= ( const QgsPolygonV2 other) const

Definition at line 64 of file qgspolygonv2.cpp.

bool QgsPolygonV2::operator== ( const QgsPolygonV2 other) const

Definition at line 31 of file qgspolygonv2.cpp.

void QgsPolygonV2::setExteriorRing ( QgsCurveV2 ring)
overridevirtual

Sets the exterior ring of the polygon.

The CurvePolygon type will be updated to match the dimensionality of the exterior ring. For instance, setting a 2D exterior ring on a 3D CurvePolygon will drop the z dimension from the CurvePolygon and all interior rings.

Parameters
ringnew exterior ring. Ownership is transferred to the CurvePolygon.
See also
setInteriorRings()
exteriorRing()

Reimplemented from QgsCurvePolygonV2.

Definition at line 210 of file qgspolygonv2.cpp.

QgsPolygonV2 * QgsPolygonV2::surfaceToPolygon ( ) const
overridevirtual

Reimplemented from QgsCurvePolygonV2.

Definition at line 268 of file qgspolygonv2.cpp.

QgsAbstractGeometryV2 * QgsPolygonV2::toCurveType ( ) const
overridevirtual

Returns the geometry converted to the more generic curve type QgsCurvePolygonV2.

Returns
the converted geometry. Caller takes ownership

Reimplemented from QgsAbstractGeometryV2.

Definition at line 273 of file qgspolygonv2.cpp.

int QgsPolygonV2::wkbSize ( ) const
overridevirtual

Returns the size of the WKB representation of the geometry.

See also
asWkb

Reimplemented from QgsCurvePolygonV2.

Definition at line 139 of file qgspolygonv2.cpp.


The documentation for this class was generated from the following files: