27 #include <QPainterPath>   105   int currentCurveSize = 0;
   106   for ( 
int i = 0; i < nRings; ++i )
   109     wkbPtr -= 1 + 
sizeof( int );
   128     currentCurve->
fromWkb( wkbPtr );
   129     currentCurveSize = currentCurve->
wkbSize();
   138     wkbPtr += currentCurveSize;
   197     hasZ = hasZ || curve->
is3D();
   221   int size = 
sizeof( char ) + 
sizeof( quint32 ) + 
sizeof( quint32 );
   236   unsigned char* geomPtr = 
new unsigned char[binarySize];
   239   wkbPtr << static_cast<quint32>( 
wkbType() );
   245     memcpy( wkbPtr, ringWkb, curveWkbLen );
   246     wkbPtr += curveWkbLen;
   251     unsigned char *ringWkb = curve->
asWkb( curveWkbLen );
   252     memcpy( wkbPtr, ringWkb, curveWkbLen );
   253     wkbPtr += curveWkbLen;
   267       childWkt = childWkt.
mid( childWkt.
indexOf( 
'(' ) );
   269     wkt += childWkt + 
',';
   274     if ( dynamic_cast<const QgsLineStringV2*>( curve ) )
   277       childWkt = childWkt.
mid( childWkt.
indexOf( 
'(' ) );
   279     wkt += childWkt + 
',';
   298   delete exteriorLineString;
   307     delete interiorLineString;
   329   return elemCurvePolygon;
   335   QString json = 
"{\"type\": \"Polygon\", \"coordinates\": [";
   339   exteriorLineString->
points( exteriorPts );
   341   delete exteriorLineString;
   347     interiorLineString->
points( interiorPts );
   349     delete interiorLineString;
   366   double totalArea = 0.0;
   372     totalArea += qAbs( area );
   379     if (( *ringIt )->isClosed() )
   381       ( *ringIt )->sumUpArea( area );
   382       totalArea -= qAbs( area );
   398     perimeter += ( *ringIt )->length();
   410   for ( 
int i = 0; i < n; ++i )
   432     rings.
push_back(( *it )->curveToLine() );
   513   else if ( !ring->
is3D() )
   553       ( *it )->addToPainterPath( path );
   676   else if ( vId.
vertex == n )
   693   bool success = ring->
moveVertex( vId, newPos );
   699     else if ( vId.
vertex == n - 1 )
   741     else if ( vId.
vertex == n - 1 )
   758     if (( *it )->hasCurvedSegments() )
 const QgsCurveV2 * exteriorRing() const 
 
bool removeInteriorRing(int nr)
Removes ring. 
 
bool hasCurvedSegments() const override
Returns true if the geometry contains curved segments. 
 
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
 
QgsWKBTypes::Type wkbType() const 
Returns the WKB type of the geometry. 
 
A rectangle specified with double values. 
 
QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML2 representation of the geometry. 
 
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry. 
 
virtual bool addMValue(double mValue=0) override
Adds a measure to the geometry, initialized to a preset value. 
 
