Skip to content

Commit 3de6b9d

Browse files
author
mhugent
committedAug 31, 2009
Apply coordinate clipping also for windows (probably fixes bug #1344)
git-svn-id: http://svn.osgeo.org/qgis/trunk@11532 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3c9298e commit 3de6b9d

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed
 

‎src/core/qgsvectorlayer.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@
7171
#include "qgsvectoroverlay.h"
7272
#include "qgslogger.h"
7373
#include "qgsmaplayerregistry.h"
74-
75-
#ifdef Q_WS_X11
7674
#include "qgsclipper.h"
77-
#endif
7875

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

381378
transformPoints( x, y, z, renderContext );
382379

383-
#if defined(Q_WS_X11)
384-
// Work around a +/- 32768 limitation on coordinates in X11
385-
380+
// Work around a +/- 32768 limitation on coordinates
386381
// Look through the x and y coordinates and see if there are any
387382
// that need trimming. If one is found, there's no need to look at
388383
// the rest of them so end the loop at that point.
@@ -396,7 +391,6 @@ unsigned char *QgsVectorLayer::drawLineString( unsigned char *feature, QgsRender
396391
break;
397392
}
398393
}
399-
#endif
400394

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

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

515-
#if defined(Q_WS_X11)
516-
// Work around a +/- 32768 limitation on coordinates in X11
517-
509+
// Work around a +/- 32768 limitation on coordinates
518510
// Look through the x and y coordinates and see if there are any
519511
// that need trimming. If one is found, there's no need to look at
520512
// the rest of them so end the loop at that point.
@@ -527,7 +519,6 @@ unsigned char *QgsVectorLayer::drawPolygon( unsigned char *feature, QgsRenderCon
527519
break;
528520
}
529521
}
530-
#endif
531522

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

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

35033492
transformPoint( x, y, &renderContext.mapToPixel(), renderContext.coordinateTransform() );
3493+
if ( std::abs( x ) > QgsClipper::MAX_X ||
3494+
std::abs( y ) > QgsClipper::MAX_Y )
3495+
{
3496+
break;
3497+
}
3498+
35043499
//QPointF pt(x - (marker->width()/2), y - (marker->height()/2));
35053500
QPointF pt( x*renderContext.rasterScaleFactor() - ( marker->width() / 2 ),
35063501
y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
@@ -3542,13 +3537,11 @@ void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
35423537
y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
35433538
//QPointF pt( x, y );
35443539

3545-
#if defined(Q_WS_X11)
3546-
// Work around a +/- 32768 limitation on coordinates in X11
3540+
// Work around a +/- 32768 limitation on coordinates
35473541
if ( std::abs( x ) > QgsClipper::MAX_X ||
35483542
std::abs( y ) > QgsClipper::MAX_Y )
35493543
needToTrim = true;
35503544
else
3551-
#endif
35523545
p->drawImage( pt, *marker );
35533546
}
35543547
p->restore();

0 commit comments

Comments
 (0)
Please sign in to comment.