@@ -423,20 +423,22 @@ QgsRect QgsVectorLayer::inverseProjectRect(const QgsRect& r) const
423423}
424424
425425unsigned char * QgsVectorLayer::drawLineString (unsigned char * feature,
426- bool hasZValue,
427426 QPainter* p,
428427 QgsMapToPixel* mtp,
429428 bool projectionsEnabledFlag,
430429 bool drawingToEditingCanvas)
431430{
432431 unsigned char *ptr = feature + 5 ;
432+ unsigned int wkbType = *((int *)(feature+1 ));
433433 unsigned int nPoints = *((int *)ptr);
434434 ptr = feature + 9 ;
435+
436+ bool hasZValue = (wkbType == QGis::WKBLineString25D);
435437
436438 std::vector<double > x (nPoints);
437439 std::vector<double > y (nPoints);
438440 std::vector<double > z (nPoints, 0.0 );
439-
441+
440442 // Extract the points from the WKB format into the x and y vectors.
441443 for (register unsigned int i = 0 ; i < nPoints; ++i)
442444 {
@@ -523,7 +525,6 @@ unsigned char* QgsVectorLayer::drawLineString(unsigned char* feature,
523525}
524526
525527unsigned char * QgsVectorLayer::drawPolygon (unsigned char * feature,
526- bool hasZValue,
527528 QPainter* p,
528529 QgsMapToPixel* mtp,
529530 bool projectionsEnabledFlag,
@@ -539,6 +540,10 @@ unsigned char* QgsVectorLayer::drawPolygon(unsigned char* feature,
539540 if ( numRings == 0 ) // sanity check for zero rings in polygon
540541 return feature + 9 ;
541542
543+ unsigned int wkbType = *((int *)(feature+1 ));
544+
545+ bool hasZValue = (wkbType == QGis::WKBPolygon25D);
546+
542547 int total_points = 0 ;
543548
544549 // A vector containing a pointer to a pair of double vectors.The
@@ -3413,7 +3418,6 @@ void QgsVectorLayer::drawFeature(QPainter* p,
34133418 case QGis::WKBLineString25D:
34143419 {
34153420 drawLineString (feature,
3416- (wkbType == QGis::WKBLineString25D),
34173421 p,
34183422 theMapToPixelTransform,
34193423 projectionsEnabledFlag,
@@ -3426,11 +3430,10 @@ void QgsVectorLayer::drawFeature(QPainter* p,
34263430 unsigned char * ptr = feature + 5 ;
34273431 unsigned int numLineStrings = *((int *)ptr);
34283432 ptr = feature + 9 ;
3429-
3433+
34303434 for (register unsigned int jdx = 0 ; jdx < numLineStrings; jdx++)
34313435 {
34323436 ptr = drawLineString (ptr,
3433- (wkbType == QGis::WKBMultiLineString25D),
34343437 p,
34353438 theMapToPixelTransform,
34363439 projectionsEnabledFlag,
@@ -3442,7 +3445,6 @@ void QgsVectorLayer::drawFeature(QPainter* p,
34423445 case QGis::WKBPolygon25D:
34433446 {
34443447 drawPolygon (feature,
3445- (wkbType == QGis::WKBPolygon25D),
34463448 p,
34473449 theMapToPixelTransform,
34483450 projectionsEnabledFlag,
@@ -3457,7 +3459,6 @@ void QgsVectorLayer::drawFeature(QPainter* p,
34573459 ptr = feature + 9 ;
34583460 for (register unsigned int kdx = 0 ; kdx < numPolygons; kdx++)
34593461 ptr = drawPolygon (ptr,
3460- (wkbType == QGis::WKBMultiPolygon25D),
34613462 p,
34623463 theMapToPixelTransform,
34633464 projectionsEnabledFlag,
0 commit comments