31 mTextFormat.
setColor( QColor( 0, 0, 0 ) );
33 mNumericFormat = std::make_unique< QgsBasicNumericFormat >();
35 mLineSymbol = std::make_unique< QgsLineSymbol >();
36 mLineSymbol->setColor( QColor( 0, 0, 0 ) );
37 mLineSymbol->setWidth( 0.3 );
40 line->setPenJoinStyle( Qt::MiterJoin );
41 line->setPenCapStyle( Qt::SquareCap );
44 mDivisionLineSymbol.reset( mLineSymbol->clone() );
45 mSubdivisionLineSymbol.reset( mLineSymbol->clone() );
47 mFillSymbol = std::make_unique< QgsFillSymbol >();
48 mFillSymbol->setColor( QColor( 0, 0, 0 ) );
51 fill->setStrokeStyle( Qt::NoPen );
53 mAlternateFillSymbol = std::make_unique< QgsFillSymbol >();
54 mAlternateFillSymbol->setColor( QColor( 255, 255, 255 ) );
57 fill->setStrokeStyle( Qt::NoPen );
62 : mNumSegments( other.mNumSegments )
63 , mNumSegmentsLeft( other.mNumSegmentsLeft )
64 , mNumSubdivisions( other.mNumSubdivisions )
65 , mSubdivisionsHeight( other.mSubdivisionsHeight )
66 , mNumUnitsPerSegment( other.mNumUnitsPerSegment )
67 , mNumMapUnitsPerScaleBarUnit( other.mNumMapUnitsPerScaleBarUnit )
68 , mSegmentSizeMode( other.mSegmentSizeMode )
69 , mMinBarWidth( other.mMinBarWidth )
70 , mMaxBarWidth( other.mMaxBarWidth )
71 , mUnitLabeling( other.mUnitLabeling )
72 , mTextFormat( other.mTextFormat )
73 , mHeight( other.mHeight )
74 , mLineSymbol( other.mLineSymbol->clone() )
75 , mDivisionLineSymbol( other.mDivisionLineSymbol->clone() )
76 , mSubdivisionLineSymbol( other.mSubdivisionLineSymbol->clone() )
77 , mFillSymbol( other.mFillSymbol->clone() )
78 , mAlternateFillSymbol( other.mAlternateFillSymbol->clone() )
79 , mLabelBarSpace( other.mLabelBarSpace )
80 , mLabelVerticalPlacement( other.mLabelVerticalPlacement )
81 , mLabelHorizontalPlacement( other.mLabelHorizontalPlacement )
82 , mBoxContentSpace( other.mBoxContentSpace )
83 , mAlignment( other.mAlignment )
84 , mUnits( other.mUnits )
85 , mNumericFormat( other.mNumericFormat->clone() )
92 mNumSegments = other.mNumSegments;
93 mNumSegmentsLeft = other.mNumSegmentsLeft;
94 mNumSubdivisions = other.mNumSubdivisions;
95 mSubdivisionsHeight = other.mSubdivisionsHeight;
96 mNumUnitsPerSegment = other.mNumUnitsPerSegment;
97 mNumMapUnitsPerScaleBarUnit = other.mNumMapUnitsPerScaleBarUnit;
98 mSegmentSizeMode = other.mSegmentSizeMode;
99 mMinBarWidth = other.mMinBarWidth;
100 mMaxBarWidth = other.mMaxBarWidth;
101 mUnitLabeling = other.mUnitLabeling;
102 mTextFormat = other.mTextFormat;
103 mLineSymbol.reset( other.mLineSymbol->clone() );
104 mDivisionLineSymbol.reset( other.mDivisionLineSymbol->clone() );
105 mSubdivisionLineSymbol.reset( other.mSubdivisionLineSymbol->clone() );
106 mFillSymbol.reset( other.mFillSymbol->clone() );
107 mAlternateFillSymbol.reset( other.mAlternateFillSymbol->clone() );
108 mHeight = other.mHeight;
109 mLabelBarSpace = other.mLabelBarSpace;
110 mLabelVerticalPlacement = other.mLabelVerticalPlacement;
111 mLabelHorizontalPlacement = other.mLabelHorizontalPlacement;
112 mBoxContentSpace = other.mBoxContentSpace;
113 mAlignment = other.mAlignment;
114 mUnits = other.mUnits;
115 mNumericFormat.reset( other.mNumericFormat->clone() );
121 return mFillSymbol->color();
126 mFillSymbol->setColor( color );
131 return mAlternateFillSymbol->color();
136 mAlternateFillSymbol->setColor( color );
141 return mLineSymbol->color();
146 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
148 symbol->setColor( color );
154 return mLineSymbol->width();
159 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
161 symbol->setWidth( width );
168 QPen
pen( mLineSymbol->color() );
171 pen.setJoinStyle( line->penJoinStyle() );
172 pen.setCapStyle( line->penCapStyle() );
174 pen.setWidthF( mLineSymbol->width() );
180 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
182 symbol->setColor(
pen.color() );
183 symbol->setWidth(
pen.widthF() );
187 line->setPenJoinStyle(
pen.joinStyle() );
188 line->setPenCapStyle(
pen.capStyle() );
195 return mLineSymbol.get();
200 mLineSymbol.reset( symbol );
205 return mDivisionLineSymbol.get();
210 mDivisionLineSymbol.reset( symbol );
215 return mSubdivisionLineSymbol.get();
220 mSubdivisionLineSymbol.reset( symbol );
225 return mFillSymbol.get();
230 mFillSymbol.reset( symbol );
235 return mAlternateFillSymbol.get();
240 mAlternateFillSymbol.reset( symbol );
246 b.setColor( mFillSymbol->color() );
249 b.setStyle( fill->brushStyle() );
257 mFillSymbol->setColor(
brush.color() );
260 fill->setBrushStyle(
brush.style() );
267 b.setColor( mAlternateFillSymbol->color() );
270 b.setStyle( fill->brushStyle() );
278 mAlternateFillSymbol->setColor(
brush.color() );
281 fill->setBrushStyle(
brush.style() );
289 return line->penJoinStyle();
291 return Qt::MiterJoin;
296 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
300 line->setPenJoinStyle( style );
309 return line->penCapStyle();
316 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
320 line->setPenCapStyle( style );
327 return mNumericFormat.get();
332 mNumericFormat.reset( format );