InputCoordinateDialog.cpp File Reference
#include "InputCoordinateDialog.h"
#include "ui_InputCoordinateForm.h"
#include "../../../geometry/Coord2D.h"
#include "../Exception.h"
#include "../canvas/MapDisplay.h"
#include <iostream>
#include <QDoubleValidator>
#include <QPushButton>
#include <QRegularExpression>

Go to the source code of this file.

Classes

class  DMSValidator
 Class used to evaluate the coordinates given as degree-minute-second values. More...
 

Functions

QString DD2DMS (const double &value)
 Transforms a decimal-degree value in a degree-minute-second formatted string. More...
 
double DMS2DD (const int &d, const int &m, const int &s)
 Transforms a degree-minute-second value into a decimal-degree value. More...
 
te::gm::Envelope GetCenteredBox (const te::gm::Envelope &world, const te::gm::Coord2D &center)
 Returns a centralized box maintaining the aspect ratio of the older one. More...
 
QString GetDMSAsString (const int &d, const int &m, const int &s)
 Returns the value as a formatted string. More...
 
QString GetLineEditMask (const bool &decimalDegree)
 Returns the mask to be used by lineEdit objects. More...
 
QValidator::State IsAValidDMSValue (const QString &dms, int &d, int &m, int &s)
 Returns the status of the dms construction. More...
 
QValidator::State IsAValidDMSValue (const QString &dms)
 
void ParseDMS (const QRegularExpressionMatch &match, int &d, int &m, int &s)
 Extracts the degree, minute and second portions of the match object. More...
 

Function Documentation

QString DD2DMS ( const double &  value)

Transforms a decimal-degree value in a degree-minute-second formatted string.

Parameters
valueValue in decimal-degrees.
Returns
The degree-minute-second representing the given value.

Definition at line 247 of file InputCoordinateDialog.cpp.

References GetDMSAsString().

Referenced by te::qt::widgets::InputCoordinateDialog::DMS_triggered().

double DMS2DD ( const int d,
const int m,
const int s 
)

Transforms a degree-minute-second value into a decimal-degree value.

Parameters
dDegrees.
mMinutes.
sSeconds.
Returns
The decimal-degree value.

Definition at line 220 of file InputCoordinateDialog.cpp.

References d.

Referenced by te::qt::widgets::InputCoordinateDialog::DD_triggered(), and te::qt::widgets::InputCoordinateDialog::getCoordinate().

te::gm::Envelope GetCenteredBox ( const te::gm::Envelope world,
const te::gm::Coord2D center 
)

Returns a centralized box maintaining the aspect ratio of the older one.

Parameters
worldThe bounding rect of the current visible area.
centerPoint where to centralize.
Returns
The new envelope.

Definition at line 272 of file InputCoordinateDialog.cpp.

References te::gm::Envelope::getHeight(), te::gm::Envelope::getWidth(), te::gm::Coord2D::getX(), and te::gm::Coord2D::getY().

Referenced by te::qt::widgets::InputCoordinateDialog::ok_triggered().

QString GetDMSAsString ( const int d,
const int m,
const int s 
)

Returns the value as a formatted string.

Parameters
dDegrees.
mMinutes.
sSeconds.
Returns
A string formatted as a degrees-minutes-seconds value.

Definition at line 147 of file InputCoordinateDialog.cpp.

Referenced by DD2DMS(), and DMSValidator::fixup().

QString GetLineEditMask ( const bool decimalDegree)

Returns the mask to be used by lineEdit objects.

Parameters
decimalDegreeFlag telling what kind of validators we will use.
Returns
The mask for lineEdits acoording to decimalDegree.

Definition at line 199 of file InputCoordinateDialog.cpp.

Referenced by te::qt::widgets::InputCoordinateDialog::updateValidator().

QValidator::State IsAValidDMSValue ( const QString &  dms,
int d,
int m,
int s 
)

Returns the status of the dms construction.

Parameters
dmsThe degree-minute-second value.
[out]dDegrees.
[out]mMinutes.
[out]sSeconds.
Returns
Three possible states: accepted, intermediate, invalid.

Definition at line 88 of file InputCoordinateDialog.cpp.

References ParseDMS().

Referenced by te::qt::widgets::InputCoordinateDialog::DD_triggered(), DMSValidator::fixup(), te::qt::widgets::InputCoordinateDialog::getCoordinate(), IsAValidDMSValue(), and DMSValidator::validate().

QValidator::State IsAValidDMSValue ( const QString &  dms)

Definition at line 127 of file InputCoordinateDialog.cpp.

References d, and IsAValidDMSValue().

void ParseDMS ( const QRegularExpressionMatch &  match,
int d,
int m,
int s 
)

Extracts the degree, minute and second portions of the match object.

Parameters
matchQt structure that has a regular expression.
[out]dDegrees.
[out]mMinutes.
[out]sSeconds.

Definition at line 33 of file InputCoordinateDialog.cpp.

Referenced by IsAValidDMSValue().