Skip to content
Permalink
Browse files

Fix cherry-pickings

Do not generate a ogc:Filter where a ogc:Expression is expected. #3366
Emit valid SLD when mm are used as symbol unit #3414
Export map level scale based dependencies in most vector symbology #3436
  • Loading branch information
rldhont committed Sep 21, 2016
1 parent 343a15c commit 30110a7e9b10dcb2481be26e12d05ad53a541d9e
@@ -429,19 +429,19 @@ class QgsSymbolLayerV2Utils
* returns the value un-modified
* @note added in 3.0
*/
static double rescaleUom( double size, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props );
static double rescaleUom( double size, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props );

/** Rescales the given point based on the uomScale found in the props, if any is found, otherwise
* returns a copy of the original point
* @note added in 3.0
*/
static QPointF rescaleUom( const QPointF& point, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props ) /PyName=rescalePointUom/;
static QPointF rescaleUom( const QPointF& point, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props ) /PyName=rescalePointUom/;

/** Rescales the given array based on the uomScale found in the props, if any is found, otherwise
* returns a copy of the original point
* @note added in 3.0
*/
static QVector<qreal> rescaleUom( const QVector<qreal>& array, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props ) /PyName=rescaleArrayUom/;
static QVector<qreal> rescaleUom( const QVector<qreal>& array, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props ) /PyName=rescaleArrayUom/;

/**
* Checks if the properties contain scaleMinDenom and scaleMaxDenom, if available, they are added into the SE Rule element
@@ -2315,7 +2315,7 @@ bool QgsVectorLayer::writeSld( QDomNode& node, QDomDocument& doc, QString& error
QgsStringMap localProps = QgsStringMap( props );
if ( hasScaleBasedVisibility() )
{
QgsSymbolLayerUtils::mergeScaleDependencies( minimumScale(), maximumScale(), localProps );
QgsSymbolLayerV2Utils::mergeScaleDependencies( minimumScale(), maximumScale(), localProps );
}

if ( hasGeometryType() )
@@ -142,7 +142,7 @@ void QgsRendererCategoryV2::toSld( QDomDocument &doc, QDomElement &element, QgsS
QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, filterFunc );

// add the mix/max scale denoms if we got any from the callers
QgsSymbolLayerUtils::applyScaleDependency( doc, ruleElem, props );
QgsSymbolLayerV2Utils::applyScaleDependency( doc, ruleElem, props );

mSymbol->toSld( doc, ruleElem, props );
}
@@ -2852,7 +2852,6 @@ void QgsFontMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement

QString fontPath = QString( "ttf://%1" ).arg( mFontFamily );
int markIndex = mChr.unicode();
QgsSymbolLayerV2Utils::externalMarkerToSld( doc, graphicElem, fontPath, "ttf", &markIndex, mColor, mSize );
double size = QgsSymbolLayerV2Utils::rescaleUom( mSize, mSizeUnit, props );
QgsSymbolLayerV2Utils::externalMarkerToSld( doc, graphicElem, fontPath, "ttf", &markIndex, mColor, size );

@@ -348,7 +348,7 @@ void QgsRuleBasedRendererV2::Rule::toSld( QDomDocument& doc, QDomElement &elemen
props[ "filter" ] += mFilterExp;
}

QgsSymbolLayerUtils::mergeScaleDependencies( mScaleMinDenom, mScaleMaxDenom, props );
QgsSymbolLayerV2Utils::mergeScaleDependencies( mScaleMinDenom, mScaleMaxDenom, props );

if ( mSymbol )
{
@@ -384,7 +384,7 @@ void QgsRuleBasedRendererV2::Rule::toSld( QDomDocument& doc, QDomElement &elemen
QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, props.value( "filter", "" ) );
}

QgsSymbolLayerUtils::applyScaleDependency( doc, ruleElem, props );
QgsSymbolLayerV2Utils::applyScaleDependency( doc, ruleElem, props );

mSymbol->toSld( doc, ruleElem, props );
}
@@ -947,11 +947,7 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::clone() const
return r;
}

<<<<<<< HEAD:src/core/symbology-ng/qgsrulebasedrendererv2.cpp
void QgsRuleBasedRendererV2::toSld( QDomDocument& doc, QDomElement &element ) const
=======
void QgsRuleBasedRenderer::toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const
>>>>>>> a25b025... Export map level scale based dependencies in most vector symbology:src/core/symbology-ng/qgsrulebasedrenderer.cpp
void QgsRuleBasedRendererV2::toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const
{
mRootRule->toSld( doc, element, props );
}
@@ -219,7 +219,7 @@ void QgsSingleSymbolRendererV2::toSld( QDomDocument& doc, QDomElement &element,
nameElem.appendChild( doc.createTextNode( "Single symbol" ) );
ruleElem.appendChild( nameElem );

QgsSymbolLayerUtils::applyScaleDependency( doc, ruleElem, props );
QgsSymbolLayerV2Utils::applyScaleDependency( doc, ruleElem, props );

if ( mSymbol.data() ) mSymbol->toSld( doc, ruleElem, props );
}
@@ -4097,11 +4097,11 @@ QList<double> QgsSymbolLayerV2Utils::prettyBreaks( double minimum, double maximu
return breaks;
}

double QgsSymbolLayerV2Utils::rescaleUom( double size, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props )
double QgsSymbolLayerV2Utils::rescaleUom( double size, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props )
{
double scale = 1;
bool roundToUnit = false;
if ( unit == QgsUnitTypes::RenderUnknownUnit )
if ( unit == QgsSymbolV2::Mixed )
{
if ( props.contains( "uomScale" ) )
{
@@ -4119,10 +4119,10 @@ double QgsSymbolLayerV2Utils::rescaleUom( double size, QgsUnitTypes::RenderUnit
{
switch ( unit )
{
case QgsUnitTypes::RenderMillimeters:
case QgsSymbolV2::MM:
scale = 0.001;
break;
case QgsUnitTypes::RenderPixels:
case QgsSymbolV2::Pixel:
scale = 0.00028;
roundToUnit = true;
break;
@@ -4135,7 +4135,7 @@ double QgsSymbolLayerV2Utils::rescaleUom( double size, QgsUnitTypes::RenderUnit
// target is pixels
switch ( unit )
{
case QgsUnitTypes::RenderMillimeters:
case QgsSymbolV2::MM:
scale = 1 / 0.28;
roundToUnit = true;
break;
@@ -4156,14 +4156,14 @@ double QgsSymbolLayerV2Utils::rescaleUom( double size, QgsUnitTypes::RenderUnit
return rescaled;
}

QPointF QgsSymbolLayerV2Utils::rescaleUom( const QPointF& point, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props )
QPointF QgsSymbolLayerV2Utils::rescaleUom( const QPointF& point, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props )
{
double x = rescaleUom( point.x(), unit, props );
double y = rescaleUom( point.y(), unit, props );
return QPointF( x, y );
}

QVector<qreal> QgsSymbolLayerV2Utils::rescaleUom( const QVector<qreal>& array, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props )
QVector<qreal> QgsSymbolLayerV2Utils::rescaleUom( const QVector<qreal>& array, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props )
{
QVector<qreal> result;
QVector<qreal>::const_iterator it = array.constBegin();
@@ -4174,7 +4174,7 @@ QVector<qreal> QgsSymbolLayerV2Utils::rescaleUom( const QVector<qreal>& array, Q
return result;
}

void QgsSymbolLayerUtils::applyScaleDependency( QDomDocument& doc, QDomElement& ruleElem, QgsStringMap& props )
void QgsSymbolLayerV2Utils::applyScaleDependency( QDomDocument& doc, QDomElement& ruleElem, QgsStringMap& props )
{
if ( !props.value( "scaleMinDenom", "" ).isEmpty() )
{
@@ -4191,7 +4191,7 @@ void QgsSymbolLayerUtils::applyScaleDependency( QDomDocument& doc, QDomElement&
}
}

void QgsSymbolLayerUtils::mergeScaleDependencies( int mScaleMinDenom, int mScaleMaxDenom, QgsStringMap& props )
void QgsSymbolLayerV2Utils::mergeScaleDependencies( int mScaleMinDenom, int mScaleMaxDenom, QgsStringMap& props )
{
if ( mScaleMinDenom != 0 )
{
@@ -491,19 +491,19 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
* returns the value un-modified
* @note added in 3.0
*/
static double rescaleUom( double size, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props );
static double rescaleUom( double size, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props );

