Skip to content
Permalink
Browse files

More removal of const from QgsRenderContext in symbology

  • Loading branch information
nyalldawson committed Oct 1, 2015
1 parent 1491d56 commit 5cfdea569bc02867049590bdc0aee08c62aaddb5
@@ -21,7 +21,7 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
void writeSldMarker( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;

bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;

void setSymbolName( const QString& name );
QString symbolName() const;
@@ -88,10 +88,10 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2

double estimateMaxBleed() const;

double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
Qt::PenStyle dxfPenStyle() const;
QColor dxfBrushColor( const QgsSymbolV2RenderContext& context ) const;
QColor dxfBrushColor( QgsSymbolV2RenderContext& context ) const;
Qt::BrushStyle dxfBrushStyle() const;
};

@@ -454,8 +454,8 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2

virtual double estimateMaxBleed() const;

virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
virtual QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
virtual Qt::PenStyle dxfPenStyle() const;
};

@@ -624,7 +624,7 @@ class QgsRasterFillSymbolLayer: QgsImageFillSymbolLayer

protected:

void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
void applyDataDefinedSettings( QgsSymbolV2RenderContext& context );

};

@@ -689,7 +689,7 @@ class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
QgsMapUnitScale mapUnitScale() const;

protected:
void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
void applyDataDefinedSettings( QgsSymbolV2RenderContext& context );
};

class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
@@ -838,7 +838,7 @@ class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer
virtual QSet<QString> usedAttributes() const;

protected:
void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
void applyDataDefinedSettings( QgsSymbolV2RenderContext& context );
};

class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
@@ -74,9 +74,9 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
Qt::PenStyle dxfPenStyle() const;

double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
double dxfOffset( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
};

/////////
@@ -67,7 +67,7 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& outlineWidthMapUnitScale() const;

bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
@@ -144,7 +144,7 @@ class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
void setMapUnitScale( const QgsMapUnitScale& scale );
QgsMapUnitScale mapUnitScale() const;

bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;
};

class QgsFontMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
@@ -232,18 +232,18 @@ class QgsSymbolLayerV2
virtual bool writeDxf( QgsDxfExport& e,
double mmMapUnitScaleFactor,
const QString& layerName,
const QgsSymbolV2RenderContext* context,
QgsSymbolV2RenderContext* context,
const QgsFeature* f,
const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;

virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
virtual double dxfOffset( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;

virtual QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;

virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
virtual Qt::PenStyle dxfPenStyle() const;
virtual QColor dxfBrushColor( const QgsSymbolV2RenderContext& context ) const;
virtual QColor dxfBrushColor( QgsSymbolV2RenderContext& context ) const;
virtual Qt::BrushStyle dxfBrushStyle() const;

/** Returns the current paint effect for the layer.
@@ -389,12 +389,12 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
QgsMarkerSymbolLayerV2( bool locked = false );

//handles marker offset and anchor point shift together
void markerOffset( const QgsSymbolV2RenderContext& context, double& offsetX, double& offsetY ) const;
void markerOffset( QgsSymbolV2RenderContext& context, double& offsetX, double& offsetY ) const;

void markerOffset( const QgsSymbolV2RenderContext& context, double width, double height, double& offsetX, double& offsetY ) const /PyName=markerOffsetWithWidthAndHeight/;
void markerOffset( QgsSymbolV2RenderContext& context, double width, double height, double& offsetX, double& offsetY ) const /PyName=markerOffsetWithWidthAndHeight/;

//! @note available in python bindings as markerOffset2
void markerOffset( const QgsSymbolV2RenderContext& context, double width, double height,
void markerOffset( QgsSymbolV2RenderContext& context, double width, double height,
QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::OutputUnit heightUnit,
double& offsetX, double& offsetY,
const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const /PyName=markerOffset2/;
@@ -439,8 +439,8 @@ class QgsLineSymbolLayerV2 : QgsSymbolLayerV2

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );

virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
virtual double dxfOffset( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;

protected:
QgsLineSymbolLayerV2( bool locked = false );
@@ -3602,7 +3602,7 @@ QgsRectangle QgsDxfExport::dxfExtent() const
return extent;
}

void QgsDxfExport::addFeature( const QgsSymbolV2RenderContext& ctx, const QString& layer, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol )
void QgsDxfExport::addFeature( QgsSymbolV2RenderContext& ctx, const QString& layer, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol )
{
const QgsFeature* fet = ctx.feature();
if ( !fet )
@@ -3768,7 +3768,7 @@ void QgsDxfExport::addFeature( const QgsSymbolV2RenderContext& ctx, const QStrin
}
}

QColor QgsDxfExport::colorFromSymbolLayer( const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2RenderContext& ctx )
QColor QgsDxfExport::colorFromSymbolLayer( const QgsSymbolLayerV2* symbolLayer, QgsSymbolV2RenderContext &ctx )
{
if ( !symbolLayer )
return QColor();
@@ -159,10 +159,10 @@ class CORE_EXPORT QgsDxfExport

QgsRectangle dxfExtent() const;

void addFeature( const QgsSymbolV2RenderContext &ctx, const QString &layer, const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2 *symbol );
void addFeature( QgsSymbolV2RenderContext &ctx, const QString &layer, const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2 *symbol );

//returns dxf palette index from symbol layer color
static QColor colorFromSymbolLayer( const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2RenderContext &ctx );
static QColor colorFromSymbolLayer( const QgsSymbolLayerV2 *symbolLayer, QgsSymbolV2RenderContext &ctx );
QString lineStyleFromSymbolLayer( const QgsSymbolLayerV2 *symbolLayer );

//functions for dxf palette
@@ -224,13 +224,13 @@ void QgsEllipseSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Rend
{
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, context, QVariant(), &ok ).toString();
if ( ok )
mBrush.setColor( QColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) ) );
mBrush.setColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) );
}
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR ) )
{
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR, context, QVariant(), &ok ).toString();
if ( ok )
mPen.setColor( QColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) ) );
mPen.setColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) );
}
double scaledWidth = mSymbolWidth;
double scaledHeight = mSymbolHeight;
@@ -558,7 +558,7 @@ QgsMapUnitScale QgsEllipseSymbolLayerV2::mapUnitScale() const
return QgsMapUnitScale();
}

bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature*, const QPointF& shift ) const
bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext *context, const QgsFeature*, const QPointF& shift ) const
{
//width
double symbolWidth = mSymbolWidth;
@@ -610,7 +610,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
{
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, *context, QVariant(), &ok ).toString();
if ( ok )
fc = QColor( colorString );
fc = QgsSymbolLayerV2Utils::decodeColor( colorString );
}

//outline color
@@ -619,7 +619,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
{
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR, *context, QVariant(), &ok ).toString();
if ( ok )
oc = QColor( colorString );
oc = QgsSymbolLayerV2Utils::decodeColor( colorString );
}

//symbol name
@@ -40,7 +40,7 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const override;
void writeSldMarker( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const override;

bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const override;
bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const override;

void setSymbolName( const QString& name ) { mSymbolName = name; }
QString symbolName() const { return mSymbolName; }
@@ -391,7 +391,7 @@ double QgsSimpleFillSymbolLayerV2::estimateMaxBleed() const
return penBleed + offsetBleed;
}

double QgsSimpleFillSymbolLayerV2::dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const
double QgsSimpleFillSymbolLayerV2::dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext &context ) const
{
double width = mBorderWidth;
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH_BORDER ) )
@@ -401,7 +401,7 @@ double QgsSimpleFillSymbolLayerV2::dxfWidth( const QgsDxfExport& e, const QgsSym
return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mBorderWidthUnit, e.mapUnits() );
}

QColor QgsSimpleFillSymbolLayerV2::dxfColor( const QgsSymbolV2RenderContext& context ) const
QColor QgsSimpleFillSymbolLayerV2::dxfColor( QgsSymbolV2RenderContext &context ) const
{
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_BORDER_COLOR ) )
{
@@ -418,7 +418,7 @@ Qt::PenStyle QgsSimpleFillSymbolLayerV2::dxfPenStyle() const
return mBorderStyle;
}

QColor QgsSimpleFillSymbolLayerV2::dxfBrushColor( const QgsSymbolV2RenderContext& context ) const
QColor QgsSimpleFillSymbolLayerV2::dxfBrushColor( QgsSymbolV2RenderContext& context ) const
{
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
{
@@ -563,7 +563,6 @@ void QgsGradientFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderC
QColor color = mColor;
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
{

QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR, context, QVariant(), &ok ).toString();
if ( ok )
color = QgsSymbolLayerV2Utils::decodeColor( colorString );
@@ -1642,7 +1641,7 @@ double QgsImageFillSymbolLayer::estimateMaxBleed() const
return 0;
}

double QgsImageFillSymbolLayer::dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const
double QgsImageFillSymbolLayer::dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext &context ) const
{
double width = mOutlineWidth;
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH ) )
@@ -1652,7 +1651,7 @@ double QgsImageFillSymbolLayer::dxfWidth( const QgsDxfExport& e, const QgsSymbol
return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mOutlineWidthUnit, e.mapUnits() );
}

QColor QgsImageFillSymbolLayer::dxfColor( const QgsSymbolV2RenderContext& context ) const
QColor QgsImageFillSymbolLayer::dxfColor( QgsSymbolV2RenderContext &context ) const
{
Q_UNUSED( context );
if ( !mOutline )
@@ -2124,7 +2123,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::createFromSld( QDomElement &element )
return sl;
}

void QgsSVGFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderContext& context )
void QgsSVGFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
{
if ( !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SVG_FILE )
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SVG_FILL_COLOR ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SVG_OUTLINE_COLOR )
@@ -2838,7 +2837,7 @@ QString QgsLinePatternFillSymbolLayer::ogrFeatureStyleWidth( double widthScaleFa
return featureStyle;
}

void QgsLinePatternFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderContext& context )
void QgsLinePatternFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
{
if ( !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_LINEANGLE ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISTANCE )
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_LINEWIDTH ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
@@ -3247,7 +3246,7 @@ bool QgsPointPatternFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
return true;
}

void QgsPointPatternFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderContext& context )
void QgsPointPatternFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
{
#if 0
// TODO: enable but check also if mMarkerSymbol has data defined properties
@@ -3645,7 +3644,7 @@ void QgsRasterFillSymbolLayer::setAlpha( const double alpha )
mAlpha = alpha;
}

void QgsRasterFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderContext &context )
void QgsRasterFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
{
if ( !hasDataDefinedProperties() )
return; // shortcut

0 comments on commit 5cfdea5

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