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

Curve polygon geometry type. More...

#include <qgscurvepolygonv2.h>

Inheritance diagram for QgsCurvePolygonV2:
Inheritance graph
[legend]

Public Member Functions

 QgsCurvePolygonV2 ()
 
 QgsCurvePolygonV2 (const QgsCurvePolygonV2 &p)
 
 ~QgsCurvePolygonV2 ()
 
virtual void addInteriorRing (QgsCurveV2 *ring)
 Adds an interior ring to the geometry (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 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 QgsCurvePolygonV2clone () const override
 Clones the geometry by performing a deep copy. 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 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...
 
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 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...
 
virtual void setExteriorRing (QgsCurveV2 *ring)
 Sets the exterior ring of the polygon. More...
 
void setInteriorRings (const QList< QgsCurveV2 * > &rings)
 Sets all interior rings (takes ownership) More...
 
QgsPolygonV2surfaceToPolygon () const override
 
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
 
int wkbSize () const override
 Returns the size of the WKB representation of the geometry. More...
 
- 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)
 
virtual QgsAbstractGeometryV2toCurveType () 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...
 
- 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

QgsCurveV2mExteriorRing
 
QList< QgsCurveV2 * > mInteriorRings
 
- Protected Attributes inherited from QgsSurfaceV2
QgsRectangle mBoundingBox
 
QgsCoordinateSequenceV2 mCoordinateSequence
 
- 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...
 

Detailed Description

Curve polygon geometry type.

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

Definition at line 31 of file qgscurvepolygonv2.h.

Constructor & Destructor Documentation

QgsCurvePolygonV2::QgsCurvePolygonV2 ( )

Definition at line 30 of file qgscurvepolygonv2.cpp.

QgsCurvePolygonV2::QgsCurvePolygonV2 ( const QgsCurvePolygonV2 p)

Definition at line 40 of file qgscurvepolygonv2.cpp.

QgsCurvePolygonV2::~QgsCurvePolygonV2 ( )

Definition at line 35 of file qgscurvepolygonv2.cpp.

Member Function Documentation

void QgsCurvePolygonV2::addInteriorRing ( QgsCurveV2 ring)
virtual

Adds an interior ring to the geometry (takes ownership)

Reimplemented in QgsPolygonV2.

Definition at line 530 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::addMValue ( double  mValue = 0)
overridevirtual

Adds a measure to the geometry, initialized to a preset value.

Parameters
mValueinitial m-value for all nodes
Returns
true on success
Note
added in QGIS 2.12
See also
dropMValue()
addZValue()

Implements QgsAbstractGeometryV2.

Definition at line 858 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::addZValue ( double  zValue = 0)
overridevirtual

Adds a z-dimension to the geometry, initialized to a preset value.

Parameters
zValueinitial z-value for all nodes
Returns
true on success
Note
added in QGIS 2.12
See also
dropZValue()
addMValue()

Implements QgsAbstractGeometryV2.

Definition at line 841 of file qgscurvepolygonv2.cpp.

double QgsCurvePolygonV2::area ( ) const
overridevirtual

Returns the area of the geometry.

See also
length()
perimeter()

Reimplemented from QgsAbstractGeometryV2.

Definition at line 365 of file qgscurvepolygonv2.cpp.

QDomElement QgsCurvePolygonV2::asGML2 ( QDomDocument doc,
int  precision = 17,
const QString ns = "gml" 
) const
overridevirtual

Returns a GML2 representation of the geometry.

Parameters
docDOM document
precisionnumber of decimal places for coordinates
nsXML namespace
See also
asWkb
asWkt
asGML3
asJSON

Implements QgsAbstractGeometryV2.

Definition at line 295 of file qgscurvepolygonv2.cpp.

QDomElement QgsCurvePolygonV2::asGML3 ( QDomDocument doc,
int  precision = 17,
const QString ns = "gml" 
) const
overridevirtual

Returns a GML3 representation of the geometry.

Parameters
docDOM document
precisionnumber of decimal places for coordinates
nsXML namespace
See also
asWkb
asWkt
asGML2
asJSON

Implements QgsAbstractGeometryV2.

Definition at line 319 of file qgscurvepolygonv2.cpp.

QString QgsCurvePolygonV2::asJSON ( int  precision = 17) const
overridevirtual

Returns a GeoJSON representation of the geometry.

Parameters
precisionnumber of decimal places for coordinates
See also
asWkb
asWkt
asGML2
asGML3

Implements QgsAbstractGeometryV2.

Definition at line 338 of file qgscurvepolygonv2.cpp.

unsigned char * QgsCurvePolygonV2::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

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 239 of file qgscurvepolygonv2.cpp.

QString QgsCurvePolygonV2::asWkt ( int  precision = 17) const
overridevirtual

Returns a WKT representation of the geometry.

Parameters
precisionnumber of decimal places for coordinates
See also
asWkb
asGML2
asGML3
asJSON

Implements QgsAbstractGeometryV2.

Definition at line 264 of file qgscurvepolygonv2.cpp.

QgsAbstractGeometryV2 * QgsCurvePolygonV2::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

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 424 of file qgscurvepolygonv2.cpp.

