Skip to content

Commit

Permalink
More removal of const from QgsRenderContext in symbology
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 1, 2015
1 parent 1491d56 commit 5cfdea5
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 82 deletions.
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgsellipsesymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions python/core/symbology-ng/qgsfillsymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -624,7 +624,7 @@ class QgsRasterFillSymbolLayer: QgsImageFillSymbolLayer

protected:

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

};

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

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

class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions python/core/symbology-ng/qgslinesymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/////////
Expand Down
4 changes: 2 additions & 2 deletions python/core/symbology-ng/qgsmarkersymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions python/core/symbology-ng/qgssymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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/;
Expand Down Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/core/dxf/qgsdxfexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/core/dxf/qgsdxfexport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsellipsesymbollayerv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
19 changes: 9 additions & 10 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
Expand All @@ -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 ) )
{
Expand All @@ -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 ) )
{
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) )
Expand All @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 ) )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5cfdea5

Please sign in to comment.