QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsgeometryfactory.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometryfactory.h
3 -----------------------
4 begin : September 2014
5 copyright : (C) 2014 by Marco Hugentobler
6 email : marco at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSGEOMETRYFACTORY_H
19#define QGSGEOMETRYFACTORY_H
20
21#define SIP_NO_FILE
22
23#include "qgis_core.h"
24#include "qgswkbtypes.h"
25#include <QString>
26#include <memory>
27
29class QgsLineString;
30class QgsConstWkbPtr;
31class QgsRectangle;
33class QgsMultiPoint;
35class QgsPolygon;
36class QgsMultiPolygon;
37
38//compatibility with old classes
39#include "qgspointxy.h"
40typedef QVector<QgsPointXY> QgsPolylineXY;
41typedef QVector<QgsPolylineXY> QgsPolygonXY;
42typedef QVector<QgsPointXY> QgsMultiPointXY;
43typedef QVector<QgsPolylineXY> QgsMultiPolylineXY;
44typedef QVector<QgsPolygonXY> QgsMultiPolygonXY;
45
52class CORE_EXPORT QgsGeometryFactory
53{
54 public:
55
60 static std::unique_ptr< QgsAbstractGeometry > geomFromWkb( QgsConstWkbPtr &wkb );
61
65 static std::unique_ptr< QgsAbstractGeometry > geomFromWkt( const QString &text );
66
68 static std::unique_ptr< QgsAbstractGeometry > fromPointXY( const QgsPointXY &point );
70 static std::unique_ptr<QgsMultiPoint> fromMultiPointXY( const QgsMultiPointXY &multipoint );
72 static std::unique_ptr< QgsAbstractGeometry > fromPolylineXY( const QgsPolylineXY &polyline );
74 static std::unique_ptr<QgsMultiLineString> fromMultiPolylineXY( const QgsMultiPolylineXY &multiline );
76 static std::unique_ptr<QgsPolygon> fromPolygonXY( const QgsPolygonXY &polygon );
78 static std::unique_ptr<QgsMultiPolygon> fromMultiPolygonXY( const QgsMultiPolygonXY &multipoly );
80 static std::unique_ptr< QgsAbstractGeometry > geomFromWkbType( Qgis::WkbType t );
81
86 static std::unique_ptr< QgsGeometryCollection > createCollectionOfType( Qgis::WkbType type );
87
88 private:
89 static std::unique_ptr< QgsLineString > linestringFromPolyline( const QgsPolylineXY &polyline );
90};
91
92#endif // QGSGEOMETRYFACTORY_H
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
Abstract base class for all geometries.
A const WKB pointer.
Definition qgswkbptr.h:138
Contains geometry creation routines.
Line string geometry type, with support for z-dimension and m-values.
Multi line string geometry collection.
Multi point geometry collection.
Multi polygon geometry collection.
A class to represent a 2D point.
Definition qgspointxy.h:60
Polygon geometry type.
Definition qgspolygon.h:33
A rectangle specified with double values.
QVector< QgsPolylineXY > QgsPolygonXY
QVector< QgsPolylineXY > QgsMultiPolylineXY
QVector< QgsPointXY > QgsMultiPointXY
QVector< QgsPointXY > QgsPolylineXY
QVector< QgsPolygonXY > QgsMultiPolygonXY