2012-09-24 02:28:15 +02:00
|
|
|
class QgsSymbolLayerV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgssymbollayerv2.h>
|
2012-10-03 23:44:46 +02:00
|
|
|
#include <qgslinesymbollayerv2.h>
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
%ConvertToSubClassCode
|
|
|
|
switch (sipCpp->type())
|
|
|
|
{
|
|
|
|
case QgsSymbolV2::Marker:
|
2012-10-02 16:19:15 +02:00
|
|
|
if (dynamic_cast<QgsEllipseSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsEllipseSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsFontMarkerSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsFontMarkerSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsSimpleMarkerSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsSimpleMarkerSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsSvgMarkerSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsSvgMarkerSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsVectorFieldSymbolLayer*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsVectorFieldSymbolLayer;
|
2012-10-02 16:19:15 +02:00
|
|
|
else
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsMarkerSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case QgsSymbolV2::Line:
|
2013-08-22 20:52:13 +02:00
|
|
|
if (dynamic_cast<QgsMarkerLineSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsMarkerLineSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsSimpleLineSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsSimpleLineSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsLineSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case QgsSymbolV2::Fill:
|
|
|
|
if (dynamic_cast<QgsSimpleFillSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsSimpleFillSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsImageFillSymbolLayer*>(sipCpp) != NULL)
|
|
|
|
{
|
|
|
|
if (dynamic_cast<QgsLinePatternFillSymbolLayer*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsLinePatternFillSymbolLayer;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsPointPatternFillSymbolLayer*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsPointPatternFillSymbolLayer;
|
2012-10-02 16:19:15 +02:00
|
|
|
else if (dynamic_cast<QgsSVGFillSymbolLayer*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsSVGFillSymbolLayer;
|
2015-01-20 22:36:36 +11:00
|
|
|
else if (dynamic_cast<QgsRasterFillSymbolLayer*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsRasterFillSymbolLayer;
|
2012-10-02 16:19:15 +02:00
|
|
|
else
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsImageFillSymbolLayer;
|
2012-10-02 16:19:15 +02:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<QgsCentroidFillSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsCentroidFillSymbolLayerV2;
|
2015-01-20 22:36:36 +11:00
|
|
|
else if (dynamic_cast<QgsGradientFillSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsGradientFillSymbolLayerV2;
|
2015-01-20 22:36:36 +11:00
|
|
|
else if (dynamic_cast<QgsShapeburstFillSymbolLayerV2*>(sipCpp) != NULL)
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsShapeburstFillSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
else
|
2015-10-20 18:09:33 +02:00
|
|
|
sipType = sipType_QgsFillSymbolLayerV2;
|
2012-10-02 16:19:15 +02:00
|
|
|
break;
|
|
|
|
|
2015-12-04 13:20:23 +01:00
|
|
|
case QgsSymbolV2::Hybrid:
|
|
|
|
sipType = sipType_QgsGeometryGeneratorSymbolLayerV2;
|
2012-09-24 02:28:15 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-03-28 20:03:37 +11:00
|
|
|
virtual ~QgsSymbolLayerV2();
|
2015-04-07 14:27:39 +02:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/**
|
|
|
|
* The fill color.
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QColor color() const;
|
2016-02-14 03:50:23 +01:00
|
|
|
/**
|
|
|
|
* The fill color.
|
|
|
|
*/
|
2014-01-26 18:35:21 +01:00
|
|
|
virtual void setColor( const QColor& color );
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
/** Set outline color. Supported by marker and fill layers.
|
|
|
|
* @note added in 2.1 */
|
2014-01-12 18:17:20 +01:00
|
|
|
virtual void setOutlineColor( const QColor& color );
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
/** Get outline color. Supported by marker and fill layers.
|
|
|
|
* @note added in 2.1 */
|
2014-01-12 18:17:20 +01:00
|
|
|
virtual QColor outlineColor() const;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
/** Set fill color. Supported by marker and fill layers.
|
|
|
|
* @note added in 2.1 */
|
2014-01-12 18:17:20 +01:00
|
|
|
virtual void setFillColor( const QColor& color );
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
/** Get fill color. Supported by marker and fill layers.
|
|
|
|
* @note added in 2.1 */
|
2014-01-12 18:17:20 +01:00
|
|
|
virtual QColor fillColor() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QString layerType() const = 0;
|
|
|
|
|
|
|
|
virtual void startRender( QgsSymbolV2RenderContext& context ) = 0;
|
|
|
|
virtual void stopRender( QgsSymbolV2RenderContext& context ) = 0;
|
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/**
|
|
|
|
* Shall be reimplemented by subclasses to create a deep copy of the instance.
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QgsSymbolLayerV2* clone() const = 0 /Factory/;
|
|
|
|
|
2015-10-07 11:55:34 +11:00
|
|
|
virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap& props ) const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
virtual QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;
|
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QgsStringMap properties() const = 0;
|
|
|
|
|
|
|
|
virtual void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) = 0;
|
|
|
|
|
|
|
|
virtual QgsSymbolV2* subSymbol();
|
2016-02-14 03:50:23 +01:00
|
|
|
//! set layer's subsymbol. takes ownership of the passed symbol
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );
|
|
|
|
|
|
|
|
QgsSymbolV2::SymbolType type() const;
|
|
|
|
|
2016-01-04 22:51:18 +11:00
|
|
|
//! Returns if the layer can be used below the specified symbol
|
|
|
|
virtual bool isCompatibleWithSymbol( QgsSymbolV2* symbol ) const;
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setLocked( bool locked );
|
|
|
|
bool isLocked() const;
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the estimated maximum distance which the layer style will bleed outside
|
2014-01-26 18:35:21 +01:00
|
|
|
the drawn shape. Eg, polygons drawn with an outline will draw half the width
|
|
|
|
of the outline outside of the polygon. This amount is estimated, since it may
|
|
|
|
be affected by data defined symbology rules.*/
|
|
|
|
virtual double estimateMaxBleed() const;
|
|
|
|
|
2013-04-19 15:20:44 +02:00
|
|
|
virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
virtual QgsSymbolV2::OutputUnit outputUnit() const;
|
2014-05-07 19:02:11 +02:00
|
|
|
|
|
|
|
virtual void setMapUnitScale( const QgsMapUnitScale& scale );
|
2014-04-06 21:14:02 +02:00
|
|
|
virtual QgsMapUnitScale mapUnitScale() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
// used only with rending with symbol levels is turned on (0 = first pass, 1 = second, ...)
|
|
|
|
void setRenderingPass( int renderingPass );
|
|
|
|
int renderingPass() const;
|
|
|
|
|
2015-05-06 18:23:07 +10:00
|
|
|
/** Returns the set of attributes referenced by the layer. This includes attributes
|
|
|
|
* required by any data defined properties associated with the layer.
|
|
|
|
*/
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual QSet<QString> usedAttributes() const;
|
|
|
|
|
2015-05-06 18:23:07 +10:00
|
|
|
/** 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
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see setDataDefinedProperty
|
|
|
|
* @see hasDataDefinedProperty
|
|
|
|
* @see evaluateDataDefinedProperty
|
|
|
|
*/
|
|
|
|
virtual QgsDataDefined* getDataDefinedProperty( const QString& property ) const;
|
|
|
|
|
|
|
|
/** Sets a data defined property for the layer.
|
2016-02-14 03:50:23 +01:00
|
|
|
* @param property unique property key. Any existing data defined with the same key will be deleted and overridden.
|
|
|
|
* @param dataDefined data defined object to associate with property key. Ownership is transferred to the layer.
|
2015-05-06 18:23:07 +10:00
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see getDataDefinedProperty
|
|
|
|
* @see removeDataDefinedProperty
|
|
|
|
*/
|
|
|
|
virtual void setDataDefinedProperty( const QString& property, QgsDataDefined* dataDefined /Transfer/ );
|
|
|
|
|
|
|
|
/** Removes a data defined property from the layer.
|
|
|
|
* @param property unique property key. If an associated QgsDataDefined object exists,
|
|
|
|
* it will be deleted and removed from the layer.
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see setDataDefinedProperty
|
|
|
|
* @see removeDataDefinedProperties
|
|
|
|
*/
|
2013-04-19 15:20:44 +02:00
|
|
|
virtual void removeDataDefinedProperty( const QString& property );
|
2015-05-06 18:23:07 +10:00
|
|
|
|
|
|
|
/** Removes all data defined properties from the layer and deletes associated
|
|
|
|
* objects.
|
|
|
|
* @see removeDataDefinedProperty
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
*/
|
2013-04-19 15:20:44 +02:00
|
|
|
virtual void removeDataDefinedProperties();
|
2015-05-06 18:23:07 +10:00
|
|
|
|
|
|
|
/** Checks whether the layer has any associated data defined properties.
|
|
|
|
* @returns true if layer has data defined properties
|
|
|
|
* @see hasDataDefinedProperty
|
|
|
|
*/
|
|
|
|
virtual bool hasDataDefinedProperties() const;
|
|
|
|
|
|
|
|
/** Checks whether the layer has a matching data defined property and if
|
|
|
|
* that property is currently actived.
|
|
|
|
* @param property property key
|
|
|
|
* @returns true if data defined property exists and is active
|
|
|
|
* @see hasDataDefinedProperties
|
|
|
|
* @see evaluateDataDefinedProperty
|
|
|
|
* @see getDataDefinedProperty
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
*/
|
|
|
|
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
|
2015-05-09 19:56:27 +10:00
|
|
|
* @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
|
2015-05-06 18:23:07 +10:00
|
|
|
* if property does not exist or is deactived.
|
|
|
|
* @see hasDataDefinedProperty
|
|
|
|
* @see getDataDefinedProperty
|
|
|
|
* @note added in QGIS 2.9
|
2015-12-07 21:54:40 +11:00
|
|
|
* @deprecated use variant which takes QgsSymbolV2RenderContext instead
|
2015-05-06 18:23:07 +10:00
|
|
|
*/
|
2015-08-12 07:34:08 +10:00
|
|
|
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.
|
|
|
|
* @param property property key
|
|
|
|
* @param context symbol render context
|
|
|
|
* @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.12
|
|
|
|
*/
|
|
|
|
virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const;
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2016-04-12 01:25:28 +02:00
|
|
|
virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2015-10-01 15:15:06 +10:00
|
|
|
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
|
|
|
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2015-10-01 15:15:06 +10:00
|
|
|
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
2016-04-12 01:25:28 +02:00
|
|
|
virtual double dxfAngle( QgsSymbolV2RenderContext& context ) const;
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
|
|
|
virtual Qt::PenStyle dxfPenStyle() const;
|
2015-10-01 15:15:06 +10:00
|
|
|
virtual QColor dxfBrushColor( QgsSymbolV2RenderContext& context ) const;
|
2014-11-21 01:17:21 +01:00
|
|
|
virtual Qt::BrushStyle dxfBrushStyle() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2015-03-28 20:03:37 +11:00
|
|
|
/** Returns the current paint effect for the layer.
|
|
|
|
* @returns paint effect
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see setPaintEffect
|
|
|
|
*/
|
|
|
|
QgsPaintEffect* paintEffect() const;
|
|
|
|
|
|
|
|
/** Sets the current paint effect for the layer.
|
|
|
|
* @param effect paint effect. Ownership is transferred to the layer.
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see paintEffect
|
|
|
|
*/
|
|
|
|
void setPaintEffect( QgsPaintEffect* effect /Transfer/);
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
|
|
|
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
/** Prepares all data defined property expressions for evaluation. This should
|
2015-05-06 18:23:07 +10:00
|
|
|
* be called prior to evaluating data defined properties.
|
|
|
|
* @param fields associated layer fields
|
|
|
|
* @param scale map scale
|
2015-12-07 21:54:40 +11:00
|
|
|
* @deprecated use variant which takes QgsSymbolV2RenderContext instead
|
2015-05-06 18:23:07 +10:00
|
|
|
*/
|
2015-08-12 07:34:08 +10:00
|
|
|
virtual void prepareExpressions( const QgsFields* fields, double scale = -1.0 ) /Deprecated/;
|
|
|
|
|
|
|
|
/** Prepares all data defined property expressions for evaluation. This should
|
|
|
|
* be called prior to evaluating data defined properties.
|
|
|
|
* @param context symbol render context
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
virtual void prepareExpressions( const QgsSymbolV2RenderContext& context );
|
2015-05-06 18:23:07 +10:00
|
|
|
|
|
|
|
/** 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
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2013-04-19 15:20:44 +02:00
|
|
|
void saveDataDefinedProperties( QgsStringMap& stringMap ) const;
|
2015-05-06 18:23:07 +10:00
|
|
|
|
|
|
|
/** Restores all data defined properties from string map.
|
|
|
|
* @param stringMap source string map
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
* @see saveDataDefinedProperties
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2015-05-06 18:23:07 +10:00
|
|
|
void restoreDataDefinedProperties( const QgsStringMap& stringMap );
|
|
|
|
|
|
|
|
/** Copies all data defined properties of this layer to another symbol layer.
|
|
|
|
* @param destLayer destination layer
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2013-04-19 15:20:44 +02:00
|
|
|
void copyDataDefinedProperties( QgsSymbolLayerV2* destLayer ) const;
|
2015-05-06 18:23:07 +10:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Copies paint effect of this layer to another symbol layer
|
2015-03-28 20:03:37 +11:00
|
|
|
* @param destLayer destination layer
|
|
|
|
* @note added in QGIS 2.9
|
|
|
|
*/
|
|
|
|
void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////
|
|
|
|
|
|
|
|
class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgssymbollayerv2.h>
|
|
|
|
%End
|
|
|
|
public:
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
enum HorizontalAnchorPoint
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
HCenter,
|
|
|
|
Right
|
|
|
|
};
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
enum VerticalAnchorPoint
|
|
|
|
{
|
|
|
|
Top,
|
|
|
|
VCenter,
|
|
|
|
Bottom
|
|
|
|
};
|
|
|
|
|
|
|
|
void startRender( QgsSymbolV2RenderContext& context );
|
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
virtual void renderPoint( QPointF point, QgsSymbolV2RenderContext& context ) = 0;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
|
|
|
|
|
|
|
|
void setAngle( double angle );
|
|
|
|
double angle() const;
|
2015-05-24 18:48:22 +02:00
|
|
|
|
|
|
|
/** Sets the line angle modification for the symbol's angle. This angle is added to
|
|
|
|
* the marker's rotation and data defined rotation before rendering the symbol, and
|
2015-05-15 15:53:05 +07:00
|
|
|
* is usually used for orienting symbols to match a line's angle.
|
2016-02-14 03:50:23 +01:00
|
|
|
* @param lineAngle Angle in degrees, valid values are between 0 and 360
|
2015-05-15 15:53:05 +07:00
|
|
|
* @note added in QGIS 2.9
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2015-05-15 15:53:05 +07:00
|
|
|
void setLineAngle( double lineAngle );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void setSize( double size );
|
|
|
|
double size() const;
|
|
|
|
|
|
|
|
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
|
|
|
|
QgsSymbolV2::ScaleMethod scaleMethod() const;
|
|
|
|
|
|
|
|
void setOffset( QPointF offset );
|
|
|
|
QPointF offset();
|
|
|
|
|
2015-10-07 11:55:34 +11:00
|
|
|
virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap& props ) const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-10-07 11:55:34 +11:00
|
|
|
virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, const QgsStringMap& props ) const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2013-04-19 15:20:44 +02:00
|
|
|
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit offsetUnit() const;
|
2014-05-07 19:02:11 +02:00
|
|
|
|
2014-04-06 21:14:02 +02:00
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
|
|
|
|
const QgsMapUnitScale& offsetMapUnitScale() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
|
|
|
void setSizeUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit sizeUnit() const;
|
2014-05-07 19:02:11 +02:00
|
|
|
|
2014-04-06 21:14:02 +02:00
|
|
|
void setSizeMapUnitScale( const QgsMapUnitScale& scale);
|
|
|
|
const QgsMapUnitScale& sizeMapUnitScale() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2014-05-07 19:02:11 +02:00
|
|
|
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit outputUnit() const;
|
|
|
|
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale& scale );
|
2014-04-06 21:14:02 +02:00
|
|
|
QgsMapUnitScale mapUnitScale() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
void setHorizontalAnchorPoint( HorizontalAnchorPoint h );
|
|
|
|
HorizontalAnchorPoint horizontalAnchorPoint() const;
|
|
|
|
|
|
|
|
void setVerticalAnchorPoint( VerticalAnchorPoint v );
|
|
|
|
VerticalAnchorPoint verticalAnchorPoint() const;
|
|
|
|
|
2015-11-20 19:16:15 +11:00
|
|
|
/** Returns the approximate bounding box of the marker symbol layer, taking into account
|
|
|
|
* any data defined overrides and offsets which are set for the marker layer.
|
|
|
|
* @returns approximate symbol bounds, in painter units
|
|
|
|
* @note added in QGIS 2.14
|
|
|
|
* @note this method will become pure virtual in QGIS 3.0
|
|
|
|
*/
|
|
|
|
//TODO QGIS 3.0 - make pure virtual
|
2016-02-02 19:46:18 +11:00
|
|
|
virtual QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context );
|
2015-11-20 19:16:15 +11:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
|
|
|
QgsMarkerSymbolLayerV2( bool locked = false );
|
2014-01-26 18:35:21 +01:00
|
|
|
|
|
|
|
//handles marker offset and anchor point shift together
|
2015-10-01 15:15:06 +10:00
|
|
|
void markerOffset( QgsSymbolV2RenderContext& context, double& offsetX, double& offsetY ) const;
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2015-11-08 19:18:00 +00:00
|
|
|
//! @note available in python as markerOffsetWithWidthAndHeight
|
2015-10-01 15:15:06 +10:00
|
|
|
void markerOffset( QgsSymbolV2RenderContext& context, double width, double height, double& offsetX, double& offsetY ) const /PyName=markerOffsetWithWidthAndHeight/;
|
2014-11-21 01:17:21 +01:00
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
//! @note available in python bindings as markerOffset2
|
2015-10-01 15:15:06 +10:00
|
|
|
void markerOffset( QgsSymbolV2RenderContext& context, double width, double height,
|
2014-01-27 09:22:24 +01:00
|
|
|
QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::OutputUnit heightUnit,
|
2014-04-06 21:14:02 +02:00
|
|
|
double& offsetX, double& offsetY,
|
2014-05-07 19:02:11 +02:00
|
|
|
const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const /PyName=markerOffset2/;
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2016-02-02 19:46:18 +11:00
|
|
|
static QPointF _rotatedOffset( QPointF offset, double angle );
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class QgsLineSymbolLayerV2 : QgsSymbolLayerV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgssymbollayerv2.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ) = 0;
|
|
|
|
|
|
|
|
virtual void renderPolygonOutline( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
|
|
|
|
|
|
|
|
virtual void setWidth( double width );
|
|
|
|
virtual double width() const;
|
|
|
|
|
2015-01-23 09:08:51 +01:00
|
|
|
double offset() const;
|
|
|
|
void setOffset( double offset );
|
|
|
|
|
2013-04-19 15:20:44 +02:00
|
|
|
void setWidthUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit widthUnit() const;
|
2014-05-07 19:02:11 +02:00
|
|
|
|
2014-04-06 21:14:02 +02:00
|
|
|
void setWidthMapUnitScale( const QgsMapUnitScale& scale);
|
|
|
|
const QgsMapUnitScale& widthMapUnitScale() const;
|
2013-04-19 15:20:44 +02:00
|
|
|
|
2015-01-23 09:08:51 +01:00
|
|
|
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit offsetUnit() const;
|
|
|
|
|
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale& scale );
|
|
|
|
const QgsMapUnitScale& offsetMapUnitScale() const;
|
|
|
|
|
2014-05-07 19:02:11 +02:00
|
|
|
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
|
|
|
QgsSymbolV2::OutputUnit outputUnit() const;
|
|
|
|
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale& scale );
|
|
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
|
|
|
|
|
2015-10-01 15:15:06 +10:00
|
|
|
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
|
|
|
virtual double dxfOffset( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
|
|
|
QgsLineSymbolLayerV2( bool locked = false );
|
|
|
|
};
|
|
|
|
|
|
|
|
class QgsFillSymbolLayerV2 : QgsSymbolLayerV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgssymbollayerv2.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context ) = 0;
|
|
|
|
|
|
|
|
void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );
|
|
|
|
|
|
|
|
void setAngle( double angle );
|
|
|
|
double angle() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QgsFillSymbolLayerV2( bool locked = false );
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Default method to render polygon*/
|
2013-10-18 12:00:23 +02:00
|
|
|
void _renderPolygon( QPainter* p, const QPolygonF& points, const QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|