29 mTextFormat.
setSizeUnit( Qgis::RenderUnit::Points );
30 mTextFormat.
setColor( QColor( 0, 0, 0 ) );
32 mNumericFormat = std::make_unique< QgsBasicNumericFormat >();
34 mLineSymbol = std::make_unique< QgsLineSymbol >();
35 mLineSymbol->setColor( QColor( 0, 0, 0 ) );
36 mLineSymbol->setWidth( 0.3 );
39 line->setPenJoinStyle( Qt::MiterJoin );
40 line->setPenCapStyle( Qt::SquareCap );
42 mLineSymbol->setOutputUnit( Qgis::RenderUnit::Millimeters );
43 mDivisionLineSymbol.reset( mLineSymbol->clone() );
44 mSubdivisionLineSymbol.reset( mLineSymbol->clone() );
46 mFillSymbol = std::make_unique< QgsFillSymbol >();
47 mFillSymbol->setColor( QColor( 0, 0, 0 ) );
50 fill->setStrokeStyle( Qt::NoPen );
52 mAlternateFillSymbol = std::make_unique< QgsFillSymbol >();
53 mAlternateFillSymbol->setColor( QColor( 255, 255, 255 ) );
56 fill->setStrokeStyle( Qt::NoPen );
61 : mNumSegments( other.mNumSegments )
62 , mNumSegmentsLeft( other.mNumSegmentsLeft )
63 , mNumSubdivisions( other.mNumSubdivisions )
64 , mSubdivisionsHeight( other.mSubdivisionsHeight )
65 , mNumUnitsPerSegment( other.mNumUnitsPerSegment )
66 , mNumMapUnitsPerScaleBarUnit( other.mNumMapUnitsPerScaleBarUnit )
67 , mSegmentSizeMode( other.mSegmentSizeMode )
68 , mMinBarWidth( other.mMinBarWidth )
69 , mMaxBarWidth( other.mMaxBarWidth )
70 , mUnitLabeling( other.mUnitLabeling )
71 , mTextFormat( other.mTextFormat )
72 , mHeight( other.mHeight )
73 , mLineSymbol( other.mLineSymbol->clone() )
74 , mDivisionLineSymbol( other.mDivisionLineSymbol->clone() )
75 , mSubdivisionLineSymbol( other.mSubdivisionLineSymbol->clone() )
76 , mFillSymbol( other.mFillSymbol->clone() )
77 , mAlternateFillSymbol( other.mAlternateFillSymbol->clone() )
78 , mLabelBarSpace( other.mLabelBarSpace )
79 , mLabelVerticalPlacement( other.mLabelVerticalPlacement )
80 , mLabelHorizontalPlacement( other.mLabelHorizontalPlacement )
81 , mBoxContentSpace( other.mBoxContentSpace )
82 , mAlignment( other.mAlignment )
83 , mUnits( other.mUnits )
84 , mNumericFormat( other.mNumericFormat->clone() )
91 mNumSegments = other.mNumSegments;
92 mNumSegmentsLeft = other.mNumSegmentsLeft;
93 mNumSubdivisions = other.mNumSubdivisions;
94 mSubdivisionsHeight = other.mSubdivisionsHeight;
95 mNumUnitsPerSegment = other.mNumUnitsPerSegment;
96 mNumMapUnitsPerScaleBarUnit = other.mNumMapUnitsPerScaleBarUnit;
97 mSegmentSizeMode = other.mSegmentSizeMode;
98 mMinBarWidth = other.mMinBarWidth;
99 mMaxBarWidth = other.mMaxBarWidth;
100 mUnitLabeling = other.mUnitLabeling;
101 mTextFormat = other.mTextFormat;
102 mLineSymbol.reset( other.mLineSymbol->clone() );
103 mDivisionLineSymbol.reset( other.mDivisionLineSymbol->clone() );
104 mSubdivisionLineSymbol.reset( other.mSubdivisionLineSymbol->clone() );
105 mFillSymbol.reset( other.mFillSymbol->clone() );
106 mAlternateFillSymbol.reset( other.mAlternateFillSymbol->clone() );
107 mHeight = other.mHeight;
108 mLabelBarSpace = other.mLabelBarSpace;
109 mLabelVerticalPlacement = other.mLabelVerticalPlacement;
110 mLabelHorizontalPlacement = other.mLabelHorizontalPlacement;
111 mBoxContentSpace = other.mBoxContentSpace;
112 mAlignment = other.mAlignment;
113 mUnits = other.mUnits;
114 mNumericFormat.reset( other.mNumericFormat->clone() );
120 return mFillSymbol->color();
125 mFillSymbol->setColor( color );
130 return mAlternateFillSymbol->color();
135 mAlternateFillSymbol->setColor( color );
140 return mLineSymbol->color();
145 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
147 symbol->setColor( color );
153 return mLineSymbol->width();
158 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
160 symbol->setWidth( width );
161 symbol->setOutputUnit( Qgis::RenderUnit::Millimeters );
167 QPen
pen( mLineSymbol->color() );
170 pen.setJoinStyle( line->penJoinStyle() );
171 pen.setCapStyle( line->penCapStyle() );
173 pen.setWidthF( mLineSymbol->width() );
179 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
181 symbol->setColor(
pen.color() );
182 symbol->setWidth(
pen.widthF() );
183 symbol->setOutputUnit( Qgis::RenderUnit::Millimeters );
186 line->setPenJoinStyle(
pen.joinStyle() );
187 line->setPenCapStyle(
pen.capStyle() );
194 return mLineSymbol.get();
199 mLineSymbol.reset( symbol );
204 return mDivisionLineSymbol.get();
209 mDivisionLineSymbol.reset( symbol );
214 return mSubdivisionLineSymbol.get();
219 mSubdivisionLineSymbol.reset( symbol );
224 return mFillSymbol.get();
229 mFillSymbol.reset( symbol );
234 return mAlternateFillSymbol.get();
239 mAlternateFillSymbol.reset( symbol );
245 b.setColor( mFillSymbol->color() );
248 b.setStyle( fill->brushStyle() );
256 mFillSymbol->setColor(
brush.color() );
259 fill->setBrushStyle(
brush.style() );
266 b.setColor( mAlternateFillSymbol->color() );
269 b.setStyle( fill->brushStyle() );
277 mAlternateFillSymbol->setColor(
brush.color() );
280 fill->setBrushStyle(
brush.style() );
288 return line->penJoinStyle();
290 return Qt::MiterJoin;
295 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
299 line->setPenJoinStyle( style );
308 return line->penCapStyle();
315 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
319 line->setPenCapStyle( style );
326 return mNumericFormat.get();
331 mNumericFormat.reset( format );
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...
void setSubdivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Q_DECL_DEPRECATED QColor fillColor() const
Returns the color used for fills in the scalebar.
QgsLineSymbol * lineSymbol() const
Returns the line symbol used to render the scalebar (only used for some scalebar types).
QgsLineSymbol * subdivisionLineSymbol() const
Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Q_DECL_DEPRECATED QColor fillColor2() const
Returns the secondary color used for fills in the scalebar.
void setAlternateFillSymbol(QgsFillSymbol *symbol)
Sets the secondary fill symbol used to render the scalebar (only used for some scalebar types).
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the scalebar.
Q_DECL_DEPRECATED void setFillColor(const QColor &color)
Sets the color used for fills in the scalebar.
Q_DECL_DEPRECATED void setFillColor2(const QColor &color)
Sets the secondary color used for fills in the scalebar.
Q_DECL_DEPRECATED void setLineCapStyle(Qt::PenCapStyle style)
Sets the cap style used when drawing the lines in the scalebar.
void setFillSymbol(QgsFillSymbol *symbol)
Sets the primary fill symbol used to render the scalebar (only used for some scalebar types).
Q_DECL_DEPRECATED void setLineJoinStyle(Qt::PenJoinStyle style)
Sets the join style used when drawing the lines in the scalebar.
Q_DECL_DEPRECATED QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
Q_DECL_DEPRECATED void setPen(const QPen &pen)
Sets the pen used for drawing outlines in the scalebar.
Q_DECL_DEPRECATED void setBrush(const QBrush &brush)
Sets the primary brush used for filling the scalebar.
Q_DECL_DEPRECATED void setBrush2(const QBrush &brush)
Sets the secondary brush used for filling the scalebar.
Q_DECL_DEPRECATED void setLineColor(const QColor &color)
Sets the color used for lines in the scalebar.
void setLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar (only used for some scalebar types).
void setDivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar divisions (only used for some scalebar types).
Q_DECL_DEPRECATED void setLineWidth(double width)
Sets the line width in millimeters for lines in the scalebar.
QgsFillSymbol * alternateFillSymbol() const
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
QgsFillSymbol * fillSymbol() const
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
Q_DECL_DEPRECATED double lineWidth() const
Returns the line width in millimeters for lines in the scalebar.
Q_DECL_DEPRECATED QBrush brush2() const
Returns the secondary brush for the scalebar.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for numbers in the scalebar.
QgsScaleBarSettings()
Constructor for QgsScaleBarSettings.
Q_DECL_DEPRECATED QColor lineColor() const
Returns the color used for lines in the scalebar.
Q_DECL_DEPRECATED Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
QgsScaleBarSettings & operator=(const QgsScaleBarSettings &other)
Q_DECL_DEPRECATED Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
Q_DECL_DEPRECATED QBrush brush() const
Returns the primary brush used for filling the scalebar.
QgsLineSymbol * divisionLineSymbol() const
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types).
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
void setColor(const QColor &color)
Sets the color that text will be rendered in.
void setSize(double size)
Sets the size for rendered text.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units for the size of rendered text.