A widget that shows the graphic scale associated with a display. More...
#include <ScaleWidget.h>
Public Types | |
| enum | ScaleTypes { RULER, DASHED, DASHED_BEGIN_BLACK, DOUBLE_DASHED, DOUBLE_DASHED_BEGIN_BLACK, CUSTOM } |
| Defines the different types of rulers we can use to present the graphical scale. More... | |
Public Slots | |
Public slots. | |
Methods to update the internal attributes of the class, using the signal-slot mechanism of QT. | |
| void | setInteractionHandle (const bool &state) |
| Enable / disable the interaction mode. More... | |
| void | updateScaleFactor () |
| Updates the scale values. More... | |
| void | setHeaderColor (const QColor &color) |
| Changes the color of the header. More... | |
| void | setRulerColor (const QColor &color) |
| Changes the color of the ruler. More... | |
| void | setFooterColor (const QColor &color) |
| Changes the color of the footer. More... | |
| void | setBackgroundColor (const QColor &color) |
| Changes the color of the background. More... | |
| void | setHeaderFont (const QFont &font) |
| Changes the font of the header. More... | |
| void | setFooterFont (const QFont &font) |
| Changes the font of the footer. More... | |
| void | setUnit (const QString &unit) |
| Sets the unit of measure to be used by the graphic scale. More... | |
| void | setScaleType (const int &type) |
| Sets the type of ruler to be presented. More... | |
| void | setNumericScaleVisble (const bool &visible) |
| Enable / disable the visibility of the footer or the numeric scale. More... | |
| void | setAllHeaderVisible (const bool &visible) |
| Enable / disable intermediary values of the header. More... | |
| void | setUnitsPerGap (const int &units) |
| Changes the number of units to used per interval. More... | |
| void | setRulerHeightMM (const int &hMM) |
| Updates the heightness of the ruler. More... | |
| void | setNumberOfIntervals (const int &v) |
| Updates the number of intervals of the ruler. More... | |
Signals | |
Signals | |
Signals emmited by the widget. | |
| void | aboutToBeclosed () |
Public Member Functions | |
Constructor and destructor methods. | |
Methods related to instantiation and destruction. | |
| ScaleWidget (MapDisplay *parent, const bool &interactive=false) | |
| Constructor. More... | |
| ~ScaleWidget () | |
| Destuctor. More... | |
Public methods | |
Methods to access the internal attributes of the class. | |
| bool | getInteractionHandle () const |
| Returns the value of the interaction mode. More... | |
| QColor | getHeaderColor () const |
| Returns the value of the color of the header. More... | |
| QColor | getRulerColor () const |
| Returns the value of the color of the ruler. More... | |
| QColor | getFooterColor () const |
| Returns the value of the color of the footer. More... | |
| QFont | getHeaderFont () const |
| Returns the value of the font of the header. More... | |
| QFont | getFooterFont () const |
| Returns the value of the font of the footer. More... | |
| QString | getUnit () const |
| Returns the unit being used to present the graphic scale. More... | |
| int | getScaleType () const |
| Returns the ruler type being used. More... | |
| bool | getNumericScaleIsVisible () const |
| Returns the visibility of the footer section. More... | |
| bool | getAllHeaderIsVisible () const |
| Returns the visibilty of the intermediary values on the header section. More... | |
| int | getUnitsPerGap () const |
| Returns the number of units used in each gap. More... | |
| int | getRulerHeightMM () const |
| Returns the lenght of the ruler in millimeters. More... | |
| int | getNumberOfIntervals () const |
| Returns the number of intervals being used by ruler. More... | |
| void | updateScalePosition () |
| Changes the current position of the widget, centralizing it in the display. More... | |
| void | setUnit (const int &SRID) |
| Sets the unit using SRID. More... | |
Protected Member Functions | |
Protected methods | |
Methods used internally by the object. | |
| void | redoWidget () |
| Recalculates and redraw the graphic scale based on the values of its internal attributes. More... | |
| void | paintEvent (QPaintEvent *event) |
| Reimplementation of the QFrame method. More... | |
| void | closeEvent (QCloseEvent *event) |
| Reimplementation of the QFrame method. More... | |
Protected Attributes | |
| QColor | m_bckGrd |
| Background color. More... | |
| QPixmap * | m_bckGround |
| Background pixmap. More... | |
| MapDisplay * | m_display |
| Pointer to the display where to present the widget. More... | |
| double | m_factor |
| Factor of scaling being used. More... | |
| QColor | m_footerColor |
| Color of the footer section. More... | |
| QFont | m_footerFont |
| Font of the footer section. More... | |
| bool | m_headerAllVisible |
| Flag do enabling / disabling of the intermediary values of the header. More... | |
| QColor | m_headerColor |
| Color of the header section. More... | |
| QFont | m_headerFont |
| Font of the header section. More... | |
| bool | m_interactionEnabled |
| Flag for enabling / disabling the interactive mode. More... | |
| std::vector< double > | m_intervals |
| Values of the intervals in millimeters. More... | |
| int | m_numberOfIntervals |
| Number of intervals of the ruler. More... | |
| QColor | m_rulerColor |
| Color of the ruler section. More... | |
| int | m_rulerHeightMM |
| Height of the ruler in millimeters. More... | |
| bool | m_showNumericScale |
| Flag for enabling / disabling visibility of the footer section. More... | |
| ScaleTypes | m_type |
| Type of the ruler to be presented. More... | |
| QString | m_unit |
| Unit of measure being used. More... | |
| int | m_unitsPerGap |
| Number of units to be used by each interval. More... | |
| std::vector< double > | m_values |
| Values of the intervals in the selected unit of measure. More... | |
A widget that shows the graphic scale associated with a display.
The widget shows the graphic scale being used by some display. You can change some attributes for a customized presentation. Divided in sections you can set the following attributes:
The object is divided into three sections: header, ruler and footer. The header shows the values of each interval on the ruler. Ruler is the picture of the ruler itself, and the footer shows the numeric scale showing the scale factor and the unit of measure being used.
Definition at line 99 of file ScaleWidget.h.
Defines the different types of rulers we can use to present the graphical scale.
Definition at line 108 of file ScaleWidget.h.
| te::qt::widgets::ScaleWidget::ScaleWidget | ( | MapDisplay * | parent, |
| const bool & | interactive = false |
||
| ) |
Constructor.
| parent | The display over what the scale will reflect. |
| interactive | Turn on / off interaction mode. If /a true you will can change the scale position on the display. |
Definition at line 858 of file ScaleWidget.cpp.
References m_footerFont, m_headerFont, m_interactionEnabled, and setInteractionHandle().
| te::qt::widgets::ScaleWidget::~ScaleWidget | ( | ) |
|
signal |
Signal emmited when the widget is about to be closed.
Referenced by closeEvent().
|
protected |
Reimplementation of the QFrame method.
| event | The event generated. |
Definition at line 1129 of file ScaleWidget.cpp.
References aboutToBeclosed().
| bool te::qt::widgets::ScaleWidget::getAllHeaderIsVisible | ( | ) | const |
Returns the visibilty of the intermediary values on the header section.
Definition at line 936 of file ScaleWidget.cpp.
References m_headerAllVisible.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QColor te::qt::widgets::ScaleWidget::getFooterColor | ( | ) | const |
Returns the value of the color of the footer.
Definition at line 905 of file ScaleWidget.cpp.
References m_footerColor.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QFont te::qt::widgets::ScaleWidget::getFooterFont | ( | ) | const |
Returns the value of the font of the footer.
Definition at line 915 of file ScaleWidget.cpp.
References m_footerFont.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QColor te::qt::widgets::ScaleWidget::getHeaderColor | ( | ) | const |
Returns the value of the color of the header.
Definition at line 895 of file ScaleWidget.cpp.
References m_headerColor.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QFont te::qt::widgets::ScaleWidget::getHeaderFont | ( | ) | const |
Returns the value of the font of the header.
Definition at line 910 of file ScaleWidget.cpp.
References m_headerFont.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| bool te::qt::widgets::ScaleWidget::getInteractionHandle | ( | ) | const |
Returns the value of the interaction mode.
Definition at line 890 of file ScaleWidget.cpp.
References m_interactionEnabled.
| int te::qt::widgets::ScaleWidget::getNumberOfIntervals | ( | ) | const |
Returns the number of intervals being used by ruler.
Definition at line 951 of file ScaleWidget.cpp.
References m_numberOfIntervals.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| bool te::qt::widgets::ScaleWidget::getNumericScaleIsVisible | ( | ) | const |
Returns the visibility of the footer section.
Definition at line 931 of file ScaleWidget.cpp.
References m_showNumericScale.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QColor te::qt::widgets::ScaleWidget::getRulerColor | ( | ) | const |
Returns the value of the color of the ruler.
Definition at line 900 of file ScaleWidget.cpp.
References m_rulerColor.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| int te::qt::widgets::ScaleWidget::getRulerHeightMM | ( | ) | const |
Returns the lenght of the ruler in millimeters.
Definition at line 946 of file ScaleWidget.cpp.
References m_rulerHeightMM.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| int te::qt::widgets::ScaleWidget::getScaleType | ( | ) | const |
Returns the ruler type being used.
Definition at line 926 of file ScaleWidget.cpp.
References m_type.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| QString te::qt::widgets::ScaleWidget::getUnit | ( | ) | const |
Returns the unit being used to present the graphic scale.
Definition at line 921 of file ScaleWidget.cpp.
References m_unit.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
| int te::qt::widgets::ScaleWidget::getUnitsPerGap | ( | ) | const |
Returns the number of units used in each gap.
Definition at line 941 of file ScaleWidget.cpp.
References m_unitsPerGap.
Referenced by te::qt::widgets::ScalePropertyBrowser::ScalePropertyBrowser().
|
protected |
Reimplementation of the QFrame method.
| event | The event generated. |
Definition at line 1120 of file ScaleWidget.cpp.
References m_bckGround, and p.
|
protected |
Recalculates and redraw the graphic scale based on the values of its internal attributes.
Definition at line 1095 of file ScaleWidget.cpp.
References te::qt::widgets::GetCleanImage(), GetComponentSize(), GetIntervals(), GetScale(), m_bckGrd, m_bckGround, m_display, m_factor, m_footerColor, m_footerFont, m_headerAllVisible, m_headerColor, m_headerFont, m_interactionEnabled, m_intervals, m_numberOfIntervals, m_rulerColor, m_rulerHeightMM, m_showNumericScale, m_type, m_unit, m_unitsPerGap, m_values, RepaintWidget(), and updateScalePosition().
Referenced by setAllHeaderVisible(), setBackgroundColor(), setFooterColor(), setFooterFont(), setHeaderColor(), setHeaderFont(), setInteractionHandle(), setNumberOfIntervals(), setNumericScaleVisble(), setRulerColor(), setRulerHeightMM(), setScaleType(), setUnit(), setUnitsPerGap(), and updateScaleFactor().
|
slot |
Enable / disable intermediary values of the header.
The first and last elements are alaways visible. But the intermediary values can be hidden / showed.
| visible | True if the intermediary values must be showed and false otherwise. |
Definition at line 1067 of file ScaleWidget.cpp.
References m_headerAllVisible, and redoWidget().
|
slot |
Changes the color of the background.
The initial background color is set to transparent.
| color | The new color to be used. |
Definition at line 1025 of file ScaleWidget.cpp.
References m_bckGrd, and redoWidget().
Referenced by te::qt::widgets::MapDisplay::showGraphicScale().
|
slot |
Changes the color of the footer.
| color | The new color to be used. |
Definition at line 1017 of file ScaleWidget.cpp.
References m_footerColor, and redoWidget().
|
slot |
Changes the font of the footer.
| font | The new font to be used. |
Definition at line 1039 of file ScaleWidget.cpp.
References m_footerFont, and redoWidget().
|
slot |
Changes the color of the header.
| color | The new color to be used. |
Definition at line 1003 of file ScaleWidget.cpp.
References m_headerColor, and redoWidget().
|
slot |
Changes the font of the header.
| font | The new font to be used. |
Definition at line 1032 of file ScaleWidget.cpp.
References m_headerFont, and redoWidget().
|
slot |
Enable / disable the interaction mode.
If enabled the user can change the scale position on the MapDisplay.
| state | True for enabling of the interaction mode, false to disable it. |
Definition at line 987 of file ScaleWidget.cpp.
References m_interactionEnabled, and redoWidget().
Referenced by ScaleWidget().
|
slot |
Updates the number of intervals of the ruler.
| v | Number of intervals of the ruler. |
Definition at line 1088 of file ScaleWidget.cpp.
References m_numberOfIntervals, and redoWidget().
|
slot |
Enable / disable the visibility of the footer or the numeric scale.
| visible | The new visibility of the footer section. |
Definition at line 1060 of file ScaleWidget.cpp.
References m_showNumericScale, and redoWidget().
|
slot |
Changes the color of the ruler.
| color | The new color to be used. |
Definition at line 1010 of file ScaleWidget.cpp.
References m_rulerColor, and redoWidget().
|
slot |
Updates the heightness of the ruler.
| hMM | The new height of the ruler in millimeters. |
Definition at line 1081 of file ScaleWidget.cpp.
References m_rulerHeightMM, and redoWidget().
|
slot |
Sets the type of ruler to be presented.
See the definition of ScaleTypes enumeration to see details.
| type | The new type of ruler to be presented. |
Definition at line 1053 of file ScaleWidget.cpp.
References m_type, and redoWidget().
| void te::qt::widgets::ScaleWidget::setUnit | ( | const int & | SRID | ) |
Sets the unit using SRID.
| SRID | The display SRID. |
Definition at line 977 of file ScaleWidget.cpp.
References te::common::Singleton< SpatialReferenceSystemManager >::getInstance(), and GetScaleUnit().
Referenced by te::qt::widgets::MapDisplay::showGraphicScale().
|
slot |
Sets the unit of measure to be used by the graphic scale.
Available units of measure:
| unit | The new unit of measure to be used. |
Definition at line 1046 of file ScaleWidget.cpp.
References m_unit, and redoWidget().
|
slot |
Changes the number of units to used per interval.
\ An unit is a value greater then measure corresponding to 1cm that is a better value to be presented. For example, if the display shows a data in a scale 1 : 2924mt, in the ruler we should use intervals of 3000mt, then each unit represents 3000mts.
| units | Number of units to be used in each interval. |
Definition at line 1074 of file ScaleWidget.cpp.
References m_unitsPerGap, and redoWidget().
|
slot |
Updates the scale values.
This method must be called when the visualized area changes on the display, to the ScaleWidget be adjusted to the new visualized area.
Definition at line 996 of file ScaleWidget.cpp.
References GetScale(), m_display, m_factor, m_unit, and redoWidget().
Referenced by te::qt::widgets::MultiThreadMapDisplay::setExtent(), te::qt::widgets::MapDisplay::setExtent(), and te::qt::widgets::MapDisplay::setScale().
| void te::qt::widgets::ScaleWidget::updateScalePosition | ( | ) |
Changes the current position of the widget, centralizing it in the display.
Definition at line 956 of file ScaleWidget.cpp.
References m_display, m_interactionEnabled, and te::qt::widgets::MillimetersToPixels().
Referenced by redoWidget(), te::qt::widgets::MapDisplay::resizeEvent(), and te::qt::widgets::MapDisplay::showGraphicScale().
|
protected |
Background color.
Definition at line 406 of file ScaleWidget.h.
Referenced by redoWidget(), and setBackgroundColor().
|
protected |
Background pixmap.
Definition at line 396 of file ScaleWidget.h.
Referenced by paintEvent(), redoWidget(), and ~ScaleWidget().
|
protected |
Pointer to the display where to present the widget.
Definition at line 408 of file ScaleWidget.h.
Referenced by redoWidget(), updateScaleFactor(), and updateScalePosition().
|
protected |
Factor of scaling being used.
Definition at line 399 of file ScaleWidget.h.
Referenced by redoWidget(), and updateScaleFactor().
|
protected |
Color of the footer section.
Definition at line 413 of file ScaleWidget.h.
Referenced by getFooterColor(), redoWidget(), and setFooterColor().
|
protected |
Font of the footer section.
Definition at line 397 of file ScaleWidget.h.
Referenced by getFooterFont(), redoWidget(), ScaleWidget(), and setFooterFont().
|
protected |
Flag do enabling / disabling of the intermediary values of the header.
Definition at line 411 of file ScaleWidget.h.
Referenced by getAllHeaderIsVisible(), redoWidget(), and setAllHeaderVisible().
|
protected |
Color of the header section.
Definition at line 409 of file ScaleWidget.h.
Referenced by getHeaderColor(), redoWidget(), and setHeaderColor().
|
protected |
Font of the header section.
Definition at line 410 of file ScaleWidget.h.
Referenced by getHeaderFont(), redoWidget(), ScaleWidget(), and setHeaderFont().
|
protected |
Flag for enabling / disabling the interactive mode.
Definition at line 407 of file ScaleWidget.h.
Referenced by getInteractionHandle(), redoWidget(), ScaleWidget(), setInteractionHandle(), and updateScalePosition().
|
protected |
Values of the intervals in millimeters.
Definition at line 401 of file ScaleWidget.h.
Referenced by redoWidget().
|
protected |
Number of intervals of the ruler.
Definition at line 403 of file ScaleWidget.h.
Referenced by getNumberOfIntervals(), redoWidget(), and setNumberOfIntervals().
|
protected |
Color of the ruler section.
Definition at line 405 of file ScaleWidget.h.
Referenced by getRulerColor(), redoWidget(), and setRulerColor().
|
protected |
Height of the ruler in millimeters.
Definition at line 414 of file ScaleWidget.h.
Referenced by getRulerHeightMM(), redoWidget(), and setRulerHeightMM().
|
protected |
Flag for enabling / disabling visibility of the footer section.
Definition at line 398 of file ScaleWidget.h.
Referenced by getNumericScaleIsVisible(), redoWidget(), and setNumericScaleVisble().
|
protected |
Type of the ruler to be presented.
Definition at line 404 of file ScaleWidget.h.
Referenced by getScaleType(), redoWidget(), and setScaleType().
|
protected |
Unit of measure being used.
Definition at line 400 of file ScaleWidget.h.
Referenced by getUnit(), redoWidget(), setUnit(), and updateScaleFactor().
|
protected |
Number of units to be used by each interval.
Definition at line 412 of file ScaleWidget.h.
Referenced by getUnitsPerGap(), redoWidget(), and setUnitsPerGap().
|
protected |
Values of the intervals in the selected unit of measure.
Definition at line 402 of file ScaleWidget.h.
Referenced by redoWidget().