/// <summary> /// 构造函数 /// </summary> /// <param name="PrimeMeridian">首子午线</param> /// <param name="HorizontalDatum">基准</param> /// <param name="LinearUnit">尺度计量单位</param> /// <param name="axes">坐标轴</param> /// <param name="name">坐标系统名称</param> /// <param name="id">坐标系统编号</param> public GeocentricCs( PrimeMeridian PrimeMeridian, HorizontalDatum HorizontalDatum, LinearUnit LinearUnit, List <IAxis> axes, string name = null, string id = null) : base(axes, name, id) { this.HorizontalDatum = HorizontalDatum; this.HorizontalDatum = HorizontalDatum; this.LinearUnit = LinearUnit; }
/// <summary> /// 初始化一个 2D投影坐标系统 实例。 /// </summary> /// <param name="datum">Horizontal datum</param> /// <param name="geographicCs">Geographic coordinate system</param> /// <param name="linearUnit">Linear unit</param> /// <param name="projection">Projection</param> /// <param name="Axis">Axis info</param> /// <param name="name">Name</param> /// <param name="id">Authority-specific identification code.</param> public ProjectedCs( HorizontalDatum datum, GeographicCs geographicCs, LinearUnit linearUnit, Projection projection, List <IAxis> Axis, string name = null, string id = null) : base(datum, Axis, name, id) { GeographicCs = geographicCs; LinearUnit = linearUnit; Projection = projection; }
/// <summary> /// Creates a <see cref="CreateGeocentricCs"/> from a <see cref="HorizontalDatum">datum</see>, /// <see cref="LinearUnit">linear unit</see> and <see cref="PrimeMeridian"/>. /// </summary> /// <param name="name">Name of geocentric coordinate system</param> /// <param name="datum">Horizontal datum</param> /// <param name="linearUnit">Linear unit</param> /// <param name="primeMeridian">Prime meridian</param> /// <returns>Geocentric Coordinate System</returns> public GeocentricCs CreateGeocentricCs(string name, HorizontalDatum datum, LinearUnit linearUnit, PrimeMeridian primeMeridian) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Invalid name"); } List <IAxis> info = new List <IAxis>(3); info.Add(new Axis("X", Direction.Other)); info.Add(new Axis("Y", Direction.Other)); info.Add(new Axis("Z", Direction.Other)); return(new GeocentricCs() { HorizontalDatum = datum, Name = name, Axes = info, PrimeMeridian = primeMeridian, LinearUnit = linearUnit }); }
/// <summary> /// 椭球体 /// </summary> /// <param name="semiMajorAxis">长半轴</param> /// <param name="flatteningOrInverse">扁率或其倒数,根据数据大小程序自动判断</param> /// <param name="axisUnit">坐标轴计量单位</param> public Ellipsoid(double semiMajorAxis, double flatteningOrInverse, LinearUnit axisUnit = null, string name = null) { //default meter this.AxisUnit = axisUnit == null ? LinearUnit.Metre : axisUnit; this.Name = name == null ? "未命名椭球" : name; this.SemiMajorAxis = semiMajorAxis; if (flatteningOrInverse < 1)//小于 1 则是扁率,大于 1 则是其倒数 { this.Flattening = flatteningOrInverse; this.InverseFlattening = 1 / flatteningOrInverse; } else { this.Flattening = 1 / flatteningOrInverse; this.InverseFlattening = flatteningOrInverse; } this.SemiMinorAxis = semiMajorAxis * (1 - Flattening); this.PolarCurvatureSemiAxis = semiMajorAxis * semiMajorAxis / SemiMinorAxis; this.FirstEccentricity = Math.Sqrt(semiMajorAxis * semiMajorAxis - SemiMinorAxis * SemiMinorAxis) / semiMajorAxis; this.SecondEccentricity = Math.Sqrt(semiMajorAxis * semiMajorAxis - SemiMinorAxis * SemiMinorAxis) / SemiMinorAxis; }
/// <summary> /// Creates a <see cref="ProjectedCs"/> using a projection object. /// </summary> /// <param name="name">Name of projected coordinate system</param> /// <param name="gcs">Geographic coordinate system</param> /// <param name="projection">Projection</param> /// <param name="linearUnit">Linear unit</param> /// <param name="axis0">Primary axis</param> /// <param name="axis1">Secondary axis</param> /// <returns>Projected coordinate system</returns> public ProjectedCs CreateProjectedCs(string name, GeographicCs gcs, Projection projection, LinearUnit linearUnit, Axis axis0, Axis axis1) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Invalid name"); } if (gcs == null) { throw new ArgumentException("Geographic coordinate system was null"); } if (projection == null) { throw new ArgumentException("Projection was null"); } if (linearUnit == null) { throw new ArgumentException("Linear unit was null"); } List <IAxis> info = new List <IAxis>(2); info.Add(axis0); info.Add(axis1); return(new ProjectedCs(null, gcs, linearUnit, projection, info, name)); }
/// <summary> /// Creates an <see cref="Ellipsoid"/> from an major radius, and inverse flattening. /// </summary> /// <seealso cref="CreateEllipsoid"/> /// <param name="name">Name of ellipsoid</param> /// <param name="semiMajorAxis">Semi major-axis</param> /// <param name="inverseFlattening">Inverse flattening</param> /// <param name="linearUnit">Linear unit</param> /// <returns>Ellipsoid</returns> public Ellipsoid CreateFlattenedSphere(string name, double semiMajorAxis, double inverseFlattening, LinearUnit linearUnit) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Invalid name"); } return(new Ellipsoid(semiMajorAxis, inverseFlattening, linearUnit, name)); }
/// <summary> /// Creates a spatial reference object given its Well-known text representation. /// The output object may be either a <see cref="GeographicCs"/> or /// a <see cref="ProjectedCs"/>. /// </summary> /// <param name="WKT">The Well-known text representation for the spatial reference</param> /// <returns>The resulting spatial reference object</returns> //public ICoordinateSystem CreateFromWkt(string WKT) //{ // return CoordinateSystemWktReader.Parse(WKT) as ICoordinateSystem; //} /// <summary> /// Creates an <see cref="Ellipsoid"/> from radius values. /// </summary> /// <seealso cref="CreateFlattenedSphere"/> /// <param name="name">Name of ellipsoid</param> /// <param name="semiMajorAxis"></param> /// <param name="semiMinorAxis"></param> /// <param name="linearUnit"></param> /// <returns>Ellipsoid</returns> public IEllipsoid CreateEllipsoid(string name, double semiMajorAxis, double semiMinorAxis, LinearUnit linearUnit) { double ivf = 0; if (semiMajorAxis != semiMinorAxis) { ivf = semiMajorAxis / (semiMajorAxis - semiMinorAxis); } return(new Ellipsoid(semiMajorAxis, ivf, linearUnit) { Name = name }); }