te::qt::widgets::ScaleWidget Class Reference

A widget that shows the graphic scale associated with a display. More...

#include <ScaleWidget.h>

Inheritance diagram for te::qt::widgets::ScaleWidget:

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...
 
MapDisplaym_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...
 

Detailed Description

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:

  1. The unit to be showed.
  2. Header:
    • Font.
    • Color.
    • Visibility of the intermediary values.
  3. Ruler:
    • Color.
    • Units per interval.
    • Number of intervals.
    • Height in millimeters.
    • Type of ruler for presentation pourposes.
  4. Footer:
    • Font.
    • Color.
    • Visibility

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.

Member Enumeration Documentation

◆ ScaleTypes

Defines the different types of rulers we can use to present the graphical scale.

Enumerator
RULER 

As a ruler.

DASHED 

Alternated rectangles and alternated colors, beginning with a white one.

DASHED_BEGIN_BLACK 

Alternated rectangles and alternated colors, beginning with a colored one.

DOUBLE_DASHED 

Alternated rectangles and alternated colors, beginning with a white one, whith two rulers.

DOUBLE_DASHED_BEGIN_BLACK 

Alternated rectangles and alternated colors, beginning with a colored one, whith two rulers.

CUSTOM 

Customized.

Definition at line 108 of file ScaleWidget.h.

Constructor & Destructor Documentation

◆ ScaleWidget()

te::qt::widgets::ScaleWidget::ScaleWidget ( MapDisplay parent,
const bool &  interactive = false 
)

Constructor.

Parameters
parentThe display over what the scale will reflect.
interactiveTurn on / off interaction mode. If /a true you will can change the scale position on the display.

◆ ~ScaleWidget()

te::qt::widgets::ScaleWidget::~ScaleWidget ( )

Destuctor.

Member Function Documentation

◆ aboutToBeclosed

void te::qt::widgets::ScaleWidget::aboutToBeclosed ( )
signal

Signal emmited when the widget is about to be closed.

◆ closeEvent()

void te::qt::widgets::ScaleWidget::closeEvent ( QCloseEvent *  event)
protected

Reimplementation of the QFrame method.

Parameters
eventThe event generated.

◆ getAllHeaderIsVisible()

bool te::qt::widgets::ScaleWidget::getAllHeaderIsVisible ( ) const

Returns the visibilty of the intermediary values on the header section.

Returns
Visibilty of the intermediary values on the header section.

◆ getFooterColor()

QColor te::qt::widgets::ScaleWidget::getFooterColor ( ) const

Returns the value of the color of the footer.

Returns
Value of the color of the footer.

◆ getFooterFont()

QFont te::qt::widgets::ScaleWidget::getFooterFont ( ) const

Returns the value of the font of the footer.

Returns
Value of the font of the footer.

◆ getHeaderColor()

QColor te::qt::widgets::ScaleWidget::getHeaderColor ( ) const

Returns the value of the color of the header.

Returns
Value of the color of the header.

◆ getHeaderFont()

QFont te::qt::widgets::ScaleWidget::getHeaderFont ( ) const

Returns the value of the font of the header.

Returns
Value of the font of the header.

◆ getInteractionHandle()

bool te::qt::widgets::ScaleWidget::getInteractionHandle ( ) const

Returns the value of the interaction mode.

Returns
Value of the interaction mode.

◆ getNumberOfIntervals()

int te::qt::widgets::ScaleWidget::getNumberOfIntervals ( ) const

Returns the number of intervals being used by ruler.

Returns
Number of intervals being used by ruler.

◆ getNumericScaleIsVisible()

bool te::qt::widgets::ScaleWidget::getNumericScaleIsVisible ( ) const

Returns the visibility of the footer section.

Returns
Visibility of the footer section.

◆ getRulerColor()

QColor te::qt::widgets::ScaleWidget::getRulerColor ( ) const

Returns the value of the color of the ruler.

Returns
Value of the color of the ruler.

◆ getRulerHeightMM()

int te::qt::widgets::ScaleWidget::getRulerHeightMM ( ) const

Returns the lenght of the ruler in millimeters.

Returns
Lenght of the ruler in millimeters.

◆ getScaleType()

