@@ -73,52 +73,53 @@ QgsAbstractGeometry* QgsGeometryFactory::geomFromWkb( QgsConstWkbPtr& wkbPtr )
7373
7474QgsAbstractGeometry* QgsGeometryFactory::geomFromWkt ( const QString& text )
7575{
76+ QString trimmed = text.trimmed ();
7677 QgsAbstractGeometry* geom = nullptr ;
77- if ( text .startsWith ( QLatin1String ( " Point" ), Qt::CaseInsensitive ) )
78+ if ( trimmed .startsWith ( QLatin1String ( " Point" ), Qt::CaseInsensitive ) )
7879 {
7980 geom = new QgsPointV2 ();
8081 }
81- else if ( text .startsWith ( QLatin1String ( " LineString" ), Qt::CaseInsensitive ) )
82+ else if ( trimmed .startsWith ( QLatin1String ( " LineString" ), Qt::CaseInsensitive ) )
8283 {
8384 geom = new QgsLineString ();
8485 }
85- else if ( text .startsWith ( QLatin1String ( " CircularString" ), Qt::CaseInsensitive ) )
86+ else if ( trimmed .startsWith ( QLatin1String ( " CircularString" ), Qt::CaseInsensitive ) )
8687 {
8788 geom = new QgsCircularString ();
8889 }
89- else if ( text .startsWith ( QLatin1String ( " CompoundCurve" ) , Qt::CaseInsensitive ) )
90+ else if ( trimmed .startsWith ( QLatin1String ( " CompoundCurve" ) , Qt::CaseInsensitive ) )
9091 {
9192 geom = new QgsCompoundCurve ();
9293 }
93- else if ( text .startsWith ( QLatin1String ( " Polygon" ), Qt::CaseInsensitive ) )
94+ else if ( trimmed .startsWith ( QLatin1String ( " Polygon" ), Qt::CaseInsensitive ) )
9495 {
9596 geom = new QgsPolygonV2 ();
9697 }
97- else if ( text .startsWith ( QLatin1String ( " CurvePolygon" ), Qt::CaseInsensitive ) )
98+ else if ( trimmed .startsWith ( QLatin1String ( " CurvePolygon" ), Qt::CaseInsensitive ) )
9899 {
99100 geom = new QgsCurvePolygon ();
100101 }
101- else if ( text .startsWith ( QLatin1String ( " MultiPoint" ), Qt::CaseInsensitive ) )
102+ else if ( trimmed .startsWith ( QLatin1String ( " MultiPoint" ), Qt::CaseInsensitive ) )
102103 {
103104 geom = new QgsMultiPointV2 ();
104105 }
105- else if ( text .startsWith ( QLatin1String ( " MultiCurve" ), Qt::CaseInsensitive ) )
106+ else if ( trimmed .startsWith ( QLatin1String ( " MultiCurve" ), Qt::CaseInsensitive ) )
106107 {
107108 geom = new QgsMultiCurve ();
108109 }
109- else if ( text .startsWith ( QLatin1String ( " MultiLineString" ), Qt::CaseInsensitive ) )
110+ else if ( trimmed .startsWith ( QLatin1String ( " MultiLineString" ), Qt::CaseInsensitive ) )
110111 {
111112 geom = new QgsMultiLineString ();
112113 }
113- else if ( text .startsWith ( QLatin1String ( " MultiSurface" ), Qt::CaseInsensitive ) )
114+ else if ( trimmed .startsWith ( QLatin1String ( " MultiSurface" ), Qt::CaseInsensitive ) )
114115 {
115116 geom = new QgsMultiSurface ();
116117 }
117- else if ( text .startsWith ( QLatin1String ( " MultiPolygon" ), Qt::CaseInsensitive ) )
118+ else if ( trimmed .startsWith ( QLatin1String ( " MultiPolygon" ), Qt::CaseInsensitive ) )
118119 {
119120 geom = new QgsMultiPolygonV2 ();
120121 }
121- else if ( text .startsWith ( QLatin1String ( " GeometryCollection" ), Qt::CaseInsensitive ) )
122+ else if ( trimmed .startsWith ( QLatin1String ( " GeometryCollection" ), Qt::CaseInsensitive ) )
122123 {
123124 geom = new QgsGeometryCollection ();
124125 }
0 commit comments