QgsRectangle QgsCurvePolygonV2::calculateBoundingBox ( ) const
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 216 of file qgscurvepolygonv2.cpp.

void QgsCurvePolygonV2::clear ( )
overridevirtual

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

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 80 of file qgscurvepolygonv2.cpp.

QgsCurvePolygonV2 * QgsCurvePolygonV2::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 75 of file qgscurvepolygonv2.cpp.

double QgsCurvePolygonV2::closestSegment ( const QgsPointV2 pt,
QgsPointV2 segmentPt,
QgsVertexId vertexAfter,
bool *  leftOf,
double  epsilon 
) const
overridevirtual

Searches for the closest segment of the geometry to a given point.

Parameters
ptspecifies the point to find closest segment to
segmentPtstorage for the closest point within the geometry
vertexAfterstorage for the ID of the vertex at the end of the closest segment
leftOfreturns 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)
epsilonepsilon for segment snapping
Returns
squared distance to closest segment or negative value on error

Implements QgsAbstractGeometryV2.

Definition at line 656 of file qgscurvepolygonv2.cpp.

QgsCoordinateSequenceV2 QgsCurvePolygonV2::coordinateSequence ( ) const
overridevirtual

Retrieves the sequence of geometries, rings and nodes.

Returns
coordinate sequence

Implements QgsAbstractGeometryV2.

Definition at line 612 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::deleteVertex ( QgsVertexId  position)
overridevirtual

Deletes a vertex within the geometry.

Parameters
positionvertex id for vertex to delete
Returns
true if delete was successful
See also
insertVertex
moveVertex

Implements QgsAbstractGeometryV2.

Definition at line 752 of file qgscurvepolygonv2.cpp.

virtual int QgsCurvePolygonV2::dimension ( ) const
inlineoverridevirtual

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 40 of file qgscurvepolygonv2.h.

void QgsCurvePolygonV2::draw ( QPainter p) const
overridevirtual

Draws the geometry using the specified QPainter.

Parameters
pdestination QPainter

Implements QgsAbstractGeometryV2.

Definition at line 561 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::dropMValue ( )
overridevirtual

Drops any measure values which exist in the geometry.

Returns
true if m-values were present and have been removed
See also
addMValue()
dropZValue()
Note
added in QGIS 2.14

Implements QgsAbstractGeometryV2.

Definition at line 891 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::dropZValue ( )
overridevirtual

Drops any z-dimensions which exist in the geometry.

Returns
true if Z values were present and have been removed
See also
addZValue()
dropMValue()
Note
added in QGIS 2.14

Implements QgsAbstractGeometryV2.

Definition at line 875 of file qgscurvepolygonv2.cpp.

const QgsCurveV2 * QgsCurvePolygonV2::exteriorRing ( ) const

Definition at line 468 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::fromWkb ( QgsConstWkbPtr  wkb)
overridevirtual

Sets the geometry from a WKB string.

See also
fromWkt

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 91 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::fromWkt ( const QString wkt)
overridevirtual

Sets the geometry from a WKT string.

See also
fromWkb

Implements QgsAbstractGeometryV2.

Definition at line 147 of file qgscurvepolygonv2.cpp.

virtual QString QgsCurvePolygonV2::geometryType ( ) const
inlineoverridevirtual

Returns a unique string representing the geometry type.

See also
wkbType
wktTypeStr

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 39 of file qgscurvepolygonv2.h.

bool QgsCurvePolygonV2::hasCurvedSegments ( ) const
overridevirtual

Returns true if the geometry contains curved segments.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 796 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::insertVertex ( QgsVertexId  position,
const QgsPointV2 vertex 
)
overridevirtual

Inserts a vertex into the geometry.

Parameters
positionvertex id for position of inserted vertex
vertexvertex to insert
Returns
true if insert was successful
See also
moveVertex
deleteVertex

Implements QgsAbstractGeometryV2.

Definition at line 704 of file qgscurvepolygonv2.cpp.

const QgsCurveV2 * QgsCurvePolygonV2::interiorRing ( int  i) const

Definition at line 473 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::moveVertex ( QgsVertexId  position,
const QgsPointV2 newPos 
)
overridevirtual

Moves a vertex within the geometry.

Parameters
positionvertex id for vertex to move
newPosnew position of vertex
Returns
true if move was successful
See also
insertVertex
deleteVertex

Implements QgsAbstractGeometryV2.

Definition at line 730 of file qgscurvepolygonv2.cpp.

int QgsCurvePolygonV2::nCoordinates ( ) const
overridevirtual

Returns the number of nodes contained in the geometry.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 635 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::nextVertex ( QgsVertexId id,
QgsPointV2 vertex 
) const
overridevirtual

Returns next vertex id and coordinates.

Parameters
idinitial value should be the starting vertex id. The next vertex id will be stored in this variable if found.
vertexcontainer for found node
Returns
false if at end

Implements QgsAbstractGeometryV2.

Definition at line 668 of file qgscurvepolygonv2.cpp.

int QgsCurvePolygonV2::numInteriorRings ( ) const

