Commit 67ca45fb authored by Bernhard Beschow's avatar Bernhard Beschow

realize that Marble::Dimension is specific to LatLonEdit

parent 59a05342
......@@ -46,7 +46,7 @@ public:
public: // API to be implemented
virtual void setupUi() = 0;
virtual void setupMinMax(Dimension dimension) = 0;
virtual void setupMinMax(LatLonEdit::Dimension dimension) = 0;
virtual void setValue(qreal value) = 0;
virtual void handleIntEditChange() = 0;
virtual void handleUIntEditChange() = 0;
......@@ -63,7 +63,7 @@ public:
explicit DecimalInputHandler(LatLonEditPrivate *ui) : AbstractInputHandler(ui) {}
public: // AbstractInputHandler API
void setupUi() override;
void setupMinMax(Dimension dimension) override;
void setupMinMax(LatLonEdit::Dimension dimension) override;
void setValue(qreal value) override;
void handleIntEditChange() override;
void handleUIntEditChange() override;
......@@ -77,7 +77,7 @@ public:
explicit DMSInputHandler(LatLonEditPrivate *ui) : AbstractInputHandler(ui) {}
public: // AbstractInputHandler API
void setupUi() override;
void setupMinMax(Dimension dimension) override;
void setupMinMax(LatLonEdit::Dimension dimension) override;
void setValue(qreal value) override;
void handleIntEditChange() override;
void handleUIntEditChange() override;
......@@ -91,7 +91,7 @@ public:
explicit DMInputHandler(LatLonEditPrivate *ui) : AbstractInputHandler(ui) {}
public: // AbstractInputHandler API
void setupUi() override;
void setupMinMax(Dimension dimension) override;
void setupMinMax(LatLonEdit::Dimension dimension) override;
void setValue(qreal value) override;
void handleIntEditChange() override;
void handleUIntEditChange() override;
......@@ -107,7 +107,7 @@ class LatLonEditPrivate : public Ui::LatLonEditPrivate
friend class DMInputHandler;
public:
Dimension m_dimension;
LatLonEdit::Dimension m_dimension;
qreal m_value;
GeoDataCoordinates::Notation m_notation;
AbstractInputHandler *m_inputHandler;
......@@ -140,9 +140,9 @@ void DecimalInputHandler::setupUi()
m_ui->m_uintValueEditor->hide();
}
void DecimalInputHandler::setupMinMax(Dimension dimension)
void DecimalInputHandler::setupMinMax(LatLonEdit::Dimension dimension)
{
const qreal maxValue = (dimension == Longitude) ? 180.0 : 90.0;
const qreal maxValue = (dimension == LatLonEdit::Longitude) ? 180.0 : 90.0;
m_ui->m_floatValueEditor->setMinimum(-maxValue);
m_ui->m_floatValueEditor->setMaximum( maxValue);
......@@ -191,9 +191,9 @@ void DMSInputHandler::setupUi()
m_ui->m_uintValueEditor->show();
}
void DMSInputHandler::setupMinMax(Dimension dimension)
void DMSInputHandler::setupMinMax(LatLonEdit::Dimension dimension)
{
const int maxValue = (dimension == Longitude) ? 180 : 90;
const int maxValue = (dimension == LatLonEdit::Longitude) ? 180 : 90;
m_ui->m_intValueEditor->setMinimum(-maxValue);
m_ui->m_intValueEditor->setMaximum( maxValue);
......@@ -349,9 +349,9 @@ void DMInputHandler::setupUi()
m_ui->m_uintValueEditor->hide();
}
void DMInputHandler::setupMinMax(Dimension dimension)
void DMInputHandler::setupMinMax(LatLonEdit::Dimension dimension)
{
const int maxValue = (dimension == Longitude) ? 180 : 90;
const int maxValue = (dimension == LatLonEdit::Longitude) ? 180 : 90;
m_ui->m_intValueEditor->setMinimum(-maxValue);
m_ui->m_intValueEditor->setMaximum( maxValue);
......@@ -448,7 +448,7 @@ qreal DMInputHandler::calculateValue() const
LatLonEditPrivate::LatLonEditPrivate()
: m_dimension(Latitude)
: m_dimension(LatLonEdit::Latitude)
, m_value(0.0)
, m_notation(GeoDataCoordinates::DMS)
, m_inputHandler(new DMSInputHandler(this))
......@@ -467,7 +467,7 @@ void LatLonEditPrivate::init(QWidget* parent) { setupUi(parent); }
using namespace Marble;
LatLonEdit::LatLonEdit(QWidget *parent, Dimension dimension, GeoDataCoordinates::Notation notation)
LatLonEdit::LatLonEdit(QWidget *parent, LatLonEdit::Dimension dimension, GeoDataCoordinates::Notation notation)
: QWidget( parent ), d(new LatLonEditPrivate())
{
d->init(this);
......
......@@ -30,6 +30,14 @@ class MARBLE_EXPORT LatLonEdit : public QWidget
//Q_PROPERTY( int dimension READ dimension WRITE setDimension )
public:
/**
* @brief This enum is used to choose the dimension.
*/
enum Dimension {
Latitude, ///< Latitude
Longitude ///< Longitude
};
explicit LatLonEdit(QWidget *parent = 0, Dimension dimension = Longitude,
GeoDataCoordinates::Notation notation = GeoDataCoordinates::DMS);
~LatLonEdit() override;
......
......@@ -56,16 +56,6 @@ enum Projection {
// value above. Adjust that method if you do changes here
};
/**
* @brief This enum is used to choose the dimension.
*/
enum Dimension {
Latitude, ///< Latitude
Longitude ///< Longitude
};
Q_DECLARE_FLAGS(Dimensions, Dimension)
/**
* @brief This enum is used to choose the unit chosen to measure angles.
*/
......
......@@ -78,8 +78,8 @@ PlacemarkEditHeaderPrivate::~PlacemarkEditHeaderPrivate()
void PlacemarkEditHeaderPrivate::init(QWidget* parent)
{
setupUi(parent);
m_longitude->setDimension( Longitude );
m_latitude->setDimension( Latitude );
m_longitude->setDimension(LatLonEdit::Longitude);
m_latitude->setDimension(LatLonEdit::Latitude);
m_targetId->setVisible(false);
targetIdLabel->setVisible(false);
setNotation(GeoDataCoordinates::DMS);
......
......@@ -58,22 +58,22 @@ void NodeItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
// Setting the latlonedit spinboxes values
if( index.column() == 1 ) {
latLonEditWidget->setDimension( Marble::Longitude );
latLonEditWidget->setDimension(LatLonEdit::Longitude);
value = outerBoundary.at( index.row() ).longitude( GeoDataCoordinates::Degree );
}
else {
latLonEditWidget->setDimension( Marble::Latitude );
latLonEditWidget->setDimension(LatLonEdit::Latitude);
value = outerBoundary.at( index.row() ).latitude( GeoDataCoordinates::Degree );
}
}
else if (const auto lineString = geodata_cast<GeoDataLineString>(m_placemark->geometry())) {
// Setting the latlonedit spinboxes values
if( index.column() == 1 ) {
latLonEditWidget->setDimension( Marble::Longitude );
latLonEditWidget->setDimension(LatLonEdit::Longitude);
value = lineString->at( index.row() ).longitude( GeoDataCoordinates::Degree );
}
else {
latLonEditWidget->setDimension( Marble::Latitude );
latLonEditWidget->setDimension(LatLonEdit::Latitude);
value = lineString->at( index.row() ).latitude(GeoDataCoordinates::Degree );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment