[QGIS Commit] r13970 - branches/threading-branch/src/core/symbology-ng

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jul 27 07:12:38 EDT 2010


Author: wonder
Date: 2010-07-27 11:12:38 +0000 (Tue, 27 Jul 2010)
New Revision: 13970

Modified:
   branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp
Log:
A bit more efficient conversion of polygons


Modified: branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp
===================================================================
--- branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp	2010-07-27 10:23:35 UTC (rev 13969)
+++ branches/threading-branch/src/core/symbology-ng/qgsrendererv2.cpp	2010-07-27 11:12:38 UTC (rev 13970)
@@ -107,8 +107,21 @@
     unsigned int nPoints = *(( int* )wkb );
     wkb += sizeof( unsigned int );
 
-    QPolygonF poly( nPoints );
+    if ( nPoints == 0 )
+      continue;
 
+    QPointF* data;
+    if ( idx == 0 )
+    {
+      pts.resize( nPoints );
+      data = pts.data();
+    }
+    else
+    {
+      holes.append( QPolygonF( nPoints ) );
+      data = holes.last().data();
+    }
+
     // Extract the points from the WKB and store in a pair of vectors.
     for ( unsigned int jdx = 0; jdx < nPoints; jdx++ )
     {
@@ -120,19 +133,12 @@
         ct->transformInPlace( x, y, z );
       mtp.transformInPlace( x, y );
 
-      poly[jdx] = QPointF( x, y );
+      data[jdx] = QPointF( x, y );
 
       if ( hasZValue )
         wkb += sizeof( double );
     }
 
-    if ( nPoints < 1 )
-      continue;
-
-    if ( idx == 0 )
-      pts = poly;
-    else
-      holes.append( poly );
   }
 
   return wkb;



More information about the QGIS-commit mailing list