Definition at line 463 of file qgscurvepolygonv2.cpp.

QgsCurvePolygonV2 & QgsCurvePolygonV2::operator= ( const QgsCurvePolygonV2 p)

Definition at line 56 of file qgscurvepolygonv2.cpp.

virtual int QgsCurvePolygonV2::partCount ( ) const
inlineoverridevirtual

Returns count of parts contained in the geometry.

See also
vertexCount
ringCount

Implements QgsAbstractGeometryV2.

Definition at line 114 of file qgscurvepolygonv2.h.

double QgsCurvePolygonV2::perimeter ( ) const
overridevirtual

Returns the perimeter of the geometry.

See also
area()
length()

Reimplemented from QgsAbstractGeometryV2.

Definition at line 394 of file qgscurvepolygonv2.cpp.

bool QgsCurvePolygonV2::removeInteriorRing ( int  nr)

Removes ring.

Exterior ring is 0, first interior ring 1, ...

Definition at line 550 of file qgscurvepolygonv2.cpp.

virtual int QgsCurvePolygonV2::ringCount ( int  = 0) const
inlineoverridevirtual

Implements QgsAbstractGeometryV2.

Definition at line 113 of file qgscurvepolygonv2.h.

QgsAbstractGeometryV2 * QgsCurvePolygonV2::segmentize ( double  tolerance = M_PI_2 / 90,
SegmentationToleranceType  toleranceType = MaximumAngle 
) const
overridevirtual

Returns a geometry without curves.

Caller takes ownership

Parameters
tolerancesegmentation tolerance
toleranceTypemaximum segmentation angle or maximum difference between approximation and curve

Reimplemented from QgsAbstractGeometryV2.

Definition at line 814 of file qgscurvepolygonv2.cpp.

void QgsCurvePolygonV2::setExteriorRing ( QgsCurveV2 ring)
virtual

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 in QgsPolygonV2.

Definition at line 482 of file qgscurvepolygonv2.cpp.

void QgsCurvePolygonV2::setInteriorRings ( const QList< QgsCurveV2 * > &  rings)

Sets all interior rings (takes ownership)

Definition at line 517 of file qgscurvepolygonv2.cpp.

QgsPolygonV2 * QgsCurvePolygonV2::surfaceToPolygon ( ) const
overridevirtual

Implements QgsSurfaceV2.

Reimplemented in QgsPolygonV2.

Definition at line 409 of file qgscurvepolygonv2.cpp.

QgsPolygonV2 * QgsCurvePolygonV2::toPolygon ( double  tolerance = M_PI_2 / 90,
SegmentationToleranceType  toleranceType = MaximumAngle 
) const
virtual

Returns a new polygon geometry corresponding to a segmentized approximation of the curve.

Parameters
tolerancesegmentation tolerance
toleranceTypemaximum segmentation angle or maximum difference between approximation and curve

Definition at line 443 of file qgscurvepolygonv2.cpp.

void QgsCurvePolygonV2::transform ( const QgsCoordinateTransform ct,
QgsCoordinateTransform::TransformDirection  d = QgsCoordinateTransform::ForwardTransform,
bool  transformZ = false 
)
overridevirtual

Transforms the geometry using a coordinate transform.

Parameters
ctcoordinate transform
dtransformation direction
transformZset 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 584 of file qgscurvepolygonv2.cpp.

void QgsCurvePolygonV2::transform ( const QTransform t)
overridevirtual

Transforms the geometry using a QTransform object.

Parameters
tQTransform transformation

Implements QgsAbstractGeometryV2.

Definition at line 598 of file qgscurvepolygonv2.cpp.

double QgsCurvePolygonV2::vertexAngle ( QgsVertexId  vertex) const
overridevirtual

Returns approximate rotation angle for a vertex.

Usually average angle between adjacent segments.

Parameters
vertexthe vertex id
Returns
rotation in radians, clockwise from north

Implements QgsAbstractGeometryV2.

Definition at line 819 of file qgscurvepolygonv2.cpp.

QgsPointV2 QgsCurvePolygonV2::vertexAt ( QgsVertexId  id) const
overridevirtual

Returns the point corresponding to a specified vertex id.

Implements QgsAbstractGeometryV2.

Definition at line 836 of file qgscurvepolygonv2.cpp.

int QgsCurvePolygonV2::vertexCount ( int  = 0,
int  ring = 0 
) const
overridevirtual

Implements QgsAbstractGeometryV2.

Definition at line 831 of file qgscurvepolygonv2.cpp.

int QgsCurvePolygonV2::wkbSize ( ) const
overridevirtual

Returns the size of the WKB representation of the geometry.

See also
asWkb

Implements QgsAbstractGeometryV2.

Reimplemented in QgsPolygonV2.

Definition at line 225 of file qgscurvepolygonv2.cpp.

Member Data Documentation

QgsCurveV2* QgsCurvePolygonV2::mExteriorRing
protected

Definition at line 124 of file qgscurvepolygonv2.h.

QList<QgsCurveV2*> QgsCurvePolygonV2::mInteriorRings
protected

Definition at line 125 of file qgscurvepolygonv2.h.


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