17 #ifndef QGSSCALEBARSETTINGS_H 18 #define QGSSCALEBARSETTINGS_H 20 #include "qgis_core.h" 56 SegmentSizeFitWidth = 1
64 LabelAboveSegment = 0,
73 LabelCenteredEdge = 0,
82 mPen = QPen( mLineColor );
83 mPen.setJoinStyle( mLineJoinStyle );
84 mPen.setCapStyle( mLineCapStyle );
85 mPen.setWidthF( mLineWidth );
87 mBrush.setColor( mFillColor );
88 mBrush.setStyle( Qt::SolidPattern );
90 mBrush2.setColor( mFillColor2 );
91 mBrush2.setStyle( Qt::SolidPattern );
93 mTextFormat.setSize( 12.0 );
95 mTextFormat.setColor( QColor( 0, 0, 0 ) );
265 mTextFormat.setFont( font );
266 if ( font.pointSizeF() > 0 )
268 mTextFormat.setSize( font.pointSizeF() );
271 else if ( font.pixelSize() > 0 )
273 mTextFormat.setSize( font.pixelSize() );
306 void setFillColor(
const QColor &color ) { mFillColor = color; mBrush.setColor( color ); }
320 void setFillColor2(
const QColor &color ) { mFillColor2 = color; mBrush2.setColor( color ); }
332 void setLineColor(
const QColor &color ) { mLineColor = color; mPen.setColor( mLineColor ); }
344 void setLineWidth(
double width ) { mLineWidth = width; mPen.setWidthF( width ); }
351 QPen
pen()
const {
return mPen; }
357 void setPen(
const QPen &pen ) { mPen = pen; }
365 QBrush
brush()
const {
return mBrush; }
371 void setBrush(
const QBrush &brush ) { mBrush = brush; }
379 QBrush
brush2()
const {
return mBrush2; }
385 void setBrush2(
const QBrush &brush ) { mBrush2 = brush; }
391 double height()
const {
return mHeight; }
473 void setLineJoinStyle( Qt::PenJoinStyle style ) { mLineJoinStyle = style; mPen.setJoinStyle( style ); }
485 void setLineCapStyle( Qt::PenCapStyle style ) { mLineCapStyle = style; mPen.setCapStyle( style ); }
490 int mNumSegments = 2;
492 int mNumSegmentsLeft = 0;
494 double mNumUnitsPerSegment = 0;
496 double mNumMapUnitsPerScaleBarUnit = 1.0;
500 double mMinBarWidth = 50.0;
502 double mMaxBarWidth = 150.0;
505 QString mUnitLabeling;
511 QColor mFillColor = QColor( 0, 0, 0 );
513 QColor mFillColor2 = QColor( 255, 255, 255 );
515 QColor mLineColor = QColor( 0, 0, 0 );
517 double mLineWidth = 0.3;
525 double mHeight = 3.0;
528 double mLabelBarSpace = 3.0;
535 double mBoxContentSpace = 1.0;
541 Qt::PenJoinStyle mLineJoinStyle = Qt::MiterJoin;
542 Qt::PenCapStyle mLineCapStyle = Qt::SquareCap;
546 #endif // QGSSCALEBARSETTINGS_H void setMinimumBarWidth(double width)
Sets the minimum width (in millimeters) for scale bar segments.
double mapUnitsPerScaleBarUnit() const
Returns the number of map units per scale bar unit used by the scalebar.
QBrush brush() const
Returns the primary brush used for filling the scalebar.
void setLineColor(const QColor &color)
Sets the color used for lines in the scalebar.
QString unitLabel() const
Returns the label for units.
QgsTextFormat textFormat() const
Returns the text format used for drawing text in the scalebar.
QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
LabelVerticalPlacement
Label vertical placement.
Alignment alignment() const
Returns the scalebar alignment.
void setPen(const QPen &pen)
Sets the pen used for drawing outlines in the scalebar.
QColor fillColor2() const
Returns the secondary color used for fills in the scalebar.
SegmentSizeMode segmentSizeMode() const
Returns the size mode for the scale bar segments.
void setLabelVerticalPlacement(LabelVerticalPlacement placement)
Sets the vertical placement of text labels.
double lineWidth() const
Returns the line width in millimeters for lines in the scalebar.
Alignment
Scalebar alignment.
QColor lineColor() const
Returns the color used for lines in the scalebar.
Q_DECL_DEPRECATED QFont font() const
Returns the font used for drawing text in the scalebar.
LabelHorizontalPlacement
Label horizontal placement.
QColor fillColor() const
Returns the color used for fills in the scalebar.
double height() const
Returns the scalebar height (in millimeters).
LabelVerticalPlacement labelVerticalPlacement() const
Returns the vertical placement of text labels.
void setFillColor(const QColor &color)
Sets the color used for fills in the scalebar.
int numberOfSegments() const
Returns the number of segments included in the scalebar.
double minimumBarWidth() const
Returns the minimum width (in millimeters) for scale bar segments.
void setLineCapStyle(Qt::PenCapStyle style)
Sets the cap style used when drawing the lines in the scalebar.
void setMapUnitsPerScaleBarUnit(double units)
Sets the number of map units per scale bar unit used by the scalebar.
void setAlignment(Alignment alignment)
Sets the scalebar alignment.
QgsUnitTypes::DistanceUnit units() const
Returns the distance units used by the scalebar.
double boxContentSpace() const
Returns the spacing (margin) between the scalebar box and content in millimeters. ...
double labelBarSpace() const
Returns the spacing (in millimeters) between labels and the scalebar.
void setMaximumBarWidth(double width)
Sets the maximum width (in millimeters) for scale bar segments.
void setBoxContentSpace(double space)
Sets the space (margin) between the scalebar box and content in millimeters.
void setUnitsPerSegment(double units)
Sets the number of scalebar units per segment.
void setSegmentSizeMode(SegmentSizeMode mode)
Sets the size mode for scale bar segments.
void setFillColor2(const QColor &color)
Sets the secondary color used for fills in the scalebar.
SegmentSizeMode
Modes for setting size for scale bar segments.
LabelHorizontalPlacement labelHorizontalPlacement() const
Returns the horizontal placement of text labels.
QgsScaleBarSettings()
Constructor for QgsScaleBarSettings.
double maximumBarWidth() const
Returns the maximum width (in millimeters) for scale bar segments.
QgsTextFormat & textFormat()
Returns the text format used for drawing text in the scalebar.
DistanceUnit
Units of distance.
void setHeight(double height)
Sets the scalebar height (in millimeters).
Q_DECL_DEPRECATED QColor fontColor() const
Returns the color used for drawing text in the scalebar.
Points (e.g., for font sizes)
Q_DECL_DEPRECATED void setFontColor(const QColor &color)
Sets the color used for drawing text in the scalebar.
void setLineJoinStyle(Qt::PenJoinStyle style)
Sets the join style used when drawing the lines in the scalebar.
void setLineWidth(double width)
Sets the line width in millimeters for lines in the scalebar.
void setLabelBarSpace(double space)
Sets the spacing (in millimeters) between labels and the scalebar.
Labels are drawn centered relative to segment.
void setLabelHorizontalPlacement(LabelHorizontalPlacement placement)
Sets the horizontal placement of text labels.
void setBrush2(const QBrush &brush)
Sets the secondary brush used for filling the scalebar.
double unitsPerSegment() const
Returns the number of scalebar units per segment.
Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
void setNumberOfSegmentsLeft(int segments)
Sets the number of segments included in the left part of the scalebar.
QBrush brush2() const
Returns the secondary brush for the scalebar.
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for drawing text in the scalebar.
Container for all settings relating to text rendering.
Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
int numberOfSegmentsLeft() const
Returns the number of segments included in the left part of the scalebar.
void setUnits(QgsUnitTypes::DistanceUnit units)
Sets the distance units used by the scalebar.
Labels are drawn below the scalebar.
void setBrush(const QBrush &brush)
Sets the primary brush used for filling the scalebar.
Q_DECL_DEPRECATED void setFont(const QFont &font)
Sets the font used for drawing text in the scalebar.
void setUnitLabel(const QString &label)
Sets the label for units.
void setNumberOfSegments(int segments)
Sets the number of segments included in the scalebar.
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...