|
58 | 58 | #include <qgsproject.h>
|
59 | 59 | #include "qgssymbolv2.h"
|
60 | 60 | #include "qgssymbollayerv2utils.h"
|
| 61 | +#include "qgsmaptopixelgeometrysimplifier.h" |
61 | 62 | #include <QMessageBox>
|
62 | 63 |
|
63 | 64 |
|
@@ -2422,6 +2423,25 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
2422 | 2423 | return;
|
2423 | 2424 | }
|
2424 | 2425 |
|
| 2426 | + // simplify? |
| 2427 | + const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod(); |
| 2428 | + QScopedPointer<QgsGeometry> scopedClonedGeom; |
| 2429 | + if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() ) |
| 2430 | + { |
| 2431 | + int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope; |
| 2432 | + QgsGeometry* g = new QgsGeometry( *geom ); |
| 2433 | + |
| 2434 | + if ( QgsMapToPixelSimplifier::simplifyGeometry( g, simplifyHints, simplifyMethod.tolerance() ) ) |
| 2435 | + { |
| 2436 | + geom = g; |
| 2437 | + scopedClonedGeom.reset( g ); |
| 2438 | + } |
| 2439 | + else |
| 2440 | + { |
| 2441 | + delete g; |
| 2442 | + } |
| 2443 | + } |
| 2444 | + |
2425 | 2445 | // whether we're going to create a centroid for polygon
|
2426 | 2446 | bool centroidPoly = (( placement == QgsPalLayerSettings::AroundPoint
|
2427 | 2447 | || placement == QgsPalLayerSettings::OverPoint )
|
@@ -2982,6 +3002,25 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte
|
2982 | 3002 | return;
|
2983 | 3003 | }
|
2984 | 3004 |
|
| 3005 | + // simplify? |
| 3006 | + const QgsVectorSimplifyMethod &simplifyMethod = context.vectorSimplifyMethod(); |
| 3007 | + QScopedPointer<QgsGeometry> scopedClonedGeom; |
| 3008 | + if ( simplifyMethod.simplifyHints() != QgsVectorSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() ) |
| 3009 | + { |
| 3010 | + int simplifyHints = simplifyMethod.simplifyHints() | QgsMapToPixelSimplifier::SimplifyEnvelope; |
| 3011 | + QgsGeometry* g = new QgsGeometry( *geom ); |
| 3012 | + |
| 3013 | + if ( QgsMapToPixelSimplifier::simplifyGeometry( g, simplifyHints, simplifyMethod.tolerance() ) ) |
| 3014 | + { |
| 3015 | + geom = g; |
| 3016 | + scopedClonedGeom.reset( g ); |
| 3017 | + } |
| 3018 | + else |
| 3019 | + { |
| 3020 | + delete g; |
| 3021 | + } |
| 3022 | + } |
| 3023 | + |
2985 | 3024 | const GEOSGeometry* geos_geom = nullptr;
|
2986 | 3025 | QScopedPointer<QgsGeometry> scopedPreparedGeom;
|
2987 | 3026 |
|
|
0 commit comments