QGIS API Documentation  2.12.0-Lyon
Public Member Functions | List of all members
QgsCompoundCurveV2 Class Reference

Compound curve geometry type. More...

#include <qgscompoundcurvev2.h>

Inheritance diagram for QgsCompoundCurveV2:
Inheritance graph
[legend]

Public Member Functions

 QgsCompoundCurveV2 ()
 
 QgsCompoundCurveV2 (const QgsCompoundCurveV2 &curve)
 
 ~QgsCompoundCurveV2 ()
 
void addCurve (QgsCurveV2 *c)
 Adds a curve to the geometr (takes ownership) More...
 
virtual bool addMValue (double mValue=0) override
 Adds a measure to the geometry, initialized to a preset value. More...
 
void addToPainterPath (QPainterPath &path) const override
 Adds a curve to a painter path. More...
 
void addVertex (const QgsPointV2 &pt)
 Adds a vertex to the end of the geometry. More...
 
virtual bool addZValue (double zValue=0) override
 Adds a z-dimension to the geometry, initialized to a preset value. 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 QgsRectangle calculateBoundingBox () const override
 Calculates the minimal bounding box for the geometry. More...
 
virtual void clear () override
 Clears the geometry, ie reset it to a null geometry. More...
 
virtual QgsCompoundCurveV2clone () const override
 Clones the geometry by performing a deep copy. More...
 
void close ()
 Appends first point if not already closed. More...
 
virtual 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...
 
const QgsCurveV2curveAt (int i) const
 Returns the curve at the specified index. More...
 
virtual QgsLineStringV2curveToLine () const override
 Returns a new line string geometry corresponding to a segmentized approximation of the curve. More...
 
virtual bool deleteVertex (const QgsVertexId &position) override
 Deletes a vertex within the geometry. More...
 
virtual int dimension () const override
 Returns the inherent dimension of the geometry. More...
 
void draw (QPainter &p) const override
 Draws the geometry using the specified QPainter. More...
 
void drawAsPolygon (QPainter &p) const override
 Draws the curve as a polygon on the specified QPainter. More...
 
virtual QgsPointV2 endPoint () const override
 Returns the end point of the curve. More...
 
