137 QStringList coordinates = parts.second.split(
' ', QString::SkipEmptyParts );
138 if ( coordinates.
size() < 2 )
158 mX = coordinates[idx++].toDouble();
159 mY = coordinates[idx++].toDouble();
161 mZ = coordinates[idx++].toDouble();
163 mM = coordinates[idx++].toDouble();
170 int size =
sizeof( char ) +
sizeof( quint32 );
184 unsigned char* geomPtr =
new unsigned char[binarySize];
187 wkb << static_cast<quint32>(
wkbType() );
244 return "{\"type\": \"Point\", \"coordinates\": [" 257 mX = mY = mZ = mM = 0.;
285 Q_UNUSED( position );
363 t.
map( mX, mY, &x, &y );
virtual bool fromWkb(QgsConstWkbPtr wkb) override
Sets the geometry from a WKB string.
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
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 asGML3(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML3 representation of the geometry.
QDomNode appendChild(const QDomNode &newChild)
double x() const
Returns the point's x-coordinate.
void transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform) override
Transforms the geometry using a coordinate transform.
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.
Abstract base class for all geometries.
void draw(QPainter &p) const override
Draws the geometry using the specified QPainter.
bool operator==(const QgsPointV2 &pt) const
QDomElement createElementNS(const QString &nsURI, const QString &qName)
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
bool operator!=(const QgsPointV2 &pt) const
static endian_t endian()
Returns whether this machine uses big or little endian.
virtual bool moveVertex(QgsVertexId position, const QgsPointV2 &newPos) override
Moves a vertex within the geometry.
QString wktTypeStr() const
Returns the WKT type string of the geometry.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const override
Returns next vertex id and coordinates.
double y() const
Returns the point's y-coordinate.
QgsWKBTypes::Type readHeader() const
void drawRect(const QRectF &rectangle)
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
virtual QString geometryType() const override
Returns a unique string representing the geometry type.
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.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
QgsPointV2(double x=0.0, double y=0.0)
Construct a 2 dimensional point with an initial x and y coordinate.
static double sqrDistance2D(const QgsPointV2 &pt1, const QgsPointV2 &pt2)
Returns the squared 2D distance between two points.
Utility class for identifying a unique vertex within a geometry.
bool isMeasure() const
Returns true if the geometry contains m values.
double z() const
Returns the point's z-coordinate.
void setAttribute(const QString &name, const QString &value)
void clear() override
Clears the geometry, ie reset it to a null geometry.
Point geometry type, with support for z-dimension and m-values.
QString qgsDoubleToString(double a, int precision=17)
QgsWKBTypes::Type mWkbType
virtual QgsPointV2 * clone() const override
Clones the geometry by performing a deep copy.
virtual bool dropMValue() override
Drops any measure values which exist in the geometry.
QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML2 representation of the geometry.
virtual bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
bool convertTo(QgsWKBTypes::Type type) override
Converts the geometry to a specified type.
QPointF toQPointF() const
Returns the point as a QPointF.
A class to represent a point.
QList< QgsPointSequenceV2 > QgsRingSequenceV2
QDomText createTextNode(const QString &value)
virtual bool addMValue(double mValue=0) override
Adds a measure to the geometry, initialized to a preset value.
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.
static Type dropM(Type type)
Drops the m dimension (if present) for a WKB type and returns the new type.
virtual bool addZValue(double zValue=0) override
Adds a z-dimension to the geometry, initialized to a preset value.
QString asWkt(int precision=17) const override
Returns a WKT representation of the geometry.
unsigned char * asWkb(int &binarySize) const override
Returns a WKB representation of the geometry.
QString asJSON(int precision=17) const override
Returns a GeoJSON representation of the geometry.
double m() const
Returns the point's m value.
virtual void clearCache() const
Clears any cached parameters associated with the geometry, eg bounding boxes.
static Type flatType(Type type)
Returns the flat type for a WKB type.
static Type parseType(const QString &wktStr)
Attempts to extract the WKB type from a WKT string.
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 bool dropZValue() override
Drops any z-dimensions which exist in the geometry.
virtual QgsCoordinateSequenceV2 coordinateSequence() const override
Retrieves the sequence of geometries, rings and nodes.
int wkbSize() const override
Returns the size of the WKB representation of the geometry.
QList< QgsPointV2 > QgsPointSequenceV2