77 const QString trimmed = text.trimmed();
78 std::unique_ptr< QgsAbstractGeometry> geom;
79 if ( trimmed.startsWith( QLatin1String(
"Point" ), Qt::CaseInsensitive ) )
81 geom = std::make_unique< QgsPoint >();
83 else if ( trimmed.startsWith( QLatin1String(
"LineString" ), Qt::CaseInsensitive ) )
85 geom = std::make_unique< QgsLineString >();
87 else if ( trimmed.startsWith( QLatin1String(
"CircularString" ), Qt::CaseInsensitive ) )
89 geom = std::make_unique< QgsCircularString >();
91 else if ( trimmed.startsWith( QLatin1String(
"CompoundCurve" ), Qt::CaseInsensitive ) )
93 geom = std::make_unique< QgsCompoundCurve>();
95 else if ( trimmed.startsWith( QLatin1String(
"Polygon" ), Qt::CaseInsensitive ) )
97 geom = std::make_unique< QgsPolygon >();
99 else if ( trimmed.startsWith( QLatin1String(
"Triangle" ), Qt::CaseInsensitive ) )
101 geom = std::make_unique< QgsTriangle >();
103 else if ( trimmed.startsWith( QLatin1String(
"CurvePolygon" ), Qt::CaseInsensitive ) )
105 geom = std::make_unique< QgsCurvePolygon >();
107 else if ( trimmed.startsWith( QLatin1String(
"MultiPoint" ), Qt::CaseInsensitive ) )
109 geom = std::make_unique< QgsMultiPoint >();
111 else if ( trimmed.startsWith( QLatin1String(
"MultiCurve" ), Qt::CaseInsensitive ) )
113 geom = std::make_unique< QgsMultiCurve >();
115 else if ( trimmed.startsWith( QLatin1String(
"MultiLineString" ), Qt::CaseInsensitive ) )
117 geom = std::make_unique< QgsMultiLineString >();
119 else if ( trimmed.startsWith( QLatin1String(
"MultiSurface" ), Qt::CaseInsensitive ) )
121 geom = std::make_unique< QgsMultiSurface >();
123 else if ( trimmed.startsWith( QLatin1String(
"MultiPolygon" ), Qt::CaseInsensitive ) )
125 geom = std::make_unique< QgsMultiPolygon >();
127 else if ( trimmed.startsWith( QLatin1String(
"GeometryCollection" ), Qt::CaseInsensitive ) )
129 geom = std::make_unique< QgsGeometryCollection >();
131 else if ( trimmed.startsWith( QLatin1String(
"PolyhedralSurface" ), Qt::CaseInsensitive ) )
133 geom = std::make_unique< QgsPolyhedralSurface >();
135 else if ( trimmed.startsWith( QLatin1String(
"TIN" ), Qt::CaseInsensitive ) )
137 geom = std::make_unique< QgsTriangulatedSurface >();
142 if ( !geom->fromWkt( text ) )
186 auto poly = std::make_unique< QgsPolygon >();
188 QVector<QgsCurve *> holes;
189 holes.reserve( polygon.size() );
190 for (
int i = 0; i < polygon.size(); ++i )
192 std::unique_ptr< QgsLineString > l = linestringFromPolyline( polygon.at( i ) );
197 poly->setExteriorRing( l.release() );
201 holes.push_back( l.release() );
204 poly->setInteriorRings( holes );
245 return std::make_unique< QgsPoint >();
247 return std::make_unique< QgsLineString >();
249 return std::make_unique< QgsCircularString >();
251 return std::make_unique< QgsCompoundCurve >();
253 return std::make_unique< QgsPolygon >();
255 return std::make_unique< QgsCurvePolygon >();
257 return std::make_unique< QgsMultiLineString >();
259 return std::make_unique< QgsMultiPolygon >();
261 return std::make_unique< QgsMultiPoint >();
263 return std::make_unique< QgsMultiCurve >();
265 return std::make_unique< QgsMultiSurface >();
267 return std::make_unique< QgsGeometryCollection >();
269 return std::make_unique< QgsTriangle >();
271 return std::make_unique< QgsPolyhedralSurface >();
273 return std::make_unique< QgsTriangulatedSurface >();