Skip to content

Commit

Permalink
Apply coordinate clipping also for windows (probably fixes bug #1344)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11532 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 31, 2009
1 parent c91177b commit 7fb3286
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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.
Expand All @@ -396,7 +391,6 @@ unsigned char *QgsVectorLayer::drawLineString( unsigned char *feature, QgsRender
break;
}
}
#endif

// set up QPolygonF class with transformed points
QPolygonF pa( nPoints );
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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();
Expand All @@ -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 ) );
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 7fb3286

Please sign in to comment.