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/nmData/nmUtmProjection.h

47 lines
2.7 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef NMUTMPROJECTION_H
#define NMUTMPROJECTION_H
#include "nmData_global.h"
#include <QString>
// WGS84/UTM 坐标工具,不依赖 QWidget、分析管理器或当前工程。
// 经纬度统一使用十进制度,投影坐标统一使用米;显示单位由调用方交给框架换算。
namespace nmUtmProjection
{
// 检查有限经纬度及 UTM 覆盖范围:纬度 [-80, 84],经度 [-180, 180]。
NM_DATA_EXPORT bool isValidGeographic(double dLatitude, double dLongitude);
// 检查有限米制坐标及基本范围:东向 [0, 1000000],北向 [0, 10000000]。
// 此检查不能代替反投影后的纬度范围检查。
NM_DATA_EXPORT bool isValidProjected(double dEasting, double dNorthing);
// 解析两位经度带号和纬度带字母(如 50S);S 是纬度带,不表示南半球。
// 排除 32X/34X/36X 等不存在的自然分带;失败时调用方不得使用输出参数。
NM_DATA_EXPORT bool parseZone(const QString& sZone, int& nZone, char& cBand);
// 将合法纬度(度)转换为 C~X 纬度带;纬度无效时返回 0,X 带包含北纬 84 度。
NM_DATA_EXPORT char latitudeBand(double dLatitude);
// 格式化带号和字母,不改变投影坐标;基本字符或数值不合法时返回空串。
// 是否属于有效自然分带仍由 parseZone 检查。
NM_DATA_EXPORT QString zoneText(int nZone, char cBand);
// 正投影:输入纬度/经度(度),输出自然分带和东向/北向(米)。
// 包含 Norway/Svalbard 特殊带宽及 +/-180 度边界;失败时不要使用输出参数。
NM_DATA_EXPORT bool geographicToUtm(double dLatitude, double dLongitude, QString& sZone,
double& dEasting, double& dNorthing);
// 反投影:按指定经度带及字母对应的半球解释米制坐标,输出纬度/经度(度)。
// 不按反算位置自动换成相邻自然带:模型偏移坐标必须继续使用参考点的投影带。
// 字母用于确定假北值,不限制结果仍处于原 8 度纬度带;超出半球/UTM 范围返回 false。
// 失败时不要使用输出参数,调用方应清空派生经纬度,避免保留上一次结果。
NM_DATA_EXPORT bool utmToGeographic(int nZone, char cBand, double dEasting, double dNorthing,
double& dLatitude, double& dLongitude);
// 返回有效自然分带覆盖区域的中心经纬度(度),供用户主动选带时初始化参考点。
// 特殊宽窄带使用覆盖区域中心;无效分带返回 false,不产生默认坐标。
NM_DATA_EXPORT bool zoneCenter(int nZone, char cBand, double& dLatitude, double& dLongitude);
}
#endif // NMUTMPROJECTION_H