Skip to content
Permalink
Browse files

Deprecate QgsScaleExpression

Has now been completely replaced by QgsSizeScalePropertyTransformer
  • Loading branch information
nyalldawson committed Feb 14, 2017
1 parent b376ae1 commit 1b5bf1d289bd0c8b0b3fcf1c06d4236ede52f553
@@ -274,6 +274,7 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsProviderCountCalcEvent and QgsProviderExtentCalcEvent. These classes were unused in QGIS core and unmaintained.
- QgsWebviewWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsEditorWidgetConfig was removed. Use QVariantMap instead.
- QgsScaleExpression. Use QgsProperty with a QgsSizeScalePropertyTransformer instead.
- QgsSvgAnnotationItem. Use QgsSvgAnnotation instead.
- QgsSymbologyV2Conversion was removed. Reading of renderers from pre-1.0 versions is not supported anymore.
- QgsTextAnnotationItem. Use QgsTextAnnotation instead.
@@ -131,7 +131,6 @@
%Include qgsrunprocess.sip
%Include qgsruntimeprofiler.sip
%Include qgsscalecalculator.sip
%Include qgsscaleexpression.sip
%Include qgsscaleutils.sip
%Include qgssimplifymethod.sip
%Include qgssnapper.sip

This file was deleted.

@@ -43,7 +43,7 @@ class CORE_EXPORT QgsScaleExpression : public QgsExpression
* to determine whether it's a scale expression
* @param expression expression string
*/
QgsScaleExpression( const QString &expression );
Q_DECL_DEPRECATED QgsScaleExpression( const QString &expression );

/** Constructor for QgsScaleExpression which creates an expression from
* specified parameters
@@ -56,7 +56,7 @@ class CORE_EXPORT QgsScaleExpression : public QgsExpression
* @param nullSize size in case expression evaluates to NULL
* @param exponent to use in case of Exponential type
*/
QgsScaleExpression( Type type, const QString& baseExpression, double minValue, double maxValue, double minSize, double maxSize, double nullSize = 0, double exponent = 1 );
Q_DECL_DEPRECATED QgsScaleExpression( Type type, const QString& baseExpression, double minValue, double maxValue, double minSize, double maxSize, double nullSize = 0, double exponent = 1 );

operator bool() const { return ! mExpression.isEmpty(); }

@@ -793,17 +793,17 @@ QgsLegendSymbolListV2 QgsCategorizedSymbolRenderer::legendSymbolItemsV2() const
return QgsFeatureRenderer::legendSymbolItemsV2();
}

QgsScaleExpression exp( ddSize.asExpression() );
if ( exp.type() != QgsScaleExpression::Unknown )
if ( QgsSizeScaleTransformer* sizeTransformer = dynamic_cast< QgsSizeScaleTransformer* >( ddSize.transformer() ) )
{
QgsLegendSymbolItem title( nullptr, exp.baseExpression(), QLatin1String( "" ) );
QgsLegendSymbolItem title( nullptr, ddSize.propertyType() == QgsProperty::ExpressionBasedProperty ? ddSize.expressionString()
: ddSize.field(), QString() );
lst << title;
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( sizeTransformer->minValue(), sizeTransformer->maxValue(), 4 ) )
{
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QLatin1String( "" ) );
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QString() );
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
s->setDataDefinedSize( QgsProperty() );
s->setSize( exp.size( v ) );
s->setSize( sizeTransformer->size( v ) );
lst << si;
}
// now list the categorized symbols
@@ -1180,17 +1180,17 @@ QgsLegendSymbolListV2 QgsGraduatedSymbolRenderer::legendSymbolItemsV2() const
return QgsFeatureRenderer::legendSymbolItemsV2();
}

QgsScaleExpression exp( ddSize.asExpression() );
if ( exp.type() != QgsScaleExpression::Unknown )
if ( QgsSizeScaleTransformer* sizeTransformer = dynamic_cast< QgsSizeScaleTransformer* >( ddSize.transformer() ) )
{
QgsLegendSymbolItem title( nullptr, exp.baseExpression(), QLatin1String( "" ) );
QgsLegendSymbolItem title( nullptr, ddSize.propertyType() == QgsProperty::ExpressionBasedProperty ? ddSize.expressionString()
: ddSize.field(), QString() );
list << title;
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) )
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( sizeTransformer->minValue(), sizeTransformer->maxValue(), 4 ) )
{
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QLatin1String( "" ) );
QgsLegendSymbolItem si( mSourceSymbol.get(), QString::number( v ), QString() );
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
s->setDataDefinedSize( QgsProperty() );
s->setSize( exp.size( v ) );
s->setSize( sizeTransformer->size( v ) );
list << si;
}
// now list the graduated symbols
@@ -308,17 +308,17 @@ QgsLegendSymbolListV2 QgsSingleSymbolRenderer::legendSymbolItemsV2() const
QgsProperty sizeDD( symbol->dataDefinedSize() );
if ( sizeDD && sizeDD.isActive() && sizeDD.propertyType() == QgsProperty::ExpressionBasedProperty )
{
QgsScaleExpression scaleExp( sizeDD.asExpression() );
if ( scaleExp.type() != QgsScaleExpression::Unknown )
if ( QgsSizeScaleTransformer* sizeTransformer = dynamic_cast< QgsSizeScaleTransformer* >( ddSize.transformer() ) )
{
QgsLegendSymbolItem title( nullptr, scaleExp.baseExpression(), QString() );
QgsLegendSymbolItem title( nullptr, ddSize.propertyType() == QgsProperty::ExpressionBasedProperty ? ddSize.expressionString()
: ddSize.field(), QString() );
lst << title;
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( scaleExp.minValue(), scaleExp.maxValue(), 4 ) )
Q_FOREACH ( double v, QgsSymbolLayerUtils::prettyBreaks( sizeTransformer->minValue(), sizeTransformer->maxValue(), 4 ) )
{
QgsLegendSymbolItem si( mSymbol.get(), QString::number( v ), QString() );
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( si.symbol() );
s->setDataDefinedSize( QgsProperty() );
s->setSize( scaleExp.size( v ) );
s->setSize( sizeTransformer->size( v ) );
lst << si;
}
return lst;
@@ -181,7 +181,6 @@ ADD_QGIS_TEST(rastersublayertest testqgsrastersublayer.cpp)
ADD_QGIS_TEST(rectangletest testqgsrectangle.cpp)
ADD_QGIS_TEST(rendererstest testqgsrenderers.cpp)
ADD_QGIS_TEST(rulebasedrenderertest testqgsrulebasedrenderer.cpp)
ADD_QGIS_TEST(scaleexpressiontest testqgsscaleexpression.cpp)
ADD_QGIS_TEST(shapebursttest testqgsshapeburst.cpp )
ADD_QGIS_TEST(simplemarkertest testqgssimplemarker.cpp)
ADD_QGIS_TEST(snappingutilstest testqgssnappingutils.cpp )

This file was deleted.

0 comments on commit 1b5bf1d

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