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
65 QString
ogrFeatureStyle(
double mmScaleFactor,
double mapUnitScaleFactor )
const;
67 Qt::BrushStyle
brushStyle()
const {
return mBrushStyle; }
88 void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; }
96 void setOffset( QPointF offset ) { mOffset = offset; }
178 QColor color2 = Qt::white,
179 GradientColorType gradientColorType = SimpleTwoColor,
180 GradientType gradientType = Linear,
181 GradientCoordinateMode coordinateMode = Feature,
182 GradientSpread gradientSpread = Pad
220 QColor
color2()
const {
return mColor2; }
253 QPointF
offset()
const {
return mOffset; }
295 void applyGradient(
const QgsSymbolV2RenderContext& context, QBrush& brush,
const QColor& color,
const QColor& color2,
298 const QPointF &referencePoint1,
const QPointF &referencePoint2,
const double angle );
301 QPointF rotateReferencePoint(
const QPointF & refPoint,
double angle );
315 ShapeburstColorType colorType = SimpleTwoColor,
316 int blurRadius = 0,
bool useWholeShape =
true,
double maxDistance = 5 );
453 QColor
color2()
const {
return mColor2; }
482 QPointF
offset()
const {
return mOffset; }
533 void applyDataDefinedSymbology(
QgsSymbolV2RenderContext& context, QColor& color, QColor& color2,
int& blurRadius,
bool& useWholeShape,
534 double& maxDistance ,
bool &ignoreRings );
537 void distanceTransform1d(
double *f,
int n,
int *v,
double *z,
double *d );
539 void distanceTransform2d(
double * im,
int width,
int height );
541 double * distanceTransform( QImage * im );
544 void dtArrayToQImage(
double * array, QImage *im,
QgsVectorColorRampV2* ramp,
double layerAlpha = 1,
bool useWholeShape =
true,
int maxPixelDistance = 0 );
617 void setSvgFilePath(
const QString& svgPath );
676 void setDefaultSvgParams();
679 void applyPattern( QBrush& brush,
const QString& svgFilePath,
double patternWidth,
QgsSymbolV2::OutputUnit patternWidthUnit,
const QColor& svgFillColor,
const QColor& svgOutlineColor,
713 void setLineWidth(
double w );
718 double offset()
const {
return mOffset; }
768 void applyPattern(
const QgsSymbolV2RenderContext& context, QBrush& brush,
double lineAngle,
double distance,
double lineWidth,
const QColor& color );
864 double displacementX,
double displacementY );
894 void setColor(
const QColor& color );
virtual QSet< QString > usedAttributes() const
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)
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
void setAngle(double angle)
Rotation angle for gradient fill.
const QgsMapUnitScale & displacementXMapUnitScale() const
virtual void setOutputUnit(QgsSymbolV2::OutputUnit unit)
virtual Qt::PenStyle dxfPenStyle() const
double ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
void setMapUnitScale(const QgsMapUnitScale &scale)
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
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)
virtual QgsSymbolV2 * subSymbol()
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 setDistanceMapUnitScale(const QgsMapUnitScale &scale)
void setColor2(QColor color2)
Sets the color for the endpoint of the shapeburst fill.
QgsSymbolV2::OutputUnit outputUnit() const
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 mDisplacementXUnit
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
double useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
double mDistance
Distance (in mm or map units) between lines.
void setBorderColor(QColor borderColor)
QColor fillColor() const
Get fill color.
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
QgsMapUnitScale mDistanceYMapUnitScale
QgsVectorColorRampV2 * mGradientRamp
QMap< QString, QString > QgsStringMap
void setFillColor(const QColor &color)
Set fill color.
void setPatternWidth(double width)
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void setSvgOutlineColor(const QColor &c)
virtual void startRender(QgsSymbolV2RenderContext &context)=0
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
virtual QgsSymbolV2 * subSymbol()
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...
QgsSymbolV2::OutputUnit mDisplacementYUnit
void setLineAngle(double a)
virtual void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
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
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.
const QgsMapUnitScale & offsetMapUnitScale() const
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
QgsMarkerSymbolV2 * mMarker
QPointF offset() const
Returns the offset for the shapeburst fill.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
const QgsMapUnitScale & distanceXMapUnitScale() const
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 QgsStringMap properties() const =0
double patternWidth() const
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)
QgsMapUnitScale mOffsetMapUnitScale
QgsSymbolV2::OutputUnit mOffsetUnit
QgsMapUnitScale mDisplacementXMapUnitScale
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
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.
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
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
QgsSymbolV2::OutputUnit lineWidthUnit() const
A class for svg fill patterns.
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
GradientColorType mGradientColorType
QgsSymbolV2::OutputUnit mDistanceXUnit
QgsMapUnitScale mDistanceMapUnitScale
void setDisplacementYUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & distanceYMapUnitScale() const
QgsSymbolV2::OutputUnit displacementYUnit() const
bool referencePoint1IsCentroid() const
QgsSymbolV2::OutputUnit mBorderWidthUnit
Qt::PenJoinStyle penJoinStyle() const
const QgsMapUnitScale & offsetMapUnitScale() const
QgsSymbolV2::OutputUnit mDistanceUnit
virtual QgsMapUnitScale mapUnitScale() const
void setDistanceY(double d)
QgsMarkerSymbolV2 * mMarkerSymbol
QgsMapUnitScale mapUnitScale() const
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
void setOutlineColor(const QColor &color)
Set outline color.
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
void setUseWholeShape(double useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
QgsSymbolV2::OutputUnit mDistanceUnit
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
QColor outlineColor() const
Get outline color.
QgsLineSymbolV2 * mFillLineSymbol
Fill line.
virtual double estimateMaxBleed() const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape...
void setOffset(double offset)
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit displacementXUnit() const
void setGradientSpread(GradientSpread gradientSpread)
QgsSymbolV2::OutputUnit mPatternWidthUnit
QgsSymbolV2::OutputUnit offsetUnit() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
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
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
#define DEFAULT_SIMPLEFILL_BORDERWIDTH
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
QgsSymbolV2::OutputUnit offsetUnit() const
QRectF mSvgViewBox
SVG view box (to keep the aspect ratio.
void setIgnoreRings(double ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
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 mPatternWidth
Width of the pattern (in output units)
#define DEFAULT_SIMPLEFILL_COLOR
void setColor2(QColor color2)
void setBorderStyle(Qt::PenStyle borderStyle)