virtual bool fromWkb (const unsigned char *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 (const QgsVertexId &position, const QgsPointV2 &vertex) override
 Inserts a vertex into the geometry. More...
 
virtual double length () const override
 Returns the length of the geometry. More...
 
virtual bool moveVertex (const QgsVertexId &position, const QgsPointV2 &newPos) override
 Moves a vertex within the geometry. More...
 
int nCurves () const
 Returns the number of curves in the geometry. More...
 
virtual int numPoints () const override
 Returns the number of points in the curve. More...
 
QgsCompoundCurveV2operator= (const QgsCompoundCurveV2 &curve)
 
bool pointAt (int i, QgsPointV2 &vertex, QgsVertexId::VertexType &type) const override
 Returns the point and vertex id of a point within the curve. More...
 
virtual void points (QList< QgsPointV2 > &pts) const override
 Returns a list of points within the curve. More...
 
void removeCurve (int i)
 Removes a curve from the geometry. More...
 
virtual QgsPointV2 startPoint () const override
 Returns the starting point of the curve. More...
 
void sumUpArea (double &sum) const override
 Calculates the area of the curve. More...
 
void transform (const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform) 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 (const QgsVertexId &vertex) const override
 Returns approximate rotation angle for a vertex. More...
 
int wkbSize () const override
 Returns the size of the WKB representation of the geometry. More...
 
- Public Member Functions inherited from QgsCurveV2
 QgsCurveV2 ()
 
virtual ~QgsCurveV2 ()
 
virtual void coordinateSequence (QList< QList< QList< QgsPointV2 > > > &coord) const override
 Retrieves the sequence of geometries, rings and nodes. More...
 
virtual bool isClosed () const
 Returns true if the curve is closed. More...
 
virtual bool isRing () const
 Returns true if the curve is a ring. More...
 
virtual bool nextVertex (QgsVertexId &id, QgsPointV2 &vertex) const override
 Returns next vertex id and coordinates. More...
 
virtual int partCount () const override
 
virtual int ringCount (int=0) const override
 
QgsAbstractGeometryV2segmentize () const override
 Returns a version of the geometry without curves. More...
 
virtual QgsPointV2 vertexAt (const QgsVertexId &id) const override
 Returns the point corresponding to a specified vertex id. More...
 
virtual int vertexCount (int=0, int=0) const override
 
- Public Member Functions inherited from QgsAbstractGeometryV2
 QgsAbstractGeometryV2 ()
 
 QgsAbstractGeometryV2 (const QgsAbstractGeometryV2 &geom)
 
virtual ~QgsAbstractGeometryV2 ()
 
virtual double area () const
 Returns the area of the geometry. More...
 
QgsRectangle boundingBox () const
 Returns the minimal bounding box for the geometry. More...
 
virtual QgsPointV2 centroid () const
 Returns the centroid of 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...
 
int nCoordinates () const
 Returns the number of nodes contained in the geometry. More...
 
virtual QgsAbstractGeometryV2operator= (const QgsAbstractGeometryV2 &geom)
 
virtual double perimeter () const
 Returns the perimeter 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...
 

Additional Inherited Members

- 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...
 
- Static Protected Member Functions inherited from QgsAbstractGeometryV2
static bool readWkbHeader (QgsConstWkbPtr &wkbPtr, QgsWKBTypes::Type &wkbType, bool &endianSwap, QgsWKBTypes::Type expectedType)
 Reads a WKB header and tests its validity. More...
 
- Protected Attributes inherited from QgsAbstractGeometryV2
QgsRectangle mBoundingBox
 
QgsWKBTypes::Type mWkbType
 

Detailed Description

Compound curve 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 qgscompoundcurvev2.h.

Constructor & Destructor Documentation

QgsCompoundCurveV2::QgsCompoundCurveV2 ( )

Definition at line 28 of file qgscompoundcurvev2.cpp.

QgsCompoundCurveV2::QgsCompoundCurveV2 ( const QgsCompoundCurveV2 curve)

Definition at line 38 of file qgscompoundcurvev2.cpp.

QgsCompoundCurveV2::~QgsCompoundCurveV2 ( )

Definition at line 33 of file qgscompoundcurvev2.cpp.

Member Function Documentation

void QgsCompoundCurveV2::addCurve ( QgsCurveV2 c)

Adds a curve to the geometr (takes ownership)

Definition at line 370 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::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
addZValue

Implements QgsAbstractGeometryV2.

Definition at line 642 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::addToPainterPath ( QPainterPath path) const
overridevirtual

Adds a curve to a painter path.

Implements QgsCurveV2.

Definition at line 453 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::addVertex ( const QgsPointV2 pt)

Adds a vertex to the end of the geometry.

Definition at line 394 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::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
addMValue

Implements QgsAbstractGeometryV2.

Definition at line 628 of file qgscompoundcurvev2.cpp.

QDomElement QgsCompoundCurveV2::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 234 of file qgscompoundcurvev2.cpp.

QDomElement QgsCompoundCurveV2::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 243 of file qgscompoundcurvev2.cpp.

QString QgsCompoundCurveV2::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 274 of file qgscompoundcurvev2.cpp.

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

Definition at line 194 of file qgscompoundcurvev2.cpp.

QString QgsCompoundCurveV2::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 213 of file qgscompoundcurvev2.cpp.

QgsRectangle QgsCompoundCurveV2::calculateBoundingBox ( ) const
overridevirtual

Calculates the minimal bounding box for the geometry.

Derived classes should override this method to return the correct bounding box.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 71 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::clear ( )
overridevirtual

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

Implements QgsAbstractGeometryV2.

Definition at line 64 of file qgscompoundcurvev2.cpp.

QgsCompoundCurveV2 * QgsCompoundCurveV2::clone ( ) const
overridevirtual

Clones the geometry by performing a deep copy.

Implements QgsAbstractGeometryV2.

Definition at line 59 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::close ( )

Appends first point if not already closed.

Definition at line 584 of file qgscompoundcurvev2.cpp.

double QgsCompoundCurveV2::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 for search
segmentPtstorage for the closest point within the geometry
vertexAfterstorage for the id of the vertex after the closest segment
leftOfreturns if the point lies on the left of right side of the segment ( < 0 means left, > 0 means right )
epsilonepsilon for segment snapping
Returns
squared distance to closest segment

Implements QgsAbstractGeometryV2.

Definition at line 555 of file qgscompoundcurvev2.cpp.

const QgsCurveV2 * QgsCompoundCurveV2::curveAt ( int  i) const

Returns the curve at the specified index.

Definition at line 361 of file qgscompoundcurvev2.cpp.

QgsLineStringV2 * QgsCompoundCurveV2::curveToLine ( ) const
overridevirtual

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

Implements QgsCurveV2.

Definition at line 347 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::deleteVertex ( const 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 513 of file qgscompoundcurvev2.cpp.

virtual int QgsCompoundCurveV2::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 38 of file qgscompoundcurvev2.h.

void QgsCompoundCurveV2::draw ( QPainter p) const
overridevirtual

Draws the geometry using the specified QPainter.

Parameters
pdestination QPainter

Implements QgsAbstractGeometryV2.

Definition at line 426 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::drawAsPolygon ( QPainter p) const
overridevirtual

Draws the curve as a polygon on the specified QPainter.

Parameters
pdestination QPainter

Implements QgsCurveV2.

Definition at line 464 of file qgscompoundcurvev2.cpp.

QgsPointV2 QgsCompoundCurveV2::endPoint ( ) const
overridevirtual

Returns the end point of the curve.

See also
startPoint

Implements QgsCurveV2.

Definition at line 303 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::fromWkb ( const unsigned char *  wkb)
overridevirtual

Sets the geometry from a WKB string.

See also
fromWkt

Implements QgsAbstractGeometryV2.

Definition at line 87 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::fromWkt ( const QString wkt)
overridevirtual

Sets the geometry from a WKT string.

See also
fromWkb

Implements QgsAbstractGeometryV2.

Definition at line 133 of file qgscompoundcurvev2.cpp.

virtual QString QgsCompoundCurveV2::geometryType ( ) const
inlineoverridevirtual

Returns a unique string representing the geometry type.

See also
wkbType
wktTypeStr

Implements QgsAbstractGeometryV2.

Definition at line 37 of file qgscompoundcurvev2.h.

bool QgsCompoundCurveV2::hasCurvedSegments ( ) const
overridevirtual

Returns true if the geometry contains curved segments.

Reimplemented from QgsAbstractGeometryV2.

Definition at line 593 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::insertVertex ( const 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 475 of file qgscompoundcurvev2.cpp.

double QgsCompoundCurveV2::length ( ) const
overridevirtual

Returns the length of the geometry.

See also
area()
perimeter()

Reimplemented from QgsAbstractGeometryV2.

Definition at line 283 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::moveVertex ( const 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 496 of file qgscompoundcurvev2.cpp.

int QgsCompoundCurveV2::nCurves ( ) const
inline

Returns the number of curves in the geometry.

Definition at line 64 of file qgscompoundcurvev2.h.

int QgsCompoundCurveV2::numPoints ( ) const
overridevirtual

Returns the number of points in the curve.

Implements QgsCurveV2.

Definition at line 330 of file qgscompoundcurvev2.cpp.

QgsCompoundCurveV2 & QgsCompoundCurveV2::operator= ( const QgsCompoundCurveV2 curve)

Definition at line 46 of file qgscompoundcurvev2.cpp.

bool QgsCompoundCurveV2::pointAt ( int  i,
QgsPointV2 vertex,
QgsVertexId::VertexType type 
) const
overridevirtual

Returns the point and vertex id of a point within the curve.

Implements QgsCurveV2.

Definition at line 560 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::points ( QList< QgsPointV2 > &  pt) const
overridevirtual

Returns a list of points within the curve.

Implements QgsCurveV2.

Definition at line 312 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::removeCurve ( int  i)

Removes a curve from the geometry.

Parameters
iindex of curve to remove

Definition at line 383 of file qgscompoundcurvev2.cpp.

QgsPointV2 QgsCompoundCurveV2::startPoint ( ) const
overridevirtual

Returns the starting point of the curve.

See also
endPoint

Implements QgsCurveV2.

Definition at line 294 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::sumUpArea ( double &  sum) const
overridevirtual

Calculates the area of the curve.

Derived classes should override this to return the correct area of the curve.

Implements QgsCurveV2.

Definition at line 575 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::transform ( const QgsCoordinateTransform ct,
QgsCoordinateTransform::TransformDirection  d = QgsCoordinateTransform::ForwardTransform 
)
overridevirtual

Transforms the geometry using a coordinate transform.

Parameters
ctcoordinate transform
dtransformation direction

Implements QgsAbstractGeometryV2.

Definition at line 435 of file qgscompoundcurvev2.cpp.

void QgsCompoundCurveV2::transform ( const QTransform t)
overridevirtual

Transforms the geometry using a QTransform object.

Parameters
tQTransform transformation

Implements QgsAbstractGeometryV2.

Definition at line 444 of file qgscompoundcurvev2.cpp.

double QgsCompoundCurveV2::vertexAngle ( const 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 606 of file qgscompoundcurvev2.cpp.

int QgsCompoundCurveV2::wkbSize ( ) const
overridevirtual

Returns the size of the WKB representation of the geometry.

See also
asWkb

Implements QgsAbstractGeometryV2.

Definition at line 184 of file qgscompoundcurvev2.cpp.


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