QGIS/python/core/symbology-ng/qgsarrowsymbollayer.sip

153 lines
5.5 KiB
Plaintext
Raw Normal View History

/** \ingroup core
* \class QgsArrowSymbolLayer
* \brief Line symbol layer used for representing lines as arrows.
* \note Added in version 2.16
*/
2016-08-06 11:01:42 +02:00
class QgsArrowSymbolLayer : public QgsLineSymbolLayer
{
%TypeHeaderCode
#include <qgsarrowsymbollayer.h>
%End
public:
/** Simple constructor */
QgsArrowSymbolLayer();
/**
* Create a new QgsArrowSymbolLayer
*
* @param properties A property map to deserialize saved information from properties()
*
* @return A new QgsArrowSymbolLayer
*/
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
/** Virtual constructor */
virtual QgsArrowSymbolLayer *clone() const /Factory/;
/** Get the sub symbol used for filling */
virtual QgsSymbol *subSymbol();
/** Set the sub symbol used for filling */
virtual bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
/** Return a list of attributes required to render this feature */
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
/** Get current arrow width */
double arrowWidth() const;
/** Set the arrow width */
void setArrowWidth( double width );
/** Get the unit for the arrow width */
QgsUnitTypes::RenderUnit arrowWidthUnit() const;
/** Set the unit for the arrow width */
void setArrowWidthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the arrow width */
QgsMapUnitScale arrowWidthUnitScale() const;
/** Set the scale for the arrow width */
void setArrowWidthUnitScale( const QgsMapUnitScale &scale );
/** Get current arrow start width. Only meaningfull for single headed arrows */
double arrowStartWidth() const;
/** Set the arrow start width */
void setArrowStartWidth( double width );
/** Get the unit for the arrow start width */
QgsUnitTypes::RenderUnit arrowStartWidthUnit() const;
/** Set the unit for the arrow start width */
void setArrowStartWidthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the arrow start width */
QgsMapUnitScale arrowStartWidthUnitScale() const;
/** Set the scale for the arrow start width */
void setArrowStartWidthUnitScale( const QgsMapUnitScale &scale );
/** Get the current arrow head length */
double headLength() const;
/** Set the arrow head length */
void setHeadLength( double length );
/** Get the unit for the head length */
QgsUnitTypes::RenderUnit headLengthUnit() const;
/** Set the unit for the head length */
void setHeadLengthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the head length */
QgsMapUnitScale headLengthUnitScale() const;
/** Set the scale for the head length */
void setHeadLengthUnitScale( const QgsMapUnitScale &scale );
/** Get the current arrow head height */
double headThickness() const;
/** Set the arrow head height */
void setHeadThickness( double thickness );
/** Get the unit for the head height */
QgsUnitTypes::RenderUnit headThicknessUnit() const;
/** Set the unit for the head height */
void setHeadThicknessUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the head height */
QgsMapUnitScale headThicknessUnitScale() const;
/** Set the scale for the head height */
void setHeadThicknessUnitScale( const QgsMapUnitScale &scale );
/** Return whether it is a curved arrow or a straight one */
bool isCurved() const;
/** Set whether it is a curved arrow or a straight one */
void setIsCurved( bool isCurved );
/** Return whether the arrow is repeated along the line or not */
bool isRepeated() const;
/** Set whether the arrow is repeated along the line */
void setIsRepeated( bool isRepeated );
/** Possible head types */
enum HeadType
{
HeadSingle, //< One single head at the end
HeadReversed, //< One single head at the beginning
HeadDouble //< Two heads
};
/** Get the current head type */
HeadType headType() const;
/** Set the head type */
void setHeadType( HeadType type );
/** Possible arrow types */
enum ArrowType
{
ArrowPlain, //< Regular arrow
ArrowLeftHalf, //< Halved arrow, only the left side of the arrow is rendered (for straight arrows) or the side toward the exterior (for curved arrows)
ArrowRightHalf //< Halved arrow, only the right side of the arrow is rendered (for straight arrows) or the side toward the interior (for curved arrows)
};
/** Get the current arrow type */
ArrowType arrowType() const;
/** Set the arrow type */
void setArrowType( ArrowType 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;
/**
* 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;
/** Prepare the rendering */
void startRender( QgsSymbolRenderContext &context );
/** End of the rendering */
void stopRender( QgsSymbolRenderContext &context );
/** Main drawing method */
void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context );
void setColor( const QColor &c );
virtual QColor color() const;
private:
QgsArrowSymbolLayer( const QgsArrowSymbolLayer& );
};