public GeoPoint(GaussCoordinate xyh, double a, double f) { try { //读取高斯平面坐标值,如果是未赋值对象则产生异常 double x = xyh.x; double y = xyh.y; ellipsoid = new ReferenceEllipsoid(a, f); gaussCoord = xyh; double B, L; Geodetic.xy_BL(x, y, out B, out L, xyh.BeltWidth, 0, ellipsoid.a, ellipsoid.f); geodeticCoord = new GeodeticCoordinate(B, L); dimension = 2; try { //如果存在高程异常和正常高,则按此式计算大地高 double h = xyh.h; if (!dHlIsNull) { geodeticCoord.H = h + dH; double X, Y, Z; Geodetic.BLH_XYZ(B, L, h + dH, out X, out Y, out Z, ellipsoid.a, ellipsoid.f); spatialCoord = new SpatialRectCoordinate(X, Y, Z); dimension = 3; } } catch { } } catch { } }
public GeoPoint(SpatialRectCoordinate XYZ, double a, double f) { try { //读取空间直角坐标值,如果未赋值则产生异常 double X = XYZ.X; double Y = XYZ.Y; double Z = XYZ.Z; ellipsoid = new ReferenceEllipsoid(a, f); spatialCoord = XYZ; double B, L, H; Geodetic.XYZ_BLH(X, Y, Z, out B, out L, out H, ellipsoid.a, ellipsoid.f); geodeticCoord = new GeodeticCoordinate(B, L, H); double x, y; Geodetic.BL_xy(geodeticCoord.B, geodeticCoord.L, out x, out y, ellipsoid.a, ellipsoid.f); gaussCoord = new GaussCoordinate(x, y); if (!dHlIsNull) { gaussCoord.h = H - dH; } dimension = 3; } catch { } }
public GeoPoint(GeodeticCoordinate BLH, double a, double f) { try { //获取大地坐标,如果赋的值是空对象则会产生异常 double B = BLH.B; double L = BLH.L; geodeticCoord = BLH; ellipsoid = new ReferenceEllipsoid(a, f); double x, y; Geodetic.BL_xy(B, L, out x, out y, ellipsoid.a, ellipsoid.f); gaussCoord = new GaussCoordinate(x, y); dimension = 2; try { //获取大地高,如果没有大地高,则产生异常,只取二维坐标 double H = BLH.H; double X, Y, Z; Geodetic.BLH_XYZ(B, L, H, out X, out Y, out Z, ellipsoid.a, ellipsoid.f); spatialCoord = new SpatialRectCoordinate(X, Y, Z); dimension = 3; } catch { } } catch { } }
/// <summary> /// 给定参数的七参数坐标转换 /// </summary> /// <param name="info">转换参数</param> /// <returns>转换后的空间直角坐标</returns> public SpatialRectCoordinate CoordinateConvert(TransformParameters p) { if (dimension > 2) { return(Geodetic.CoordinateTransform(spatialCoord, p)); } else { throw new Exception("进行坐标转换需要三维坐标"); } }
public GeoPoint(double B, double L, double H, double a, double f) : this(B, L, a, f) { geodeticCoord = new GeodeticCoordinate(B, L, H); double X, Y, Z; Geodetic.BLH_XYZ(B, L, H, out X, out Y, out Z, ellipsoid.a, ellipsoid.f); spatialCoord = new SpatialRectCoordinate(X, Y, Z); dimension = 3; }
public GeoPoint(double B, double L, double a, double f) { ellipsoid = new ReferenceEllipsoid(a, f); geodeticCoord = new GeodeticCoordinate(B, L); double x, y; Geodetic.BL_xy(B, L, out x, out y, ellipsoid.a, ellipsoid.f); gaussCoord = new GaussCoordinate(x, y); dimension = 2; }