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 71 Qt::BrushStyle
brushStyle()
const {
return mBrushStyle; }
92 void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; }
189 const QColor& color2 = Qt::white,
325 int blurRadius = 0,
bool useWholeShape =
true,
double maxDistance = 5 );
543 double& maxDistance,
bool &ignoreRings );
546 void distanceTransform1d(
double *f,
int n,
int *v,
double *z,
double *d );
548 void distanceTransform2d(
double * im,
int width,
int height );
550 double * distanceTransform(
QImage * im );
553 void dtArrayToQImage(
double * array,
QImage *im,
QgsVectorColorRampV2* ramp,
double layerAlpha = 1,
bool useWholeShape =
true,
int maxPixelDistance = 0 );
642 void setImageFilePath(
const QString& imagePath );
666 void setAlpha(
const double alpha );
671 double alpha()
const {
return mAlpha; }
725 void setWidth(
const double width ) { mWidth = width; }
733 double width()
const {
return mWidth; }
785 void applyPattern(
QBrush& brush,
const QString& imageFilePath,
const double width,
const double alpha,
817 void setSvgFilePath(
const QString& svgPath );
875 void setDefaultSvgParams();
909 QString ogrFeatureStyleWidth(
double widthScaleFactor )
const;
916 void setLineWidth(
double w );
921 double offset()
const {
return mOffset; }
1075 double displacementX,
double displacementY );
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
QgsFeatureId mCurrentFeatureId
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
QgsSymbolV2::OutputUnit offsetUnit() const
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
QgsVectorColorRampV2 * colorRamp()
Returns the color ramp used for the shapeburst fill.
virtual Qt::BrushStyle dxfBrushStyle() const
get brush/fill style
void setDistance(double d)
const QgsMapUnitScale & displacementYMapUnitScale() const
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
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)
const QgsMapUnitScale & borderWidthMapUnitScale() const
OutputUnit
The unit of the output.
virtual void setOutputUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
QgsSymbolV2::OutputUnit mOffsetUnit
FillCoordinateMode mCoordinateMode
virtual QgsSymbolLayerV2 * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsSymbolV2::OutputUnit mLineWidthUnit
QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
void setCoordinateMode(GradientCoordinateMode coordinateMode)
QgsMapUnitScale mLineWidthMapUnitScale
virtual Qt::PenStyle dxfPenStyle() const
get pen style
const QgsMapUnitScale & lineWidthMapUnitScale() const
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
bool mReferencePoint1IsCentroid
QgsSymbolV2::OutputUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
const QgsMapUnitScale & displacementXMapUnitScale() const
virtual QColor dxfColor(QgsSymbolV2RenderContext &context) const
get color
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString imageFilePath() const
The path to the raster image used for the fill.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
Qt::BrushStyle brushStyle() const
virtual QgsMapUnitScale mapUnitScale() const
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient.
GradientType gradientType() const
Type of gradient, eg linear or radial.
Base class for polygon renderers generating texture images.
QgsMapUnitScale mOffsetMapUnitScale
QgsMapUnitScale mPatternWidthMapUnitScale
GradientCoordinateMode mCoordinateMode
void setPointOnSurface(bool pointOnSurface)
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
QgsSymbolV2::OutputUnit widthUnit() const
Returns the units for the image's width.
QPointF offset() const
Returns the offset for the shapeburst fill.
virtual QColor dxfBrushColor(QgsSymbolV2RenderContext &context) const
get brush/fill color
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mOutlineWidthMapUnitScale
GradientType mGradientType
virtual void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)=0
QgsSymbolV2::OutputUnit mWidthUnit
QgsSymbolV2::OutputUnit mDisplacementXUnit
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
QPointF referencePoint2() const
double mDistance
Distance (in mm or map units) between lines.
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features...
QgsMapUnitScale mOffsetMapUnitScale
double mLineAngle
Vector line angle in degrees (0 = horizontal, counterclockwise)
GradientSpread mGradientSpread
QgsSymbolV2::OutputUnit borderWidthUnit() const
QgsMapUnitScale mDistanceYMapUnitScale
QgsVectorColorRampV2 * mGradientRamp
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
QMap< QString, QString > QgsStringMap
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
void setPatternWidth(double width)
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
Writes the SLD element following the SLD v1.1 specs.
QgsMapUnitScale mapUnitScale() const override
QgsSymbolV2::OutputUnit outputUnit() const override
void setSvgOutlineColor(const QColor &c)
virtual void startRender(QgsSymbolV2RenderContext &context)=0
const QgsMapUnitScale & offsetMapUnitScale() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
QgsMapUnitScale mDisplacementYMapUnitScale
virtual QgsSymbolV2::OutputUnit outputUnit() const
void setGradientType(GradientType gradientType)
const QgsMapUnitScale & offsetMapUnitScale() const
QString mImageFilePath
Path to the image file.
QgsSymbolV2::OutputUnit mDisplacementYUnit
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
GradientSpread gradientSpread() const
Gradient spread mode.
void setLineAngle(double a)
QgsSymbolV2::OutputUnit distanceXUnit() 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.
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsLineSymbolV2 * mOutline
Custom outline.
#define DEFAULT_SIMPLEFILL_STYLE
QgsMapUnitScale mDistanceXMapUnitScale
QgsSymbolV2::OutputUnit patternWidthUnit() const
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
double mOffset
Offset perpendicular to line direction.
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.
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...
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
QgsMarkerSymbolV2 * mMarker
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
double displacementX() const
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
QgsSymbolV2::OutputUnit distanceYUnit() const
const QgsMapUnitScale & outlineWidthMapUnitScale() const
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
Qt::PenStyle mBorderStyle
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
QgsMapUnitScale mOffsetMapUnitScale
double alpha() const
The opacity for the raster image used in the fill.
QgsSymbolV2::OutputUnit mOffsetUnit
virtual QgsSymbolV2 * subSymbol() override
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
bool referencePoint2IsCentroid() 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.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
void setDisplacementXUnit(QgsSymbolV2::OutputUnit unit)
virtual bool setSubSymbol(QgsSymbolV2 *symbol) override
set layer's subsymbol. takes ownership of the passed symbol
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
virtual QColor color() const
The fill color.
QgsMapUnitScale mDisplacementXMapUnitScale
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
void setOffset(QPointF offset)
Sets the offset for the fill.
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
QString mSvgFilePath
Path to the svg file (or empty if constructed directly from data)
const QgsMapUnitScale & distanceMapUnitScale() const
QgsSymbolV2::OutputUnit mOffsetUnit
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
QgsSymbolV2::OutputUnit displacementXUnit() const
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features...
void setOffset(QPointF offset)
Offset for gradient fill.
virtual QString layerType() const =0
Returns a string that represents this layer type.
void setBorderColor(const QColor &borderColor)
void setDisplacementY(double d)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Sets the units used for the offset for the shapeburst fill.
QgsSymbolV2::OutputUnit mDistanceYUnit
virtual QgsSymbolV2 * subSymbol()
void setOffset(QPointF offset)
const QgsMapUnitScale & distanceMapUnitScale() const
Qt::PenJoinStyle mPenJoinStyle
double svgOutlineWidth() const
QgsMapUnitScale mWidthMapUnitScale
A class for svg fill patterns.
QgsSymbolV2::OutputUnit lineWidthUnit() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
void setGradientColorType(GradientColorType gradientColorType)
Qt::BrushStyle mBrushStyle
QColor borderColor() const
QgsMapUnitScale mBorderWidthMapUnitScale
GradientColorType mGradientColorType
QColor svgFillColor() const
Struct for storing maximum and minimum scales for measurements in map units.
QgsSymbolV2::OutputUnit mDistanceXUnit
QgsMapUnitScale mDistanceMapUnitScale
void setDisplacementYUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & distanceXMapUnitScale() const
const QgsMapUnitScale & patternWidthMapUnitScale() const
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const
get line width
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
bool pointOnSurface() const
double borderWidth() const
QgsSymbolV2::OutputUnit mBorderWidthUnit
QgsSymbolV2::OutputUnit offsetUnit() const
const QgsMapUnitScale & distanceYMapUnitScale() const
QgsSymbolV2::OutputUnit mDistanceUnit
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
double patternWidth() const
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
void setDistanceY(double d)
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
QgsMarkerSymbolV2 * mMarkerSymbol
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
QgsSymbolV2::OutputUnit offsetUnit() const
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units for the fill's offset.
virtual void setColor(const QColor &color)
The fill color.
virtual double dxfAngle(QgsSymbolV2RenderContext &context) const
get angle
void setDistanceX(double d)
QgsSymbolV2::OutputUnit mDistanceUnit
bool referencePoint1IsCentroid() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setColor2(const QColor &color2)
const QgsMapUnitScale & offsetMapUnitScale() const
void setOffset(double offset)
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
void setWidthUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the image's width.
void setGradientSpread(GradientSpread gradientSpread)
QgsSymbolV2::OutputUnit mPatternWidthUnit
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Qt::PenStyle borderStyle() const
QColor svgOutlineColor() const
virtual QgsSymbolV2 * subSymbol() override
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
QgsSymbolV2::OutputUnit displacementYUnit() const
double displacementY() const
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolV2::OutputUnit distanceUnit() const
Abstract base class for color ramps.
void setBorderWidth(double borderWidth)
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
#define DEFAULT_SIMPLEFILL_JOINSTYLE
void setDisplacementX(double d)
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
set layer's subsymbol. takes ownership of the passed symbol
double width() const
Returns the width used for scaling the image used in the fill.
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
Qt::PenJoinStyle penJoinStyle() 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 QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
virtual void applyDataDefinedSettings(QgsSymbolV2RenderContext &context)
const QgsMapUnitScale & offsetMapUnitScale() const
virtual QgsSymbolV2 * subSymbol() override
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
QRectF mSvgViewBox
SVG view box (to keep the aspect ratio.
QImage * mSvgPattern
SVG pattern image.
void setSvgOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
QPointF offset() const
Returns the offset for the fill.
double mPatternWidth
Width of the pattern (in output units)
QPointF referencePoint1() const
QgsSymbolV2::OutputUnit outlineWidthUnit() const
#define DEFAULT_SIMPLEFILL_COLOR
void setBorderStyle(Qt::PenStyle borderStyle)