You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmWxPointerPosDlg.h

76 lines
2.9 KiB
C

#ifndef NMWXPOINTERPOSDLG_H
#define NMWXPOINTERPOSDLG_H
#include "iDlgBase.h"
#include "nmSubWxs_global.h"
#include <QPointer>
class QComboBox;
class QGridLayout;
class QLineEdit;
class nmDataAnalyzeManager;
/**
* @brief 模型位置显示窗口,跟随所属画布的鼠标位置更新坐标,不修改分析数据。
* @note 本地 X/Y 和东向、北向坐标以米接收,由框架单位绑定器负责显示换算。
* 坐标均可选中复制;UTM 带只展示当前参考点的设置,不提供编辑入口。
* 输入列与单位列按 8:5 横向伸展,纵向采用字体和主题的推荐高度。
*/
class NM_SUB_WXS_EXPORT nmWxPointerPosDlg : public iDlgBase
{
Q_OBJECT
public:
/** @brief 绑定父级 nmGuiPlot 的分析管理器,由 Qt 父子关系管理窗口生命周期。 */
explicit nmWxPointerPosDlg(QWidget* parent = nullptr);
public slots:
/** @brief 接收画布的米制坐标,刷新显示并保留各字段已选择的单位。 */
void setPointerPos(double x, double y);
private:
/** @brief 四个长度字段分别保存单位选择,不混用本地坐标与地理坐标。 */
enum LengthField
{
LocalX,
LocalY,
Easting,
Northing,
LengthFieldCount
};
/** @brief 创建本地网格、地理坐标分组及标准关闭按钮。 */
void initUI() override;
/** @brief 添加只读长度字段,并通过初始单位 m 识别框架长度单位组。 */
void createLengthField(QGridLayout* pGrid, int nRow, LengthField field,
const QString& sLabel, const QString& sObjectName);
/** @brief 回填米制值;无有效数据时清空显示并暂停单位切换,避免恢复旧值。 */
void setLengthValue(LengthField field, double dValue, bool bValid);
/** @brief 未设置参考点或参考数据失效时,清空地理坐标,保留本地坐标显示。 */
void clearGeographicValues();
/** @brief 将有限且在范围内的经纬度转换为度分秒,按百分之一秒四舍五入并进位。 */
QString formatCoordinate(double dCoordinate, bool bLatitude) const;
private:
// 借用所属分析的管理器,删除时自动置空,不使用全局当前分析。
// 参考点可能在窗口打开后新增、清空或重建,每次刷新重新读取,不缓存其裸指针。
QPointer<nmDataAnalyzeManager> m_pDataManager;
// 长度控件均由 Qt 父子关系释放;绑定状态独立记录,禁止以错误单位展示原始值。
QLineEdit* m_pLengthEdits[LengthFieldCount];
QComboBox* m_pLengthUnits[LengthFieldCount];
bool m_bUnitsBound[LengthFieldCount];
// 非长度字段使用普通只读文本框,经纬度文本本身包含度、分、秒符号。
QLineEdit* m_pLonEdit;
QLineEdit* m_pLatEdit;
QLineEdit* m_pUtmZoneEdit;
};
#endif // NMWXPOINTERPOSDLG_H