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 methods | |
Methods used internally by the object. | |
QPixmap * | m_bckGround |
Background pixmap. More... | |
QFont | m_footerFont |
Font of the footer section. More... | |
bool | m_showNumericScale |
Flag for enabling / disabling visibility of the footer section. More... | |
double | m_factor |
Factor of scaling being used. More... | |
QString | m_unit |
Unit of measure being used. More... | |
std::vector< double > | m_intervals |
Values of the intervals in millimeters. More... | |
std::vector< double > | m_values |
Values of the intervals in the selected unit of measure. More... | |
int | m_numberOfIntervals |
Number of intervals of the ruler. More... | |
ScaleTypes | m_type |
Type of the ruler to be presented. More... | |
QColor | m_rulerColor |
Color of the ruler section. More... | |
QColor | m_bckGrd |
Background color. More... | |
bool | m_interactionEnabled |
Flag for enabling / disabling the interactive mode. More... | |
MapDisplay * | m_display |
Pointer to the display where to present the widget. More... | |
QColor | m_headerColor |
Color of the header section. More... | |
QFont | m_headerFont |
Font of the header section. More... | |
bool | m_headerAllVisible |
Flag do enabling / disabling of the intermediary values of the header. More... | |
int | m_unitsPerGap |
Number of units to be used by each interval. More... | |
QColor | m_footerColor |
Color of the footer section. More... | |
int | m_rulerHeightMM |
Height of the ruler in millimeters. More... | |
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... | |
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. |
te::qt::widgets::ScaleWidget::~ScaleWidget | ( | ) |
Destuctor.
|
signal |
Signal emmited when the widget is about to be closed.
|
protected |
Reimplementation of the QFrame method.
event | The event generated. |
bool te::qt::widgets::ScaleWidget::getAllHeaderIsVisible | ( | ) | const |
Returns the visibilty of the intermediary values on the header section.
QColor te::qt::widgets::ScaleWidget::getFooterColor | ( | ) | const |
Returns the value of the color of the footer.
QFont te::qt::widgets::ScaleWidget::getFooterFont | ( | ) | const |
Returns the value of the font of the footer.
QColor te::qt::widgets::ScaleWidget::getHeaderColor | ( | ) | const |
Returns the value of the color of the header.
QFont te::qt::widgets::ScaleWidget::getHeaderFont | ( | ) | const |
Returns the value of the font of the header.
bool te::qt::widgets::ScaleWidget::getInteractionHandle | ( | ) | const |
Returns the value of the interaction mode.
int te::qt::widgets::ScaleWidget::getNumberOfIntervals | ( | ) | const |
Returns the number of intervals being used by ruler.
bool te::qt::widgets::ScaleWidget::getNumericScaleIsVisible | ( | ) | const |
Returns the visibility of the footer section.
QColor te::qt::widgets::ScaleWidget::getRulerColor | ( | ) | const |
Returns the value of the color of the ruler.
int te::qt::widgets::ScaleWidget::getRulerHeightMM | ( | ) | const |
Returns the lenght of the ruler in millimeters.
int te::qt::widgets::ScaleWidget::getScaleType | ( | ) | const |
Returns the ruler type being used.
QString te::qt::widgets::ScaleWidget::getUnit | ( | ) | const |
Returns the unit being used to present the graphic scale.
int te::qt::widgets::ScaleWidget::getUnitsPerGap | ( | ) | const |
Returns the number of units used in each gap.
|
protected |
Reimplementation of the QFrame method.
event | The event generated. |
|
protected |
Recalculates and redraw the graphic scale based on the values of its internal attributes.
|
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. |
|
slot |
Changes the color of the background.
The initial background color is set to transparent.
color | The new color to be used. |
|
slot |
Changes the color of the footer.
color | The new color to be used. |
|
slot |
Changes the font of the footer.
font | The new font to be used. |
|
slot |
Changes the color of the header.
color | The new color to be used. |
|
slot |
Changes the font of the header.
font | The new font to be used. |
|
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. |
|
slot |
Updates the number of intervals of the ruler.
v | Number of intervals of the ruler. |
|
slot |
Enable / disable the visibility of the footer or the numeric scale.
visible | The new visibility of the footer section. |
|
slot |
Changes the color of the ruler.
color | The new color to be used. |
|
slot |
Updates the heightness of the ruler.
hMM | The new height of the ruler in millimeters. |
|
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. |
void te::qt::widgets::ScaleWidget::setUnit | ( | const int & | SRID | ) |
Sets the unit using SRID.
SRID | The display SRID. |
|
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. |
|
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. |
|
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.
void te::qt::widgets::ScaleWidget::updateScalePosition | ( | ) |
Changes the current position of the widget, centralizing it in the display.
|
protected |
Background color.
Definition at line 406 of file ScaleWidget.h.
|
protected |
Background pixmap.
Definition at line 396 of file ScaleWidget.h.
|
protected |
Pointer to the display where to present the widget.
Definition at line 408 of file ScaleWidget.h.
|
protected |
Factor of scaling being used.
Definition at line 399 of file ScaleWidget.h.
|
protected |
Color of the footer section.
Definition at line 413 of file ScaleWidget.h.
|
protected |
Font of the footer section.
Definition at line 397 of file ScaleWidget.h.
|
protected |
Flag do enabling / disabling of the intermediary values of the header.
Definition at line 411 of file ScaleWidget.h.
|
protected |
Color of the header section.
Definition at line 409 of file ScaleWidget.h.
|
protected |
Font of the header section.
Definition at line 410 of file ScaleWidget.h.
|
protected |
Flag for enabling / disabling the interactive mode.
Definition at line 407 of file ScaleWidget.h.
|
protected |
Values of the intervals in millimeters.
Definition at line 401 of file ScaleWidget.h.
|
protected |
Number of intervals of the ruler.
Definition at line 403 of file ScaleWidget.h.
|
protected |
Color of the ruler section.
Definition at line 405 of file ScaleWidget.h.
|
protected |
Height of the ruler in millimeters.
Definition at line 414 of file ScaleWidget.h.
|
protected |
Flag for enabling / disabling visibility of the footer section.
Definition at line 398 of file ScaleWidget.h.
|
protected |
Type of the ruler to be presented.
Definition at line 404 of file ScaleWidget.h.
|
protected |
Unit of measure being used.
Definition at line 400 of file ScaleWidget.h.
|
protected |
Number of units to be used by each interval.
Definition at line 412 of file ScaleWidget.h.
|
protected |
Values of the intervals in the selected unit of measure.
Definition at line 402 of file ScaleWidget.h.