mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Merge pull request #3480 from nyalldawson/symbol
Remove deprecated members from symbology
This commit is contained in:
commit
26d7235e85
@ -304,6 +304,11 @@ variant instead.</li>
|
||||
<li>GenericDataSourceURI has been renamed to GenericDataSourceUri</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsCategorizedSymbolRendererWidget QgsCategorizedSymbolRendererWidget
|
||||
<ul>
|
||||
<li>sizeScaleFieldChanged() and scaleMethodChanged() were removed. These settings are no longer exposed in the widget's GUI.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsClipper QgsClipper
|
||||
|
||||
<ul>
|
||||
@ -552,7 +557,17 @@ None will need to be modified, as the method will return an empty geometry if th
|
||||
\subsection qgis_api_break_3_0_QgsFeatureRendererV2 QgsFeatureRendererV2
|
||||
|
||||
<ul>
|
||||
<li>The method capabilities() returns QgsFeatureRendererV2::Capabilities flags instead of an integer. The two are binary compatible.
|
||||
<li>The method capabilities() returns QgsFeatureRendererV2::Capabilities flags instead of an integer. The two are binary compatible.</li>
|
||||
<li>symbolForFeature( QgsFeature& feature ) has been removed. The symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) method should be used instead (previously available as symbolForFeature2 in PyQGIS bindings). symbolForFeature has been made pure virtual.</li>
|
||||
<li>originalSymbolForFeature( QgsFeature& feature ) has been removed. The symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolForFeature2 in PyQGIS bindings).</li>
|
||||
<li>startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) was removed. This function has had no effect since QGIS 2.4</li>
|
||||
<li>symbols() has been removed. The symbols( QgsRenderContext& context ) method should be used instead (previously available as symbols2 in PyQGIS bindings).</li>
|
||||
<li>writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) was removed. writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) should be used instead.</li>
|
||||
<li>rotationField() and setRotationField() were removed. Data defined properties for QgsSymbolLayer should be used instead.</li>
|
||||
<li>willRenderFeature( QgsFeature& feat ) has been removed. The willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as willRenderFeature2 in PyQGIS bindings).</li>
|
||||
<li>symbolsForFeature( QgsFeature& feat ) has been removed. The symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as symbolsForFeature2 in PyQGIS bindings).</li>
|
||||
<li>originalSymbolsForFeature( QgsFeature& feat ) has been removed. The originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolsForFeature2 in PyQGIS bindings).</li>
|
||||
<li>copyPaintEffect() was removed. copyRendererData() should be used instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsFields QgsFields
|
||||
@ -609,6 +624,18 @@ and the new ramp can be retrieved after executing the dialog by calling ramp().<
|
||||
<li>Some internal methods which were previously public or protected were made private.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsGraduatedSymbolRenderer QgsGraduatedSymbolRenderer
|
||||
|
||||
<ul>
|
||||
<li>getDataValues() has been removed - use QgsVectorLayer::getDoubleValues() instead</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsGraduatedSymbolRendererWidget QgsGraduatedSymbolRenderer
|
||||
<ul>
|
||||
<li>sizeScaleFieldChanged() and scaleMethodChanged() were removed. These settings are no longer exposed in the widget's GUI.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsGraphBuilderInterface QgsGraphBuilderInterface
|
||||
|
||||
<ul>
|
||||
@ -883,6 +910,25 @@ be returned instead of a null pointer if no transformation is required.</li>
|
||||
<li>QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ) constructor and reset( bool isPolygon) have been removed, use constructor and function with Qgis::GeometryType as argument instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsRuleBasedRenderer QgsRuleBasedRenderer
|
||||
|
||||
<ul>
|
||||
<li>QgsRuleBasedRenderer.Rule checkState() and setCheckState() were removed. Use active() and setActive() instead.</li>
|
||||
<li>startRender( QgsRenderContext& context, const QgsFields& fields ) was removed. Use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSimpleMarkerSymbolLayer QgsSimpleMarkerSymbolLayer
|
||||
|
||||
<ul>
|
||||
<li>The constructor variant with a string for the shape name has been removed. Use the variant which accepts a QgsSimpleMarkerSymbolLayerBase.Shape enum instead.</li>
|
||||
<li>name() and setName() have been removed. Use shape() and setShape() instead.</li>
|
||||
<li>prepareShape() and preparePath() were removed. Calling these methods manually should no longer be required.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSingleSymbolRendererWidget QgsSingleSymbolRendererWidget
|
||||
<ul>
|
||||
<li>sizeScaleFieldChanged() and scaleMethodChanged() were removed. These settings are no longer exposed in the widget's GUI.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSnapper QgsSnapper
|
||||
|
||||
@ -890,6 +936,12 @@ be returned instead of a null pointer if no transformation is required.</li>
|
||||
<li>Constructor variant with QgsMapRenderer has been removed. Use the variant with QgsMapSettings.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSvgCache QgsSvgCache
|
||||
|
||||
<ul>
|
||||
<li>containsParamsV2() was removed. Use containsParamsV3() instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbol QgsSymbol (renamed from QgsSymbolV2)
|
||||
|
||||
<ul>
|
||||
@ -897,6 +949,8 @@ be returned instead of a null pointer if no transformation is required.</li>
|
||||
and renamed to RenderUnit. QgsSymbol::OutputUnitList was renamed to QgsUnitTypes::RenderUnitList. All methods which previously accepted QgsSymbol::OutputUnit
|
||||
parameters or QgsSymbol::OutputUnitList parameters now take QgsUnitTypes::RenderUnit or QgsUnitTypes::RenderUnitList parameters respectively.</li>
|
||||
<li>startRender() now accepts a QgsFields reference, not a pointer.</li>
|
||||
<li>isSymbolLayerCompatible() was removed. Use QgsSymbolLayer::isCompatibleWithSymbol() instead.</li>
|
||||
<li>The DataDefinedSizeScale flag has been removed. This is no longer used and data defined scaling on a symbol layer level should be used instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolLayer QgsSymbolLayer (renamed from QgsSymbolLayerV2)
|
||||
@ -904,6 +958,10 @@ parameters or QgsSymbol::OutputUnitList parameters now take QgsUnitTypes::Render
|
||||
<ul>
|
||||
<li>The deprecated prepareExpressions( const QgsFields* fields, double scale = -1.0 ) method has been removed. Use
|
||||
the variant which takes QgsSymbolRenderContext instead.</li>
|
||||
<li>The deprecated methods dataDefinedProperty( const QString& property ) and dataDefinedPropertyString() were removed. Use getDataDefinedProperty() instead.</li>
|
||||
<li>setDataDefinedProperty( const QString& property, const QString& expressionString ) was removed. Use setDataDefinedProperty( const QString& property, QgsDataDefined* dataDefined ) instead.</li>
|
||||
<li>evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature ) was removed. Use the variant which takes QgsSymbolRenderContext instead.</li>
|
||||
<li>expression() was removed. Use getDataDefinedProperty or evaluateDataDefinedProperty instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolRenderContext QgsSymbolRenderContext (renamed from QgsSymbolV2RenderContext)
|
||||
@ -917,6 +975,19 @@ the variant which takes QgsSymbolRenderContext instead.</li>
|
||||
|
||||
<ul>
|
||||
<li>encodeOutputUnit() and decodeOutputUnit() were removed. QgsUnitTypes::encodeUnit() and QgsUnitTypes::decodeRenderUnit() should be used instead.</li>
|
||||
<li>The signatures for wellKnownMarkerToSld() and wellKnownMarkerFromSld() were changed.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolSelectorDialog QgsSymbolSelectorDialog
|
||||
|
||||
<ul>
|
||||
<li>saveSymbol() was removed.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolSelectorWidget QgsSymbolSelectorWidget
|
||||
|
||||
<ul>
|
||||
<li>saveSymbol() was removed.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsTolerance QgsTolerance
|
||||
@ -1053,7 +1124,9 @@ in code which previously passed a null pointer to QgsVectorFileWriter.</li>
|
||||
<ul>
|
||||
<li>New virtual method <code>bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage, QgsStringMap props = QgsStringMap() )</code> accepts an
|
||||
optional property map passing down layer level properties to the SLD encoders. If scale based visibility is enabled, it will contain the
|
||||
<code>scaleMinDenom</code> and <code>scaleMaxDenom</code> properties.
|
||||
<code>scaleMinDenom</code> and <code>scaleMaxDenom</code> properties.</li>
|
||||
<li>The RotationField capabitity was removed. This is now handled using data defined rotation at a symbol layer level</li>
|
||||
<li>setScaleMethodToSymbol was removed. This is now handled using data defined scaling at a symbol layer level</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
@ -50,10 +50,10 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
|
||||
virtual ~QgsCategorizedSymbolRenderer();
|
||||
|
||||
//! @note available in python as symbolForFeature2
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
//! @note available in python as originalSymbolForFeature2
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
@ -73,7 +73,7 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
|
||||
virtual QString filter( const QgsFields& fields = QgsFields() );
|
||||
|
||||
//! @note available in python as symbols2
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
|
||||
/** Update all the symbols but leave categories and colors. This method also sets the source
|
||||
* symbol for the renderer.
|
||||
@ -168,15 +168,6 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
|
||||
*/
|
||||
void updateColorRamp( QgsColorRamp* ramp /Transfer/, bool inverted = false );
|
||||
|
||||
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
|
||||
QString rotationField() const /Deprecated/;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const;
|
||||
|
||||
//! items of symbology items in legend should be checkable
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemsCheckable() const;
|
||||
|
@ -94,9 +94,9 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
virtual ~QgsGraduatedSymbolRenderer();
|
||||
|
||||
//! @note labelForLowerUpper in python bindings
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
//! @note originalSymbolForFeature2 in python bindings
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
@ -114,7 +114,7 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
virtual QgsFeatureRenderer::Capabilities capabilities();
|
||||
|
||||
//! @note symbol2 in python bindings
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
|
||||
QString classAttribute() const;
|
||||
void setClassAttribute( const QString& attr );
|
||||
@ -183,12 +183,6 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
//! @note Added in 2.6
|
||||
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses );
|
||||
|
||||
//! Evaluates the data expression and returns the list of values from the layer
|
||||
//! @param vlayer The layer for which to evaluate the expression
|
||||
//! @note Added in 2.6
|
||||
//! @deprecated use QgsVectorLayer::getDoubleValues instead
|
||||
QList<double> getDataValues( QgsVectorLayer *vlayer ) /Deprecated/;
|
||||
|
||||
//! Return the label format used to generate default classification labels
|
||||
//! @note Added in 2.6
|
||||
const QgsRendererRangeLabelFormat &labelFormat() const;
|
||||
@ -299,15 +293,6 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
//! @note added in 2.10
|
||||
void setGraduatedMethod( GraduatedMethod method );
|
||||
|
||||
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
|
||||
QString rotationField() const /Deprecated/;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const;
|
||||
|
||||
//! items of symbology items in legend should be checkable
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemsCheckable() const;
|
||||
|
@ -14,9 +14,9 @@ class QgsHeatmapRenderer : QgsFeatureRenderer
|
||||
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
|
||||
virtual void stopRender( QgsRenderContext& context );
|
||||
//! @note symbolForFeature2 in python bindings
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
//! @note symbol2 in python bindings
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
virtual QString dump() const;
|
||||
virtual QList<QString> usedAttributes();
|
||||
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;
|
||||
|
@ -45,23 +45,23 @@ class QgsInvertedPolygonRenderer : QgsFeatureRenderer
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbol2
|
||||
*/
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as originalSymbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbolsForFeature
|
||||
*/
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature/;
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as originalSymbolsForFeature2
|
||||
*/
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer. */
|
||||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@ -71,7 +71,7 @@ class QgsInvertedPolygonRenderer : QgsFeatureRenderer
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as willRenderFeature2
|
||||
*/
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Creates a renderer out of an XML, for loading*/
|
||||
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;
|
||||
|
@ -148,28 +148,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param name symbol name, should be one of "square", "rectangle", "diamond",
|
||||
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
|
||||
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||
* @param color fill color for symbol
|
||||
* @param borderColor border color for symbol
|
||||
* @param size symbol size (in mm)
|
||||
* @param angle symbol rotation angle
|
||||
* @param scaleMethod scaling method for data defined scaling
|
||||
* @param penJoinStyle join style for outline pen
|
||||
* @deprecated use variant which accepts QgsSimpleMarkerSymbolLayerBase::Shape instead
|
||||
*/
|
||||
QgsSimpleMarkerSymbolLayer( const QString& name,
|
||||
const QColor& color = DEFAULT_SIMPLEMARKER_COLOR,
|
||||
const QColor& borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
|
||||
double size = DEFAULT_SIMPLEMARKER_SIZE,
|
||||
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
|
||||
QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
|
||||
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE ) /Deprecated/;
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param shape symbol shape
|
||||
* @param size symbol size (in mm)
|
||||
@ -225,12 +203,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
|
||||
// new methods
|
||||
|
||||
//! @deprecated use shape() instead
|
||||
QString name() const /Deprecated/;
|
||||
|
||||
//! @deprecated use setShape() instead
|
||||
void setName( const QString& name ) /Deprecated/;
|
||||
|
||||
/** Returns the marker's border color.
|
||||
* @see setBorderColor()
|
||||
* @see outlineStyle()
|
||||
@ -334,13 +306,6 @@ class QgsSimpleMarkerSymbolLayer : QgsSimpleMarkerSymbolLayerBase
|
||||
*/
|
||||
void drawMarker( QPainter* p, QgsSymbolRenderContext& context );
|
||||
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool prepareShape( const QString& name = QString() ) /Deprecated/;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool prepareShape( const QString& name, QPolygonF &polygon ) const /Deprecated/;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
bool preparePath( QString name = QString() ) /Deprecated/;
|
||||
|
||||
/** Prepares cache image
|
||||
* @returns true in case of success, false if cache image size too large
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ class QgsNullSymbolRenderer : QgsFeatureRenderer
|
||||
virtual QList<QString> usedAttributes();
|
||||
virtual QString dump() const;
|
||||
virtual QgsFeatureRenderer* clone() const /Factory/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
|
||||
/** Creates a null renderer from XML element.
|
||||
* @param element DOM element
|
||||
|
@ -30,27 +30,27 @@ class QgsPointDisplacementRenderer : QgsFeatureRenderer
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as symbols2
|
||||
*/
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as symbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as originalSymbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as symbolsForFeature2
|
||||
*/
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as originalSymbolsForFeature2
|
||||
*/
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
@note available in python as willRenderFeature2
|
||||
*/
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
@ -77,10 +77,6 @@ class QgsPointDisplacementRenderer : QgsFeatureRenderer
|
||||
virtual bool legendSymbolItemChecked( const QString& key );
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true );
|
||||
|
||||
//! not available in python bindings
|
||||
//! @deprecated since 2.4
|
||||
// void setDisplacementGroups( const QList<QMap<QgsFeatureId, QgsFeature> >& list );
|
||||
|
||||
void setLabelFont( const QFont& f );
|
||||
QFont labelFont() const;
|
||||
|
||||
|
@ -64,15 +64,6 @@ class QgsFeatureRenderer
|
||||
|
||||
QString type() const;
|
||||
|
||||
/** To be overridden
|
||||
*
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* @param feature feature
|
||||
* @return returns pointer to symbol or 0 if symbol was not found
|
||||
* @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature ) /Deprecated/;
|
||||
|
||||
/** To be overridden
|
||||
*
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
@ -80,30 +71,16 @@ class QgsFeatureRenderer
|
||||
* @param context render context
|
||||
* @return returns pointer to symbol or 0 if symbol was not found
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbolForFeature2
|
||||
*/
|
||||
// TODO - QGIS 3.0 make pure virtual when above method is removed
|
||||
// TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
|
||||
/**
|
||||
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
|
||||
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
|
||||
* of a symbol for use in rendering.
|
||||
* @note added in 2.6
|
||||
* @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature ) /Deprecated/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) = 0;
|
||||
|
||||
/**
|
||||
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
|
||||
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
|
||||
* of a symbol for use in rendering.
|
||||
* @note added in 2.12
|
||||
* @note available in Python bindings as originalSymbolForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
/**
|
||||
* Return legend keys matching a specified feature.
|
||||
@ -120,9 +97,6 @@ class QgsFeatureRenderer
|
||||
*/
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;
|
||||
|
||||
//! @deprecated since 2.4 - not using QgsVectorLayer directly anymore
|
||||
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) /Deprecated/;
|
||||
|
||||
/**
|
||||
* Needs to be called when a render cycle has finished to clean up.
|
||||
*/
|
||||
@ -175,7 +149,6 @@ class QgsFeatureRenderer
|
||||
enum Capability
|
||||
{
|
||||
SymbolLevels, // rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
|
||||
RotationField, // rotate symbols by attribute value
|
||||
MoreSymbolsPerFeature, // may use more than one symbol to render a feature: symbolsForFeature() will return them
|
||||
Filter, // features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)
|
||||
ScaleDependent // depends on scale if feature will be rendered (rule based )
|
||||
@ -186,18 +159,12 @@ class QgsFeatureRenderer
|
||||
//! returns bitwise OR-ed capabilities of the renderer
|
||||
virtual QgsFeatureRenderer::Capabilities capabilities();
|
||||
|
||||
/** For symbol levels
|
||||
* @deprecated use symbols( QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual QgsSymbolList symbols() /Deprecated/;
|
||||
|
||||
/** Returns list of symbols used by the renderer.
|
||||
* @param context render context
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbols2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
|
||||
bool usingSymbolLevels() const;
|
||||
void setUsingSymbolLevels( bool usingSymbolLevels );
|
||||
@ -208,9 +175,6 @@ class QgsFeatureRenderer
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc );
|
||||
|
||||
//! create the SLD UserStyle element following the SLD v1.1 specs
|
||||
//! @deprecated since 2.8 - use the other override with styleName
|
||||
virtual QDomElement writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const /Deprecated/;
|
||||
//! create the SLD UserStyle element following the SLD v1.1 specs with the given name
|
||||
//! @note added in 2.8
|
||||
virtual QDomElement writeSld( QDomDocument& doc, const QString& styleName ) const;
|
||||
@ -268,60 +232,24 @@ class QgsFeatureRenderer
|
||||
//! set type and size of editing vertex markers for subsequent rendering
|
||||
void setVertexMarkerAppearance( int type, int size );
|
||||
|
||||
//! return rotation field name (or empty string if not set or not supported by renderer)
|
||||
//! @deprecated use the symbol's methods instead
|
||||
virtual QString rotationField() const /Deprecated/;
|
||||
|
||||
//! sets rotation field of renderer (if supported by the renderer)
|
||||
//! @deprecated use the symbol's methods instead
|
||||
virtual void setRotationField( const QString& fieldName ) /Deprecated/;
|
||||
|
||||
/** Returns whether the renderer will render a feature or not.
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* Default implementation uses symbolForFeature().
|
||||
* @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual bool willRenderFeature( QgsFeature& feat ) /Deprecated/;
|
||||
|
||||
/** Returns whether the renderer will render a feature or not.
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* Default implementation uses symbolForFeature().
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as willRenderFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
|
||||
|
||||
/** Returns list of symbols used for rendering the feature.
|
||||
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
|
||||
* to use symbolForFeature()
|
||||
* @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat ) /Deprecated/;
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Returns list of symbols used for rendering the feature.
|
||||
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
|
||||
* to use symbolForFeature()
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbolsForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Equivalent of originalSymbolsForFeature() call
|
||||
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
|
||||
* @note added in 2.6
|
||||
* @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat ) /Deprecated/;
|
||||
|
||||
/** Equivalent of originalSymbolsForFeature() call
|
||||
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
|
||||
* @note added in 2.12
|
||||
* @note available in Python bindings as originalSymbolsForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
|
||||
* @note added in 2.12 */
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Allows for a renderer to modify the extent of a feature request prior to rendering
|
||||
* @param extent reference to request's filter extent. Modify extent to change the
|
||||
@ -431,8 +359,6 @@ class QgsFeatureRenderer
|
||||
*/
|
||||
static QPointF _getPoint( QgsRenderContext& context, const QgsPointV2& point );
|
||||
|
||||
void setScaleMethodToSymbol( QgsSymbol* symbol, int scaleMethod );
|
||||
|
||||
/**
|
||||
* Clones generic renderer data to another renderer.
|
||||
* Currently clones
|
||||
@ -443,12 +369,6 @@ class QgsFeatureRenderer
|
||||
*/
|
||||
void copyRendererData( QgsFeatureRenderer *destRenderer ) const;
|
||||
|
||||
/** Copies paint effect of this renderer to another renderer
|
||||
* @param destRenderer destination renderer for copied effect
|
||||
* @deprecated use copyRendererData instead
|
||||
*/
|
||||
void copyPaintEffect( QgsFeatureRenderer *destRenderer ) const /Deprecated/;
|
||||
|
||||
/** @note this function is used to convert old sizeScale expresssions to symbol
|
||||
* level DataDefined size
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
bool needsGeometry() const;
|
||||
|
||||
//! @note available in python bindings as symbol2
|
||||
QgsSymbolList symbols( const QgsRenderContext& context = QgsRenderContext() ) /PyName=symbols2/;
|
||||
QgsSymbolList symbols( const QgsRenderContext& context = QgsRenderContext() );
|
||||
|
||||
//! @note not available in python bindings
|
||||
// QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = "" ) const;
|
||||
@ -138,10 +138,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
*/
|
||||
QString description() const;
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use active instead
|
||||
bool checkState() const /Deprecated/;
|
||||
|
||||
/**
|
||||
* Returns if this rule is active
|
||||
*
|
||||
@ -190,10 +186,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
*/
|
||||
void setDescription( const QString& description );
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use setActive instead
|
||||
void setCheckState( bool state ) /Deprecated/;
|
||||
|
||||
/**
|
||||
* Sets if this rule is active
|
||||
* @param state Determines if the rule should be activated or deactivated
|
||||
@ -208,11 +200,6 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
|
||||
|
||||
QDomElement save( QDomDocument& doc, QgsSymbolMap& symbolMap );
|
||||
|
||||
/** Prepare the rule for rendering and its children (build active children array)
|
||||
* @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead
|
||||
*/
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields ) /Deprecated/;
|
||||
|
||||
//! prepare the rule for rendering and its children (build active children array)
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter );
|
||||
|
||||
|
@ -10,10 +10,10 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
|
||||
virtual ~QgsSingleSymbolRenderer();
|
||||
|
||||
//! @note available in python as symbolForFeature2
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
//! @note available in python as originalSymbolForFeature2
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
@ -24,15 +24,6 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
|
||||
QgsSymbol* symbol() const;
|
||||
void setSymbol( QgsSymbol* s /Transfer/ );
|
||||
|
||||
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
|
||||
QString rotationField() const /Deprecated/;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const;
|
||||
|
||||
virtual QString dump() const;
|
||||
|
||||
virtual QgsSingleSymbolRenderer* clone() const /Factory/;
|
||||
@ -44,7 +35,7 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
|
||||
virtual QgsFeatureRenderer::Capabilities capabilities();
|
||||
|
||||
//! @note available in python as symbol2
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
|
||||
//! create renderer from XML element
|
||||
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;
|
||||
|
@ -112,26 +112,6 @@ class QgsSvgCache : QObject
|
||||
void containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor, bool& hasOutlineWidthParam,
|
||||
double& defaultOutlineWidth ) const;
|
||||
|
||||
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
|
||||
* default values in the svg file, only the first one is considered.
|
||||
* @param path path to SVG file
|
||||
* @param hasFillParam will be true if fill param present in SVG
|
||||
* @param hasDefaultFillParam will be true if fill param has a default value specified
|
||||
* @param defaultFillColor will be set to default fill color specified in SVG, if present
|
||||
* @param hasOutlineParam will be true if outline param present in SVG
|
||||
* @param hasDefaultOutlineColor will be true if outline param has a default value specified
|
||||
* @param defaultOutlineColor will be set to default outline color specified in SVG, if present
|
||||
* @param hasOutlineWidthParam will be true if outline width param present in SVG
|
||||
* @param hasDefaultOutlineWidth will be true if outline width param has a default value specified
|
||||
* @param defaultOutlineWidth will be set to default outline width specified in SVG, if present
|
||||
* @note available in python bindings as containsParamsV2
|
||||
* @note added in QGIS 2.12
|
||||
* @deprecated use variant with fill and outline opacity
|
||||
*/
|
||||
void containsParams( const QString& path, bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
|
||||
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
|
||||
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const /Deprecated,PyName=containsParamsV2/;
|
||||
|
||||
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
|
||||
* default values in the svg file, only the first one is considered.
|
||||
* @param path path to SVG file
|
||||
|
@ -41,7 +41,6 @@ class QgsSymbol
|
||||
|
||||
enum RenderHint
|
||||
{
|
||||
DataDefinedSizeScale,
|
||||
DataDefinedRotation
|
||||
};
|
||||
|
||||
@ -274,11 +273,6 @@ class QgsSymbol
|
||||
*/
|
||||
void renderUsingLayer( QgsSymbolLayer* layer, QgsSymbolRenderContext& context );
|
||||
|
||||
//! check whether a symbol layer type can be used within the symbol
|
||||
//! (marker-marker, line-line, fill-fill/line)
|
||||
//! @deprecated since 2.14, use QgsSymbolLayer::isCompatibleWithSymbol instead
|
||||
bool isSymbolLayerCompatible( SymbolType layerType );
|
||||
|
||||
//! Render editing vertex marker at specified point
|
||||
//! @note added in QGIS 2.16
|
||||
void renderVertexMarker( QPointF pt, QgsRenderContext& context, int currentVertexMarkerType, int currentVertexMarkerSize );
|
||||
|
@ -172,21 +172,6 @@ class QgsSymbolLayer
|
||||
*/
|
||||
virtual QSet<QString> usedAttributes() const;
|
||||
|
||||
/** Returns a data defined expression for a property, if set
|
||||
* @deprecated use getDataDefinedProperty instead
|
||||
*/
|
||||
virtual const QgsExpression* dataDefinedProperty( const QString& property ) const /Deprecated/;
|
||||
|
||||
/** Returns a data defined expression for a property, if set
|
||||
* @deprecated use getDataDefinedProperty instead
|
||||
*/
|
||||
virtual QString dataDefinedPropertyString( const QString& property ) const /Deprecated/;
|
||||
|
||||
/** Sets a data defined expression for a property
|
||||
* @deprecated use setDataDefinedProperty( const QString& property, QgsDataDefined* dataDefined ) instead
|
||||
*/
|
||||
virtual void setDataDefinedProperty( const QString& property, const QString& expressionString ) /Deprecated/;
|
||||
|
||||
/** Returns the data defined property corresponding to the specified property key
|
||||
* @param property property key
|
||||
* @returns matching data defined property if it exists
|
||||
@ -239,23 +224,6 @@ class QgsSymbolLayer
|
||||
*/
|
||||
virtual bool hasDataDefinedProperty( const QString& property ) const;
|
||||
|
||||
/** Evaluates the matching data defined property and returns the calculated
|
||||
* value. Prior to evaluation the data defined property must be prepared
|
||||
* by calling @link prepareExpressions @endlink.
|
||||
* @param property property key
|
||||
* @param feature pointer to the feature to use during expression or field
|
||||
* evaluation
|
||||
* @param defaultVal default value to return if evaluation was not successful
|
||||
* @param ok if specified, will be set to true if evaluation was successful
|
||||
* @returns calculated value for data defined property, or default value
|
||||
* if property does not exist or is deactived.
|
||||
* @see hasDataDefinedProperty
|
||||
* @see getDataDefinedProperty
|
||||
* @note added in QGIS 2.9
|
||||
* @deprecated use variant which takes QgsSymbolRenderContext instead
|
||||
*/
|
||||
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature ) const /Deprecated/;
|
||||
|
||||
/** Evaluates the matching data defined property and returns the calculated
|
||||
* value. Prior to evaluation the data defined property must be prepared
|
||||
* by calling @link prepareExpressions @endlink.
|
||||
@ -308,11 +276,6 @@ class QgsSymbolLayer
|
||||
*/
|
||||
virtual void prepareExpressions( const QgsSymbolRenderContext& context );
|
||||
|
||||
/** Returns the data defined expression associated with a property
|
||||
* @deprecated use getDataDefinedProperty or evaluateDataDefinedProperty instead
|
||||
*/
|
||||
virtual QgsExpression* expression( const QString& property ) const /Deprecated/;
|
||||
|
||||
/** Saves all data defined properties to a string map.
|
||||
* @param stringMap destination string map
|
||||
* @see restoreDataDefinedProperties
|
||||
|
@ -171,17 +171,9 @@ class QgsSymbolLayerUtils
|
||||
QString &path, QString &mime,
|
||||
QColor &color, double &size );
|
||||
|
||||
/** @deprecated Use wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element, QString name, QColor color, QColor borderColor, Qt::PenStyle borderStyle, double borderWidth, double size ) instead */
|
||||
static void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor = QColor(),
|
||||
double borderWidth = -1, double size = -1 ) /Deprecated/;
|
||||
static void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor, Qt::PenStyle borderStyle,
|
||||
double borderWidth = -1, double size = -1 );
|
||||
/** @deprecated Use wellKnownMarkerFromSld( QDomElement &element, QString &name, QColor &color, QColor &borderColor, Qt::PenStyle &borderStyle, double &borderWidth, double &size ) instead */
|
||||
static bool wellKnownMarkerFromSld( QDomElement &element,
|
||||
QString &name, QColor &color, QColor &borderColor,
|
||||
double &borderWidth, double &size ) /Deprecated/;
|
||||
|
||||
//! @note available in python as wellKnownMarkerFromSld2
|
||||
static bool wellKnownMarkerFromSld( QDomElement &element,
|
||||
|
@ -32,9 +32,6 @@ class QgsCategorizedSymbolRendererWidget : QgsRendererWidget
|
||||
void deleteCategories();
|
||||
void deleteAllCategories();
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
|
||||
void showSymbolLevels();
|
||||
|
||||
void rowsMoved();
|
||||
|
@ -30,8 +30,6 @@ class QgsGraduatedSymbolRendererWidget : QgsRendererWidget
|
||||
/** Toggle the link between classes boundaries */
|
||||
void toggleBoundariesLink( bool linked );
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
void labelFormatChanged();
|
||||
|
||||
void showSymbolLevels();
|
||||
|
@ -18,8 +18,5 @@ class QgsSingleSymbolRendererWidget : QgsRendererWidget
|
||||
public slots:
|
||||
void changeSingleSymbol();
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
|
||||
void showSymbolLevels();
|
||||
};
|
||||
|
@ -72,8 +72,6 @@ class QgsSymbolSelectorWidget : QgsPanelWidget
|
||||
|
||||
void lockLayer();
|
||||
|
||||
void saveSymbol() /Deprecated/;
|
||||
|
||||
//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
|
||||
//! @note added in QGIS 2.14
|
||||
void duplicateLayer();
|
||||
@ -159,8 +157,6 @@ class QgsSymbolSelectorDialog : QDialog
|
||||
|
||||
void lockLayer();
|
||||
|
||||
void saveSymbol() /Deprecated/;
|
||||
|
||||
//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
|
||||
//! @note added in QGIS 2.14
|
||||
void duplicateLayer();
|
||||
|
@ -4168,8 +4168,7 @@ bool QgsDxfExport::hasDataDefinedProperties( const QgsSymbolLayer* sl, const Qgs
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( symbol->renderHints() & QgsSymbol::DataDefinedSizeScale ||
|
||||
symbol->renderHints() & QgsSymbol::DataDefinedRotation )
|
||||
if ( symbol->renderHints() & QgsSymbol::DataDefinedRotation )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -40,16 +40,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
|
||||
*/
|
||||
static QgsSymbolLayer* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
|
||||
/** Virtual constructor */
|
||||
virtual QgsArrowSymbolLayer* clone() const override;
|
||||
|
||||
/** Get the sub symbol used for filling */
|
||||
virtual QgsSymbol* subSymbol() override { return mSymbol.data(); }
|
||||
|
||||
/** Set the sub symbol used for filling. Takes ownership. */
|
||||
virtual bool setSubSymbol( QgsSymbol* symbol ) override;
|
||||
|
||||
/** Return a list of attributes required to render this feature */
|
||||
virtual QSet<QString> usedAttributes() const override;
|
||||
|
||||
/** Get current arrow width */
|
||||
@ -140,28 +133,11 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayer
|
||||
/** Set the arrow type */
|
||||
void setArrowType( ArrowType type ) { mArrowType = type; }
|
||||
|
||||
/**
|
||||
* Should be reimplemented by subclasses to return a string map that
|
||||
* contains the configuration information for the symbol layer. This
|
||||
* is used to serialize a symbol layer perstistently.
|
||||
*/
|
||||
QgsStringMap properties() const override;
|
||||
|
||||
/**
|
||||
* Returns a string that represents this layer type. Used for serialization.
|
||||
* Should match with the string used to register this symbol layer in the registry.
|
||||
*/
|
||||
QString layerType() const override;
|
||||
|
||||
/** Prepare the rendering */
|
||||
void startRender( QgsSymbolRenderContext& context ) override;
|
||||
|
||||
/** End of the rendering */
|
||||
void stopRender( QgsSymbolRenderContext& context ) override;
|
||||
|
||||
/** Main drawing method */
|
||||
void renderPolyline( const QPolygonF& points, QgsSymbolRenderContext& context ) override;
|
||||
|
||||
void setColor( const QColor& c ) override;
|
||||
virtual QColor color() const override;
|
||||
|
||||
|
@ -153,7 +153,6 @@ QgsCategorizedSymbolRenderer::QgsCategorizedSymbolRenderer( const QString& attrN
|
||||
: QgsFeatureRenderer( "categorizedSymbol" )
|
||||
, mAttrName( attrName )
|
||||
, mInvertedColorRamp( false )
|
||||
, mScaleMethod( DEFAULT_SCALE_METHOD )
|
||||
, mAttrNum( -1 )
|
||||
, mCounting( false )
|
||||
{
|
||||
@ -216,38 +215,9 @@ QgsSymbol* QgsCategorizedSymbolRenderer::symbolForValue( const QVariant& value )
|
||||
|
||||
QgsSymbol* QgsCategorizedSymbolRenderer::symbolForFeature( QgsFeature& feature, QgsRenderContext &context )
|
||||
{
|
||||
QgsSymbol* symbol = originalSymbolForFeature( feature, context );
|
||||
if ( !symbol )
|
||||
return nullptr;
|
||||
|
||||
if ( !mRotation.data() && !mSizeScale.data() )
|
||||
return symbol; // no data-defined rotation/scaling - just return the symbol
|
||||
|
||||
// find out rotation, size scale
|
||||
const double rotation = mRotation.data() ? mRotation->evaluate( &context.expressionContext() ).toDouble() : 0;
|
||||
const double sizeScale = mSizeScale.data() ? mSizeScale->evaluate( &context.expressionContext() ).toDouble() : 1.;
|
||||
|
||||
// take a temporary symbol (or create it if doesn't exist)
|
||||
QgsSymbol* tempSymbol = mTempSymbols[symbol];
|
||||
|
||||
// modify the temporary symbol and return it
|
||||
if ( tempSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol* markerSymbol = static_cast<QgsMarkerSymbol*>( tempSymbol );
|
||||
if ( mRotation.data() ) markerSymbol->setAngle( rotation );
|
||||
markerSymbol->setSize( sizeScale * static_cast<QgsMarkerSymbol*>( symbol )->size() );
|
||||
markerSymbol->setScaleMethod( mScaleMethod );
|
||||
}
|
||||
else if ( tempSymbol->type() == QgsSymbol::Line )
|
||||
{
|
||||
QgsLineSymbol* lineSymbol = static_cast<QgsLineSymbol*>( tempSymbol );
|
||||
lineSymbol->setWidth( sizeScale * static_cast<QgsLineSymbol*>( symbol )->width() );
|
||||
}
|
||||
|
||||
return tempSymbol;
|
||||
return originalSymbolForFeature( feature, context );
|
||||
}
|
||||
|
||||
|
||||
QVariant QgsCategorizedSymbolRenderer::valueForFeature( QgsFeature& feature, QgsRenderContext &context ) const
|
||||
{
|
||||
QgsAttributes attrs = feature.attributes();
|
||||
@ -435,15 +405,6 @@ void QgsCategorizedSymbolRenderer::startRender( QgsRenderContext& context, const
|
||||
Q_FOREACH ( const QgsRendererCategory& cat, mCategories )
|
||||
{
|
||||
cat.symbol()->startRender( context, fields );
|
||||
|
||||
if ( mRotation.data() || mSizeScale.data() )
|
||||
{
|
||||
QgsSymbol* tempSymbol = cat.symbol()->clone();
|
||||
tempSymbol->setRenderHints(( mRotation.data() ? QgsSymbol::DataDefinedRotation : 0 ) |
|
||||
( mSizeScale.data() ? QgsSymbol::DataDefinedSizeScale : 0 ) );
|
||||
tempSymbol->startRender( context, fields );
|
||||
mTempSymbols[ cat.symbol()] = tempSymbol;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -454,15 +415,6 @@ void QgsCategorizedSymbolRenderer::stopRender( QgsRenderContext& context )
|
||||
{
|
||||
cat.symbol()->stopRender( context );
|
||||
}
|
||||
|
||||
// cleanup mTempSymbols
|
||||
QHash<QgsSymbol*, QgsSymbol*>::const_iterator it2 = mTempSymbols.constBegin();
|
||||
for ( ; it2 != mTempSymbols.constEnd(); ++it2 )
|
||||
{
|
||||
it2.value()->stopRender( context );
|
||||
delete it2.value();
|
||||
}
|
||||
mTempSymbols.clear();
|
||||
mExpression.reset();
|
||||
}
|
||||
|
||||
@ -480,9 +432,6 @@ QList<QString> QgsCategorizedSymbolRenderer::usedAttributes()
|
||||
if ( !testExpr.hasParserError() )
|
||||
attributes.unite( testExpr.referencedColumns().toSet() );
|
||||
|
||||
if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
|
||||
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
|
||||
|
||||
QgsCategoryList::const_iterator catIt = mCategories.constBegin();
|
||||
for ( ; catIt != mCategories.constEnd(); ++catIt )
|
||||
{
|
||||
@ -514,7 +463,6 @@ QgsCategorizedSymbolRenderer* QgsCategorizedSymbolRenderer::clone() const
|
||||
r->setInvertedColorRamp( mInvertedColorRamp );
|
||||
}
|
||||
r->setUsingSymbolLevels( usingSymbolLevels() );
|
||||
r->setSizeScaleField( sizeScaleField() );
|
||||
|
||||
copyRendererData( r );
|
||||
return r;
|
||||
@ -523,10 +471,6 @@ QgsCategorizedSymbolRenderer* QgsCategorizedSymbolRenderer::clone() const
|
||||
void QgsCategorizedSymbolRenderer::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
|
||||
{
|
||||
props[ "attribute" ] = mAttrName;
|
||||
if ( mRotation.data() )
|
||||
props[ "angle" ] = mRotation->expression();
|
||||
if ( mSizeScale.data() )
|
||||
props[ "scale" ] = mSizeScale->expression();
|
||||
|
||||
// create a Rule for each range
|
||||
for ( QgsCategoryList::const_iterator it = mCategories.constBegin(); it != mCategories.constEnd(); ++it )
|
||||
@ -770,14 +714,9 @@ QDomElement QgsCategorizedSymbolRenderer::save( QDomDocument& doc )
|
||||
}
|
||||
|
||||
QDomElement rotationElem = doc.createElement( "rotation" );
|
||||
if ( mRotation.data() )
|
||||
rotationElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mRotation.data() ) );
|
||||
rendererElem.appendChild( rotationElem );
|
||||
|
||||
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
|
||||
if ( mSizeScale.data() )
|
||||
sizeScaleElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) );
|
||||
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerUtils::encodeScaleMethod( mScaleMethod ) );
|
||||
rendererElem.appendChild( sizeScaleElem );
|
||||
|
||||
if ( mPaintEffect && !QgsPaintEffectRegistry::isDefaultStack( mPaintEffect ) )
|
||||
@ -936,37 +875,6 @@ void QgsCategorizedSymbolRenderer::updateColorRamp( QgsColorRamp* ramp, bool inv
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::setRotationField( const QString& fieldOrExpression )
|
||||
{
|
||||
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
|
||||
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString QgsCategorizedSymbolRenderer::rotationField() const
|
||||
{
|
||||
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
|
||||
QgsDataDefined ddAngle = s->dataDefinedAngle();
|
||||
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
|
||||
{
|
||||
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );
|
||||
}
|
||||
|
||||
QString QgsCategorizedSymbolRenderer::sizeScaleField() const
|
||||
{
|
||||
return mSizeScale.data() ? QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) : QString();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::updateSymbols( QgsSymbol * sym )
|
||||
{
|
||||
int i = 0;
|
||||
@ -980,16 +888,6 @@ void QgsCategorizedSymbolRenderer::updateSymbols( QgsSymbol * sym )
|
||||
setSourceSymbol( sym->clone() );
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::setScaleMethod( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mScaleMethod = scaleMethod;
|
||||
QgsCategoryList::const_iterator catIt = mCategories.constBegin();
|
||||
for ( ; catIt != mCategories.constEnd(); ++catIt )
|
||||
{
|
||||
setScaleMethodToSymbol( catIt->symbol(), scaleMethod );
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsCategorizedSymbolRenderer::legendSymbolItemsCheckable() const
|
||||
{
|
||||
return true;
|
||||
|
@ -71,7 +71,6 @@ class CORE_EXPORT QgsRendererCategory
|
||||
|
||||
typedef QList<QgsRendererCategory> QgsCategoryList;
|
||||
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
/** \ingroup core
|
||||
* \class QgsCategorizedSymbolRenderer
|
||||
*/
|
||||
@ -83,30 +82,16 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
|
||||
virtual ~QgsCategorizedSymbolRenderer();
|
||||
|
||||
//! @note available in python as symbolForFeature2
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
//! @note available in python as originalSymbolForFeature2
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context ) override;
|
||||
|
||||
virtual QList<QString> usedAttributes() override;
|
||||
|
||||
virtual QString dump() const override;
|
||||
|
||||
virtual QgsCategorizedSymbolRenderer* clone() const override;
|
||||
|
||||
virtual void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props = QgsStringMap() ) const override;
|
||||
|
||||
//! returns bitwise OR-ed capabilities of the renderer
|
||||
virtual Capabilities capabilities() override { return SymbolLevels | RotationField | Filter; }
|
||||
|
||||
virtual Capabilities capabilities() override { return SymbolLevels | Filter; }
|
||||
virtual QString filter( const QgsFields& fields = QgsFields() ) override;
|
||||
|
||||
//! @note available in python as symbols2
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) override;
|
||||
|
||||
/** Update all the symbols but leave categories and colors. This method also sets the source
|
||||
@ -148,19 +133,10 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
//! create renderer from XML element
|
||||
static QgsFeatureRenderer* create( QDomElement& element );
|
||||
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc ) override;
|
||||
|
||||
//! return a list of symbology items for the legend
|
||||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
|
||||
|
||||
//! return a list of item text / symbol
|
||||
//! @note not available in python bindings
|
||||
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = QString() ) override;
|
||||
|
||||
//! @note added in 2.10
|
||||
QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
|
||||
|
||||
virtual QSet< QString > legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
/** Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying
|
||||
@ -202,31 +178,10 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
void updateColorRamp( QgsColorRamp* ramp, bool inverted = false );
|
||||
|
||||
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
|
||||
Q_DECL_DEPRECATED QString rotationField() const override;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const { return mScaleMethod; }
|
||||
|
||||
//! items of symbology items in legend should be checkable
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemsCheckable() const override;
|
||||
|
||||
//! item in symbology was checked
|
||||
// @note added in 2.5
|
||||
virtual bool legendSymbolItemChecked( const QString& key ) override;
|
||||
|
||||
virtual void setLegendSymbolItem( const QString& key, QgsSymbol* symbol ) override;
|
||||
|
||||
//! item in symbology was checked
|
||||
// @note added in 2.5
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true ) override;
|
||||
|
||||
//! If supported by the renderer, return classification attribute for the use in legend
|
||||
//! @note added in 2.6
|
||||
virtual QString legendClassificationAttribute() const override { return classAttribute(); }
|
||||
|
||||
//! creates a QgsCategorizedSymbolRenderer from an existing renderer.
|
||||
@ -240,9 +195,6 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
QScopedPointer<QgsSymbol> mSourceSymbol;
|
||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
||||
bool mInvertedColorRamp;
|
||||
QScopedPointer<QgsExpression> mRotation;
|
||||
QScopedPointer<QgsExpression> mSizeScale;
|
||||
QgsSymbol::ScaleMethod mScaleMethod;
|
||||
QScopedPointer<QgsExpression> mExpression;
|
||||
|
||||
//! attribute index (derived from attribute name in startRender)
|
||||
@ -252,9 +204,6 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
QHash<QString, QgsSymbol*> mSymbolHash;
|
||||
bool mCounting;
|
||||
|
||||
//! temporary symbols, used for data-defined rotation and scaling
|
||||
QHash<QgsSymbol*, QgsSymbol*> mTempSymbols;
|
||||
|
||||
void rebuildHash();
|
||||
|
||||
QgsSymbol* skipRender();
|
||||
@ -267,7 +216,5 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
QVariant valueForFeature( QgsFeature& feature, QgsRenderContext &context ) const;
|
||||
|
||||
};
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
|
||||
#endif // QGSCATEGORIZEDSYMBOLRENDERERV2_H
|
||||
|
@ -340,36 +340,15 @@ class CORE_EXPORT QgsCptCityBrowserModel : public QAbstractItemModel
|
||||
~QgsCptCityBrowserModel();
|
||||
|
||||
// implemented methods from QAbstractItemModel for read-only access
|
||||
|
||||
/** Used by other components to obtain information about each item provided by the model.
|
||||
In many models, the combination of flags should include Qt::ItemIsEnabled and Qt::ItemIsSelectable. */
|
||||
virtual Qt::ItemFlags flags( const QModelIndex &index ) const override;
|
||||
|
||||
/** Used to supply item data to views and delegates. Generally, models only need to supply data
|
||||
for Qt::DisplayRole and any application-specific user roles, but it is also good practice
|
||||
to provide data for Qt::ToolTipRole, Qt::AccessibleTextRole, and Qt::AccessibleDescriptionRole.
|
||||
See the Qt::ItemDataRole enum documentation for information about the types associated with each role. */
|
||||
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
|
||||
|
||||
/** Provides views with information to show in their headers. The information is only retrieved
|
||||
by views that can display header information. */
|
||||
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
|
||||
|
||||
/** Provides the number of rows of data exposed by the model. */
|
||||
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
|
||||
|
||||
/** Provides the number of columns of data exposed by the model. List models do not provide this function
|
||||
because it is already implemented in QAbstractListModel. */
|
||||
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
|
||||
|
||||
/** Returns the index of the item in the model specified by the given row, column and parent index. */
|
||||
virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const override;
|
||||
|
||||
QModelIndex findItem( QgsCptCityDataItem *item, QgsCptCityDataItem *parent = nullptr ) const;
|
||||
|
||||
/** Returns the parent of the model item with the given index.
|
||||
* If the item has no parent, an invalid QModelIndex is returned.
|
||||
*/
|
||||
virtual QModelIndex parent( const QModelIndex &index ) const override;
|
||||
|
||||
/** Returns a list of mime that can describe model indexes */
|
||||
|
@ -550,11 +550,7 @@ QSizeF QgsEllipseSymbolLayer::calculateSize( QgsSymbolRenderContext& context, do
|
||||
context.setOriginalValueVariable( mSymbolWidth );
|
||||
width = evaluateDataDefinedProperty( QgsSymbolLayer::EXPR_WIDTH, context, mSymbolWidth ).toDouble();
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||
{
|
||||
width = mSize;
|
||||
}
|
||||
else //3. priority: global width setting
|
||||
else //2. priority: global width setting
|
||||
{
|
||||
width = mSymbolWidth;
|
||||
}
|
||||
@ -570,11 +566,7 @@ QSizeF QgsEllipseSymbolLayer::calculateSize( QgsSymbolRenderContext& context, do
|
||||
context.setOriginalValueVariable( mSymbolHeight );
|
||||
height = evaluateDataDefinedProperty( QgsSymbolLayer::EXPR_HEIGHT, context, mSymbolHeight ).toDouble();
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||
{
|
||||
height = mSize;
|
||||
}
|
||||
else //3. priority: global height setting
|
||||
else //2. priority: global height setting
|
||||
{
|
||||
height = mSymbolHeight;
|
||||
}
|
||||
@ -745,10 +737,6 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFact
|
||||
context.setOriginalValueVariable( mSymbolWidth );
|
||||
symbolWidth = evaluateDataDefinedProperty( QgsSymbolLayer::EXPR_WIDTH, context, mSymbolWidth ).toDouble();
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||
{
|
||||
symbolWidth = mSize;
|
||||
}
|
||||
if ( mSymbolWidthUnit == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
symbolWidth *= mmMapUnitScaleFactor;
|
||||
@ -761,10 +749,6 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFact
|
||||
context.setOriginalValueVariable( mSymbolHeight );
|
||||
symbolHeight = evaluateDataDefinedProperty( QgsSymbolLayer::EXPR_HEIGHT, context, mSymbolHeight ).toDouble();
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
|
||||
{
|
||||
symbolHeight = mSize;
|
||||
}
|
||||
if ( mSymbolHeightUnit == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
symbolHeight *= mmMapUnitScaleFactor;
|
||||
|
@ -73,18 +73,9 @@ class CORE_EXPORT QgsSimpleFillSymbolLayer : public QgsFillSymbolLayer
|
||||
QColor borderColor() const { return mBorderColor; }
|
||||
void setBorderColor( const QColor& borderColor ) { mBorderColor = borderColor; }
|
||||
|
||||
/** Get outline color.
|
||||
* @note added in 2.1 */
|
||||
QColor outlineColor() const override { return borderColor(); }
|
||||
/** Set outline color.
|
||||
* @note added in 2.1 */
|
||||
void setOutlineColor( const QColor& color ) override { setBorderColor( color ); }
|
||||
|
||||
/** Get fill color.
|
||||
* @note added in 2.1 */
|
||||
QColor fillColor() const override { return color(); }
|
||||
/** Set fill color.
|
||||
* @note added in 2.1 */
|
||||
void setFillColor( const QColor& color ) override { setColor( color ); }
|
||||
|
||||
Qt::PenStyle borderStyle() const { return mBorderStyle; }
|
||||
|
@ -289,7 +289,6 @@ QgsGraduatedSymbolRenderer::QgsGraduatedSymbolRenderer( const QString& attrName,
|
||||
, mAttrName( attrName )
|
||||
, mMode( Custom )
|
||||
, mInvertedColorRamp( false )
|
||||
, mScaleMethod( DEFAULT_SCALE_METHOD )
|
||||
, mGraduatedMethod( GraduatedColor )
|
||||
, mAttrNum( -1 )
|
||||
, mCounting( false )
|
||||
@ -348,34 +347,7 @@ QString QgsGraduatedSymbolRenderer::legendKeyForValue( double value ) const
|
||||
|
||||
QgsSymbol* QgsGraduatedSymbolRenderer::symbolForFeature( QgsFeature& feature, QgsRenderContext &context )
|
||||
{
|
||||
QgsSymbol* symbol = originalSymbolForFeature( feature, context );
|
||||
if ( !symbol )
|
||||
return nullptr;
|
||||
|
||||
if ( !mRotation.data() && !mSizeScale.data() )
|
||||
return symbol; // no data-defined rotation/scaling - just return the symbol
|
||||
|
||||
// find out rotation, size scale
|
||||
const double rotation = mRotation.data() ? mRotation->evaluate( &context.expressionContext() ).toDouble() : 0;
|
||||
const double sizeScale = mSizeScale.data() ? mSizeScale->evaluate( &context.expressionContext() ).toDouble() : 1.;
|
||||
|
||||
// take a temporary symbol (or create it if doesn't exist)
|
||||
QgsSymbol* tempSymbol = mTempSymbols[symbol];
|
||||
|
||||
// modify the temporary symbol and return it
|
||||
if ( tempSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol* markerSymbol = static_cast<QgsMarkerSymbol*>( tempSymbol );
|
||||
if ( mRotation.data() ) markerSymbol->setAngle( rotation );
|
||||
markerSymbol->setSize( sizeScale * static_cast<QgsMarkerSymbol*>( symbol )->size() );
|
||||
markerSymbol->setScaleMethod( mScaleMethod );
|
||||
}
|
||||
else if ( tempSymbol->type() == QgsSymbol::Line )
|
||||
{
|
||||
QgsLineSymbol* lineSymbol = static_cast<QgsLineSymbol*>( tempSymbol );
|
||||
lineSymbol->setWidth( sizeScale * static_cast<QgsLineSymbol*>( symbol )->width() );
|
||||
}
|
||||
return tempSymbol;
|
||||
return originalSymbolForFeature( feature, context );
|
||||
}
|
||||
|
||||
QVariant QgsGraduatedSymbolRenderer::valueForFeature( QgsFeature& feature, QgsRenderContext &context ) const
|
||||
@ -425,15 +397,6 @@ void QgsGraduatedSymbolRenderer::startRender( QgsRenderContext& context, const Q
|
||||
continue;
|
||||
|
||||
range.symbol()->startRender( context, fields );
|
||||
|
||||
if ( mRotation.data() || mSizeScale.data() )
|
||||
{
|
||||
QgsSymbol* tempSymbol = range.symbol()->clone();
|
||||
tempSymbol->setRenderHints(( mRotation.data() ? QgsSymbol::DataDefinedRotation : 0 ) |
|
||||
( mSizeScale.data() ? QgsSymbol::DataDefinedSizeScale : 0 ) );
|
||||
tempSymbol->startRender( context, fields );
|
||||
mTempSymbols[ range.symbol()] = tempSymbol;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -447,15 +410,6 @@ void QgsGraduatedSymbolRenderer::stopRender( QgsRenderContext& context )
|
||||
|
||||
range.symbol()->stopRender( context );
|
||||
}
|
||||
|
||||
// cleanup mTempSymbols
|
||||
QHash<QgsSymbol*, QgsSymbol*>::const_iterator it2 = mTempSymbols.constBegin();
|
||||
for ( ; it2 != mTempSymbols.constEnd(); ++it2 )
|
||||
{
|
||||
it2.value()->stopRender( context );
|
||||
delete it2.value();
|
||||
}
|
||||
mTempSymbols.clear();
|
||||
}
|
||||
|
||||
QList<QString> QgsGraduatedSymbolRenderer::usedAttributes()
|
||||
@ -472,9 +426,6 @@ QList<QString> QgsGraduatedSymbolRenderer::usedAttributes()
|
||||
if ( !testExpr.hasParserError() )
|
||||
attributes.unite( testExpr.referencedColumns().toSet() );
|
||||
|
||||
if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
|
||||
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
|
||||
|
||||
QgsRangeList::const_iterator range_it = mRanges.constBegin();
|
||||
for ( ; range_it != mRanges.constEnd(); ++range_it )
|
||||
{
|
||||
@ -553,7 +504,6 @@ QgsGraduatedSymbolRenderer* QgsGraduatedSymbolRenderer::clone() const
|
||||
r->setInvertedColorRamp( mInvertedColorRamp );
|
||||
}
|
||||
r->setUsingSymbolLevels( usingSymbolLevels() );
|
||||
r->setSizeScaleField( sizeScaleField() );
|
||||
r->setLabelFormat( labelFormat() );
|
||||
r->setGraduatedMethod( graduatedMethod() );
|
||||
copyRendererData( r );
|
||||
@ -564,10 +514,6 @@ void QgsGraduatedSymbolRenderer::toSld( QDomDocument& doc, QDomElement &element,
|
||||
{
|
||||
props[ "attribute" ] = mAttrName;
|
||||
props[ "method" ] = graduatedMethodStr( mGraduatedMethod );
|
||||
if ( mRotation.data() )
|
||||
props[ "angle" ] = mRotation->expression();
|
||||
if ( mSizeScale.data() )
|
||||
props[ "scale" ] = mSizeScale->expression();
|
||||
|
||||
// create a Rule for each range
|
||||
bool first = true;
|
||||
@ -858,12 +804,6 @@ QgsGraduatedSymbolRenderer* QgsGraduatedSymbolRenderer::createRenderer(
|
||||
return r;
|
||||
}
|
||||
|
||||
QList<double> QgsGraduatedSymbolRenderer::getDataValues( QgsVectorLayer *vlayer )
|
||||
{
|
||||
bool ok;
|
||||
return vlayer->getDoubleValues( mAttrName, ok );
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses )
|
||||
{
|
||||
if ( mAttrName.isEmpty() )
|
||||
@ -1182,14 +1122,9 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument& doc )
|
||||
}
|
||||
|
||||
QDomElement rotationElem = doc.createElement( "rotation" );
|
||||
if ( mRotation.data() )
|
||||
rotationElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mRotation.data() ) );
|
||||
rendererElem.appendChild( rotationElem );
|
||||
|
||||
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
|
||||
if ( mSizeScale.data() )
|
||||
sizeScaleElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) );
|
||||
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerUtils::encodeScaleMethod( mScaleMethod ) );
|
||||
rendererElem.appendChild( sizeScaleElem );
|
||||
|
||||
QDomElement labelFormatElem = doc.createElement( "labelformat" );
|
||||
@ -1428,48 +1363,6 @@ void QgsGraduatedSymbolRenderer::updateSymbols( QgsSymbol *sym )
|
||||
setSourceSymbol( sym->clone() );
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::setRotationField( const QString& fieldOrExpression )
|
||||
{
|
||||
if ( mSourceSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
|
||||
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString QgsGraduatedSymbolRenderer::rotationField() const
|
||||
{
|
||||
if ( mSourceSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
|
||||
QgsDataDefined ddAngle = s->dataDefinedAngle();
|
||||
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
|
||||
{
|
||||
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );
|
||||
}
|
||||
|
||||
QString QgsGraduatedSymbolRenderer::sizeScaleField() const
|
||||
{
|
||||
return mSizeScale.data() ? QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) : QString();
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::setScaleMethod( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mScaleMethod = scaleMethod;
|
||||
Q_FOREACH ( const QgsRendererRange& range, mRanges )
|
||||
{
|
||||
if ( range.symbol() )
|
||||
setScaleMethodToSymbol( range.symbol(), scaleMethod );
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsGraduatedSymbolRenderer::legendSymbolItemsCheckable() const
|
||||
{
|
||||
return true;
|
||||
|
@ -125,7 +125,6 @@ class CORE_EXPORT QgsRendererRangeLabelFormat
|
||||
class QgsVectorLayer;
|
||||
class QgsColorRamp;
|
||||
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
/** \ingroup core
|
||||
* \class QgsGraduatedSymbolRenderer
|
||||
*/
|
||||
@ -137,27 +136,15 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
|
||||
virtual ~QgsGraduatedSymbolRenderer();
|
||||
|
||||
//! @note labelForLowerUpper in python bindings
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext &context ) override;
|
||||
//! @note originalSymbolForFeature2 in python bindings
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext &context ) override;
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context ) override;
|
||||
|
||||
virtual QList<QString> usedAttributes() override;
|
||||
|
||||
virtual QString dump() const override;
|
||||
|
||||
virtual QgsGraduatedSymbolRenderer* clone() const override;
|
||||
|
||||
virtual void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props = QgsStringMap() ) const override;
|
||||
|
||||
//! returns bitwise OR-ed capabilities of the renderer
|
||||
virtual Capabilities capabilities() override { return SymbolLevels | RotationField | Filter; }
|
||||
|
||||
//! @note symbol2 in python bindings
|
||||
virtual Capabilities capabilities() override { return SymbolLevels | Filter; }
|
||||
virtual QgsSymbolList symbols( QgsRenderContext &context ) override;
|
||||
|
||||
QString classAttribute() const { return mAttrName; }
|
||||
@ -227,12 +214,6 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
//! @note Added in 2.6
|
||||
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses );
|
||||
|
||||
//! Evaluates the data expression and returns the list of values from the layer
|
||||
//! @param vlayer The layer for which to evaluate the expression
|
||||
//! @note Added in 2.6
|
||||
//! @deprecated use QgsVectorLayer::getDoubleValues instead
|
||||
Q_DECL_DEPRECATED QList<double> getDataValues( QgsVectorLayer *vlayer );
|
||||
|
||||
//! Return the label format used to generate default classification labels
|
||||
//! @note Added in 2.6
|
||||
const QgsRendererRangeLabelFormat &labelFormat() const { return mLabelFormat; }
|
||||
@ -272,19 +253,10 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
//! create renderer from XML element
|
||||
static QgsFeatureRenderer* create( QDomElement& element );
|
||||
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc ) override;
|
||||
|
||||
//! return a list of symbology items for the legend
|
||||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
|
||||
|
||||
//! return a list of item text / symbol
|
||||
//! @note not available in python bindings
|
||||
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = QString() ) override;
|
||||
|
||||
//! @note added in 2.10
|
||||
QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
|
||||
|
||||
virtual QSet< QString > legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
/** Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying
|
||||
@ -354,31 +326,10 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
//! @note added in 2.10
|
||||
void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; }
|
||||
|
||||
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
|
||||
Q_DECL_DEPRECATED QString rotationField() const override;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const { return mScaleMethod; }
|
||||
|
||||
//! items of symbology items in legend should be checkable
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemsCheckable() const override;
|
||||
|
||||
//! item in symbology was checked
|
||||
//! @note added in 2.6
|
||||
virtual bool legendSymbolItemChecked( const QString& key ) override;
|
||||
|
||||
//! item in symbology was checked
|
||||
//! @note added in 2.6
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true ) override;
|
||||
|
||||
virtual void setLegendSymbolItem( const QString& key, QgsSymbol* symbol ) override;
|
||||
|
||||
//! If supported by the renderer, return classification attribute for the use in legend
|
||||
//! @note added in 2.6
|
||||
virtual QString legendClassificationAttribute() const override { return classAttribute(); }
|
||||
|
||||
//! creates a QgsGraduatedSymbolRenderer from an existing renderer.
|
||||
@ -395,18 +346,12 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
bool mInvertedColorRamp;
|
||||
QgsRendererRangeLabelFormat mLabelFormat;
|
||||
|
||||
QScopedPointer<QgsExpression> mRotation;
|
||||
QScopedPointer<QgsExpression> mSizeScale;
|
||||
QgsSymbol::ScaleMethod mScaleMethod;
|
||||
QScopedPointer<QgsExpression> mExpression;
|
||||
GraduatedMethod mGraduatedMethod;
|
||||
//! attribute index (derived from attribute name in startRender)
|
||||
int mAttrNum;
|
||||
bool mCounting;
|
||||
|
||||
//! temporary symbols, used for data-defined rotation and scaling
|
||||
QHash<QgsSymbol*, QgsSymbol*> mTempSymbols;
|
||||
|
||||
QgsSymbol* symbolForValue( double value );
|
||||
|
||||
/** Returns the matching legend key for a value.
|
||||
@ -423,6 +368,5 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
QVariant valueForFeature( QgsFeature& feature, QgsRenderContext &context ) const;
|
||||
|
||||
};
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
#endif // QGSGRADUATEDSYMBOLRENDERERV2_H
|
||||
|
@ -48,9 +48,7 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
|
||||
|
||||
virtual ~QgsInvertedPolygonRenderer();
|
||||
|
||||
/** Used to clone this feature renderer.*/
|
||||
virtual QgsInvertedPolygonRenderer* clone() const override;
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
|
||||
|
||||
/** Renders a given feature.
|
||||
@ -70,7 +68,6 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
virtual void stopRender( QgsRenderContext& context ) override;
|
||||
|
||||
/** @returns a textual representation of the renderer */
|
||||
virtual QString dump() const override;
|
||||
|
||||
/** Proxy that will call this method on the embedded renderer. */
|
||||
@ -78,23 +75,18 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
|
||||
/** Proxy that will call this method on the embedded renderer. */
|
||||
virtual Capabilities capabilities() override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbol2
|
||||
*/
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as originalSymbolForFeature2
|
||||
*/
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as symbolsForFeature
|
||||
*/
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as originalSymbolsForFeature2
|
||||
*/
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
/** Proxy that will call this method on the embedded renderer. */
|
||||
@ -104,17 +96,12 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = "" ) override;
|
||||
/** Proxy that will call this method on the embedded renderer.
|
||||
* @note available in python bindings as willRenderFeature2
|
||||
*/
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
|
||||
/** Creates a renderer out of an XML, for loading*/
|
||||
static QgsFeatureRenderer* create( QDomElement& element );
|
||||
|
||||
/** Creates an XML representation of the renderer. Used for saving purpose
|
||||
* @param doc the XML document where to create the XML subtree
|
||||
* @returns the created XML subtree
|
||||
*/
|
||||
virtual QDomElement save( QDomDocument& doc ) override;
|
||||
|
||||
void setEmbeddedRenderer( QgsFeatureRenderer* subRenderer ) override;
|
||||
|
@ -293,12 +293,6 @@ void QgsSimpleLineSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbo
|
||||
return;
|
||||
}
|
||||
|
||||
//size scaling by field
|
||||
if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale )
|
||||
{
|
||||
applySizeScale( context, mPen, mSelPen );
|
||||
}
|
||||
|
||||
double offset = mOffset;
|
||||
applyDataDefinedSymbology( context, mPen, mSelPen, offset );
|
||||
|
||||
@ -480,13 +474,6 @@ QgsSymbolLayer* QgsSimpleLineSymbolLayer::createFromSld( QDomElement &element )
|
||||
return l;
|
||||
}
|
||||
|
||||
void QgsSimpleLineSymbolLayer::applySizeScale( QgsSymbolRenderContext& context, QPen& pen, QPen& selPen )
|
||||
{
|
||||
double scaledWidth = QgsSymbolLayerUtils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
pen.setWidthF( scaledWidth );
|
||||
selPen.setWidthF( scaledWidth );
|
||||
}
|
||||
|
||||
void QgsSimpleLineSymbolLayer::applyDataDefinedSymbology( QgsSymbolRenderContext& context, QPen& pen, QPen& selPen, double& offset )
|
||||
{
|
||||
if ( !hasDataDefinedProperties() )
|
||||
@ -617,10 +604,6 @@ double QgsSimpleLineSymbolLayer::dxfWidth( const QgsDxfExport& e, QgsSymbolRende
|
||||
context.setOriginalValueVariable( mWidth );
|
||||
width = evaluateDataDefinedProperty( QgsSymbolLayer::EXPR_WIDTH, context, mWidth ).toDouble() * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), widthUnit(), e.mapUnits() );
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale )
|
||||
{
|
||||
width = QgsSymbolLayerUtils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
}
|
||||
|
||||
return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), widthUnit(), e.mapUnits() );
|
||||
}
|
||||
@ -829,8 +812,6 @@ void QgsMarkerLineSymbolLayer::startRender( QgsSymbolRenderContext& context )
|
||||
int hints = 0;
|
||||
if ( mRotateMarker )
|
||||
hints |= QgsSymbol::DataDefinedRotation;
|
||||
if ( context.renderHints() & QgsSymbol::DataDefinedSizeScale )
|
||||
hints |= QgsSymbol::DataDefinedSizeScale;
|
||||
mMarker->setRenderHints( hints );
|
||||
|
||||
mMarker->startRender( context.renderContext(), context.fields() );
|
||||
|
@ -136,7 +136,6 @@ class CORE_EXPORT QgsSimpleLineSymbolLayer : public QgsLineSymbolLayer
|
||||
private:
|
||||
//helper functions for data defined symbology
|
||||
void applyDataDefinedSymbology( QgsSymbolRenderContext& context, QPen& pen, QPen& selPen, double& offset );
|
||||
void applySizeScale( QgsSymbolRenderContext& context, QPen& pen, QPen& selPen );
|
||||
};
|
||||
|
||||
/////////
|
||||
|
@ -131,7 +131,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( QgsSimpleMarkerSymbolLayerBa
|
||||
void QgsSimpleMarkerSymbolLayerBase::startRender( QgsSymbolRenderContext &context )
|
||||
{
|
||||
bool hasDataDefinedRotation = context.renderHints() & QgsSymbol::DataDefinedRotation || hasDataDefinedProperty( QgsSymbolLayer::EXPR_ANGLE );
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
// use either QPolygonF or QPainterPath for drawing
|
||||
if ( !prepareMarkerShape( mShape ) ) // drawing as a polygon
|
||||
@ -612,7 +612,7 @@ double QgsSimpleMarkerSymbolLayerBase::calculateSize( QgsSymbolRenderContext &co
|
||||
{
|
||||
double scaledSize = mSize;
|
||||
|
||||
hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool ok = true;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE ) )
|
||||
{
|
||||
@ -682,20 +682,6 @@ void QgsSimpleMarkerSymbolLayerBase::calculateOffsetAndRotation( QgsSymbolRender
|
||||
// QgsSimpleMarkerSymbolLayer
|
||||
//
|
||||
|
||||
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( const QString& name, const QColor& color, const QColor& borderColor, double size, double angle, QgsSymbol::ScaleMethod scaleMethod,
|
||||
Qt::PenJoinStyle penJoinStyle )
|
||||
: QgsSimpleMarkerSymbolLayerBase( decodeShape( name ), size, angle, scaleMethod )
|
||||
, mBorderColor( borderColor )
|
||||
, mOutlineStyle( Qt::SolidLine )
|
||||
, mOutlineWidth( 0 )
|
||||
, mOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mPenJoinStyle( penJoinStyle )
|
||||
, mName( name )
|
||||
, mUsingCache( false )
|
||||
{
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape, double size, double angle, QgsSymbol::ScaleMethod scaleMethod, const QColor& color, const QColor& borderColor, Qt::PenJoinStyle penJoinStyle )
|
||||
: QgsSimpleMarkerSymbolLayerBase( shape, size, angle, scaleMethod )
|
||||
, mBorderColor( borderColor )
|
||||
@ -839,7 +825,7 @@ void QgsSimpleMarkerSymbolLayer::startRender( QgsSymbolRenderContext& context )
|
||||
mSelPen.setWidthF( QgsSymbolLayerUtils::convertToPainterUnits( context.renderContext(), mOutlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
|
||||
bool hasDataDefinedRotation = context.renderHints() & QgsSymbol::DataDefinedRotation || hasDataDefinedProperty( QgsSymbolLayer::EXPR_ANGLE );
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
// use caching only when:
|
||||
// - size, rotation, shape, color, border color is not data-defined
|
||||
@ -944,21 +930,6 @@ bool QgsSimpleMarkerSymbolLayer::prepareCache( QgsSymbolRenderContext& context )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::prepareShape( const QString& name )
|
||||
{
|
||||
return shapeToPolygon( name.isNull() ? mShape : decodeShape( name ), mPolygon );
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::prepareShape( const QString& name, QPolygonF &polygon ) const
|
||||
{
|
||||
return shapeToPolygon( decodeShape( name ), polygon );
|
||||
}
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayer::preparePath( QString name )
|
||||
{
|
||||
return prepareMarkerPath( decodeShape( name ) );
|
||||
}
|
||||
|
||||
void QgsSimpleMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
|
||||
{
|
||||
//making changes here? Don't forget to also update ::bounds if the changes affect the bounding box
|
||||
@ -1266,7 +1237,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport& e, double mmMapUnitScal
|
||||
//data defined size?
|
||||
double size = mSize;
|
||||
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
//data defined size
|
||||
bool ok = true;
|
||||
@ -2082,7 +2053,7 @@ void QgsSvgMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContext
|
||||
double QgsSvgMarkerSymbolLayer::calculateSize( QgsSymbolRenderContext& context, bool& hasDataDefinedSize ) const
|
||||
{
|
||||
double scaledSize = mSize;
|
||||
hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
bool ok = true;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE ) )
|
||||
@ -2297,7 +2268,7 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
||||
//size
|
||||
double size = mSize;
|
||||
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
bool ok = true;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE ) )
|
||||
@ -2678,7 +2649,7 @@ void QgsFontMarkerSymbolLayer::calculateOffsetAndRotation( QgsSymbolRenderContex
|
||||
double QgsFontMarkerSymbolLayer::calculateSize( QgsSymbolRenderContext& context )
|
||||
{
|
||||
double scaledSize = mSize;
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbol::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
bool hasDataDefinedSize = hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE );
|
||||
|
||||
bool ok = true;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayer::EXPR_SIZE ) )
|
||||
|
@ -186,28 +186,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
{
|
||||
public:
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param name symbol name, should be one of "square", "rectangle", "diamond",
|
||||
* "pentagon", "hexagon", "triangle", "equilateral_triangle", "star", "arrow",
|
||||
* "circle", "cross", "cross_fill", "cross2", "line", "x", "arrowhead", "filled_arrowhead",
|
||||
* "semi_circle", "third_circle", "quarter_circle", "quarter_square", "half_square",
|
||||
* "diagonal_half_square", "right_half_triangle", "left_half_triangle"
|
||||
* @param color fill color for symbol
|
||||
* @param borderColor border color for symbol
|
||||
* @param size symbol size (in mm)
|
||||
* @param angle symbol rotation angle
|
||||
* @param scaleMethod scaling method for data defined scaling
|
||||
* @param penJoinStyle join style for outline pen
|
||||
* @deprecated use variant which accepts QgsSimpleMarkerSymbolLayerBase::Shape instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED QgsSimpleMarkerSymbolLayer( const QString& name,
|
||||
const QColor& color = DEFAULT_SIMPLEMARKER_COLOR,
|
||||
const QColor& borderColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
|
||||
double size = DEFAULT_SIMPLEMARKER_SIZE,
|
||||
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
|
||||
QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
|
||||
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
|
||||
|
||||
/** Constructor for QgsSimpleMarkerSymbolLayer.
|
||||
* @param shape symbol shape
|
||||
* @param size symbol size (in mm)
|
||||
@ -263,12 +241,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
|
||||
// new methods
|
||||
|
||||
//! @deprecated use shape() instead
|
||||
Q_DECL_DEPRECATED QString name() const { return encodeShape( mShape ); }
|
||||
|
||||
//! @deprecated use setShape() instead
|
||||
Q_DECL_DEPRECATED void setName( const QString& name ) { mName = name; mShape = decodeShape( name ); }
|
||||
|
||||
/** Returns the marker's border color.
|
||||
* @see setBorderColor()
|
||||
* @see outlineStyle()
|
||||
@ -372,13 +344,6 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
|
||||
*/
|
||||
void drawMarker( QPainter* p, QgsSymbolRenderContext& context );
|
||||
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool prepareShape( const QString& name = QString() );
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool prepareShape( const QString& name, QPolygonF &polygon ) const;
|
||||
//! @deprecated will be removed in QGIS 3.0
|
||||
Q_DECL_DEPRECATED bool preparePath( QString name = QString() );
|
||||
|
||||
/** Prepares cache image
|
||||
* @returns true in case of success, false if cache image size too large
|
||||
*/
|
||||
@ -617,11 +582,7 @@ class CORE_EXPORT QgsFontMarkerSymbolLayer : public QgsMarkerSymbolLayer
|
||||
QChar character() const { return mChr; }
|
||||
void setCharacter( QChar ch ) { mChr = ch; }
|
||||
|
||||
/** Get outline color.
|
||||
* @note added in 2.16 */
|
||||
QColor outlineColor() const override { return mOutlineColor; }
|
||||
/** Set outline color.
|
||||
* @note added in 2.16 */
|
||||
void setOutlineColor( const QColor& color ) override { mOutlineColor = color; }
|
||||
|
||||
/** Get outline width.
|
||||
|
@ -105,10 +105,6 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsFeatureRenderer
|
||||
virtual bool legendSymbolItemChecked( const QString& key ) override;
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true ) override;
|
||||
|
||||
//! not available in python bindings
|
||||
//! @deprecated since 2.4
|
||||
Q_DECL_DEPRECATED void setDisplacementGroups( const QList<QMap<QgsFeatureId, QgsFeature> >& list ) { Q_UNUSED( list ); }
|
||||
|
||||
void setLabelFont( const QFont& f ) { mLabelFont = f; }
|
||||
QFont labelFont() const { return mLabelFont;}
|
||||
|
||||
|
@ -45,21 +45,6 @@ QPointF QgsFeatureRenderer::_getPoint( QgsRenderContext& context, const QgsPoint
|
||||
return QgsSymbol::_getPoint( context, point );
|
||||
}
|
||||
|
||||
void QgsFeatureRenderer::setScaleMethodToSymbol( QgsSymbol* symbol, int scaleMethod )
|
||||
{
|
||||
if ( symbol )
|
||||
{
|
||||
if ( symbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol* ms = static_cast<QgsMarkerSymbol*>( symbol );
|
||||
if ( ms )
|
||||
{
|
||||
ms->setScaleMethod( static_cast< QgsSymbol::ScaleMethod >( scaleMethod ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsFeatureRenderer::copyRendererData( QgsFeatureRenderer* destRenderer ) const
|
||||
{
|
||||
if ( !destRenderer || !mPaintEffect )
|
||||
@ -70,14 +55,6 @@ void QgsFeatureRenderer::copyRendererData( QgsFeatureRenderer* destRenderer ) co
|
||||
destRenderer->mOrderByEnabled = mOrderByEnabled;
|
||||
}
|
||||
|
||||
void QgsFeatureRenderer::copyPaintEffect( QgsFeatureRenderer *destRenderer ) const
|
||||
{
|
||||
if ( !destRenderer || !mPaintEffect )
|
||||
return;
|
||||
|
||||
destRenderer->setPaintEffect( mPaintEffect->clone() );
|
||||
}
|
||||
|
||||
QgsFeatureRenderer::QgsFeatureRenderer( const QString& type )
|
||||
: mType( type )
|
||||
, mUsingSymbolLevels( false )
|
||||
@ -101,30 +78,7 @@ QgsFeatureRenderer* QgsFeatureRenderer::defaultRenderer( QgsWkbTypes::GeometryTy
|
||||
return new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( geomType ) );
|
||||
}
|
||||
|
||||
QgsSymbol* QgsFeatureRenderer::symbolForFeature( QgsFeature& feature )
|
||||
{
|
||||
QgsRenderContext context;
|
||||
context.setExpressionContext( QgsExpressionContextUtils::createFeatureBasedContext( feature, QgsFields() ) );
|
||||
return symbolForFeature( feature, context );
|
||||
}
|
||||
|
||||
QgsSymbol* QgsFeatureRenderer::symbolForFeature( QgsFeature &feature, QgsRenderContext &context )
|
||||
{
|
||||
Q_UNUSED( context );
|
||||
// base method calls deprecated symbolForFeature to maintain API
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return symbolForFeature( feature );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
QgsSymbol *QgsFeatureRenderer::originalSymbolForFeature( QgsFeature &feature )
|
||||
{
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return symbolForFeature( feature );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
QgsSymbol *QgsFeatureRenderer::originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context )
|
||||
QgsSymbol* QgsFeatureRenderer::originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context )
|
||||
{
|
||||
return symbolForFeature( feature, context );
|
||||
}
|
||||
@ -136,11 +90,6 @@ QSet< QString > QgsFeatureRenderer::legendKeysForFeature( QgsFeature& feature, Q
|
||||
return QSet< QString >();
|
||||
}
|
||||
|
||||
void QgsFeatureRenderer::startRender( QgsRenderContext& context, const QgsVectorLayer* vlayer )
|
||||
{
|
||||
startRender( context, vlayer->fields() );
|
||||
}
|
||||
|
||||
bool QgsFeatureRenderer::filterNeedsGeometry() const
|
||||
{
|
||||
return false;
|
||||
@ -166,23 +115,6 @@ QString QgsFeatureRenderer::dump() const
|
||||
return "UNKNOWN RENDERER\n";
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::symbols()
|
||||
{
|
||||
QgsRenderContext context;
|
||||
return symbols( context );
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::symbols( QgsRenderContext &context )
|
||||
{
|
||||
Q_UNUSED( context );
|
||||
|
||||
//base implementation calls deprecated method to maintain API
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return symbols();
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
|
||||
QgsFeatureRenderer* QgsFeatureRenderer::load( QDomElement& element )
|
||||
{
|
||||
// <renderer-v2 type=""> ... </renderer-v2>
|
||||
@ -326,12 +258,6 @@ QgsFeatureRenderer* QgsFeatureRenderer::loadSld( const QDomNode &node, QgsWkbTyp
|
||||
return r;
|
||||
}
|
||||
|
||||
QDomElement QgsFeatureRenderer::writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const
|
||||
{
|
||||
QgsStringMap props;
|
||||
return writeSld( doc, layer.name(), props );
|
||||
}
|
||||
|
||||
QDomElement QgsFeatureRenderer::writeSld( QDomDocument& doc, const QString& styleName, QgsStringMap props ) const
|
||||
{
|
||||
QDomElement userStyleElem = doc.createElement( "UserStyle" );
|
||||
@ -402,13 +328,6 @@ void QgsFeatureRenderer::setVertexMarkerAppearance( int type, int size )
|
||||
mCurrentVertexMarkerSize = size;
|
||||
}
|
||||
|
||||
bool QgsFeatureRenderer::willRenderFeature( QgsFeature &feat )
|
||||
{
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return nullptr != symbolForFeature( feat );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
bool QgsFeatureRenderer::willRenderFeature( QgsFeature &feat, QgsRenderContext &context )
|
||||
{
|
||||
return nullptr != symbolForFeature( feat, context );
|
||||
@ -442,16 +361,6 @@ void QgsFeatureRenderer::renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolyg
|
||||
}
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature& feat )
|
||||
{
|
||||
QgsSymbolList lst;
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
QgsSymbol* s = symbolForFeature( feat );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
if ( s ) lst.append( s );
|
||||
return lst;
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature &feat, QgsRenderContext &context )
|
||||
{
|
||||
QgsSymbolList lst;
|
||||
@ -460,16 +369,6 @@ QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature &feat, QgsRender
|
||||
return lst;
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::originalSymbolsForFeature( QgsFeature& feat )
|
||||
{
|
||||
QgsSymbolList lst;
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
QgsSymbol* s = originalSymbolForFeature( feat );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
if ( s ) lst.append( s );
|
||||
return lst;
|
||||
}
|
||||
|
||||
QgsSymbolList QgsFeatureRenderer::originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context )
|
||||
{
|
||||
QgsSymbolList lst;
|
||||
|
@ -91,15 +91,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
|
||||
QString type() const { return mType; }
|
||||
|
||||
/** To be overridden
|
||||
*
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* @param feature feature
|
||||
* @return returns pointer to symbol or 0 if symbol was not found
|
||||
* @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsSymbol* symbolForFeature( QgsFeature& feature );
|
||||
|
||||
/** To be overridden
|
||||
*
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
@ -107,29 +98,15 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
* @param context render context
|
||||
* @return returns pointer to symbol or 0 if symbol was not found
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbolForFeature2
|
||||
*/
|
||||
// TODO - QGIS 3.0 make pure virtual when above method is removed
|
||||
// TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
/**
|
||||
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
|
||||
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
|
||||
* of a symbol for use in rendering.
|
||||
* @note added in 2.6
|
||||
* @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature );
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) = 0;
|
||||
|
||||
/**
|
||||
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
|
||||
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
|
||||
* of a symbol for use in rendering.
|
||||
* @note added in 2.12
|
||||
* @note available in Python bindings as originalSymbolForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
||||
|
||||
/**
|
||||
@ -147,9 +124,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
*/
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;
|
||||
|
||||
//! @deprecated since 2.4 - not using QgsVectorLayer directly anymore
|
||||
Q_DECL_DEPRECATED virtual void startRender( QgsRenderContext& context, const QgsVectorLayer* vlayer );
|
||||
|
||||
/**
|
||||
* Needs to be called when a render cycle has finished to clean up.
|
||||
*/
|
||||
@ -214,7 +188,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
enum Capability
|
||||
{
|
||||
SymbolLevels = 1, //!< rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
|
||||
RotationField = 1 << 1, //!< rotate symbols by attribute value
|
||||
MoreSymbolsPerFeature = 1 << 2, //!< may use more than one symbol to render a feature: symbolsForFeature() will return them
|
||||
Filter = 1 << 3, //!< features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)
|
||||
ScaleDependent = 1 << 4 //!< depends on scale if feature will be rendered (rule based )
|
||||
@ -236,18 +209,11 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
*/
|
||||
virtual Capabilities capabilities() { return 0; }
|
||||
|
||||
/** For symbol levels
|
||||
* @deprecated use symbols( QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsSymbolList symbols();
|
||||
|
||||
/** Returns list of symbols used by the renderer.
|
||||
* @param context render context
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbols2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) { Q_UNUSED( context ); return QgsSymbolList(); }
|
||||
|
||||
bool usingSymbolLevels() const { return mUsingSymbolLevels; }
|
||||
void setUsingSymbolLevels( bool usingSymbolLevels ) { mUsingSymbolLevels = usingSymbolLevels; }
|
||||
@ -258,9 +224,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc );
|
||||
|
||||
//! create the SLD UserStyle element following the SLD v1.1 specs
|
||||
//! @deprecated since 2.8 - use the other override with styleName
|
||||
Q_DECL_DEPRECATED virtual QDomElement writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const;
|
||||
//! create the SLD UserStyle element following the SLD v1.1 specs with the given name
|
||||
//! @note added in 2.8
|
||||
virtual QDomElement writeSld( QDomDocument& doc, const QString& styleName, QgsStringMap props = QgsStringMap() ) const;
|
||||
@ -322,59 +285,24 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
//! set type and size of editing vertex markers for subsequent rendering
|
||||
void setVertexMarkerAppearance( int type, int size );
|
||||
|
||||
//! return rotation field name (or empty string if not set or not supported by renderer)
|
||||
//! @deprecated use the symbol's methods instead
|
||||
Q_DECL_DEPRECATED virtual QString rotationField() const { return QString(); }
|
||||
|
||||
//! sets rotation field of renderer (if supported by the renderer)
|
||||
//! @deprecated use the symbol's methods instead
|
||||
Q_DECL_DEPRECATED virtual void setRotationField( const QString& fieldName ) { Q_UNUSED( fieldName ); }
|
||||
|
||||
/** Returns whether the renderer will render a feature or not.
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* Default implementation uses symbolForFeature().
|
||||
* @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual bool willRenderFeature( QgsFeature& feat );
|
||||
|
||||
/** Returns whether the renderer will render a feature or not.
|
||||
* Must be called between startRender() and stopRender() calls.
|
||||
* Default implementation uses symbolForFeature().
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as willRenderFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Returns list of symbols used for rendering the feature.
|
||||
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
|
||||
* to use symbolForFeature()
|
||||
* @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsSymbolList symbolsForFeature( QgsFeature& feat );
|
||||
|
||||
/** Returns list of symbols used for rendering the feature.
|
||||
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
|
||||
* to use symbolForFeature()
|
||||
* @note added in QGIS 2.12
|
||||
* @note available in Python bindings as symbolsForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Equivalent of originalSymbolsForFeature() call
|
||||
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
|
||||
* @note added in 2.6
|
||||
* @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat );
|
||||
|
||||
/** Equivalent of originalSymbolsForFeature() call
|
||||
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
|
||||
* @note added in 2.12
|
||||
* @note available in Python bindings as originalSymbolsForFeature2
|
||||
*/
|
||||
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
|
||||
|
||||
/** Allows for a renderer to modify the extent of a feature request prior to rendering
|
||||
@ -485,8 +413,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
*/
|
||||
static QPointF _getPoint( QgsRenderContext& context, const QgsPointV2& point );
|
||||
|
||||
void setScaleMethodToSymbol( QgsSymbol* symbol, int scaleMethod );
|
||||
|
||||
/**
|
||||
* Clones generic renderer data to another renderer.
|
||||
* Currently clones
|
||||
@ -497,12 +423,6 @@ class CORE_EXPORT QgsFeatureRenderer
|
||||
*/
|
||||
void copyRendererData( QgsFeatureRenderer *destRenderer ) const;
|
||||
|
||||
/** Copies paint effect of this renderer to another renderer
|
||||
* @param destRenderer destination renderer for copied effect
|
||||
* @deprecated use copyRendererData instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void copyPaintEffect( QgsFeatureRenderer *destRenderer ) const;
|
||||
|
||||
QString mType;
|
||||
|
||||
bool mUsingSymbolLevels;
|
||||
|
@ -396,12 +396,6 @@ void QgsRuleBasedRenderer::Rule::toSld( QDomDocument& doc, QDomElement &element,
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext& context, const QgsFields& fields )
|
||||
{
|
||||
QString filter;
|
||||
return startRender( context, fields, filter );
|
||||
}
|
||||
|
||||
bool QgsRuleBasedRenderer::Rule::startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter )
|
||||
{
|
||||
mActiveChildren.clear();
|
||||
@ -1217,7 +1211,6 @@ QgsRuleBasedRenderer* QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur
|
||||
return nullptr;
|
||||
|
||||
QgsSymbol* origSymbol = singleSymbolRenderer->symbol()->clone();
|
||||
convertToDataDefinedSymbology( origSymbol, singleSymbolRenderer->sizeScaleField() );
|
||||
r = new QgsRuleBasedRenderer( origSymbol );
|
||||
}
|
||||
else if ( renderer->type() == "categorizedSymbol" )
|
||||
@ -1275,7 +1268,6 @@ QgsRuleBasedRenderer* QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur
|
||||
//data dependent area and rotation, so we need to convert these to obtain the same rendering
|
||||
|
||||
QgsSymbol* origSymbol = category.symbol()->clone();
|
||||
convertToDataDefinedSymbology( origSymbol, categorizedRenderer->sizeScaleField() );
|
||||
rule->setSymbol( origSymbol );
|
||||
|
||||
rootrule->appendChild( rule );
|
||||
@ -1330,8 +1322,6 @@ QgsRuleBasedRenderer* QgsRuleBasedRenderer::convertFromRenderer( const QgsFeatur
|
||||
//data dependent area and rotation, so we need to convert these to obtain the same rendering
|
||||
|
||||
QgsSymbol* symbol = range.symbol()->clone();
|
||||
convertToDataDefinedSymbology( symbol, graduatedRenderer->sizeScaleField() );
|
||||
|
||||
rule->setSymbol( symbol );
|
||||
|
||||
rootrule->appendChild( rule );
|
||||
|
@ -192,10 +192,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
QString description() const { return mDescription; }
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use active instead
|
||||
Q_DECL_DEPRECATED bool checkState() const { return mIsActive; }
|
||||
|
||||
/**
|
||||
* Returns if this rule is active
|
||||
*
|
||||
@ -244,10 +240,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
*/
|
||||
void setDescription( const QString& description ) { mDescription = description; }
|
||||
|
||||
//! @note added in 2.6
|
||||
//! @deprecated use setActive instead
|
||||
Q_DECL_DEPRECATED void setCheckState( bool state ) { mIsActive = state; }
|
||||
|
||||
/**
|
||||
* Sets if this rule is active
|
||||
* @param state Determines if the rule should be activated or deactivated
|
||||
@ -266,11 +258,6 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
|
||||
QDomElement save( QDomDocument& doc, QgsSymbolMap& symbolMap ) const;
|
||||
|
||||
/** Prepare the rule for rendering and its children (build active children array)
|
||||
* @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED bool startRender( QgsRenderContext& context, const QgsFields& fields );
|
||||
|
||||
//! prepare the rule for rendering and its children (build active children array)
|
||||
bool startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter );
|
||||
|
||||
@ -447,52 +434,20 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
|
||||
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) override;
|
||||
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc ) override;
|
||||
|
||||
//! return a list of symbology items for the legend
|
||||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
|
||||
|
||||
//! items of symbology items in legend should be checkable
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemsCheckable() const override;
|
||||
|
||||
//! items of symbology items in legend is checked
|
||||
//! @note added in 2.5
|
||||
virtual bool legendSymbolItemChecked( const QString& key ) override;
|
||||
|
||||
//! item in symbology was checked
|
||||
//! @note added in 2.5
|
||||
virtual void checkLegendSymbolItem( const QString& key, bool state = true ) override;
|
||||
|
||||
virtual void setLegendSymbolItem( const QString& key, QgsSymbol* symbol ) override;
|
||||
|
||||
//! return a list of item text / symbol
|
||||
//! @note not available in python bindings
|
||||
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = "" ) override;
|
||||
|
||||
//! Return a list of symbology items for the legend. Better choice than legendSymbolItems().
|
||||
//! Default fallback implementation just uses legendSymbolItems() implementation
|
||||
//! @note added in 2.6
|
||||
virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
|
||||
|
||||
//! for debugging
|
||||
virtual QString dump() const override;
|
||||
|
||||
//! return whether the renderer will render a feature or not.
|
||||
//! Must be called between startRender() and stopRender() calls.
|
||||
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
|
||||
//! return list of symbols used for rendering the feature.
|
||||
//! For renderers that do not support MoreSymbolsPerFeature it is more efficient
|
||||
//! to use symbolForFeature()
|
||||
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
|
||||
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) override;
|
||||
|
||||
virtual QSet<QString> legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
//! returns bitwise OR-ed capabilities of the renderer
|
||||
virtual Capabilities capabilities() override { return MoreSymbolsPerFeature | Filter | ScaleDependent; }
|
||||
|
||||
/////
|
||||
|
@ -36,8 +36,6 @@
|
||||
QgsSingleSymbolRenderer::QgsSingleSymbolRenderer( QgsSymbol* symbol )
|
||||
: QgsFeatureRenderer( "singleSymbol" )
|
||||
, mSymbol( symbol )
|
||||
, mScaleMethod( DEFAULT_SCALE_METHOD )
|
||||
, mOrigSize( 0.0 )
|
||||
{
|
||||
Q_ASSERT( symbol );
|
||||
}
|
||||
@ -46,33 +44,9 @@ QgsSingleSymbolRenderer::~QgsSingleSymbolRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
QgsSymbol* QgsSingleSymbolRenderer::symbolForFeature( QgsFeature& feature, QgsRenderContext &context )
|
||||
QgsSymbol* QgsSingleSymbolRenderer::symbolForFeature( QgsFeature&, QgsRenderContext & )
|
||||
{
|
||||
context.expressionContext().setFeature( feature );
|
||||
if ( !mRotation.data() && !mSizeScale.data() ) return mSymbol.data();
|
||||
|
||||
const double rotation = mRotation.data() ? mRotation->evaluate( &context.expressionContext() ).toDouble() : 0;
|
||||
const double sizeScale = mSizeScale.data() ? mSizeScale->evaluate( &context.expressionContext() ).toDouble() : 1.;
|
||||
|
||||
if ( mTempSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol* markerSymbol = static_cast<QgsMarkerSymbol*>( mTempSymbol.data() );
|
||||
if ( mRotation.data() ) markerSymbol->setAngle( rotation );
|
||||
markerSymbol->setSize( sizeScale * mOrigSize );
|
||||
markerSymbol->setScaleMethod( mScaleMethod );
|
||||
}
|
||||
else if ( mTempSymbol->type() == QgsSymbol::Line )
|
||||
{
|
||||
QgsLineSymbol* lineSymbol = static_cast<QgsLineSymbol*>( mTempSymbol.data() );
|
||||
lineSymbol->setWidth( sizeScale * mOrigSize );
|
||||
}
|
||||
else if ( mTempSymbol->type() == QgsSymbol::Fill )
|
||||
{
|
||||
QgsFillSymbol* fillSymbol = static_cast<QgsFillSymbol*>( mTempSymbol.data() );
|
||||
if ( mRotation.data() ) fillSymbol->setAngle( rotation );
|
||||
}
|
||||
|
||||
return mTempSymbol.data();
|
||||
return mSymbol.data();
|
||||
}
|
||||
|
||||
QgsSymbol* QgsSingleSymbolRenderer::originalSymbolForFeature( QgsFeature& feature, QgsRenderContext &context )
|
||||
@ -88,58 +62,20 @@ void QgsSingleSymbolRenderer::startRender( QgsRenderContext& context, const QgsF
|
||||
return;
|
||||
|
||||
mSymbol->startRender( context, fields );
|
||||
|
||||
if ( mRotation.data() || mSizeScale.data() )
|
||||
{
|
||||
// we are going to need a temporary symbol
|
||||
mTempSymbol.reset( mSymbol->clone() );
|
||||
|
||||
int hints = 0;
|
||||
if ( mRotation.data() )
|
||||
hints |= QgsSymbol::DataDefinedRotation;
|
||||
if ( mSizeScale.data() )
|
||||
hints |= QgsSymbol::DataDefinedSizeScale;
|
||||
mTempSymbol->setRenderHints( hints );
|
||||
|
||||
mTempSymbol->startRender( context, fields );
|
||||
|
||||
if ( mSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
mOrigSize = static_cast<QgsMarkerSymbol*>( mSymbol.data() )->size();
|
||||
}
|
||||
else if ( mSymbol->type() == QgsSymbol::Line )
|
||||
{
|
||||
mOrigSize = static_cast<QgsLineSymbol*>( mSymbol.data() )->width();
|
||||
}
|
||||
else
|
||||
{
|
||||
mOrigSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRenderer::stopRender( QgsRenderContext& context )
|
||||
{
|
||||
if ( !mSymbol.data() ) return;
|
||||
if ( !mSymbol.data() )
|
||||
return;
|
||||
|
||||
mSymbol->stopRender( context );
|
||||
|
||||
if ( mRotation.data() || mSizeScale.data() )
|
||||
{
|
||||
// we are going to need a temporary symbol
|
||||
mTempSymbol->stopRender( context );
|
||||
mTempSymbol.reset();
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> QgsSingleSymbolRenderer::usedAttributes()
|
||||
{
|
||||
QSet<QString> attributes;
|
||||
if ( mSymbol.data() ) attributes.unite( mSymbol->usedAttributes() );
|
||||
if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
|
||||
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
|
||||
return attributes.toList();
|
||||
}
|
||||
|
||||
@ -154,43 +90,6 @@ void QgsSingleSymbolRenderer::setSymbol( QgsSymbol* s )
|
||||
mSymbol.reset( s );
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRenderer::setRotationField( const QString& fieldOrExpression )
|
||||
{
|
||||
if ( mSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSymbol.data() );
|
||||
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString QgsSingleSymbolRenderer::rotationField() const
|
||||
{
|
||||
if ( mSymbol->type() == QgsSymbol::Marker )
|
||||
{
|
||||
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSymbol.data() );
|
||||
QgsDataDefined ddAngle = s->dataDefinedAngle();
|
||||
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
|
||||
{
|
||||
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );
|
||||
}
|
||||
|
||||
QString QgsSingleSymbolRenderer::sizeScaleField() const
|
||||
{
|
||||
return mSizeScale.data() ? QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) : QString();
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRenderer::setScaleMethod( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mScaleMethod = scaleMethod;
|
||||
setScaleMethodToSymbol( mSymbol.data(), scaleMethod );
|
||||
}
|
||||
|
||||
QString QgsSingleSymbolRenderer::dump() const
|
||||
{
|
||||
return mSymbol.data() ? QString( "SINGLE: %1" ).arg( mSymbol->dump() ) : "";
|
||||
@ -200,18 +99,12 @@ QgsSingleSymbolRenderer* QgsSingleSymbolRenderer::clone() const
|
||||
{
|
||||
QgsSingleSymbolRenderer* r = new QgsSingleSymbolRenderer( mSymbol->clone() );
|
||||
r->setUsingSymbolLevels( usingSymbolLevels() );
|
||||
r->setSizeScaleField( sizeScaleField() );
|
||||
copyRendererData( r );
|
||||
return r;
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRenderer::toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const
|
||||
{
|
||||
if ( mRotation.data() )
|
||||
props[ "angle" ] = mRotation->expression();
|
||||
if ( mSizeScale.data() )
|
||||
props[ "scale" ] = mSizeScale->expression();
|
||||
|
||||
QDomElement ruleElem = doc.createElement( "se:Rule" );
|
||||
element.appendChild( ruleElem );
|
||||
|
||||
@ -368,14 +261,9 @@ QDomElement QgsSingleSymbolRenderer::save( QDomDocument& doc )
|
||||
rendererElem.appendChild( symbolsElem );
|
||||
|
||||
QDomElement rotationElem = doc.createElement( "rotation" );
|
||||
if ( mRotation.data() )
|
||||
rotationElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mRotation.data() ) );
|
||||
rendererElem.appendChild( rotationElem );
|
||||
|
||||
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
|
||||
if ( mSizeScale.data() )
|
||||
sizeScaleElem.setAttribute( "field", QgsSymbolLayerUtils::fieldOrExpressionFromExpression( mSizeScale.data() ) );
|
||||
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerUtils::encodeScaleMethod( mScaleMethod ) );
|
||||
rendererElem.appendChild( sizeScaleElem );
|
||||
|
||||
if ( mPaintEffect && !QgsPaintEffectRegistry::isDefaultStack( mPaintEffect ) )
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "qgsexpression.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
/** \ingroup core
|
||||
* \class QgsSingleSymbolRenderer
|
||||
*/
|
||||
@ -33,30 +32,15 @@ class CORE_EXPORT QgsSingleSymbolRenderer : public QgsFeatureRenderer
|
||||
|
||||
virtual ~QgsSingleSymbolRenderer();
|
||||
|
||||
//! @note available in python as symbolForFeature2
|
||||
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
//! @note available in python as originalSymbolForFeature2
|
||||
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
|
||||
|
||||
virtual void stopRender( QgsRenderContext& context ) override;
|
||||
|
||||
virtual QList<QString> usedAttributes() override;
|
||||
|
||||
QgsSymbol* symbol() const;
|
||||
void setSymbol( QgsSymbol* s );
|
||||
|
||||
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
|
||||
Q_DECL_DEPRECATED QString rotationField() const override;
|
||||
|
||||
void setSizeScaleField( const QString& fieldOrExpression );
|
||||
QString sizeScaleField() const;
|
||||
|
||||
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
||||
QgsSymbol::ScaleMethod scaleMethod() const { return mScaleMethod; }
|
||||
|
||||
virtual QString dump() const override;
|
||||
|
||||
virtual QgsSingleSymbolRenderer* clone() const override;
|
||||
@ -64,31 +48,16 @@ class CORE_EXPORT QgsSingleSymbolRenderer : public QgsFeatureRenderer
|
||||
virtual void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props = QgsStringMap() ) const override;
|
||||
static QgsFeatureRenderer* createFromSld( QDomElement& element, QgsWkbTypes::GeometryType geomType );
|
||||
|
||||
//! returns bitwise OR-ed capabilities of the renderer
|
||||
virtual Capabilities capabilities() override { return SymbolLevels | RotationField; }
|
||||
|
||||
//! @note available in python as symbol2
|
||||
virtual Capabilities capabilities() override { return SymbolLevels; }
|
||||
virtual QgsSymbolList symbols( QgsRenderContext& context ) override;
|
||||
|
||||
//! create renderer from XML element
|
||||
static QgsFeatureRenderer* create( QDomElement& element );
|
||||
|
||||
//! store renderer info to XML element
|
||||
virtual QDomElement save( QDomDocument& doc ) override;
|
||||
|
||||
//! return a list of symbology items for the legend
|
||||
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
|
||||
|
||||
//! return a list of item text / symbol
|
||||
//! @note not available in python bindings
|
||||
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = QString() ) override;
|
||||
|
||||
//! Return a list of symbology items for the legend. Better choice than legendSymbolItems().
|
||||
//! @note added in 2.6
|
||||
virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
|
||||
|
||||
virtual QSet< QString > legendKeysForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
|
||||
|
||||
virtual void setLegendSymbolItem( const QString& key, QgsSymbol* symbol ) override;
|
||||
|
||||
//! creates a QgsSingleSymbolRenderer from an existing renderer.
|
||||
@ -98,15 +67,8 @@ class CORE_EXPORT QgsSingleSymbolRenderer : public QgsFeatureRenderer
|
||||
|
||||
protected:
|
||||
QScopedPointer<QgsSymbol> mSymbol;
|
||||
QScopedPointer<QgsExpression> mRotation;
|
||||
QScopedPointer<QgsExpression> mSizeScale;
|
||||
QgsSymbol::ScaleMethod mScaleMethod;
|
||||
|
||||
// temporary stuff for rendering
|
||||
QScopedPointer<QgsSymbol> mTempSymbol;
|
||||
double mOrigSize;
|
||||
};
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
|
||||
#endif // QGSSINGLESYMBOLRENDERERV2_H
|
||||
|
@ -249,26 +249,6 @@ void QgsSvgCache::containsParams( const QString& path, bool& hasFillParam, QColo
|
||||
hasOutlineOpacityParam, hasDefaultOutlineOpacity, defaultOutlineOpacity );
|
||||
}
|
||||
|
||||
|
||||
void QgsSvgCache::containsParams( const QString& path,
|
||||
bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
|
||||
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
|
||||
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const
|
||||
{
|
||||
bool hasFillOpacityParam = false;
|
||||
bool hasDefaultFillOpacity = false;
|
||||
double defaultFillOpacity = 1.0;
|
||||
bool hasOutlineOpacityParam = false;
|
||||
bool hasDefaultOutlineOpacity = false;
|
||||
double defaultOutlineOpacity = 1.0;
|
||||
|
||||
containsParams( path, hasFillParam, hasDefaultFillParam, defaultFillColor,
|
||||
hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
|
||||
hasOutlineParam, hasDefaultOutlineColor, defaultOutlineColor,
|
||||
hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth,
|
||||
hasOutlineOpacityParam, hasDefaultOutlineOpacity, defaultOutlineOpacity );
|
||||
}
|
||||
|
||||
void QgsSvgCache::containsParams( const QString& path,
|
||||
bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
|
||||
bool& hasFillOpacityParam, bool& hasDefaultFillOpacity, double& defaultFillOpacity,
|
||||
|
@ -145,26 +145,6 @@ class CORE_EXPORT QgsSvgCache : public QObject
|
||||
void containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor, bool& hasOutlineWidthParam,
|
||||
double& defaultOutlineWidth ) const;
|
||||
|
||||
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
|
||||
* default values in the svg file, only the first one is considered.
|
||||
* @param path path to SVG file
|
||||
* @param hasFillParam will be true if fill param present in SVG
|
||||
* @param hasDefaultFillParam will be true if fill param has a default value specified
|
||||
* @param defaultFillColor will be set to default fill color specified in SVG, if present
|
||||
* @param hasOutlineParam will be true if outline param present in SVG
|
||||
* @param hasDefaultOutlineColor will be true if outline param has a default value specified
|
||||
* @param defaultOutlineColor will be set to default outline color specified in SVG, if present
|
||||
* @param hasOutlineWidthParam will be true if outline width param present in SVG
|
||||
* @param hasDefaultOutlineWidth will be true if outline width param has a default value specified
|
||||
* @param defaultOutlineWidth will be set to default outline width specified in SVG, if present
|
||||
* @note available in python bindings as containsParamsV2
|
||||
* @note added in QGIS 2.12
|
||||
* @deprecated use variant with fill and outline opacity
|
||||
*/
|
||||
Q_DECL_DEPRECATED void containsParams( const QString& path, bool& hasFillParam, bool& hasDefaultFillParam, QColor& defaultFillColor,
|
||||
bool& hasOutlineParam, bool& hasDefaultOutlineColor, QColor& defaultOutlineColor,
|
||||
bool& hasOutlineWidthParam, bool& hasDefaultOutlineWidth, double& defaultOutlineWidth ) const;
|
||||
|
||||
/** Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
|
||||
* default values in the svg file, only the first one is considered.
|
||||
* @param path path to SVG file
|
||||
|
@ -324,17 +324,6 @@ QgsSymbolLayer* QgsSymbol::symbolLayer( int layer )
|
||||
return mLayers.value( layer );
|
||||
}
|
||||
|
||||
|
||||
bool QgsSymbol::isSymbolLayerCompatible( SymbolType layerType )
|
||||
{
|
||||
// fill symbol can contain also line symbol layers for drawing of outlines
|
||||
if ( mType == Fill && layerType == Line )
|
||||
return true;
|
||||
|
||||
return mType == layerType;
|
||||
}
|
||||
|
||||
|
||||
bool QgsSymbol::insertSymbolLayer( int index, QgsSymbolLayer* layer )
|
||||
{
|
||||
if ( index < 0 || index > mLayers.count() ) // can be added also after the last index
|
||||
|
@ -82,7 +82,6 @@ class CORE_EXPORT QgsSymbol
|
||||
|
||||
enum RenderHint
|
||||
{
|
||||
DataDefinedSizeScale = 1,
|
||||
DataDefinedRotation = 2
|
||||
};
|
||||
|
||||
@ -334,11 +333,6 @@ class CORE_EXPORT QgsSymbol
|
||||
*/
|
||||
void renderUsingLayer( QgsSymbolLayer* layer, QgsSymbolRenderContext& context );
|
||||
|
||||
//! check whether a symbol layer type can be used within the symbol
|
||||
//! (marker-marker, line-line, fill-fill/line)
|
||||
//! @deprecated since 2.14, use QgsSymbolLayer::isCompatibleWithSymbol instead
|
||||
Q_DECL_DEPRECATED bool isSymbolLayerCompatible( SymbolType layerType );
|
||||
|
||||
//! Render editing vertex marker at specified point
|
||||
//! @note added in QGIS 2.16
|
||||
void renderVertexMarker( QPointF pt, QgsRenderContext& context, int currentVertexMarkerType, int currentVertexMarkerSize );
|
||||
|
@ -90,13 +90,6 @@ const QString QgsSymbolLayer::EXPR_OFFSET_ALONG_LINE( "offset_along_line" );
|
||||
const QString QgsSymbolLayer::EXPR_HORIZONTAL_ANCHOR_POINT( "horizontal_anchor_point" );
|
||||
const QString QgsSymbolLayer::EXPR_VERTICAL_ANCHOR_POINT( "vertical_anchor_point" );
|
||||
|
||||
const QgsExpression* QgsSymbolLayer::dataDefinedProperty( const QString& property ) const
|
||||
{
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return expression( property );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
QgsDataDefined *QgsSymbolLayer::getDataDefinedProperty( const QString &property ) const
|
||||
{
|
||||
if ( mDataDefinedProperties.isEmpty() )
|
||||
@ -110,23 +103,6 @@ QgsDataDefined *QgsSymbolLayer::getDataDefinedProperty( const QString &property
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QgsExpression* QgsSymbolLayer::expression( const QString& property ) const
|
||||
{
|
||||
QgsDataDefined* dd = getDataDefinedProperty( property );
|
||||
return dd ? dd->expression() : nullptr;
|
||||
}
|
||||
|
||||
QString QgsSymbolLayer::dataDefinedPropertyString( const QString& property ) const
|
||||
{
|
||||
const QgsDataDefined* dd = getDataDefinedProperty( property );
|
||||
return dd ? dd->expressionString() : QString();
|
||||
}
|
||||
|
||||
void QgsSymbolLayer::setDataDefinedProperty( const QString& property, const QString& expressionString )
|
||||
{
|
||||
setDataDefinedProperty( property, new QgsDataDefined( expressionString ) );
|
||||
}
|
||||
|
||||
void QgsSymbolLayer::setDataDefinedProperty( const QString &property, QgsDataDefined *dataDefined )
|
||||
{
|
||||
removeDataDefinedProperty( property );
|
||||
@ -173,48 +149,6 @@ bool QgsSymbolLayer::hasDataDefinedProperty( const QString& property ) const
|
||||
return dd && dd->isActive();
|
||||
}
|
||||
|
||||
QVariant QgsSymbolLayer::evaluateDataDefinedProperty( const QString &property, const QgsFeature* feature, const QVariant& defaultVal, bool *ok ) const
|
||||
{
|
||||
if ( ok )
|
||||
*ok = false;
|
||||
|
||||
QgsDataDefined* dd = getDataDefinedProperty( property );
|
||||
if ( !dd || !dd->isActive() )
|
||||
return defaultVal;
|
||||
|
||||
if ( dd->useExpression() )
|
||||
{
|
||||
if ( dd->expression() )
|
||||
{
|
||||
QgsExpressionContext context = feature ? QgsExpressionContextUtils::createFeatureBasedContext( *feature, QgsFields() ) : QgsExpressionContext();
|
||||
QVariant result = dd->expression()->evaluate( &context );
|
||||
if ( result.isValid() )
|
||||
{
|
||||
if ( ok )
|
||||
*ok = true;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
return defaultVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
}
|
||||
else if ( feature && !dd->field().isEmpty() && !mFields.isEmpty() )
|
||||
{
|
||||
int attributeIndex = mFields.fieldNameIndex( dd->field() );
|
||||
if ( attributeIndex >= 0 )
|
||||
{
|
||||
if ( ok )
|
||||
*ok = true;
|
||||
return feature->attribute( attributeIndex );
|
||||
}
|
||||
}
|
||||
return defaultVal;
|
||||
}
|
||||
|
||||
QVariant QgsSymbolLayer::evaluateDataDefinedProperty( const QString& property, const QgsSymbolRenderContext& context, const QVariant& defaultVal, bool* ok ) const
|
||||
{
|
||||
if ( ok )
|
||||
|
@ -154,21 +154,6 @@ class CORE_EXPORT QgsSymbolLayer
|
||||
*/
|
||||
virtual QSet<QString> usedAttributes() const;
|
||||
|
||||
/** Returns a data defined expression for a property, if set
|
||||
* @deprecated use getDataDefinedProperty instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual const QgsExpression* dataDefinedProperty( const QString& property ) const;
|
||||
|
||||
/** Returns a data defined expression for a property, if set
|
||||
* @deprecated use getDataDefinedProperty instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QString dataDefinedPropertyString( const QString& property ) const;
|
||||
|
||||
/** Sets a data defined expression for a property
|
||||
* @deprecated use setDataDefinedProperty( const QString& property, QgsDataDefined* dataDefined ) instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual void setDataDefinedProperty( const QString& property, const QString& expressionString );
|
||||
|
||||
/** Returns the data defined property corresponding to the specified property key
|
||||
* @param property property key
|
||||
* @returns matching data defined property if it exists
|
||||
@ -221,23 +206,6 @@ class CORE_EXPORT QgsSymbolLayer
|
||||
*/
|
||||
virtual bool hasDataDefinedProperty( const QString& property ) const;
|
||||
|
||||
/** Evaluates the matching data defined property and returns the calculated
|
||||
* value. Prior to evaluation the data defined property must be prepared
|
||||
* by calling @link prepareExpressions @endlink.
|
||||
* @param property property key
|
||||
* @param feature pointer to the feature to use during expression or field
|
||||
* evaluation
|
||||
* @param defaultVal default value to return if evaluation was not successful
|
||||
* @param ok if specified, will be set to true if evaluation was successful
|
||||
* @returns calculated value for data defined property, or default value
|
||||
* if property does not exist or is deactived.
|
||||
* @see hasDataDefinedProperty
|
||||
* @see getDataDefinedProperty
|
||||
* @note added in QGIS 2.9
|
||||
* @deprecated use variant which takes QgsSymbolRenderContext instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature, const QVariant& defaultVal = QVariant(), bool *ok = nullptr ) const;
|
||||
|
||||
/** Evaluates the matching data defined property and returns the calculated
|
||||
* value. Prior to evaluation the data defined property must be prepared
|
||||
* by calling @link prepareExpressions @endlink.
|
||||
@ -318,11 +286,6 @@ class CORE_EXPORT QgsSymbolLayer
|
||||
*/
|
||||
virtual void prepareExpressions( const QgsSymbolRenderContext& context );
|
||||
|
||||
/** Returns the data defined expression associated with a property
|
||||
* @deprecated use getDataDefinedProperty or evaluateDataDefinedProperty instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QgsExpression* expression( const QString& property ) const;
|
||||
|
||||
/** Saves all data defined properties to a string map.
|
||||
* @param stringMap destination string map
|
||||
* @see restoreDataDefinedProperties
|
||||
|
@ -769,22 +769,6 @@ QList<QPolygonF> offsetLine( QPolygonF polyline, double dist, QgsWkbTypes::Geome
|
||||
return resultLine;
|
||||
}
|
||||
|
||||
QList<QPolygonF> offsetLine( const QPolygonF& polyline, double dist )
|
||||
{
|
||||
QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::PointGeometry;
|
||||
int pointCount = polyline.count();
|
||||
|
||||
if ( pointCount > 3 && qgsDoubleNear( polyline[ 0 ].x(), polyline[ pointCount - 1 ].x() ) && qgsDoubleNear( polyline[ 0 ].y(), polyline[ pointCount - 1 ].y() ) )
|
||||
{
|
||||
geometryType = QgsWkbTypes::PolygonGeometry;
|
||||
}
|
||||
else if ( pointCount > 1 )
|
||||
{
|
||||
geometryType = QgsWkbTypes::LineGeometry;
|
||||
}
|
||||
return offsetLine( polyline, dist, geometryType );
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
|
||||
@ -2050,13 +2034,6 @@ bool QgsSymbolLayerUtils::externalMarkerFromSld( QDomElement &element,
|
||||
return true;
|
||||
}
|
||||
|
||||
void QgsSymbolLayerUtils::wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor,
|
||||
double borderWidth, double size )
|
||||
{
|
||||
wellKnownMarkerToSld( doc, element, name, color, borderColor, Qt::SolidLine, borderWidth, size );
|
||||
}
|
||||
|
||||
void QgsSymbolLayerUtils::wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor, Qt::PenStyle borderStyle,
|
||||
double borderWidth, double size )
|
||||
@ -2093,14 +2070,6 @@ void QgsSymbolLayerUtils::wellKnownMarkerToSld( QDomDocument &doc, QDomElement &
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsSymbolLayerUtils::wellKnownMarkerFromSld( QDomElement &element,
|
||||
QString &name, QColor &color, QColor &borderColor,
|
||||
double &borderWidth, double &size )
|
||||
{
|
||||
Qt::PenStyle borderStyle;
|
||||
return wellKnownMarkerFromSld( element, name, color, borderColor, borderStyle, borderWidth, size );
|
||||
}
|
||||
|
||||
bool QgsSymbolLayerUtils::wellKnownMarkerFromSld( QDomElement &element,
|
||||
QString &name, QColor &color, QColor &borderColor, Qt::PenStyle &borderStyle,
|
||||
double &borderWidth, double &size )
|
||||
|
@ -238,17 +238,9 @@ class CORE_EXPORT QgsSymbolLayerUtils
|
||||
QString &path, QString &mime,
|
||||
QColor &color, double &size );
|
||||
|
||||
/** @deprecated Use wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element, QString name, QColor color, QColor borderColor, Qt::PenStyle borderStyle, double borderWidth, double size ) instead */
|
||||
Q_DECL_DEPRECATED static void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor = QColor(),
|
||||
double borderWidth = -1, double size = -1 );
|
||||
static void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
||||
const QString& name, const QColor& color, const QColor& borderColor, Qt::PenStyle borderStyle,
|
||||
double borderWidth = -1, double size = -1 );
|
||||
/** @deprecated Use wellKnownMarkerFromSld( QDomElement &element, QString &name, QColor &color, QColor &borderColor, Qt::PenStyle &borderStyle, double &borderWidth, double &size ) instead */
|
||||
Q_DECL_DEPRECATED static bool wellKnownMarkerFromSld( QDomElement &element,
|
||||
QString &name, QColor &color, QColor &borderColor,
|
||||
double &borderWidth, double &size );
|
||||
|
||||
//! @note available in python as wellKnownMarkerFromSld2
|
||||
static bool wellKnownMarkerFromSld( QDomElement &element,
|
||||
@ -566,8 +558,6 @@ class CORE_EXPORT QgsSymbolLayerUtils
|
||||
|
||||
class QPolygonF;
|
||||
|
||||
//! @deprecated since 2.4 - calculate line shifted by a specified distance
|
||||
QList<QPolygonF> offsetLine( const QPolygonF& polyline, double dist );
|
||||
//! calculate geometry shifted by a specified distance
|
||||
QList<QPolygonF> offsetLine( QPolygonF polyline, double dist, QgsWkbTypes::GeometryType geometryType );
|
||||
|
||||
|
@ -761,8 +761,6 @@ void QgsCategorizedSymbolRendererWidget::addCategories()
|
||||
// recreate renderer
|
||||
QgsCategorizedSymbolRenderer *r = new QgsCategorizedSymbolRenderer( attrName, cats );
|
||||
r->setSourceSymbol( mCategorizedSymbol->clone() );
|
||||
r->setScaleMethod( mRenderer->scaleMethod() );
|
||||
r->setSizeScaleField( mRenderer->sizeScaleField() );
|
||||
r->setInvertedColorRamp( cbxInvertedColorRamp->isChecked() );
|
||||
QScopedPointer< QgsColorRamp > ramp( getColorRamp() );
|
||||
if ( ramp )
|
||||
@ -839,18 +837,6 @@ void QgsCategorizedSymbolRendererWidget::addCategory()
|
||||
emit widgetChanged();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererWidget::sizeScaleFieldChanged( const QString& fldName )
|
||||
{
|
||||
mRenderer->setSizeScaleField( fldName );
|
||||
emit widgetChanged();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererWidget::scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mRenderer->setScaleMethod( scaleMethod );
|
||||
emit widgetChanged();
|
||||
}
|
||||
|
||||
QList<QgsSymbol*> QgsCategorizedSymbolRendererWidget::selectedSymbols()
|
||||
{
|
||||
QList<QgsSymbol*> selectedSymbols;
|
||||
|
@ -111,9 +111,6 @@ class GUI_EXPORT QgsCategorizedSymbolRendererWidget : public QgsRendererWidget,
|
||||
void deleteCategories();
|
||||
void deleteAllCategories();
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
|
||||
void showSymbolLevels();
|
||||
|
||||
void rowsMoved();
|
||||
|
@ -1026,16 +1026,6 @@ void QgsGraduatedSymbolRendererWidget::changeCurrentValue( QStandardItem * item
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererWidget::sizeScaleFieldChanged( const QString& fldName )
|
||||
{
|
||||
mRenderer->setSizeScaleField( fldName );
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererWidget::scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mRenderer->setScaleMethod( scaleMethod );
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererWidget::labelFormatChanged()
|
||||
{
|
||||
QgsRendererRangeLabelFormat labelFormat = QgsRendererRangeLabelFormat(
|
||||
|
@ -109,8 +109,6 @@ class GUI_EXPORT QgsGraduatedSymbolRendererWidget : public QgsRendererWidget, pr
|
||||
/** Toggle the link between classes boundaries */
|
||||
void toggleBoundariesLink( bool linked );
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
void labelFormatChanged();
|
||||
|
||||
void showSymbolLevels();
|
||||
|
@ -101,22 +101,6 @@ void QgsSingleSymbolRendererWidget::changeSingleSymbol()
|
||||
emit widgetChanged();
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRendererWidget::sizeScaleFieldChanged( const QString& fldName )
|
||||
{
|
||||
mRenderer->setSizeScaleField( fldName );
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRendererWidget::scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod )
|
||||
{
|
||||
mRenderer->setScaleMethod( scaleMethod );
|
||||
// Set also on the symbol clone
|
||||
QgsMarkerSymbol *markerSymbol = dynamic_cast<QgsMarkerSymbol *>( mSingleSymbol );
|
||||
if ( markerSymbol )
|
||||
{
|
||||
markerSymbol->setScaleMethod( scaleMethod );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsSingleSymbolRendererWidget::showSymbolLevels()
|
||||
{
|
||||
showSymbolLevelsDialog( mRenderer );
|
||||
|
@ -49,9 +49,6 @@ class GUI_EXPORT QgsSingleSymbolRendererWidget : public QgsRendererWidget
|
||||
public slots:
|
||||
void changeSingleSymbol();
|
||||
|
||||
void sizeScaleFieldChanged( const QString& fldName );
|
||||
void scaleMethodChanged( QgsSymbol::ScaleMethod scaleMethod );
|
||||
|
||||
void showSymbolLevels();
|
||||
|
||||
protected:
|
||||
|
@ -139,29 +139,6 @@ void QgsSymbolLayerWidget::updateDataDefinedProperty()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
QString QgsSymbolLayerWidget::dataDefinedPropertyLabel( const QString &entryName )
|
||||
{
|
||||
QString label = entryName;
|
||||
if ( entryName == "size" )
|
||||
{
|
||||
label = tr( "Size" );
|
||||
QgsMarkerSymbolLayer * layer = dynamic_cast<QgsMarkerSymbolLayer *>( symbolLayer() );
|
||||
if ( layer )
|
||||
{
|
||||
switch ( layer->scaleMethod() )
|
||||
{
|
||||
case QgsSymbol::ScaleArea:
|
||||
label += " (" + tr( "area" ) + ')';
|
||||
break;
|
||||
case QgsSymbol::ScaleDiameter:
|
||||
label += " (" + tr( "diameter" ) + ')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
QgsSimpleLineSymbolLayerWidget::QgsSimpleLineSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent )
|
||||
: QgsSymbolLayerWidget( parent, vl )
|
||||
{
|
||||
|
@ -97,13 +97,6 @@ class GUI_EXPORT QgsSymbolLayerWidget : public QWidget, protected QgsExpressionC
|
||||
|
||||
QgsMapCanvas* mMapCanvas;
|
||||
|
||||
/** Get label for data defined entry.
|
||||
* Implemented only for 'size' of marker symbols
|
||||
* @note added in 2.1
|
||||
* @deprecated no longer used
|
||||
*/
|
||||
Q_DECL_DEPRECATED virtual QString dataDefinedPropertyLabel( const QString &entryName );
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Should be emitted whenever configuration changes happened on this symbol layer configuration.
|
||||
|
@ -641,34 +641,6 @@ void QgsSymbolSelectorWidget::duplicateLayer()
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorWidget::saveSymbol()
|
||||
{
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText( this, tr( "Symbol name" ),
|
||||
tr( "Please enter name for the symbol:" ), QLineEdit::Normal, tr( "New symbol" ), &ok );
|
||||
if ( !ok || name.isEmpty() )
|
||||
return;
|
||||
|
||||
// check if there is no symbol with same name
|
||||
if ( mStyle->symbolNames().contains( name ) )
|
||||
{
|
||||
int res = QMessageBox::warning( this, tr( "Save symbol" ),
|
||||
tr( "Symbol with name '%1' already exists. Overwrite?" )
|
||||
.arg( name ),
|
||||
QMessageBox::Yes | QMessageBox::No );
|
||||
if ( res != QMessageBox::Yes )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// add new symbol to style and re-populate the list
|
||||
mStyle->addSymbol( name, mSymbol->clone() );
|
||||
|
||||
// make sure the symbol is stored
|
||||
mStyle->saveSymbol( name, mSymbol->clone(), 0, QStringList() );
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorWidget::changeLayer( QgsSymbolLayer* newLayer )
|
||||
{
|
||||
SymbolLayerItem* item = currentLayerItem();
|
||||
@ -832,13 +804,6 @@ void QgsSymbolSelectorDialog::lockLayer()
|
||||
mSelectorWidget->lockLayer();
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorDialog::saveSymbol()
|
||||
{
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
mSelectorWidget->saveSymbol();
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
void QgsSymbolSelectorDialog::duplicateLayer()
|
||||
{
|
||||
mSelectorWidget->duplicateLayer();
|
||||
|
@ -206,11 +206,6 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
||||
*/
|
||||
void lockLayer();
|
||||
|
||||
/**
|
||||
* Save the current active symbol layer into the users saved styles.
|
||||
*/
|
||||
Q_DECL_DEPRECATED void saveSymbol();
|
||||
|
||||
//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
|
||||
//! @note added in QGIS 2.14
|
||||
void duplicateLayer();
|
||||
@ -330,8 +325,6 @@ class GUI_EXPORT QgsSymbolSelectorDialog : public QDialog
|
||||
|
||||
void lockLayer();
|
||||
|
||||
Q_DECL_DEPRECATED void saveSymbol();
|
||||
|
||||
//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
|
||||
//! @note added in QGIS 2.14
|
||||
void duplicateLayer();
|
||||
|
@ -144,9 +144,6 @@ def dumpGraduatedRenderer(r):
|
||||
rstr = rstr + dumpColorRamp(r.sourceColorRamp())
|
||||
rstr = rstr + str(r.invertedColorRamp()) + ':'
|
||||
rstr = rstr + dumpRangeList(r.ranges())
|
||||
rstr = rstr + r.rotationField() + ':'
|
||||
rstr = rstr + r.sizeScaleField() + ':'
|
||||
rstr = rstr + str(r.scaleMethod()) + ':'
|
||||
return rstr
|
||||
|
||||
#=================================================================
|
||||
@ -315,33 +312,12 @@ class TestQgsGraduatedSymbolRenderer(unittest.TestCase):
|
||||
self.assertFalse(renderer.invertedColorRamp(),
|
||||
"Get/set renderer inverted color ramp")
|
||||
|
||||
value = '"value"*2'
|
||||
exp = QgsSymbolLayerUtils.fieldOrExpressionToExpression(value)
|
||||
valuestr = QgsSymbolLayerUtils.fieldOrExpressionFromExpression(exp)
|
||||
renderer.setRotationField(value)
|
||||
self.assertEqual(valuestr, renderer.rotationField(),
|
||||
"Get/set renderer rotation field")
|
||||
|
||||
value = '"value"*3'
|
||||
exp = QgsSymbolLayerUtils.fieldOrExpressionToExpression(value)
|
||||
valuestr = QgsSymbolLayerUtils.fieldOrExpressionFromExpression(exp)
|
||||
renderer.setSizeScaleField(value)
|
||||
self.assertEqual(valuestr, renderer.sizeScaleField(),
|
||||
"Get/set renderer size scale field")
|
||||
|
||||
renderer.setSourceColorRamp(ramp)
|
||||
self.assertEqual(
|
||||
dumpColorRamp(ramp),
|
||||
dumpColorRamp(renderer.sourceColorRamp()),
|
||||
"Get/set renderer color ramp")
|
||||
|
||||
for sm in (
|
||||
QgsSymbol.ScaleArea,
|
||||
QgsSymbol.ScaleDiameter,
|
||||
):
|
||||
renderer.setScaleMethod(sm)
|
||||
self.assertEqual(str(sm), str(renderer.scaleMethod()),
|
||||
"Get/set renderer scale method")
|
||||
# test for classificatio with varying size
|
||||
renderer.setGraduatedMethod(QgsGraduatedSymbolRenderer.GraduatedSize)
|
||||
renderer.setSourceColorRamp(None)
|
||||
@ -353,7 +329,7 @@ class TestQgsGraduatedSymbolRenderer(unittest.TestCase):
|
||||
self.assertEqual(renderer.minSymbolSize(), 2)
|
||||
refSizes = [2, (13 + 2) * .5, 13]
|
||||
ctx = QgsRenderContext()
|
||||
for idx, symbol in enumerate(renderer.symbols2(ctx)):
|
||||
for idx, symbol in enumerate(renderer.symbols(ctx)):
|
||||
self.assertEqual(symbol.size(), refSizes[idx])
|
||||
|
||||
def testQgsGraduatedSymbolRenderer_2(self):
|
||||
@ -462,18 +438,6 @@ class TestQgsGraduatedSymbolRenderer(unittest.TestCase):
|
||||
|
||||
# Test retrieving data values from a layer
|
||||
ml = createMemoryLayer((1.2, 0.5, 5.0, 1.0, 1.0, 1.2))
|
||||
# ... by attribute
|
||||
renderer.setClassAttribute("value")
|
||||
self.assertEqual(renderer.classAttribute(), "value", "Error in set/get classAttribute")
|
||||
data = renderer.getDataValues(ml)
|
||||
datastr = ':'.join([str(x) for x in data])
|
||||
self.assertEqual(datastr, '1.2:0.5:5.0:1.0:1.0:1.2', "Error returning field data")
|
||||
# ... by expression
|
||||
renderer.setClassAttribute('"value"*"value"')
|
||||
self.assertEqual(renderer.classAttribute(), '"value"*"value"', "Error in set/get classAttribute")
|
||||
data = renderer.getDataValues(ml)
|
||||
datastr = ':'.join([str(x) for x in data])
|
||||
self.assertEqual(datastr, '1.44:0.25:25.0:1.0:1.0:1.44', "Error returning field expression")
|
||||
|
||||
renderer.setClassAttribute("value")
|
||||
# Equal interval calculations
|
||||
|
@ -42,6 +42,7 @@ from qgis.core import (QgsGeometry,
|
||||
QgsMapSettings,
|
||||
QgsRenderChecker,
|
||||
QgsSimpleMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayerBase,
|
||||
QgsUnitTypes,
|
||||
QgsWkbTypes
|
||||
)
|
||||
@ -207,15 +208,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
self.assertEqual(markerSymbol.size(), 10)
|
||||
markerSymbol.setSize(20)
|
||||
self.assertEqual(markerSymbol.size(), 20)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).size(), 20)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
self.assertEqual(markerSymbol.size(), 30)
|
||||
markerSymbol.setSize(3)
|
||||
self.assertEqual(markerSymbol.size(), 3)
|
||||
@ -230,15 +231,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 90))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=90))
|
||||
self.assertEqual(markerSymbol.angle(), 90)
|
||||
markerSymbol.setAngle(100)
|
||||
self.assertEqual(markerSymbol.angle(), 100)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).angle(), 100)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 130))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10, 150))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=130))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10, angle=150))
|
||||
# should take first layer's angle
|
||||
self.assertEqual(markerSymbol.angle(), 100)
|
||||
markerSymbol.setAngle(10)
|
||||
@ -254,15 +255,15 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderMillimeters)
|
||||
markerSymbol.setSizeUnit(QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).sizeUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
# should now be mixed size units
|
||||
self.assertEqual(markerSymbol.sizeUnit(), QgsUnitTypes.RenderUnknownUnit)
|
||||
markerSymbol.setSizeUnit(QgsUnitTypes.RenderPixels)
|
||||
@ -278,7 +279,7 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
# create a marker symbol with a single layer
|
||||
markerSymbol = QgsMarkerSymbol()
|
||||
markerSymbol.deleteSymbolLayer(0)
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.symbolLayer(0).setSizeMapUnitScale(QgsMapUnitScale(10000, 20000))
|
||||
self.assertEqual(markerSymbol.sizeMapUnitScale(), QgsMapUnitScale(10000, 20000))
|
||||
markerSymbol.setSizeMapUnitScale(QgsMapUnitScale(1000, 2000))
|
||||
@ -286,8 +287,8 @@ class TestQgsMarkerSymbol(unittest.TestCase):
|
||||
self.assertEqual(markerSymbol.symbolLayer(0).sizeMapUnitScale(), QgsMapUnitScale(1000, 2000))
|
||||
|
||||
# add additional layers
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer('star', QColor(255, 0, 0), QColor(0, 255, 0), 30))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10))
|
||||
markerSymbol.appendSymbolLayer(QgsSimpleMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=30))
|
||||
# should take first layer's map unit scale
|
||||
self.assertEqual(markerSymbol.sizeMapUnitScale(), QgsMapUnitScale(1000, 2000))
|
||||
markerSymbol.setSizeMapUnitScale(QgsMapUnitScale(3000, 4000))
|
||||
|
@ -36,6 +36,8 @@ from qgis.core import (
|
||||
QgsMultiRenderChecker,
|
||||
QgsSingleSymbolRenderer,
|
||||
QgsFillSymbol,
|
||||
QgsRenderContext,
|
||||
QgsDataDefined
|
||||
)
|
||||
|
||||
from qgis.testing import unittest, start_app
|
||||
@ -69,7 +71,7 @@ class TestQgsSymbolExpressionVariables(unittest.TestCase):
|
||||
sym1 = QgsFillSymbol.createSimple({'color': '#fdbf6f'})
|
||||
|
||||
renderer = QgsSingleSymbolRenderer(sym1)
|
||||
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_num - 1) * 200, 0, 0 )')
|
||||
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', QgsDataDefined('color_rgb( (@geometry_part_num - 1) * 200, 0, 0 )'))
|
||||
self.layer.setRenderer(renderer)
|
||||
|
||||
# Setup rendering check
|
||||
@ -85,7 +87,7 @@ class TestQgsSymbolExpressionVariables(unittest.TestCase):
|
||||
sym1 = QgsFillSymbol.createSimple({'color': '#fdbf6f'})
|
||||
|
||||
renderer = QgsSingleSymbolRenderer(sym1)
|
||||
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_count - 1) * 200, 0, 0 )')
|
||||
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', QgsDataDefined('color_rgb( (@geometry_part_count - 1) * 200, 0, 0 )'))
|
||||
self.layer.setRenderer(renderer)
|
||||
|
||||
# Setup rendering check
|
||||
@ -101,7 +103,7 @@ class TestQgsSymbolExpressionVariables(unittest.TestCase):
|
||||
sym1 = QgsFillSymbol.createSimple({'color': '#ff0000'})
|
||||
|
||||
renderer = QgsSingleSymbolRenderer(sym1)
|
||||
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'set_color_part( @symbol_color, \'value\', "Value" * 4)')
|
||||
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', QgsDataDefined('set_color_part( @symbol_color, \'value\', "Value" * 4)'))
|
||||
self.layer.setRenderer(renderer)
|
||||
|
||||
# Setup rendering check
|
||||
|
@ -46,6 +46,7 @@ from qgis.core import (QgsCentroidFillSymbolLayer,
|
||||
QgsSimpleFillSymbolLayer,
|
||||
QgsSimpleLineSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayerBase,
|
||||
QgsSVGFillSymbolLayer,
|
||||
QgsSvgMarkerSymbolLayer,
|
||||
QgsSymbolLayer,
|
||||
@ -410,8 +411,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'star'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Star
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
@ -504,8 +505,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'triangle'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Triangle
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
@ -598,8 +599,8 @@ class TestQgsSymbolLayer(unittest.TestCase):
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
mExpectedValue = u'circle'
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
|
||||
mExpectedValue = QgsSimpleMarkerSymbolLayerBase.Circle
|
||||
mValue = mSymbolLayer.subSymbol().symbolLayer(0).shape()
|
||||
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
|
||||
assert mExpectedValue == mValue, mMessage
|
||||
|
||||
|
@ -33,7 +33,7 @@ from qgis.PyQt.QtXml import (
|
||||
from qgis.PyQt.QtGui import QColor
|
||||
|
||||
from qgis.core import (
|
||||
QgsSimpleMarkerSymbolLayer, QgsUnitTypes, QgsSvgMarkerSymbolLayer,
|
||||
QgsSimpleMarkerSymbolLayer, QgsSimpleMarkerSymbolLayerBase, QgsUnitTypes, QgsSvgMarkerSymbolLayer,
|
||||
QgsFontMarkerSymbolLayer, QgsEllipseSymbolLayer, QgsSimpleLineSymbolLayer,
|
||||
QgsMarkerLineSymbolLayer, QgsMarkerSymbol, QgsSimpleFillSymbolLayer, QgsSVGFillSymbolLayer,
|
||||
QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsVectorLayer)
|
||||
@ -53,7 +53,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerRotation(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setAngle(50)
|
||||
dom, root = self.symbolToSld(symbol)
|
||||
# print( "Simple marker rotation: " + root.ownerDocument().toString())
|
||||
@ -88,7 +88,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerUnitDefault(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setOutlineWidth(3)
|
||||
symbol.setOffset(QPointF(5, 10))
|
||||
dom, root = self.symbolToSld(symbol)
|
||||
@ -111,7 +111,7 @@ class TestQgsSymbolLayerCreateSld(unittest.TestCase):
|
||||
|
||||
def testSimpleMarkerUnitPixels(self):
|
||||
symbol = QgsSimpleMarkerSymbolLayer(
|
||||
'star', QColor(255, 0, 0), QColor(0, 255, 0), 10)
|
||||
QgsSimpleMarkerSymbolLayerBase.Star, color=QColor(255, 0, 0), borderColor=QColor(0, 255, 0), size=10)
|
||||
symbol.setOutlineWidth(3)
|
||||
symbol.setOffset(QPointF(5, 10))
|
||||
symbol.setOutputUnit(QgsUnitTypes.RenderPixels)
|
||||
|
Loading…
x
Reference in New Issue
Block a user