QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with QgsScaleBarRenderer. More...
#include <qgsscalebarsettings.h>
Public Types | |
enum | Alignment { AlignLeft = 0 , AlignMiddle , AlignRight } |
Scalebar alignment. More... | |
enum | LabelHorizontalPlacement { LabelCenteredEdge = 0 , LabelCenteredSegment } |
Label horizontal placement. More... | |
enum | LabelVerticalPlacement { LabelAboveSegment = 0 , LabelBelowSegment } |
Label vertical placement. More... | |
enum | SegmentSizeMode { SegmentSizeFixed = 0 , SegmentSizeFitWidth = 1 } |
Modes for setting size for scale bar segments. More... | |
Public Member Functions | |
QgsScaleBarSettings () | |
Constructor for QgsScaleBarSettings. More... | |
QgsScaleBarSettings (const QgsScaleBarSettings &other) | |
Copy constructor. More... | |
~QgsScaleBarSettings () | |
Alignment | alignment () const |
Returns the scalebar alignment. More... | |
QgsFillSymbol * | alternateFillSymbol () const |
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types). More... | |
double | boxContentSpace () const |
Returns the spacing (margin) between the scalebar box and content in millimeters. More... | |
Q_DECL_DEPRECATED QBrush | brush () const |
Returns the primary brush used for filling the scalebar. More... | |
Q_DECL_DEPRECATED QBrush | brush2 () const |
Returns the secondary brush for the scalebar. More... | |
QgsLineSymbol * | divisionLineSymbol () const |
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED QColor | fillColor () const |
Returns the color used for fills in the scalebar. More... | |
Q_DECL_DEPRECATED QColor | fillColor2 () const |
Returns the secondary color used for fills in the scalebar. More... | |
QgsFillSymbol * | fillSymbol () const |
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED QFont | font () const |
Returns the font used for drawing text in the scalebar. More... | |
Q_DECL_DEPRECATED QColor | fontColor () const |
Returns the color used for drawing text in the scalebar. More... | |
double | height () const |
Returns the scalebar height (in millimeters). More... | |
double | labelBarSpace () const |
Returns the spacing (in millimeters) between labels and the scalebar. More... | |
LabelHorizontalPlacement | labelHorizontalPlacement () const |
Returns the horizontal placement of text labels. More... | |
LabelVerticalPlacement | labelVerticalPlacement () const |
Returns the vertical placement of text labels. More... | |
Q_DECL_DEPRECATED Qt::PenCapStyle | lineCapStyle () const |
Returns the cap style used for drawing lines in the scalebar. More... | |
Q_DECL_DEPRECATED QColor | lineColor () const |
Returns the color used for lines in the scalebar. More... | |
Q_DECL_DEPRECATED Qt::PenJoinStyle | lineJoinStyle () const |
Returns the join style used for drawing lines in the scalebar. More... | |
QgsLineSymbol * | lineSymbol () const |
Returns the line symbol used to render the scalebar (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED double | lineWidth () const |
Returns the line width in millimeters for lines in the scalebar. More... | |
double | mapUnitsPerScaleBarUnit () const |
Returns the number of map units per scale bar unit used by the scalebar. More... | |
double | maximumBarWidth () const |
Returns the maximum width (in millimeters) for scale bar segments. More... | |
double | minimumBarWidth () const |
Returns the minimum width (in millimeters) for scale bar segments. More... | |
int | numberOfSegments () const |
Returns the number of segments included in the scalebar. More... | |
int | numberOfSegmentsLeft () const |
Returns the number of segments included in the left part of the scalebar. More... | |
int | numberOfSubdivisions () const |
Returns the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types). More... | |
const QgsNumericFormat * | numericFormat () const |
Returns the numeric format used for numbers in the scalebar. More... | |
QgsScaleBarSettings & | operator= (const QgsScaleBarSettings &other) |
Q_DECL_DEPRECATED QPen | pen () const |
Returns the pen used for drawing outlines in the scalebar. More... | |
SegmentSizeMode | segmentSizeMode () const |
Returns the size mode for the scale bar segments. More... | |
void | setAlignment (Alignment alignment) |
Sets the scalebar alignment. More... | |
void | setAlternateFillSymbol (QgsFillSymbol *symbol) |
Sets the secondary fill symbol used to render the scalebar (only used for some scalebar types). More... | |
void | setBoxContentSpace (double space) |
Sets the space (margin) between the scalebar box and content in millimeters. More... | |
Q_DECL_DEPRECATED void | setBrush (const QBrush &brush) |
Sets the primary brush used for filling the scalebar. More... | |
Q_DECL_DEPRECATED void | setBrush2 (const QBrush &brush) |
Sets the secondary brush used for filling the scalebar. More... | |
void | setDivisionLineSymbol (QgsLineSymbol *symbol) |
Sets the line symbol used to render the scalebar divisions (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED void | setFillColor (const QColor &color) |
Sets the color used for fills in the scalebar. More... | |
Q_DECL_DEPRECATED void | setFillColor2 (const QColor &color) |
Sets the secondary color used for fills in the scalebar. More... | |
void | setFillSymbol (QgsFillSymbol *symbol) |
Sets the primary fill symbol used to render the scalebar (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED void | setFont (const QFont &font) |
Sets the font used for drawing text in the scalebar. More... | |
Q_DECL_DEPRECATED void | setFontColor (const QColor &color) |
Sets the color used for drawing text in the scalebar. More... | |
void | setHeight (double height) |
Sets the scalebar height (in millimeters). More... | |
void | setLabelBarSpace (double space) |
Sets the spacing (in millimeters) between labels and the scalebar. More... | |
void | setLabelHorizontalPlacement (LabelHorizontalPlacement placement) |
Sets the horizontal placement of text labels. More... | |
void | setLabelVerticalPlacement (LabelVerticalPlacement placement) |
Sets the vertical placement of text labels. More... | |
Q_DECL_DEPRECATED void | setLineCapStyle (Qt::PenCapStyle style) |
Sets the cap style used when drawing the lines in the scalebar. More... | |
Q_DECL_DEPRECATED void | setLineColor (const QColor &color) |
Sets the color used for lines in the scalebar. More... | |
Q_DECL_DEPRECATED void | setLineJoinStyle (Qt::PenJoinStyle style) |
Sets the join style used when drawing the lines in the scalebar. More... | |
void | setLineSymbol (QgsLineSymbol *symbol) |
Sets the line symbol used to render the scalebar (only used for some scalebar types). More... | |
Q_DECL_DEPRECATED void | setLineWidth (double width) |
Sets the line width in millimeters for lines in the scalebar. More... | |
void | setMapUnitsPerScaleBarUnit (double units) |
Sets the number of map units per scale bar unit used by the scalebar. More... | |
void | setMaximumBarWidth (double width) |
Sets the maximum width (in millimeters) for scale bar segments. More... | |
void | setMinimumBarWidth (double width) |
Sets the minimum width (in millimeters) for scale bar segments. More... | |
void | setNumberOfSegments (int segments) |
Sets the number of segments included in the scalebar. More... | |
void | setNumberOfSegmentsLeft (int segments) |
Sets the number of segments included in the left part of the scalebar. More... | |
void | setNumberOfSubdivisions (int subdivisions) |
Sets the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types). More... | |
void | setNumericFormat (QgsNumericFormat *format) |
Sets the numeric format used for numbers in the scalebar. More... | |
Q_DECL_DEPRECATED void | setPen (const QPen &pen) |
Sets the pen used for drawing outlines in the scalebar. More... | |
void | setSegmentSizeMode (SegmentSizeMode mode) |
Sets the size mode for scale bar segments. More... | |
void | setSubdivisionLineSymbol (QgsLineSymbol *symbol) |
Sets the line symbol used to render the scalebar subdivisions (only used for some scalebar types). More... | |
void | setSubdivisionsHeight (double height) |
Sets the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types). More... | |
void | setTextFormat (const QgsTextFormat &format) |
Sets the text format used for drawing text in the scalebar. More... | |
void | setUnitLabel (const QString &label) |
Sets the label for units. More... | |
void | setUnits (QgsUnitTypes::DistanceUnit units) |
Sets the distance units used by the scalebar. More... | |
void | setUnitsPerSegment (double units) |
Sets the number of scalebar units per segment. More... | |
QgsLineSymbol * | subdivisionLineSymbol () const |
Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types). More... | |
double | subdivisionsHeight () const |
Returns the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types). More... | |
QgsTextFormat & | textFormat () |
Returns the text format used for drawing text in the scalebar. More... | |
QgsTextFormat | textFormat () const |
Returns the text format used for drawing text in the scalebar. More... | |
QString | unitLabel () const |
Returns the label for units. More... | |
QgsUnitTypes::DistanceUnit | units () const |
Returns the distance units used by the scalebar. More... | |
double | unitsPerSegment () const |
Returns the number of scalebar units per segment. More... | |
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with QgsScaleBarRenderer.
Definition at line 40 of file qgsscalebarsettings.h.
Scalebar alignment.
Enumerator | |
---|---|
AlignLeft | Left aligned. |
AlignMiddle | Center aligned. |
AlignRight | Right aligned. |
Definition at line 47 of file qgsscalebarsettings.h.
Label horizontal placement.
Enumerator | |
---|---|
LabelCenteredEdge | Labels are drawn centered relative to segment's edge. |
LabelCenteredSegment | Labels are drawn centered relative to segment. |
Definition at line 75 of file qgsscalebarsettings.h.
Label vertical placement.
Enumerator | |
---|---|
LabelAboveSegment | Labels are drawn above the scalebar. |
LabelBelowSegment | Labels are drawn below the scalebar. |
Definition at line 66 of file qgsscalebarsettings.h.
Modes for setting size for scale bar segments.
Enumerator | |
---|---|
SegmentSizeFixed | Scale bar segment size is fixed to a map unit. |
SegmentSizeFitWidth | Scale bar segment size is calculated to fit a size range. |
Definition at line 57 of file qgsscalebarsettings.h.
QgsScaleBarSettings::QgsScaleBarSettings | ( | ) |
Constructor for QgsScaleBarSettings.
Definition at line 25 of file qgsscalebarsettings.cpp.
|
default |
QgsScaleBarSettings::QgsScaleBarSettings | ( | const QgsScaleBarSettings & | other | ) |
Copy constructor.
Definition at line 59 of file qgsscalebarsettings.cpp.
|
inline |
Returns the scalebar alignment.
Definition at line 614 of file qgsscalebarsettings.h.
QgsFillSymbol * QgsScaleBarSettings::alternateFillSymbol | ( | ) | const |
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
Definition at line 231 of file qgsscalebarsettings.cpp.
|
inline |
Returns the spacing (margin) between the scalebar box and content in millimeters.
Definition at line 602 of file qgsscalebarsettings.h.
QBrush QgsScaleBarSettings::brush | ( | ) | const |
Returns the primary brush used for filling the scalebar.
Definition at line 241 of file qgsscalebarsettings.cpp.
QBrush QgsScaleBarSettings::brush2 | ( | ) | const |
Returns the secondary brush for the scalebar.
This is used for alternating color style scalebars, such as single and double box styles.
Definition at line 262 of file qgsscalebarsettings.cpp.
QgsLineSymbol * QgsScaleBarSettings::divisionLineSymbol | ( | ) | const |
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types).
Ownership is not transferred.
Definition at line 201 of file qgsscalebarsettings.cpp.
QColor QgsScaleBarSettings::fillColor | ( | ) | const |
Returns the color used for fills in the scalebar.
Definition at line 117 of file qgsscalebarsettings.cpp.
QColor QgsScaleBarSettings::fillColor2 | ( | ) | const |
Returns the secondary color used for fills in the scalebar.
Definition at line 127 of file qgsscalebarsettings.cpp.
QgsFillSymbol * QgsScaleBarSettings::fillSymbol | ( | ) | const |
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
Definition at line 221 of file qgsscalebarsettings.cpp.
|
inline |
Returns the font used for drawing text in the scalebar.
Definition at line 289 of file qgsscalebarsettings.h.
|
inline |
Returns the color used for drawing text in the scalebar.
Definition at line 317 of file qgsscalebarsettings.h.
|
inline |
Returns the scalebar height (in millimeters).
Definition at line 550 of file qgsscalebarsettings.h.
|
inline |
Returns the spacing (in millimeters) between labels and the scalebar.
Definition at line 562 of file qgsscalebarsettings.h.
|
inline |
Returns the horizontal placement of text labels.
Definition at line 589 of file qgsscalebarsettings.h.
|
inline |
Returns the vertical placement of text labels.
Definition at line 575 of file qgsscalebarsettings.h.
Qt::PenCapStyle QgsScaleBarSettings::lineCapStyle | ( | ) | const |
Returns the cap style used for drawing lines in the scalebar.
Definition at line 303 of file qgsscalebarsettings.cpp.
QColor QgsScaleBarSettings::lineColor | ( | ) | const |
Returns the color used for lines in the scalebar.
Definition at line 137 of file qgsscalebarsettings.cpp.
Qt::PenJoinStyle QgsScaleBarSettings::lineJoinStyle | ( | ) | const |
Returns the join style used for drawing lines in the scalebar.
Definition at line 283 of file qgsscalebarsettings.cpp.
QgsLineSymbol * QgsScaleBarSettings::lineSymbol | ( | ) | const |
Returns the line symbol used to render the scalebar (only used for some scalebar types).
Ownership is not transferred.
Definition at line 191 of file qgsscalebarsettings.cpp.
double QgsScaleBarSettings::lineWidth | ( | ) | const |
Returns the line width in millimeters for lines in the scalebar.
Definition at line 150 of file qgsscalebarsettings.cpp.
|
inline |
Returns the number of map units per scale bar unit used by the scalebar.
Definition at line 243 of file qgsscalebarsettings.h.
|
inline |
Returns the maximum width (in millimeters) for scale bar segments.
This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.
Definition at line 215 of file qgsscalebarsettings.h.
|
inline |
Returns the minimum width (in millimeters) for scale bar segments.
This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.
Definition at line 195 of file qgsscalebarsettings.h.
|
inline |
Returns the number of segments included in the scalebar.
Definition at line 100 of file qgsscalebarsettings.h.
|
inline |
Returns the number of segments included in the left part of the scalebar.
Definition at line 114 of file qgsscalebarsettings.h.
|
inline |
Returns the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types).
Definition at line 132 of file qgsscalebarsettings.h.
const QgsNumericFormat * QgsScaleBarSettings::numericFormat | ( | ) | const |
Returns the numeric format used for numbers in the scalebar.
Definition at line 323 of file qgsscalebarsettings.cpp.
QgsScaleBarSettings & QgsScaleBarSettings::operator= | ( | const QgsScaleBarSettings & | other | ) |
Definition at line 88 of file qgsscalebarsettings.cpp.
QPen QgsScaleBarSettings::pen | ( | ) | const |
Returns the pen used for drawing outlines in the scalebar.
Definition at line 164 of file qgsscalebarsettings.cpp.
|
inline |
Returns the size mode for the scale bar segments.
Definition at line 177 of file qgsscalebarsettings.h.
|
inline |
Sets the scalebar alignment.
Definition at line 620 of file qgsscalebarsettings.h.
void QgsScaleBarSettings::setAlternateFillSymbol | ( | QgsFillSymbol * | symbol | ) |
Sets the secondary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership of symbol is transferred to the scalebar.
Definition at line 236 of file qgsscalebarsettings.cpp.
|
inline |
Sets the space (margin) between the scalebar box and content in millimeters.
Definition at line 608 of file qgsscalebarsettings.h.
void QgsScaleBarSettings::setBrush | ( | const QBrush & | brush | ) |
Sets the primary brush used for filling the scalebar.
Definition at line 253 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setBrush2 | ( | const QBrush & | brush | ) |
Sets the secondary brush used for filling the scalebar.
Definition at line 274 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setDivisionLineSymbol | ( | QgsLineSymbol * | symbol | ) |
Sets the line symbol used to render the scalebar divisions (only used for some scalebar types).
Ownership of symbol is transferred to the scalebar.
Definition at line 206 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setFillColor | ( | const QColor & | color | ) |
Sets the color used for fills in the scalebar.
Definition at line 122 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setFillColor2 | ( | const QColor & | color | ) |
Sets the secondary color used for fills in the scalebar.
Definition at line 132 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setFillSymbol | ( | QgsFillSymbol * | symbol | ) |
Sets the primary fill symbol used to render the scalebar (only used for some scalebar types).
Ownership of symbol is transferred to the scalebar.
Definition at line 226 of file qgsscalebarsettings.cpp.
|
inline |
Sets the font used for drawing text in the scalebar.
Definition at line 296 of file qgsscalebarsettings.h.
|
inline |
Sets the color used for drawing text in the scalebar.
Definition at line 325 of file qgsscalebarsettings.h.
|
inline |
Sets the scalebar height (in millimeters).
Definition at line 556 of file qgsscalebarsettings.h.
|
inline |
Sets the spacing (in millimeters) between labels and the scalebar.
Definition at line 568 of file qgsscalebarsettings.h.
|
inline |
Sets the horizontal placement of text labels.
Definition at line 596 of file qgsscalebarsettings.h.
|
inline |
Sets the vertical placement of text labels.
Definition at line 582 of file qgsscalebarsettings.h.
void QgsScaleBarSettings::setLineCapStyle | ( | Qt::PenCapStyle | style | ) |
Sets the cap style used when drawing the lines in the scalebar.
Definition at line 312 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setLineColor | ( | const QColor & | color | ) |
Sets the color used for lines in the scalebar.
Definition at line 142 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setLineJoinStyle | ( | Qt::PenJoinStyle | style | ) |
Sets the join style used when drawing the lines in the scalebar.
Definition at line 292 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setLineSymbol | ( | QgsLineSymbol * | symbol | ) |
Sets the line symbol used to render the scalebar (only used for some scalebar types).
Ownership of symbol is transferred to the scalebar.
Definition at line 196 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setLineWidth | ( | double | width | ) |
Sets the line width in millimeters for lines in the scalebar.
Definition at line 155 of file qgsscalebarsettings.cpp.
|
inline |
Sets the number of map units per scale bar unit used by the scalebar.
Definition at line 249 of file qgsscalebarsettings.h.
|
inline |
Sets the maximum width (in millimeters) for scale bar segments.
This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.
Definition at line 225 of file qgsscalebarsettings.h.
|
inline |
Sets the minimum width (in millimeters) for scale bar segments.
This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.
Definition at line 205 of file qgsscalebarsettings.h.
|
inline |
Sets the number of segments included in the scalebar.
Definition at line 107 of file qgsscalebarsettings.h.
|
inline |
Sets the number of segments included in the left part of the scalebar.
Definition at line 121 of file qgsscalebarsettings.h.
|
inline |
Sets the number of subdivisions for segments included in the right part of the scalebar (only used for some scalebar types).
Definition at line 143 of file qgsscalebarsettings.h.
void QgsScaleBarSettings::setNumericFormat | ( | QgsNumericFormat * | format | ) |
Sets the numeric format used for numbers in the scalebar.
Ownership of format is transferred to the settings.
Definition at line 328 of file qgsscalebarsettings.cpp.
void QgsScaleBarSettings::setPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing outlines in the scalebar.
Definition at line 176 of file qgsscalebarsettings.cpp.
|
inline |
Sets the size mode for scale bar segments.
Definition at line 185 of file qgsscalebarsettings.h.
void QgsScaleBarSettings::setSubdivisionLineSymbol | ( | QgsLineSymbol * | symbol | ) |
Sets the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Ownership of symbol is transferred to the scalebar.
Definition at line 216 of file qgsscalebarsettings.cpp.
|
inline |
Sets the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).
Definition at line 157 of file qgsscalebarsettings.h.
|
inline |
Sets the text format used for drawing text in the scalebar.
Definition at line 282 of file qgsscalebarsettings.h.
|
inline |
|
inline |
Sets the distance units used by the scalebar.
Definition at line 237 of file qgsscalebarsettings.h.
|
inline |
Sets the number of scalebar units per segment.
Definition at line 169 of file qgsscalebarsettings.h.
QgsLineSymbol * QgsScaleBarSettings::subdivisionLineSymbol | ( | ) | const |
Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Ownership is not transferred.
Definition at line 211 of file qgsscalebarsettings.cpp.
|
inline |
Returns the scalebar subdivisions height (in millimeters) for segments included in the right part of the scalebar (only used for some scalebar types).
Definition at line 150 of file qgsscalebarsettings.h.
|
inline |
Returns the text format used for drawing text in the scalebar.
Definition at line 268 of file qgsscalebarsettings.h.
|
inline |
Returns the text format used for drawing text in the scalebar.
Definition at line 275 of file qgsscalebarsettings.h.
|
inline |
Returns the label for units.
Definition at line 255 of file qgsscalebarsettings.h.
|
inline |
Returns the distance units used by the scalebar.
Definition at line 231 of file qgsscalebarsettings.h.
|
inline |
Returns the number of scalebar units per segment.
Definition at line 163 of file qgsscalebarsettings.h.