Skip to content
Permalink
Browse files

Speed up WKB conversion to linestrings

  • Loading branch information
nyalldawson committed May 25, 2018
1 parent cb4d117 commit c73262d572ba2bf62121f19bd6aa0c60ee3b6a32
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/core/geometry/qgslinestring.cpp
@@ -1123,17 +1123,21 @@ void QgsLineString::importVerticesFromWkb( const QgsConstWkbPtr &wkb )
mY.resize( nVertices );
hasZ ? mZ.resize( nVertices ) : mZ.clear();
hasM ? mM.resize( nVertices ) : mM.clear();
double *x = mX.data();
double *y = mY.data();
double *m = hasM ? mM.data() : nullptr;
double *z = hasZ ? mZ.data() : nullptr;
for ( int i = 0; i < nVertices; ++i )
{
wkb >> mX[i];
wkb >> mY[i];
wkb >> *x++;
wkb >> *y++;
if ( hasZ )
{
wkb >> mZ[i];
wkb >> *z++;
}
if ( hasM )
{
wkb >> mM[i];
wkb >> *m++;
}
}
clearCache(); //set bounding box invalid

0 comments on commit c73262d

Please sign in to comment.
You can’t perform that action at this time.