Skip to content
Permalink
Browse files

Apply coordinate clipping also for windows (probably fixes bug #1344)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11532 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Aug 31, 2009
1 parent c91177b commit 7fb328619f53b8a494c497948582195d7626dc25
Showing with 9 additions and 16 deletions.
  1. +9 −16 src/core/qgsvectorlayer.cpp
@@ -71,10 +71,7 @@
#include "qgsvectoroverlay.h"
#include "qgslogger.h"
#include "qgsmaplayerregistry.h"

#ifdef Q_WS_X11
#include "qgsclipper.h"
#endif

#ifdef TESTPROVIDERLIB
#include <dlfcn.h>
@@ -380,9 +377,7 @@ unsigned char *QgsVectorLayer::drawLineString( unsigned char *feature, QgsRender

transformPoints( x, y, z, renderContext );

#if defined(Q_WS_X11)
// Work around a +/- 32768 limitation on coordinates in X11

// Work around a +/- 32768 limitation on coordinates
// Look through the x and y coordinates and see if there are any
// that need trimming. If one is found, there's no need to look at
// the rest of them so end the loop at that point.
@@ -396,7 +391,6 @@ unsigned char *QgsVectorLayer::drawLineString( unsigned char *feature, QgsRender
break;
}
}
#endif

// set up QPolygonF class with transformed points
QPolygonF pa( nPoints );
@@ -512,9 +506,7 @@ unsigned char *QgsVectorLayer::drawPolygon( unsigned char *feature, QgsRenderCon

transformPoints( ring->first, ring->second, zVector, renderContext );

#if defined(Q_WS_X11)
// Work around a +/- 32768 limitation on coordinates in X11

// Work around a +/- 32768 limitation on coordinates
// Look through the x and y coordinates and see if there are any
// that need trimming. If one is found, there's no need to look at
// the rest of them so end the loop at that point.
@@ -527,7 +519,6 @@ unsigned char *QgsVectorLayer::drawPolygon( unsigned char *feature, QgsRenderCon
break;
}
}
#endif

// Don't bother keeping the ring if it has been trimmed out of
// existence.
@@ -3483,9 +3474,7 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
// executed, but never used, in a bit of code where performance is
// critical).
if ( ! fet.isValid() ) { return; }
#if defined(Q_WS_X11)
bool needToTrim = false;
#endif

QgsGeometry* geom = fet.geometry();
unsigned char* feature = geom->asWkb();
@@ -3501,6 +3490,12 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
double y = *(( double * )( feature + 5 + sizeof( double ) ) );

transformPoint( x, y, &renderContext.mapToPixel(), renderContext.coordinateTransform() );
if ( std::abs( x ) > QgsClipper::MAX_X ||
std::abs( y ) > QgsClipper::MAX_Y )
{
break;
}

//QPointF pt(x - (marker->width()/2), y - (marker->height()/2));
QPointF pt( x*renderContext.rasterScaleFactor() - ( marker->width() / 2 ),
y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
@@ -3542,13 +3537,11 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
//QPointF pt( x, y );

#if defined(Q_WS_X11)
// Work around a +/- 32768 limitation on coordinates in X11
// Work around a +/- 32768 limitation on coordinates
if ( std::abs( x ) > QgsClipper::MAX_X ||
std::abs( y ) > QgsClipper::MAX_Y )
needToTrim = true;
else
#endif
p->drawImage( pt, *marker );
}
p->restore();

0 comments on commit 7fb3286

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