16 #ifndef QGSCOMPOSERSCALEBAR_H 17 #define QGSCOMPOSERSCALEBAR_H 56 SegmentSizeFitWidth = 1
70 void setNumSegments(
int nSegments );
73 void setNumSegmentsLeft(
int nSegmentsLeft );
76 void setNumUnitsPerSegment(
double units );
114 void setMinBarWidth(
double minWidth );
135 void setMaxBarWidth(
double maxWidth );
144 void setFont(
const QFont& font );
216 void setBoxContentSpace(
double space );
241 void setLineJoinStyle( Qt::PenJoinStyle style );
255 void setLineCapStyle( Qt::PenCapStyle style );
258 void applyDefaultSettings();
264 void setStyle(
const QString& styleName );
276 void adjustBoxSize();
282 QString firstLabelString()
const;
297 void correctXPositionAlignment(
double width,
double widthAfter );
303 void updateSegmentSize();
305 void invalidateCurrentMap();
359 void refreshSegmentMillimeters();
362 double mapWidth()
const;
365 #endif //QGSCOMPOSERSCALEBAR_H A scale bar item that can be added to a map composition.
double minBarWidth() const
Returns the minimum size (in millimeters) for scale bar segments.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
double mLabelBarSpace
Space between bar and Text labels.
double mHeight
Height of bars/lines.
double mNumUnitsPerSegment
Size of a segment (in map units)
double mNumMapUnitsPerScaleBarUnit
Number of map units per scale bar units (e.g.
void setPen(const QPen &pen)
Sets the pen used for drawing the scalebar.
double boxContentSpace() const
Qt::PenJoinStyle mLineJoinStyle
void setUnitLabeling(const QString &label)
A item that forms part of a map composition.
Alignment alignment() const
Left / Middle/ Right.
double mMinBarWidth
Minimum allowed bar width, when mSegmentSizeMode is FitWidth.
ScaleBarUnits units() const
QgsScaleBarStyle * mStyle
Scalebar style.
QBrush mBrush2
Secondary fill.
SegmentSizeMode
Modes for setting size for scale bar segments.
void update(const QRectF &rect)
void setNumMapUnitsPerScaleBarUnit(double d)
double numMapUnitsPerScaleBarUnit() const
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
double mSegmentMillimeters
Width of a segment (in mm)
int numSegmentsLeft() const
Qt::PenCapStyle mLineCapStyle
double labelBarSpace() const
void setBrush2(const QBrush &brush)
Sets secondary brush for the scalebar.
QString unitLabeling() const
double segmentMillimeters() const
int mNumSegmentsLeft
Number of segments on left side.
Abstraction of composer scale bar style.
const QgsComposerMap * composerMap() const
void setLabelBarSpace(double space)
Graphics scene for map printing.
Object representing map window.
QPen pen() const
Returns the pen used for drawing the scalebar.
QColor fontColor() const
Returns the color used for drawing text in the scalebar.
Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
int mNumSegments
Number of segments on right side.
double mMaxBarWidth
Maximum allowed bar width, when mSegmentSizeMode is FitWidth.
void setFontColor(const QColor &c)
Sets the color used for drawing text in the scalebar.
SegmentSizeMode mSegmentSizeMode
Either fixed (i.e.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
double numUnitsPerSegment() const
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
double mBoxContentSpace
Space between content and item box.
QString mUnitLabeling
Labeling of map units.
QBrush brush() const
Returns the primary brush for the scalebar.
QBrush brush2() const
Returns the secondary brush for the scalebar.
const QgsComposerMap * mComposerMap
Reference to composer map object.
SegmentSizeMode segmentSizeMode() const
Returns the size mode for scale bar segments.
Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
double maxBarWidth() const
Returns the maximum size (in millimeters) for scale bar segments.
void setBrush(const QBrush &brush)
Sets primary brush for the scalebar.
virtual int type() const override
Return correct graphics item type.