@@ -64,6 +64,7 @@ bool QgsPointV2::fromWkb( const unsigned char* wkb )
64
64
QgsWKBTypes::Type type = wkbPtr.readHeader ();
65
65
if ( QgsWKBTypes::flatType ( type ) != QgsWKBTypes::Point )
66
66
{
67
+ clear ();
67
68
return false ;
68
69
}
69
70
mWkbType = type;
@@ -75,6 +76,8 @@ bool QgsPointV2::fromWkb( const unsigned char* wkb )
75
76
if ( isMeasure () )
76
77
wkbPtr >> mM ;
77
78
79
+ mBoundingBox = QgsRectangle ();
80
+
78
81
return true ;
79
82
}
80
83
@@ -88,8 +91,8 @@ bool QgsPointV2::fromWkt( const QString& wkt )
88
91
return false ;
89
92
mWkbType = parts.first ;
90
93
91
- QStringList coordinates = parts.second .split ( " " , QString::SkipEmptyParts );
92
- if ( coordinates.size () < 2 + is3D () + isMeasure () )
94
+ QStringList coordinates = parts.second .split ( ' ' , QString::SkipEmptyParts );
95
+ if ( coordinates.size () < 2 )
93
96
{
94
97
clear ();
95
98
return false ;
@@ -111,9 +114,9 @@ bool QgsPointV2::fromWkt( const QString& wkt )
111
114
int idx = 0 ;
112
115
mX = coordinates[idx++].toDouble ();
113
116
mY = coordinates[idx++].toDouble ();
114
- if ( is3D () )
117
+ if ( is3D () && coordinates. length () > 2 )
115
118
mZ = coordinates[idx++].toDouble ();
116
- if ( isMeasure () )
119
+ if ( isMeasure () && coordinates. length () > 2 + is3D () )
117
120
mM = coordinates[idx++].toDouble ();
118
121
119
122
return true ;
@@ -197,10 +200,12 @@ void QgsPointV2::clear()
197
200
{
198
201
mWkbType = QgsWKBTypes::Unknown;
199
202
mX = mY = mZ = mM = 0 .;
203
+ mBoundingBox = QgsRectangle ();
200
204
}
201
205
202
206
void QgsPointV2::transform ( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d )
203
207
{
208
+ mBoundingBox = QgsRectangle ();
204
209
ct.transformInPlace ( mX , mY , mZ , d );
205
210
}
206
211
@@ -215,6 +220,7 @@ void QgsPointV2::coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coor
215
220
bool QgsPointV2::moveVertex ( const QgsVertexId& position, const QgsPointV2& newPos )
216
221
{
217
222
Q_UNUSED ( position );
223
+ mBoundingBox = QgsRectangle ();
218
224
mX = newPos.mX ;
219
225
mY = newPos.mY ;
220
226
if ( is3D () && newPos.is3D () )
@@ -225,7 +231,6 @@ bool QgsPointV2::moveVertex( const QgsVertexId& position, const QgsPointV2& newP
225
231
{
226
232
mM = newPos.mM ;
227
233
}
228
- mBoundingBox = QgsRectangle (); // set bounding box invalid
229
234
return true ;
230
235
}
231
236
@@ -279,6 +284,7 @@ bool QgsPointV2::addMValue( double mValue )
279
284
280
285
void QgsPointV2::transform ( const QTransform& t )
281
286
{
287
+ mBoundingBox = QgsRectangle ();
282
288
qreal x, y;
283
289
t.map ( mX , mY , &x, &y );
284
290
mX = x; mY = y;
0 commit comments