29 return QStringLiteral(
"MultiPoint" );
34 auto result = qgis::make_unique< QgsMultiPoint >();
36 return result.release();
51 QString collectionWkt( wkt );
53 QRegExp regex(
"^\\s*MultiPoint\\s*[ZM]*\\s*\\(\\s*[-\\d]" );
54 regex.setCaseSensitivity( Qt::CaseInsensitive );
55 if ( regex.indexIn( collectionWkt ) >= 0 )
58 collectionWkt.replace(
'(', QLatin1String(
"((" ) ).replace(
')', QLatin1String(
"))" ) ).replace(
',', QLatin1String(
"),(" ) );
72 QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral(
"MultiPoint" ) );
75 return elemMultiPoint;
79 if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
81 QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral(
"pointMember" ) );
82 elemPointMember.appendChild( geom->asGml2( doc, precision, ns, axisOrder ) );
83 elemMultiPoint.appendChild( elemPointMember );
87 return elemMultiPoint;
92 QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral(
"MultiPoint" ) );
95 return elemMultiPoint;
99 if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
101 QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral(
"pointMember" ) );
102 elemPointMember.appendChild( geom->asGml3( doc, precision, ns, axisOrder ) );
103 elemMultiPoint.appendChild( elemPointMember );
107 return elemMultiPoint;
112 QString json = QStringLiteral(
"{\"type\": \"MultiPoint\", \"coordinates\": " );
117 if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
124 json += QLatin1String(
" }" );
135 if ( !qgsgeometry_cast<QgsPoint *>( g ) )
174 if (
id.part < 0 || id.part >=
mGeometries.count() ||
id.vertex != 0 ||
id.ring != 0 )
190 if (
const QgsPoint *point = qgsgeometry_cast< const QgsPoint * >( part ) )
192 return !filter( *point );
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
bool isMeasure() const
Returns true if the geometry contains m values.
static QString pointsToJSON(const QgsPointSequence &points, int precision)
Returns a geoJSON coordinates string.
QgsMultiPoint * clone() const override
Clones the geometry by performing a deep copy.
void clear() override
Clears the geometry, ie reset it to a null geometry.
bool insertGeometry(QgsAbstractGeometry *g, int index) override
Inserts a geometry before a specified index and takes ownership.
void filterVertices(const std::function< bool(const QgsPoint &) > &filter) override
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
Multi point geometry collection.
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
QgsWkbTypes::Type mWkbType
virtual bool insertGeometry(QgsAbstractGeometry *g, int index)
Inserts a geometry before a specified index and takes ownership.
bool isEmpty() const override
Returns true if the geometry is empty.
QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", QgsAbstractGeometry::AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML3 representation of the geometry.
Utility class for identifying a unique vertex within a geometry.
void setZMTypeFromSubGeometry(const QgsAbstractGeometry *subggeom, QgsWkbTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
Abstract base class for all geometries.
QString asJson(int precision=17) const override
Returns a GeoJSON representation of the geometry.
QgsWkbTypes::Type wkbType() const
Returns the WKB type of the geometry.
Point geometry type, with support for z-dimension and m-values.
bool fromCollectionWkt(const QString &wkt, const QVector< QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType=QString())
Reads a collection from a WKT string.
AxisOrder
Axis order for GML generation.
QgsMultiPoint * toCurveType() const override
Returns the geometry converted to the more generic curve type.
QVector< QgsPoint > QgsPointSequence
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
QVector< QgsAbstractGeometry *> mGeometries
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
int vertexNumberFromVertexId(QgsVertexId id) const override
Returns the vertex number corresponding to a vertex id.
double segmentLength(QgsVertexId startVertex) const override
Returns the length of the segment of the geometry which begins at startVertex.
bool wktOmitChildType() const override
Returns whether child type names are omitted from Wkt representations of the collection.
QgsMultiPoint * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership...
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
QString geometryType() const override
Returns a unique string representing the geometry type.
int nCoordinates() const override
Returns the number of nodes contained in the geometry.
static Type flatType(Type type)
Returns the flat type for a WKB type.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
QDomElement asGml2(QDomDocument &doc, int precision=17, const QString &ns="gml", QgsAbstractGeometry::AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML2 representation of the geometry.
virtual bool addGeometry(QgsAbstractGeometry *g)
Adds a geometry and takes ownership. Returns true in case of success.
void clear() override
Clears the geometry, ie reset it to a null geometry.