static QPair< QgsWKBTypes::Type, QString > wktReadBlock(const QString &wkt)
Parses a WKT block of the format "TYPE( contents )" and returns a pair of geometry type to contents (...
 
QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML2 representation of the geometry. 
 
virtual QgsRectangle calculateBoundingBox() const override
Default calculator for the minimal bounding box for the geometry. 
 
virtual QgsAbstractGeometryV2 & operator=(const QgsAbstractGeometryV2 &geom)
 
QDomNode appendChild(const QDomNode &newChild)
 
virtual void addInteriorRing(QgsCurveV2 *ring)
Adds an interior ring to the geometry (takes ownership) 
 
void push_back(const T &value)
 
void clear() override
Clears the geometry, ie reset it to a null geometry. 
 
void points(QgsPointSequenceV2 &pt) const override
Returns a list of points within the curve. 
 
void setTagName(const QString &name)
 
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type. 
 
static bool hasM(Type type)
Tests whether a WKB type contains m values. 
 
Circular string geometry type. 
 
virtual double length() const 
Returns the length of the geometry. 
 
QgsPolygonV2 * surfaceToPolygon() const override
 
virtual bool deleteVertex(QgsVertexId position) override
Deletes a vertex within the geometry. 
 
virtual QgsCoordinateSequenceV2 coordinateSequence() const override
Retrieves the sequence of geometries, rings and nodes. 
 
const T & at(int i) const
 
virtual void addToPainterPath(QPainterPath &path) const =0
Adds a curve to a painter path. 
 
static QString pointsToJSON(const QgsPointSequenceV2 &points, int precision)
Returns a geoJSON coordinates string. 
 
Abstract base class for all geometries. 
 
double vertexAngle(QgsVertexId vertex) const override
Returns approximate rotation angle for a vertex. 
 
static QStringList wktGetChildBlocks(const QString &wkt, const QString &defaultType="")
Parses a WKT string and returns of list of blocks contained in the WKT. 
 
static double closestSegmentFromComponents(T &container, componentType ctype, const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon)
 
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry. 
 
virtual bool moveVertex(QgsVertexId position, const QgsPointV2 &newPos) override
Moves a vertex within the geometry. 
 
QDomElement createElementNS(const QString &nsURI, const QString &qName)
 
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension. 
 
virtual QgsCurveV2 * clone() const override=0
Clones the geometry by performing a deep copy. 
 
static endian_t endian()
Returns whether this machine uses big or little endian. 
 
QString wktTypeStr() const 
Returns the WKT type string of the geometry. 
 
virtual int wkbSize() const =0
Returns the size of the WKB representation of the geometry. 
 
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value. 
 
virtual void clearCache() const override
Clears any cached parameters associated with the geometry, eg bounding boxes. 
 
QDomElement toElement() const
 
virtual int numPoints() const =0
Returns the number of points in the curve. 
 
QgsWKBTypes::Type readHeader() const 
 
int wkbSize() const override
Returns the size of the WKB representation of the geometry. 
 
virtual bool dropMValue() override
Drops any measure values which exist in the geometry. 
 
bool is3D() const 
Returns true if the geometry is 3D and contains a z-value. 
 
void setInteriorRings(const QList< QgsCurveV2 * > &rings)
Sets all interior rings (takes ownership) 
 
void append(const T &value)
 
static Type dropZ(Type type)
Drops the z dimension (if present) for a WKB type and returns the new type. 
 
virtual bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string. 
 
virtual double perimeter() const override
Returns the perimeter of the geometry. 
 
virtual QString geometryType() const override
Returns a unique string representing the geometry type. 
 
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type. 
 
virtual void setExteriorRing(QgsCurveV2 *ring) override
Sets the exterior ring of the polygon. 
 
Utility class for identifying a unique vertex within a geometry. 
 
bool isMeasure() const 
Returns true if the geometry contains m values. 
 
Line string geometry type, with support for z-dimension and m-values. 
 
virtual bool fromWkb(QgsConstWkbPtr wkb)=0
Sets the geometry from a WKB string. 
 
Point geometry type, with support for z-dimension and m-values. 
 
QgsWKBTypes::Type mWkbType
 
QString asWkt(int precision=17) const override
Returns a WKT representation of the geometry. 
 
QgsCurvePolygonV2 & operator=(const QgsCurvePolygonV2 &p)
 
virtual bool hasCurvedSegments() const 
Returns true if the geometry contains curved segments. 
 
virtual unsigned char * asWkb(int &binarySize) const =0
Returns a WKB representation of the geometry. 
 
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
 
virtual QgsPolygonV2 * toPolygon() const 
 
virtual void transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform)=0
Transforms the geometry using a coordinate transform. 
 