/** Rescales the given point based on the uomScale found in the props, if any is found, otherwise
* returns a copy of the original point
* @note added in 3.0
*/
static QPointF rescaleUom( const QPointF& point, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props );
static QPointF rescaleUom( const QPointF& point, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props );

/** Rescales the given array based on the uomScale found in the props, if any is found, otherwise
* returns a copy of the original point
* @note added in 3.0
*/
static QVector<qreal> rescaleUom( const QVector<qreal>& array, QgsUnitTypes::RenderUnit unit, const QgsStringMap& props );
static QVector<qreal> rescaleUom( const QVector<qreal>& array, QgsSymbolV2::OutputUnit unit, const QgsStringMap& props );

/**
* Checks if the properties contain scaleMinDenom and scaleMaxDenom, if available, they are added into the SE Rule element
@@ -87,7 +87,7 @@ ADD_PYTHON_TEST(PyQgsSpatialiteProvider test_provider_spatialite.py)
ADD_PYTHON_TEST(PyQgsSQLStatement test_qgssqlstatement.py)
ADD_PYTHON_TEST(PyQgsStringStatisticalSummary test_qgsstringstatisticalsummary.py)
ADD_PYTHON_TEST(PyQgsSymbolLayerV2 test_qgssymbollayerv2.py)
ADD_PYTHON_TEST(PyQgsSymbolLayerCreateSld test_qgssymbollayer_createsld.py)
ADD_PYTHON_TEST(PyQgsSymbolLayerV2CreateSld test_qgssymbollayerv2_createsld.py)
ADD_PYTHON_TEST(PyQgsArrowSymbolLayer test_qgsarrowsymbollayer.py)
ADD_PYTHON_TEST(PyQgsSymbolExpressionVariables test_qgssymbolexpressionvariables.py)
ADD_PYTHON_TEST(PyQgsSyntacticSugar test_syntactic_sugar.py)

0 comments on commit 30110a7

Please sign in to comment.