Skip to content

Commit c73262d

Browse files
committed
Speed up WKB conversion to linestrings
1 parent cb4d117 commit c73262d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/geometry/qgslinestring.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,17 +1123,21 @@ void QgsLineString::importVerticesFromWkb( const QgsConstWkbPtr &wkb )
11231123
mY.resize( nVertices );
11241124
hasZ ? mZ.resize( nVertices ) : mZ.clear();
11251125
hasM ? mM.resize( nVertices ) : mM.clear();
1126+
double *x = mX.data();
1127+
double *y = mY.data();
1128+
double *m = hasM ? mM.data() : nullptr;
1129+
double *z = hasZ ? mZ.data() : nullptr;
11261130
for ( int i = 0; i < nVertices; ++i )
11271131
{
1128-
wkb >> mX[i];
1129-
wkb >> mY[i];
1132+
wkb >> *x++;
1133+
wkb >> *y++;
11301134
if ( hasZ )
11311135
{
1132-
wkb >> mZ[i];
1136+
wkb >> *z++;
11331137
}
11341138
if ( hasM )
11351139
{
1136-
wkb >> mM[i];
1140+
wkb >> *m++;
11371141
}
11381142
}
11391143
clearCache(); //set bounding box invalid

0 commit comments

Comments
 (0)