mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-18 00:04:02 -04:00
PalLabelling: Reproject geometries before evaluating mininum size
Followup 2b096e09
This commit is contained in:
parent
d53d30d290
commit
385529ef7b
@ -747,12 +747,11 @@ class QgsPalLabeling : QgsLabelingEngineInterface
|
||||
* @param geometry geometry to prepare
|
||||
* @param context render context
|
||||
* @param ct coordinate transform
|
||||
* @param minSize minimum allowable size for feature for registration with PAL
|
||||
* @param clipGeometry geometry to clip features to, if applicable
|
||||
* @returns prepared geometry
|
||||
* @note added in QGIS 2.9
|
||||
*/
|
||||
static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, double minSize = 0, QgsGeometry *clipGeometry = 0 ) /Factory/;
|
||||
static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 ) /Factory/;
|
||||
|
||||
/** Checks whether a geometry requires preparation before registration with PAL
|
||||
* @param geometry geometry to prepare
|
||||
|
@ -1730,24 +1730,25 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
|
||||
}
|
||||
|
||||
const GEOSGeometry* geos_geom = 0;
|
||||
QScopedPointer<QgsGeometry> preparedGeom;
|
||||
const QgsGeometry* preparedGeom = geom;
|
||||
QScopedPointer<QgsGeometry> scpoedPreparedGeom;
|
||||
|
||||
if ( minFeatureSize > 0 && !checkMinimumSizeMM( context, geom, minFeatureSize ) )
|
||||
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, doClip ? extentGeom : 0 ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, doClip ? extentGeom : 0 ) )
|
||||
{
|
||||
preparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, ct, minFeatureSize, doClip ? extentGeom : 0 ) );
|
||||
if ( !preparedGeom.data() )
|
||||
scpoedPreparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, ct, doClip ? extentGeom : 0 ) );
|
||||
if ( !scpoedPreparedGeom.data() )
|
||||
return;
|
||||
geos_geom = preparedGeom.data()->asGeos();
|
||||
preparedGeom = scpoedPreparedGeom.data();
|
||||
geos_geom = scpoedPreparedGeom.data()->asGeos();
|
||||
}
|
||||
else
|
||||
{
|
||||
geos_geom = geom->asGeos();
|
||||
}
|
||||
|
||||
if ( minFeatureSize > 0 && !checkMinimumSizeMM( context, preparedGeom, minFeatureSize ) )
|
||||
return;
|
||||
|
||||
if ( geos_geom == NULL )
|
||||
return; // invalid geometry
|
||||
|
||||
@ -3398,10 +3399,8 @@ QStringList QgsPalLabeling::splitToGraphemes( const QString &text )
|
||||
return graphemes;
|
||||
}
|
||||
|
||||
QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, const QgsRenderContext& context, const QgsCoordinateTransform* ct, double minSize, QgsGeometry* clipGeometry )
|
||||
QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, const QgsRenderContext& context, const QgsCoordinateTransform* ct, QgsGeometry* clipGeometry )
|
||||
{
|
||||
Q_UNUSED( minSize );
|
||||
|
||||
if ( !geometry )
|
||||
{
|
||||
return 0;
|
||||
@ -3562,7 +3561,7 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
|
||||
QScopedPointer<QgsGeometry> preparedGeom;
|
||||
if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, layerIt.value().ct, extentGeom.data() ) )
|
||||
{
|
||||
preparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, layerIt.value().ct, 0, extentGeom.data() ) );
|
||||
preparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, layerIt.value().ct, extentGeom.data() ) );
|
||||
if ( !preparedGeom.data() )
|
||||
return;
|
||||
geos_geom = preparedGeom.data()->asGeos();
|
||||
|
@ -817,12 +817,11 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
|
||||
* @param geometry geometry to prepare
|
||||
* @param context render context
|
||||
* @param ct coordinate transform
|
||||
* @param minSize minimum allowable size for feature for registration with PAL
|
||||
* @param clipGeometry geometry to clip features to, if applicable
|
||||
* @returns prepared geometry
|
||||
* @returns prepared geometry, the caller takes ownership
|
||||
* @note added in QGIS 2.9
|
||||
*/
|
||||
static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, double minSize = 0, QgsGeometry *clipGeometry = 0 );
|
||||
static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, const QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 );
|
||||
|
||||
/** Checks whether a geometry requires preparation before registration with PAL
|
||||
* @param geometry geometry to prepare
|
||||
|
Loading…
x
Reference in New Issue
Block a user