int te::qt::widgets::ScaleWidget::getScaleType ( ) const

Returns the ruler type being used.

Returns
Ruler type being used.

◆ getUnit()

QString te::qt::widgets::ScaleWidget::getUnit ( ) const

Returns the unit being used to present the graphic scale.

Returns
Unit being used to present the graphic scale.

◆ getUnitsPerGap()

int te::qt::widgets::ScaleWidget::getUnitsPerGap ( ) const

Returns the number of units used in each gap.

Returns
Number of units used in each gap.

◆ paintEvent()

void te::qt::widgets::ScaleWidget::paintEvent ( QPaintEvent *  event)
protected

Reimplementation of the QFrame method.

Parameters
eventThe event generated.

◆ redoWidget()

void te::qt::widgets::ScaleWidget::redoWidget ( )
protected

Recalculates and redraw the graphic scale based on the values of its internal attributes.

◆ setAllHeaderVisible

void te::qt::widgets::ScaleWidget::setAllHeaderVisible ( const bool &  visible)
slot

Enable / disable intermediary values of the header.

The first and last elements are alaways visible. But the intermediary values can be hidden / showed.

Parameters
visibleTrue if the intermediary values must be showed and false otherwise.

◆ setBackgroundColor

void te::qt::widgets::ScaleWidget::setBackgroundColor ( const QColor &  color)
slot

Changes the color of the background.

The initial background color is set to transparent.

Parameters
colorThe new color to be used.

◆ setFooterColor

void te::qt::widgets::ScaleWidget::setFooterColor ( const QColor &  color)
slot

Changes the color of the footer.

Parameters
colorThe new color to be used.

◆ setFooterFont

void te::qt::widgets::ScaleWidget::setFooterFont ( const QFont &  font)
slot

Changes the font of the footer.

Parameters
fontThe new font to be used.

◆ setHeaderColor

void te::qt::widgets::ScaleWidget::setHeaderColor ( const QColor &  color)
slot

Changes the color of the header.

Parameters
colorThe new color to be used.

◆ setHeaderFont

void te::qt::widgets::ScaleWidget::setHeaderFont ( const QFont &  font)
slot

Changes the font of the header.

Parameters
fontThe new font to be used.

◆ setInteractionHandle

void te::qt::widgets::ScaleWidget::setInteractionHandle ( const bool &  state)
slot

Enable / disable the interaction mode.

If enabled the user can change the scale position on the MapDisplay.

Parameters
stateTrue for enabling of the interaction mode, false to disable it.

◆ setNumberOfIntervals

void te::qt::widgets::ScaleWidget::setNumberOfIntervals ( const int &  v)
slot

Updates the number of intervals of the ruler.

Parameters
vNumber of intervals of the ruler.

◆ setNumericScaleVisble

void te::qt::widgets::ScaleWidget::setNumericScaleVisble ( const bool &  visible)
slot

Enable / disable the visibility of the footer or the numeric scale.

Parameters
visibleThe new visibility of the footer section.

◆ setRulerColor

void te::qt::widgets::ScaleWidget::setRulerColor ( const QColor &  color)
slot

Changes the color of the ruler.

Parameters
colorThe new color to be used.

◆ setRulerHeightMM

void te::qt::widgets::ScaleWidget::setRulerHeightMM ( const int &  hMM)
slot

Updates the heightness of the ruler.

Parameters
hMMThe new height of the ruler in millimeters.
Note
The hMM parameter must be a value of a measure in millimeters.

◆ setScaleType

void te::qt::widgets::ScaleWidget::setScaleType ( const int &  type)
slot

Sets the type of ruler to be presented.

See the definition of ScaleTypes enumeration to see details.

Parameters
typeThe new type of ruler to be presented.

◆ setUnit() [1/2]

void te::qt::widgets::ScaleWidget::setUnit ( const int &  SRID)

Sets the unit using SRID.

Parameters
SRIDThe display SRID.

◆ setUnit [2/2]

void te::qt::widgets::ScaleWidget::setUnit ( const QString &  unit)
slot

Sets the unit of measure to be used by the graphic scale.

Available units of measure:

  • Meters.
  • Kilometers.
  • Feet.
  • Degrees.
