mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
1018 lines
34 KiB
Plaintext
1018 lines
34 KiB
Plaintext
class QgsSimpleFillSymbolLayer : QgsFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
|
|
public:
|
|
QgsSimpleFillSymbolLayer( const QColor& color = DEFAULT_SIMPLEFILL_COLOR,
|
|
Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
|
|
const QColor& strokeColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
|
|
Qt::PenStyle strokeStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
|
|
double strokeWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH,
|
|
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEFILL_JOINSTYLE
|
|
);
|
|
|
|
// static stuff
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
|
|
|
|
// implemented from base classes
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsSimpleFillSymbolLayer *clone() const /Factory/;
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
|
|
|
|
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;
|
|
|
|
Qt::BrushStyle brushStyle() const;
|
|
void setBrushStyle( Qt::BrushStyle style );
|
|
|
|
/** Get stroke color.
|
|
* @note added in 2.1 */
|
|
QColor strokeColor() const;
|
|
/** Set stroke color.
|
|
* @note added in 2.1 */
|
|
void setStrokeColor( const QColor &color );
|
|
|
|
/** Get fill color.
|
|
* @note added in 2.1 */
|
|
QColor fillColor() const;
|
|
/** Set fill color.
|
|
* @note added in 2.1 */
|
|
void setFillColor( const QColor &color );
|
|
|
|
Qt::PenStyle strokeStyle() const;
|
|
void setStrokeStyle( Qt::PenStyle strokeStyle );
|
|
|
|
double strokeWidth() const;
|
|
void setStrokeWidth( double strokeWidth );
|
|
|
|
Qt::PenJoinStyle penJoinStyle() const;
|
|
void setPenJoinStyle( Qt::PenJoinStyle style );
|
|
|
|
void setOffset( QPointF offset );
|
|
QPointF offset();
|
|
|
|
/** Sets the units for the width of the fill's stroke.
|
|
* @param unit width units
|
|
* @see strokeWidthUnit()
|
|
*/
|
|
void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the width of the fill's stroke.
|
|
* @see setStrokeWidthUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit strokeWidthUnit() const;
|
|
|
|
void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &strokeWidthMapUnitScale() const;
|
|
|
|
/** Sets the units for the fill's offset.
|
|
* @param unit offset units
|
|
* @see offsetUnit()
|
|
*/
|
|
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the fill's offset.
|
|
* @see setOffsetUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit offsetUnit() const;
|
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &offsetMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
|
|
QColor dxfColor( QgsSymbolRenderContext &context ) const;
|
|
Qt::PenStyle dxfPenStyle() const;
|
|
QColor dxfBrushColor( QgsSymbolRenderContext &context ) const;
|
|
Qt::BrushStyle dxfBrushStyle() const;
|
|
};
|
|
|
|
class QgsGradientFillSymbolLayer : QgsFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
public:
|
|
|
|
enum GradientColorType
|
|
{
|
|
SimpleTwoColor,
|
|
ColorRamp
|
|
};
|
|
|
|
enum GradientType
|
|
{
|
|
Linear,
|
|
Radial,
|
|
Conical
|
|
};
|
|
|
|
enum GradientCoordinateMode
|
|
{
|
|
Feature,
|
|
Viewport
|
|
};
|
|
|
|
enum GradientSpread
|
|
{
|
|
Pad,
|
|
Reflect,
|
|
Repeat
|
|
};
|
|
|
|
QgsGradientFillSymbolLayer( const QColor& color = DEFAULT_SIMPLEFILL_COLOR,
|
|
const QColor& color2 = Qt::white,
|
|
GradientColorType gradientColorType = SimpleTwoColor,
|
|
GradientType gradientType = Linear,
|
|
GradientCoordinateMode coordinateMode = Feature,
|
|
GradientSpread gradientSpread = Pad
|
|
);
|
|
|
|
virtual ~QgsGradientFillSymbolLayer();
|
|
|
|
// static stuff
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
|
|
// implemented from base classes
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsGradientFillSymbolLayer *clone() const /Factory/;
|
|
|
|
double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
/** Type of gradient, e.g., linear or radial*/
|
|
GradientType gradientType() const;
|
|
void setGradientType( GradientType gradientType );
|
|
|
|
/** Gradient color mode, controls how gradient color stops are created*/
|
|
GradientColorType gradientColorType() const;
|
|
void setGradientColorType( GradientColorType gradientColorType );
|
|
|
|
/** Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp*/
|
|
QgsColorRamp *colorRamp();
|
|
void setColorRamp( QgsColorRamp *ramp );
|
|
|
|
/** Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor*/
|
|
QColor color2() const;
|
|
void setColor2( const QColor &color2 );
|
|
|
|
/** Coordinate mode for gradient. Controls how the gradient stops are positioned.*/
|
|
GradientCoordinateMode coordinateMode() const;
|
|
void setCoordinateMode( GradientCoordinateMode coordinateMode );
|
|
|
|
/** Gradient spread mode. Controls how the gradient behaves outside of the predefined stops*/
|
|
GradientSpread gradientSpread() const;
|
|
void setGradientSpread( GradientSpread gradientSpread );
|
|
|
|
/** Starting point of gradient fill, in the range [0,0] - [1,1]*/
|
|
void setReferencePoint1( QPointF referencePoint );
|
|
QPointF referencePoint1() const;
|
|
|
|
/** Sets the starting point of the gradient to be the feature centroid*/
|
|
void setReferencePoint1IsCentroid( bool isCentroid );
|
|
bool referencePoint1IsCentroid() const;
|
|
|
|
/** End point of gradient fill, in the range [0,0] - [1,1]*/
|
|
void setReferencePoint2( QPointF referencePoint );
|
|
QPointF referencePoint2() const;
|
|
|
|
/** Sets the end point of the gradient to be the feature centroid*/
|
|
void setReferencePoint2IsCentroid( bool isCentroid );
|
|
bool referencePoint2IsCentroid() const;
|
|
|
|
/** Offset for gradient fill*/
|
|
void setOffset( QPointF offset );
|
|
QPointF offset() const;
|
|
|
|
/** Units for gradient fill offset*/
|
|
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit offsetUnit() const;
|
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &offsetMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
};
|
|
|
|
class QgsShapeburstFillSymbolLayer : QgsFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
public:
|
|
|
|
enum ShapeburstColorType
|
|
{
|
|
SimpleTwoColor,
|
|
ColorRamp
|
|
};
|
|
|
|
QgsShapeburstFillSymbolLayer( const QColor& color = DEFAULT_SIMPLEFILL_COLOR, const QColor& color2 = Qt::white,
|
|
ShapeburstColorType colorType = SimpleTwoColor,
|
|
int blurRadius = 0, bool useWholeShape = true, double maxDistance = 5 );
|
|
|
|
virtual ~QgsShapeburstFillSymbolLayer();
|
|
|
|
// static stuff
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
|
|
// implemented from base classes
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsShapeburstFillSymbolLayer *clone() const /Factory/;
|
|
|
|
double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
/** Sets the blur radius, which controls the amount of blurring applied to the fill.
|
|
* @param blurRadius Radius for fill blur. Values between 0 - 17 are valid, where higher values results in a stronger blur. Set to 0 to disable blur.
|
|
* @note added in 2.3
|
|
* @see blurRadius
|
|
*/
|
|
void setBlurRadius( int blurRadius );
|
|
/** Returns the blur radius, which controls the amount of blurring applied to the fill.
|
|
* @returns Integer representing the radius for fill blur. Higher values indicate a stronger blur. A 0 value indicates that blurring is disabled.
|
|
* @note added in 2.3
|
|
* @see setBlurRadius
|
|
*/
|
|
int blurRadius() const;
|
|
|
|
/** Sets whether the shapeburst fill should be drawn using the entire shape.
|
|
* @param useWholeShape Set to true if shapeburst should cover entire shape. If false, setMaxDistance is used to calculate how far from the boundary of the shape should
|
|
* be shaded
|
|
* @note added in 2.3
|
|
* @see useWholeShape
|
|
* @see setMaxDistance
|
|
*/
|
|
void setUseWholeShape( bool useWholeShape );
|
|
/** Returns whether the shapeburst fill is set to cover the entire shape.
|
|
* @returns True if shapeburst fill will cover the entire shape. If false, shapeburst is drawn to a distance of maxDistance from the polygon's boundary.
|
|
* @note added in 2.3
|
|
* @see setUseWholeShape
|
|
* @see maxDistance
|
|
*/
|
|
bool useWholeShape() const;
|
|
|
|
/** Sets the maximum distance to shape inside of the shape from the polygon's boundary.
|
|
* @param maxDistance distance from boundary to shade. setUseWholeShape must be set to false for this parameter to take effect. Distance unit is controlled by setDistanceUnit.
|
|
* @note added in 2.3
|
|
* @see maxDistance
|
|
* @see setUseWholeShape
|
|
* @see setDistanceUnit
|
|
*/
|
|
void setMaxDistance( double maxDistance );
|
|
/** Returns the maximum distance from the shape's boundary which is shaded. This parameter is only effective if useWholeShape is false.
|
|
* @returns the maximum distance from the polygon's boundary which is shaded. Distance units are indicated by distanceUnit.
|
|
* @note added in 2.3
|
|
* @see useWholeShape
|
|
* @see setMaxDistance
|
|
* @see distanceUnit
|
|
*/
|
|
double maxDistance() const;
|
|
|
|
/** Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
|
|
* @param unit distance unit for the maximum distance
|
|
* @note added in 2.3
|
|
* @see setMaxDistance
|
|
* @see distanceUnit
|
|
*/
|
|
void setDistanceUnit( QgsUnitTypes::RenderUnit unit );
|
|
/** Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
|
|
* @returns distance unit for the maximum distance
|
|
* @note added in 2.3
|
|
* @see maxDistance
|
|
* @see setDistanceUnit
|
|
*/
|
|
QgsUnitTypes::RenderUnit distanceUnit() const;
|
|
|
|
void setDistanceMapUnitScale( const QgsMapUnitScale &scale );
|
|
const QgsMapUnitScale &distanceMapUnitScale() const;
|
|
|
|
/** Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
|
* or by simply specificing a start and end color. setColorType is used to specify which mode to use for the fill.
|
|
* @param colorType color type to use for shapeburst fill
|
|
* @note added in 2.3
|
|
* @see colorType
|
|
* @see setColor
|
|
* @see setColor2
|
|
* @see setColorRamp
|
|
*/
|
|
void setColorType( ShapeburstColorType colorType );
|
|
/** Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
|
* or by simply specificing a start and end color.
|
|
* @returns current color mode used for the shapeburst fill
|
|
* @note added in 2.3
|
|
* @see setColorType
|
|
* @see color
|
|
* @see color2
|
|
* @see colorRamp
|
|
*/
|
|
ShapeburstColorType colorType() const;
|
|
|
|
/** Sets the color ramp used to draw the shapeburst fill. Color ramps are only used if setColorType is set ShapeburstColorType::ColorRamp.
|
|
* @param ramp color ramp to use for shapeburst fill
|
|
* @note added in 2.3
|
|
* @see setColorType
|
|
* @see colorRamp
|
|
*/
|
|
void setColorRamp( QgsColorRamp *ramp );
|
|
/** Returns the color ramp used for the shapeburst fill. The color ramp is only used if the colorType is set to ShapeburstColorType::ColorRamp
|
|
* @returns a QgsColorRamp color ramp
|
|
* @note added in 2.3
|
|
* @see setColorRamp
|
|
* @see colorType
|
|
*/
|
|
QgsColorRamp *colorRamp();
|
|
|
|
/** Sets the color for the endpoint of the shapeburst fill. This color is only used if setColorType is set ShapeburstColorType::SimpleTwoColor.
|
|
* @param color2 QColor to use for endpoint of gradient
|
|
* @note added in 2.3
|
|
* @see setColorType
|
|
* @see color2
|
|
*/
|
|
void setColor2( const QColor &color2 );
|
|
/** Returns the color used for the endpoint of the shapeburst fill. This color is only used if the colorType is set to ShapeburstColorType::SimpleTwoColor
|
|
* @returns a QColor indicating the color of the endpoint of the gradient
|
|
* @note added in 2.3
|
|
* @see setColor2
|
|
* @see colorType
|
|
*/
|
|
QColor color2() const;
|
|
|
|
/** Sets whether the shapeburst fill should ignore polygon rings when calculating
|
|
* the buffered shading.
|
|
* @param ignoreRings Set to true if buffers should ignore interior rings for polygons.
|
|
* @note added in 2.3
|
|
* @see ignoreRings
|
|
*/
|
|
void setIgnoreRings( bool ignoreRings );
|
|
/** Returns whether the shapeburst fill is set to ignore polygon interior rings.
|
|
* @returns True if the shapeburst fill will ignore interior rings when calculating buffered shading.
|
|
* @note added in 2.3
|
|
* @see setIgnoreRings
|
|
*/
|
|
bool ignoreRings() const;
|
|
|
|
/** Sets the offset for the shapeburst fill.
|
|
* @param offset QPointF indicating the horizontal/vertical offset amount
|
|
* @note added in 2.3
|
|
* @see offset
|
|
* @see setOffsetUnit
|
|
*/
|
|
void setOffset( QPointF offset );
|
|
/** Returns the offset for the shapeburst fill.
|
|
* @returns a QPointF indicating the horizontal/vertical offset amount
|
|
* @note added in 2.3
|
|
* @see setOffset
|
|
* @see offsetUnit
|
|
*/
|
|
QPointF offset() const;
|
|
|
|
/** Sets the units used for the offset for the shapeburst fill.
|
|
* @param unit units for fill offset
|
|
* @note added in 2.3
|
|
* @see setOffset
|
|
* @see offsetUnit
|
|
*/
|
|
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
|
/** Returns the units used for the offset of the shapeburst fill.
|
|
* @returns units used for the fill offset
|
|
* @note added in 2.3
|
|
* @see offset
|
|
* @see setOffsetUnit
|
|
*/
|
|
QgsUnitTypes::RenderUnit offsetUnit() const;
|
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &offsetMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
};
|
|
|
|
/** Base class for polygon renderers generating texture images*/
|
|
class QgsImageFillSymbolLayer: QgsFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
|
|
public:
|
|
QgsImageFillSymbolLayer();
|
|
virtual ~QgsImageFillSymbolLayer();
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
|
|
virtual QgsSymbol *subSymbol();
|
|
virtual bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
|
|
|
|
/** Sets the units for the symbol's stroke width.
|
|
* @param unit symbol units
|
|
* @see strokeWidthUnit()
|
|
*/
|
|
void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the symbol's stroke width.
|
|
* @see setStrokeWidthUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit strokeWidthUnit() const;
|
|
|
|
void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &strokeWidthMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
virtual double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
virtual double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
|
|
virtual QColor dxfColor( QgsSymbolRenderContext &context ) const;
|
|
virtual Qt::PenStyle dxfPenStyle() const;
|
|
|
|
QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
|
|
|
protected:
|
|
|
|
virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context );
|
|
|
|
private:
|
|
|
|
QgsImageFillSymbolLayer( const QgsImageFillSymbolLayer &other );
|
|
};
|
|
|
|
/** \ingroup core
|
|
* \class QgsRasterFillSymbolLayer
|
|
* \brief A class for filling symbols with a repeated raster image.
|
|
* \note Added in version 2.7
|
|
*/
|
|
class QgsRasterFillSymbolLayer: QgsImageFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
public:
|
|
|
|
enum FillCoordinateMode
|
|
{
|
|
Feature,
|
|
Viewport
|
|
};
|
|
|
|
QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
|
|
~QgsRasterFillSymbolLayer();
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() );
|
|
|
|
// implemented from base classes
|
|
QString layerType() const;
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
QgsStringMap properties() const;
|
|
virtual QgsRasterFillSymbolLayer *clone() const;
|
|
virtual double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
//override QgsImageFillSymbolLayer's support for sub symbols
|
|
virtual QgsSymbol *subSymbol();
|
|
virtual bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
|
|
|
|
/** Sets the path to the raster image used for the fill.
|
|
* @param imagePath path to image file
|
|
* @see imageFilePath
|
|
*/
|
|
void setImageFilePath( const QString &imagePath );
|
|
/** The path to the raster image used for the fill.
|
|
* @returns path to image file
|
|
* @see setImageFilePath
|
|
*/
|
|
QString imageFilePath() const;
|
|
|
|
/** Set the coordinate mode for fill. Controls how the top left corner of the image
|
|
* fill is positioned relative to the feature.
|
|
* @param mode coordinate mode
|
|
* @see coordinateMode
|
|
*/
|
|
void setCoordinateMode( const FillCoordinateMode mode );
|
|
/** Coordinate mode for fill. Controls how the top left corner of the image
|
|
* fill is positioned relative to the feature.
|
|
* @returns coordinate mode
|
|
* @see setCoordinateMode
|
|
*/
|
|
FillCoordinateMode coordinateMode() const;
|
|
|
|
/** Sets the opacity for the raster image used in the fill.
|
|
* @param alpha opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
* @see alpha
|
|
*/
|
|
void setAlpha( const double alpha );
|
|
/** The opacity for the raster image used in the fill.
|
|
* @returns opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
* @see setAlpha
|
|
*/
|
|
double alpha() const;
|
|
|
|
/** Sets the offset for the fill.
|
|
* @param offset offset for fill
|
|
* @see offset
|
|
* @see setOffsetUnit
|
|
* @see setOffsetMapUnitScale
|
|
*/
|
|
void setOffset( QPointF offset );
|
|
/** Returns the offset for the fill.
|
|
* @returns offset for fill
|
|
* @see setOffset
|
|
* @see offsetUnit
|
|
* @see offsetMapUnitScale
|
|
*/
|
|
QPointF offset() const;
|
|
|
|
/** Sets the units for the fill's offset.
|
|
* @param unit units for offset
|
|
* @see offsetUnit
|
|
* @see setOffset
|
|
* @see setOffsetMapUnitScale
|
|
*/
|
|
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit );
|
|
/** Returns the units for the fill's offset.
|
|
* @returns units for offset
|
|
* @see setOffsetUnit
|
|
* @see offset
|
|
* @see offsetMapUnitScale
|
|
*/
|
|
QgsUnitTypes::RenderUnit offsetUnit() const;
|
|
|
|
/** Sets the map unit scale for the fill's offset.
|
|
* @param scale map unit scale for offset
|
|
* @see offsetMapUnitScale
|
|
* @see setOffset
|
|
* @see setOffsetUnit
|
|
*/
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
|
|
/** Returns the map unit scale for the fill's offset.
|
|
* @returns map unit scale for offset
|
|
* @see setOffsetMapUnitScale
|
|
* @see offset
|
|
* @see offsetUnit
|
|
*/
|
|
const QgsMapUnitScale &offsetMapUnitScale() const;
|
|
|
|
/** Sets the width for scaling the image used in the fill. The image's height will also be
|
|
* scaled to maintain the image's aspect ratio.
|
|
* @param width width for scaling the image
|
|
* @see width
|
|
* @see setWidthUnit
|
|
* @see setWidthMapUnitScale
|
|
*/
|
|
void setWidth( const double width );
|
|
/** Returns the width used for scaling the image used in the fill. The image's height is
|
|
* scaled to maintain the image's aspect ratio.
|
|
* @returns width used for scaling the image
|
|
* @see setWidth
|
|
* @see widthUnit
|
|
* @see widthMapUnitScale
|
|
*/
|
|
double width() const;
|
|
|
|
/** Sets the units for the image's width.
|
|
* @param unit units for width
|
|
* @see widthUnit
|
|
* @see setWidth
|
|
* @see setWidthMapUnitScale
|
|
*/
|
|
void setWidthUnit( const QgsUnitTypes::RenderUnit unit );
|
|
/** Returns the units for the image's width.
|
|
* @returns units for width
|
|
* @see setWidthUnit
|
|
* @see width
|
|
* @see widthMapUnitScale
|
|
*/
|
|
QgsUnitTypes::RenderUnit widthUnit() const;
|
|
|
|
/** Sets the map unit scale for the image's width.
|
|
* @param scale map unit scale for width
|
|
* @see widthMapUnitScale
|
|
* @see setWidth
|
|
* @see setWidthUnit
|
|
*/
|
|
void setWidthMapUnitScale( const QgsMapUnitScale &scale );
|
|
/** Returns the map unit scale for the image's width.
|
|
* @returns map unit scale for width
|
|
* @see setWidthMapUnitScale
|
|
* @see width
|
|
* @see widthUnit
|
|
*/
|
|
const QgsMapUnitScale &widthMapUnitScale() const;
|
|
|
|
protected:
|
|
|
|
void applyDataDefinedSettings( QgsSymbolRenderContext &context );
|
|
|
|
};
|
|
|
|
/** A class for svg fill patterns. The class automatically scales the pattern to
|
|
the appropriate pixel dimensions of the output device*/
|
|
class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
|
|
public:
|
|
QgsSVGFillSymbolLayer( const QString &svgFilePath = "", double width = 20, double rotation = 0.0 );
|
|
QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
|
|
~QgsSVGFillSymbolLayer();
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
|
|
|
|
// implemented from base classes
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsSVGFillSymbolLayer *clone() const /Factory/;
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
|
|
|
|
//getters and setters
|
|
void setSvgFilePath( const QString &svgPath );
|
|
QString svgFilePath() const;
|
|
void setPatternWidth( double width );
|
|
double patternWidth() const;
|
|
|
|
void setSvgFillColor( const QColor &c );
|
|
QColor svgFillColor() const;
|
|
void setSvgStrokeColor( const QColor &c );
|
|
QColor svgStrokeColor() const;
|
|
void setSvgStrokeWidth( double w );
|
|
double svgStrokeWidth() const;
|
|
|
|
/** Sets the units for the width of the SVG images in the pattern.
|
|
* @param unit width units
|
|
* @see patternWidthUnit()
|
|
*/
|
|
void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the width of the SVG images in the pattern.
|
|
* @see setPatternWidthUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit patternWidthUnit() const;
|
|
|
|
void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &patternWidthMapUnitScale() const;
|
|
|
|
/** Sets the units for the stroke width.
|
|
* @param unit width units
|
|
* @see svgStrokeWidthUnit()
|
|
*/
|
|
void setSvgStrokeWidthUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the stroke width.
|
|
* @see setSvgStrokeWidthUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const;
|
|
|
|
void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
protected:
|
|
void applyDataDefinedSettings( QgsSymbolRenderContext &context );
|
|
};
|
|
|
|
class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
public:
|
|
QgsLinePatternFillSymbolLayer();
|
|
~QgsLinePatternFillSymbolLayer();
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsLinePatternFillSymbolLayer *clone() const /Factory/;
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
|
|
|
|
double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
QString ogrFeatureStyleWidth( double widthScaleFactor ) const;
|
|
|
|
//getters and setters
|
|
void setLineAngle( double a );
|
|
double lineAngle() const;
|
|
|
|
/** Sets the distance between lines in the fill pattern.
|
|
* @param d distance. Units are specified by setDistanceUnit()
|
|
* @see distance()
|
|
* @see setDistanceUnit()
|
|
*/
|
|
void setDistance( double d );
|
|
|
|
/** Returns the distance between lines in the fill pattern. Units are retrieved by distanceUnit().
|
|
* @see setDistance()
|
|
* @see distanceUnit()
|
|
*/
|
|
double distance() const;
|
|
void setLineWidth( double w );
|
|
double lineWidth() const;
|
|
void setColor( const QColor &c );
|
|
QColor color() const;
|
|
void setOffset( double offset );
|
|
double offset() const;
|
|
|
|
/** Sets the units for the distance between lines in the fill pattern.
|
|
* @param unit distance units
|
|
* @see distanceUnit()
|
|
* @see setDistance()
|
|
*/
|
|
void setDistanceUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the distance between lines in the fill pattern.
|
|
* @see setDistanceUnit()
|
|
* @see distance()
|
|
*/
|
|
QgsUnitTypes::RenderUnit distanceUnit() const;
|
|
|
|
void setDistanceMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &distanceMapUnitScale() const;
|
|
|
|
/** Sets the units for the line's width.
|
|
* @param unit width units
|
|
* @see lineWidthUnit()
|
|
*/
|
|
void setLineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the line's width.
|
|
* @see setLineWidthUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit lineWidthUnit() const;
|
|
|
|
void setLineWidthMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &lineWidthMapUnitScale() const;
|
|
|
|
/** Sets the units for the line pattern's offset.
|
|
* @param unit offset units
|
|
* @see offsetUnit()
|
|
*/
|
|
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the line pattern's offset.
|
|
* @see setOffsetUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit offsetUnit() const;
|
|
|
|
void setOffsetMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &offsetMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
|
|
QgsSymbol *subSymbol();
|
|
|
|
QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
|
|
|
private:
|
|
|
|
QgsLinePatternFillSymbolLayer( const QgsLinePatternFillSymbolLayer &other );
|
|
|
|
};
|
|
|
|
class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
public:
|
|
QgsPointPatternFillSymbolLayer();
|
|
~QgsPointPatternFillSymbolLayer();
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsPointPatternFillSymbolLayer *clone() const /Factory/;
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
|
|
|
|
double estimateMaxBleed( const QgsRenderContext &context ) const;
|
|
|
|
//getters and setters
|
|
double distanceX() const;
|
|
void setDistanceX( double d );
|
|
|
|
double distanceY() const;
|
|
void setDistanceY( double d );
|
|
|
|
double displacementX() const;
|
|
void setDisplacementX( double d );
|
|
|
|
double displacementY() const;
|
|
void setDisplacementY( double d );
|
|
|
|
bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
|
|
virtual QgsSymbol *subSymbol();
|
|
|
|
/** Sets the units for the horizontal distance between points in the pattern.
|
|
* @param unit distance units
|
|
* @see distanceXUnit()
|
|
* @see setDistanceYUnit()
|
|
*/
|
|
void setDistanceXUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the horizontal distance between points in the pattern.
|
|
* @see setDistanceXUnit()
|
|
* @see distanceYUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit distanceXUnit() const;
|
|
|
|
void setDistanceXMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &distanceXMapUnitScale() const;
|
|
|
|
/** Sets the units for the vertical distance between points in the pattern.
|
|
* @param unit distance units
|
|
* @see distanceYUnit()
|
|
* @see setDistanceXUnit()
|
|
*/
|
|
void setDistanceYUnit( QgsUnitTypes::RenderUnit unit );
|
|
|
|
/** Returns the units for the vertical distance between points in the pattern.
|
|
* @see setDistanceYUnit()
|
|
* @see distanceXUnit()
|
|
*/
|
|
QgsUnitTypes::RenderUnit distanceYUnit() const;
|
|
|
|
void setDistanceYMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &distanceYMapUnitScale() const;
|
|
|
|
void setDisplacementXUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit displacementXUnit() const;
|
|
|
|
void setDisplacementXMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &displacementXMapUnitScale() const;
|
|
|
|
void setDisplacementYUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit displacementYUnit() const;
|
|
|
|
void setDisplacementYMapUnitScale( const QgsMapUnitScale &scale);
|
|
const QgsMapUnitScale &displacementYMapUnitScale() const;
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
|
|
|
void setColor( const QColor &c );
|
|
virtual QColor color() const;
|
|
|
|
protected:
|
|
void applyDataDefinedSettings( QgsSymbolRenderContext &context );
|
|
|
|
private:
|
|
|
|
QgsPointPatternFillSymbolLayer( const QgsPointPatternFillSymbolLayer &other );
|
|
};
|
|
|
|
class QgsCentroidFillSymbolLayer : QgsFillSymbolLayer
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsfillsymbollayer.h>
|
|
%End
|
|
|
|
public:
|
|
QgsCentroidFillSymbolLayer();
|
|
~QgsCentroidFillSymbolLayer();
|
|
|
|
// static stuff
|
|
|
|
static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) /Factory/;
|
|
static QgsSymbolLayer *createFromSld( QDomElement &element ) /Factory/;
|
|
|
|
// implemented from base classes
|
|
|
|
QString layerType() const;
|
|
|
|
void startRender( QgsSymbolRenderContext &context );
|
|
|
|
void stopRender( QgsSymbolRenderContext &context );
|
|
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
|
|
|
|
QgsStringMap properties() const;
|
|
|
|
virtual QgsCentroidFillSymbolLayer *clone() const /Factory/;
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const;
|
|
|
|
void setColor( const QColor &color );
|
|
QColor color() const;
|
|
|
|
QgsSymbol *subSymbol();
|
|
bool setSubSymbol( QgsSymbol *symbol /Transfer/ );
|
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
|
|
|
void setMapUnitScale(const QgsMapUnitScale &scale);
|
|
QgsMapUnitScale mapUnitScale() const;
|
|
|
|
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
|
|
|
void setPointOnSurface( bool pointOnSurface );
|
|
bool pointOnSurface() const;
|
|
|
|
/** Sets whether a point is drawn for all parts or only on the biggest part of multi-part features.
|
|
* @note added in 2.16 */
|
|
void setPointOnAllParts( bool pointOnAllParts );
|
|
/** Returns whether a point is drawn for all parts or only on the biggest part of multi-part features.
|
|
* @note added in 2.16 */
|
|
bool pointOnAllParts() const;
|
|
|
|
private:
|
|
|
|
QgsCentroidFillSymbolLayer( const QgsCentroidFillSymbolLayer &other );
|
|
};
|