void setZMTypeFromSubGeometry(const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values. 
 
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value. 
 
void transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform) override
Transforms the geometry using a coordinate transform. 
 
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const override
Returns next vertex id and coordinates. 
 
virtual int vertexCount(int=0, int ring=0) const override
 
unsigned char * asWkb(int &binarySize) const override
Returns a WKB representation of the geometry. 
 
virtual void draw(QPainter &p) const override
Draws the geometry using the specified QPainter. 
 
virtual QgsCurvePolygonV2 * clone() const override
Clones the geometry by performing a deep copy. 
 
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. 
 
Compound curve geometry type. 
 
QList< QgsPointSequenceV2 > QgsRingSequenceV2
 
QgsCoordinateSequenceV2 mCoordinateSequence
 
const QgsCurveV2 * interiorRing(int i) const 
 
virtual void sumUpArea(double &sum) const =0
Calculates the area of the curve. 
 
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex. 
 
static Type dropM(Type type)
Drops the m dimension (if present) for a WKB type and returns the new type. 
 
bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const override
Returns next vertex id and coordinates. 
 
QList< QgsCurveV2 * > mInteriorRings
 
virtual QgsLineStringV2 * curveToLine() const =0
Returns a new line string geometry corresponding to a segmentized approximation of the curve...
 
QString asJSON(int precision=17) const override
Returns a GeoJSON representation of the geometry. 
 
virtual bool deleteVertex(QgsVertexId position)=0
Deletes a vertex within the geometry. 
 
virtual bool insertVertex(QgsVertexId position, const QgsPointV2 &vertex) override
Inserts a vertex into the geometry. 
 
QString mid(int position, int n) const
 
void drawPath(const QPainterPath &path)
 
virtual void setExteriorRing(QgsCurveV2 *ring)
Sets the exterior ring of the polygon. 
 
virtual bool insertVertex(QgsVertexId position, const QgsPointV2 &vertex)=0
Inserts a vertex into the geometry. 
 
virtual bool isClosed() const 
Returns true if the curve is closed. 
 
virtual bool addZValue(double zValue=0) override
Adds a z-dimension to the geometry, initialized to a preset value. 
 
virtual QString asWkt(int precision=17) const =0
Returns a WKT representation of the geometry. 
 
virtual bool fromWkb(QgsConstWkbPtr wkb) override
Sets the geometry from a WKB string. 
 
static Type flatType(Type type)
Returns the flat type for a WKB type. 
 
virtual bool dropZValue() override
Drops any z-dimensions which exist in the geometry. 
 
virtual void drawAsPolygon(QPainter &p) const =0
Draws the curve as a polygon on the specified QPainter. 
 
static Type parseType(const QString &wktStr)
Attempts to extract the WKB type from a WKT string. 
 
QgsAbstractGeometryV2 * segmentize() const override
Returns a version of the geometry without curves. 
 
double ANALYSIS_EXPORT leftOf(Point3D *thepoint, Point3D *p1, Point3D *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. 
 
virtual QgsPointV2 vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id. 
 
Curve polygon geometry type. 
 
virtual QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const =0
Returns a GML2 representation of the geometry. 
 
const_iterator constEnd() const
 
int numInteriorRings() const 
 
const_iterator constBegin() const
 
Abstract base class for curved geometry type. 
 
virtual bool moveVertex(QgsVertexId position, const QgsPointV2 &newPos)=0
Moves a vertex within the geometry. 
 
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
 
QDomElement asGML3(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML3 representation of the geometry. 
 
virtual void points(QgsPointSequenceV2 &pt) const =0
Returns a list of points within the curve. 
 
virtual int vertexCount(int part=0, int ring=0) const override
 
virtual double area() const override
Returns the area of the geometry. 
 
virtual QgsRectangle boundingBox() const override
Returns the minimal bounding box for the geometry. 
 
QList< QgsPointV2 > QgsPointSequenceV2
 
virtual QgsPointV2 vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id. 
 
QgsCurveV2 * mExteriorRing