Parameters
unitThe new unit of measure to be used.

◆ setUnitsPerGap

void te::qt::widgets::ScaleWidget::setUnitsPerGap ( const int &  units)
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.

Parameters
unitsNumber of units to be used in each interval.

◆ updateScaleFactor

void te::qt::widgets::ScaleWidget::updateScaleFactor ( )
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.

◆ updateScalePosition()

void te::qt::widgets::ScaleWidget::updateScalePosition ( )

Changes the current position of the widget, centralizing it in the display.

Member Data Documentation

◆ m_bckGrd

QColor te::qt::widgets::ScaleWidget::m_bckGrd
protected

Background color.

Definition at line 406 of file ScaleWidget.h.

◆ m_bckGround

QPixmap* te::qt::widgets::ScaleWidget::m_bckGround
protected

Background pixmap.

Definition at line 396 of file ScaleWidget.h.

◆ m_display

MapDisplay* te::qt::widgets::ScaleWidget::m_display
protected

Pointer to the display where to present the widget.

Definition at line 408 of file ScaleWidget.h.

◆ m_factor

double te::qt::widgets::ScaleWidget::m_factor
protected

Factor of scaling being used.

Definition at line 399 of file ScaleWidget.h.

◆ m_footerColor

QColor te::qt::widgets::ScaleWidget::m_footerColor
protected

Color of the footer section.

Definition at line 413 of file ScaleWidget.h.

◆ m_footerFont

QFont te::qt::widgets::ScaleWidget::m_footerFont
protected

Font of the footer section.

Definition at line 397 of file ScaleWidget.h.

◆ m_headerAllVisible

bool te::qt::widgets::ScaleWidget::m_headerAllVisible
protected

Flag do enabling / disabling of the intermediary values of the header.

Definition at line 411 of file ScaleWidget.h.

◆ m_headerColor

QColor te::qt::widgets::ScaleWidget::m_headerColor
protected

Color of the header section.

Definition at line 409 of file ScaleWidget.h.

◆ m_headerFont

QFont te::qt::widgets::ScaleWidget::m_headerFont
protected

Font of the header section.

Definition at line 410 of file ScaleWidget.h.

◆ m_interactionEnabled

bool te::qt::widgets::ScaleWidget::m_interactionEnabled
protected

Flag for enabling / disabling the interactive mode.

Definition at line 407 of file ScaleWidget.h.

◆ m_intervals

std::vector<double> te::qt::widgets::ScaleWidget::m_intervals
protected

Values of the intervals in millimeters.

Definition at line 401 of file ScaleWidget.h.

◆ m_numberOfIntervals

int te::qt::widgets::ScaleWidget::m_numberOfIntervals
protected

Number of intervals of the ruler.

Definition at line 403 of file ScaleWidget.h.

◆ m_rulerColor

QColor te::qt::widgets::ScaleWidget::m_rulerColor
protected

Color of the ruler section.

Definition at line 405 of file ScaleWidget.h.

◆ m_rulerHeightMM

int te::qt::widgets::ScaleWidget::m_rulerHeightMM
protected

Height of the ruler in millimeters.

Definition at line 414 of file ScaleWidget.h.

◆ m_showNumericScale

bool te::qt::widgets::ScaleWidget::m_showNumericScale
protected

Flag for enabling / disabling visibility of the footer section.

Definition at line 398 of file ScaleWidget.h.

◆ m_type

ScaleTypes te::qt::widgets::ScaleWidget::m_type
protected

Type of the ruler to be presented.

Definition at line 404 of file ScaleWidget.h.

◆ m_unit

QString te::qt::widgets::ScaleWidget::m_unit
protected

Unit of measure being used.

Definition at line 400 of file ScaleWidget.h.

◆ m_unitsPerGap

int te::qt::widgets::ScaleWidget::m_unitsPerGap
protected

Number of units to be used by each interval.

Definition at line 412 of file ScaleWidget.h.

◆ m_values

std::vector<double> te::qt::widgets::ScaleWidget::m_values
protected

Values of the intervals in the selected unit of measure.

Definition at line 402 of file ScaleWidget.h.


The documentation for this class was generated from the following file: