16 #ifndef QGSFILLSYMBOLLAYERV2_H
17 #define QGSFILLSYMBOLLAYERV2_H
21 #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255)
22 #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern
23 #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0)
24 #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine
25 #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH
26 #define DEFAULT_SIMPLEFILL_JOINSTYLE Qt::BevelJoin
67 Qt::BrushStyle
brushStyle()
const {
return mBrushStyle; }
88 void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; }
180 QColor color2 = Qt::white,
181 GradientColorType gradientColorType = SimpleTwoColor,
182 GradientType gradientType = Linear,
183 GradientCoordinateMode coordinateMode = Feature,
184 GradientSpread gradientSpread = Pad
312 ShapeburstColorType colorType = SimpleTwoColor,
313 int blurRadius = 0,
bool useWholeShape =
true,
double maxDistance = 5 );
531 double& maxDistance,
bool &ignoreRings );
534 void distanceTransform1d(
double *f,
int n,
int *v,
double *z,
double *d );
536 void distanceTransform2d(
double * im,
int width,
int height );
538 double * distanceTransform(
QImage * im );
541 void dtArrayToQImage(
double * array,
QImage *im,
QgsVectorColorRampV2* ramp,
double layerAlpha = 1,
bool useWholeShape =
true,
int maxPixelDistance = 0 );
626 void setImageFilePath(
const QString& imagePath );
638 void setCoordinateMode(
const FillCoordinateMode mode );
650 void setAlpha(
const double alpha );
655 double alpha()
const {
return mAlpha; }
709 void setWidth(
const double width ) { mWidth = width; }
717 double width()
const {
return mWidth; }
769 void applyPattern(
QBrush& brush,
const QString& imageFilePath,
const double width,
const double alpha,
799 void setSvgFilePath(
const QString& svgPath );
857 void setDefaultSvgParams();
887 QString ogrFeatureStyleWidth(
double widthScaleFactor )
const;
894 void setLineWidth(
double w );
899 double offset()
const {
return mOffset; }
1047 double displacementX,
double displacementY );
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
QgsMapUnitScale mSvgOutlineWidthMapUnitScale
void setBorderWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsVectorColorRampV2 * colorRamp()
Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp...
ShapeburstColorType mColorType
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
QgsSymbolV2::OutputUnit patternWidthUnit() const
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
double borderWidth() const
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
const QgsMapUnitScale & patternWidthMapUnitScale() const
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
QgsVectorColorRampV2 * colorRamp()
Returns the color ramp used for the shapeburst fill.
void setDistance(double d)
QgsSymbolV2::OutputUnit distanceYUnit() const
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
void setSvgOutlineWidth(double w)
virtual QgsSymbolV2::OutputUnit outputUnit() const
const QgsMapUnitScale & displacementXMapUnitScale() const
virtual void setOutputUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit mOffsetUnit
virtual Qt::PenStyle dxfPenStyle() const
FillCoordinateMode mCoordinateMode
virtual QgsSymbolLayerV2 * clone() const =0
virtual double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
QgsSymbolV2::OutputUnit mLineWidthUnit
void setCoordinateMode(GradientCoordinateMode coordinateMode)
const QgsMapUnitScale & lineWidthMapUnitScale() const
QgsSymbolV2::OutputUnit distanceXUnit() const
QgsMapUnitScale mLineWidthMapUnitScale
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
bool mReferencePoint1IsCentroid
QgsSymbolV2::OutputUnit offsetUnit() const
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
virtual void applyDataDefinedSettings(const QgsSymbolV2RenderContext &context)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
QPointF referencePoint2() const
double displacementX() const
double svgOutlineWidth() const
Base class for polygon renderers generating texture images.
QgsMapUnitScale mOffsetMapUnitScale
QgsMapUnitScale mPatternWidthMapUnitScale
GradientCoordinateMode mCoordinateMode
void setPointOnSurface(bool pointOnSurface)
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
void setColor2(QColor color2)
Sets the color for the endpoint of the shapeburst fill.
bool referencePoint2IsCentroid() const
QgsMapUnitScale mOutlineWidthMapUnitScale
GradientType mGradientType
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient.
virtual void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)=0
QgsSymbolV2::OutputUnit mWidthUnit
QgsSymbolV2::OutputUnit mDisplacementXUnit
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
double mDistance
Distance (in mm or map units) between lines.
void setBorderColor(QColor borderColor)
const QgsMapUnitScale & outlineWidthMapUnitScale() const
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsMapUnitScale mOffsetMapUnitScale
double mLineAngle
Vector line angle in degrees (0 = horizontal, counterclockwise)
GradientSpread mGradientSpread
const QgsMapUnitScale & borderWidthMapUnitScale() const
QColor color() const override
QgsMapUnitScale mDistanceYMapUnitScale
QgsVectorColorRampV2 * mGradientRamp
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QMap< QString, QString > QgsStringMap
void setPatternWidth(double width)
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
QgsMapUnitScale mapUnitScale() const override
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
QgsSymbolV2::OutputUnit outputUnit() const override
void setSvgOutlineColor(const QColor &c)
virtual void startRender(QgsSymbolV2RenderContext &context)=0
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
QgsMapUnitScale mDisplacementYMapUnitScale
void setGradientType(GradientType gradientType)
QgsSymbolV2::OutputUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
QString mImageFilePath
Path to the image file.
QgsSymbolV2::OutputUnit mDisplacementYUnit
void setLineAngle(double a)
virtual void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
A class for filling symbols with a repeated raster image.
bool mReferencePoint2IsCentroid
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
QByteArray mSvgData
SVG data.
Qt::PenStyle borderStyle() const
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsLineSymbolV2 * mOutline
Custom outline.
#define DEFAULT_SIMPLEFILL_STYLE
QgsMapUnitScale mDistanceXMapUnitScale
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
double mOffset
Offset perpendicular to line direction.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
void setPenJoinStyle(Qt::PenJoinStyle style)
QgsMapUnitScale mDistanceMapUnitScale
void setBrushStyle(Qt::BrushStyle style)
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
QgsVectorColorRampV2 * mTwoColorGradientRamp
void setLineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setBlurRadius(int blurRadius)
Sets the blur radius, which controls the amount of blurring applied to the fill.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
QColor outlineColor() const override
Get outline color.
virtual double estimateMaxBleed() const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
const QgsMapUnitScale & offsetMapUnitScale() const
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
QgsMarkerSymbolV2 * mMarker
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
QPointF offset() const
Returns the offset for the shapeburst fill.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
const QgsMapUnitScale & distanceXMapUnitScale() const
QString imageFilePath() const
The path to the raster image used for the fill.
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
Qt::PenStyle mBorderStyle
QColor svgFillColor() const
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
QgsSymbolV2::OutputUnit distanceUnit() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
virtual QgsSymbolV2 * subSymbol() override
virtual QgsStringMap properties() const =0
double patternWidth() const
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context) override
void setOutlineColor(const QColor &color) override
Set outline color.
void setFillColor(const QColor &color) override
Set fill color.
QgsSymbolV2::OutputUnit borderWidthUnit() const
virtual QColor color() const
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setDisplacementXUnit(QgsSymbolV2::OutputUnit unit)
virtual bool setSubSymbol(QgsSymbolV2 *symbol) override
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
QgsMapUnitScale mDisplacementXMapUnitScale
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
virtual QColor dxfBrushColor(const QgsSymbolV2RenderContext &context) const
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
QPointF referencePoint1() const
QString mSvgFilePath
Path to the svg file (or empty if constructed directly from data)
const QgsMapUnitScale & displacementYMapUnitScale() const
QgsSymbolV2::OutputUnit mOffsetUnit
virtual QColor dxfColor(const QgsSymbolV2RenderContext &context) const
QgsSymbolV2::OutputUnit mOutlineWidthUnit
double mOutlineWidth
Outline width.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
void setColorType(ShapeburstColorType colorType)
Sets the color mode to use for the shapeburst fill.
void setDistanceXUnit(QgsSymbolV2::OutputUnit unit)
double mLineWidth
Line width (in mm or map units)
QgsVectorColorRampV2 * mGradientRamp
QColor svgOutlineColor() const
GradientSpread gradientSpread() const
Gradient spread mode.
const QgsMapUnitScale & distanceMapUnitScale() const
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setOffset(QPointF offset)
Offset for gradient fill.
virtual QString layerType() const =0
void setDisplacementY(double d)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Sets the units used for the offset for the shapeburst fill.
QgsSymbolV2::OutputUnit mDistanceYUnit
bool pointOnSurface() const
virtual QgsSymbolV2 * subSymbol()
void setOffset(QPointF offset)
const QgsMapUnitScale & offsetMapUnitScale() const
Qt::PenJoinStyle mPenJoinStyle
QgsMapUnitScale mWidthMapUnitScale
QgsSymbolV2::OutputUnit lineWidthUnit() const
A class for svg fill patterns.
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units for the fill's offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
virtual Qt::BrushStyle dxfBrushStyle() const
const QgsMapUnitScale & distanceMapUnitScale() const
void setGradientColorType(GradientColorType gradientColorType)
Qt::BrushStyle mBrushStyle
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
QgsMapUnitScale mBorderWidthMapUnitScale
QPointF offset() const
Returns the offset for the fill.
GradientColorType mGradientColorType
QgsSymbolV2::OutputUnit mDistanceXUnit
QgsMapUnitScale mDistanceMapUnitScale
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
void setDisplacementYUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & distanceYMapUnitScale() const
QgsSymbolV2::OutputUnit displacementYUnit() const
bool referencePoint1IsCentroid() const
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
QgsSymbolV2::OutputUnit mBorderWidthUnit
Qt::PenJoinStyle penJoinStyle() const
void setOffset(const QPointF &offset)
Sets the offset for the fill.
const QgsMapUnitScale & offsetMapUnitScale() const
QgsSymbolV2::OutputUnit mDistanceUnit
virtual QgsMapUnitScale mapUnitScale() const
void setDistanceY(double d)
QgsMarkerSymbolV2 * mMarkerSymbol
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
virtual void setColor(const QColor &color)
GradientType gradientType() const
Type of gradient, eg linear or radial.
QColor borderColor() const
void setDistanceX(double d)
QgsSymbolV2::OutputUnit outlineWidthUnit() const
QgsSymbolV2::OutputUnit mDistanceUnit
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
QgsSymbolV2::OutputUnit widthUnit() const
Returns the units for the image's width.
void setOffset(double offset)
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
void setWidthUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the image's width.
QgsSymbolV2::OutputUnit displacementXUnit() const
void setGradientSpread(GradientSpread gradientSpread)
double width() const
Returns the width used for scaling the image used in the fill.
QgsSymbolV2::OutputUnit mPatternWidthUnit
QgsSymbolV2::OutputUnit offsetUnit() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
virtual QgsSymbolV2 * subSymbol() override
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
const QgsMapUnitScale & offsetMapUnitScale() const
void setBorderWidth(double borderWidth)
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
#define DEFAULT_SIMPLEFILL_JOINSTYLE
void setDisplacementX(double d)
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
double displacementY() const
Qt::BrushStyle brushStyle() const
QColor fillColor() const override
Get fill color.
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the fill's offset.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
#define DEFAULT_SIMPLEFILL_BORDERWIDTH
virtual QgsSymbolV2 * subSymbol() override
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
QgsSymbolV2::OutputUnit offsetUnit() const
QRectF mSvgViewBox
SVG view box (to keep the aspect ratio.
QImage * mSvgPattern
SVG pattern image.
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
void setSvgOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
double alpha() const
The opacity for the raster image used in the fill.
double mPatternWidth
Width of the pattern (in output units)
#define DEFAULT_SIMPLEFILL_COLOR
void setColor2(QColor color2)
void setBorderStyle(Qt::PenStyle borderStyle)