79 lines
2.1 KiB
C++
Executable File
79 lines
2.1 KiB
C++
Executable File
|
|
|
|
#pragma once
|
|
|
|
#include <LtsCoordTrans/ltscoordwidget_export.h>
|
|
#include <LtsCoordTrans/lts_coord_trans.h>
|
|
#include <QWidget>
|
|
|
|
class QToolButton;
|
|
|
|
namespace LtsCoordWidget
|
|
{
|
|
class LtsCoordInputWidgetHandler;
|
|
class LTSCOORDWIDGET_EXPORT LtsCoordWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum class DisplayType
|
|
{
|
|
MGRS5,
|
|
MGRS7,
|
|
UTM,
|
|
WGS84,
|
|
MGRS = DisplayType::MGRS5
|
|
};
|
|
Q_ENUM(DisplayType)
|
|
Q_PROPERTY(DisplayType displayType READ displayType WRITE setDisplayType)
|
|
Q_PROPERTY(bool withResetButton READ withResetButton WRITE setWithResetButton)
|
|
Q_PROPERTY(bool showToolTip READ showToolTip WRITE setShowToolTip)
|
|
Q_PROPERTY(bool mgrsSquareEditable READ mgrsSquareEditable WRITE setMgrsSquareEditable)
|
|
|
|
|
|
|
|
explicit LtsCoordWidget(QWidget *parent = nullptr)
|
|
: LtsCoordWidget(LtsCoordWidget::DisplayType::MGRS, parent)
|
|
{}
|
|
|
|
|
|
|
|
explicit LtsCoordWidget(DisplayType dt, QWidget *parent = nullptr);
|
|
|
|
QPointF coordinate() const;
|
|
DisplayType displayType() const;
|
|
bool withResetButton() const;
|
|
bool showToolTip() const;
|
|
bool mgrsSquareEditable() const;
|
|
bool event(QEvent *event) override;
|
|
public Q_SLOTS:
|
|
|
|
|
|
void setCoordinate(const QPointF &geoCoord, bool bUseAsDefaultValue = true);
|
|
void setCoordinate(double lon, double lat, bool bUseAsDefaultValue = true);
|
|
void setDisplayType(LtsCoordWidget::DisplayType dt);
|
|
void setWithResetButton(bool bWith);
|
|
void setShowToolTip(bool bShow);
|
|
void setMgrsSquareEditable(bool bEditable);
|
|
void setWithSurroundingMgrsSquares(bool bEnable);
|
|
void setMgrsSquares(const QVector<LtsCoordTrans::UtmCoordinate> &geoCoords);
|
|
void clear();
|
|
|
|
Q_SIGNALS:
|
|
void coordinateChanged(const QPointF &newGeoCoord);
|
|
void invalidCoordinate();
|
|
private:
|
|
void rebuildUi();
|
|
void updateToolTip();
|
|
private Q_SLOTS:
|
|
void onResetToDefaultCoordinate();
|
|
private:
|
|
bool m_bWithResetButton = false;
|
|
bool m_bShowToolTip = true;
|
|
bool m_bMgrsSquareEditable = false;
|
|
LtsCoordWidget::DisplayType m_displayType = LtsCoordWidget::DisplayType::MGRS;
|
|
LtsCoordInputWidgetHandler *m_inputWidgetHandler = nullptr;
|
|
QPointF m_coordinate;
|
|
QPointF m_defaultCoordinate;
|
|
};
|
|
}
|