76 const QString trimmed = text.trimmed();
77 std::unique_ptr< QgsAbstractGeometry> geom;
78 if ( trimmed.startsWith( QLatin1String(
"Point" ), Qt::CaseInsensitive ) )
80 geom = std::make_unique< QgsPoint >();
82 else if ( trimmed.startsWith( QLatin1String(
"LineString" ), Qt::CaseInsensitive ) )
84 geom = std::make_unique< QgsLineString >();
86 else if ( trimmed.startsWith( QLatin1String(
"CircularString" ), Qt::CaseInsensitive ) )
88 geom = std::make_unique< QgsCircularString >();
90 else if ( trimmed.startsWith( QLatin1String(
"CompoundCurve" ), Qt::CaseInsensitive ) )
92 geom = std::make_unique< QgsCompoundCurve>();
94 else if ( trimmed.startsWith( QLatin1String(
"Polygon" ), Qt::CaseInsensitive ) )
96 geom = std::make_unique< QgsPolygon >();
98 else if ( trimmed.startsWith( QLatin1String(
"Triangle" ), Qt::CaseInsensitive ) )
100 geom = std::make_unique< QgsTriangle >();
102 else if ( trimmed.startsWith( QLatin1String(
"CurvePolygon" ), Qt::CaseInsensitive ) )
104 geom = std::make_unique< QgsCurvePolygon >();
106 else if ( trimmed.startsWith( QLatin1String(
"MultiPoint" ), Qt::CaseInsensitive ) )
108 geom = std::make_unique< QgsMultiPoint >();
110 else if ( trimmed.startsWith( QLatin1String(
"MultiCurve" ), Qt::CaseInsensitive ) )
112 geom = std::make_unique< QgsMultiCurve >();
114 else if ( trimmed.startsWith( QLatin1String(
"MultiLineString" ), Qt::CaseInsensitive ) )
116 geom = std::make_unique< QgsMultiLineString >();
118 else if ( trimmed.startsWith( QLatin1String(
"MultiSurface" ), Qt::CaseInsensitive ) )
120 geom = std::make_unique< QgsMultiSurface >();
122 else if ( trimmed.startsWith( QLatin1String(
"MultiPolygon" ), Qt::CaseInsensitive ) )
124 geom = std::make_unique< QgsMultiPolygon >();
126 else if ( trimmed.startsWith( QLatin1String(
"GeometryCollection" ), Qt::CaseInsensitive ) )
128 geom = std::make_unique< QgsGeometryCollection >();
130 else if ( trimmed.startsWith( QLatin1String(
"PolyhedralSurface" ), Qt::CaseInsensitive ) )
132 geom = std::make_unique< QgsPolyhedralSurface >();
134 else if ( trimmed.startsWith( QLatin1String(
"TIN" ), Qt::CaseInsensitive ) )
136 geom = std::make_unique< QgsTriangulatedSurface >();
141 if ( !geom->fromWkt( text ) )
185 std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >();
187 QVector<QgsCurve *> holes;
188 holes.reserve( polygon.size() );
189 for (
int i = 0; i < polygon.size(); ++i )
191 std::unique_ptr< QgsLineString > l = linestringFromPolyline( polygon.at( i ) );
196 poly->setExteriorRing( l.release() );
200 holes.push_back( l.release() );
203 poly->setInteriorRings( holes );
244 return std::make_unique< QgsPoint >();
246 return std::make_unique< QgsLineString >();
248 return std::make_unique< QgsCircularString >();
250 return std::make_unique< QgsCompoundCurve >();
252 return std::make_unique< QgsPolygon >();
254 return std::make_unique< QgsCurvePolygon >();
256 return std::make_unique< QgsMultiLineString >();
258 return std::make_unique< QgsMultiPolygon >();
260 return std::make_unique< QgsMultiPoint >();
262 return std::make_unique< QgsMultiCurve >();
264 return std::make_unique< QgsMultiSurface >();
266 return std::make_unique< QgsGeometryCollection >();
268 return std::make_unique< QgsTriangle >();
270 return std::make_unique< QgsPolyhedralSurface >();
272 return std::make_unique< QgsTriangulatedSurface >();