示例#1
0
        /// <summary>
        /// 转换操作。输入待转坐标,输出目标坐标。
        /// </summary>
        /// <param name="oldCoord">待转坐标,只取其数字部分,参考系取自属性本对象的TargetCrs属性 </param>
        /// <returns></returns>
        public override ICoordinate MatchedTrans(ICoordinate oldCoord)
        {
            IEllipsoid e = (TargetCrs.Datum as GeodeticDatum).Ellipsoid;

            IGeodeticCoord geo = (IGeodeticCoord)oldCoord;
            double         x, y, z;

            GeodeticUtils.GeodeticToXyzCoord(geo.Lon, geo.Lat, geo.Height, out x, out y, out z, e.SemiMajorAxis, e.InverseFlattening);

            return(CoordinateFactory.CreateXyzCoord(x, y, z, oldCoord.Weight));
        }
示例#2
0
        /// <summary>
        /// 只有基准不同的 XYZ 坐标转换,采用布尔沙 7 参数模型。
        /// 以WGS84转换参数作为中间参数,共转换 2 次
        /// </summary>
        /// <param name="oldCoord">待转坐标,只取其数字部分,参考系取自属性本对象的TargetCrs属性 </param>
        /// <returns></returns>
        public override ICoordinate MatchedTrans(ICoordinate oldCoord)
        {
            BursaTransParams BursaTransParams = ((IGeodeticDatum)SourceCrs.Datum).TransParamsToWgs84;
            IXYZ             temp             = GeodeticUtils.BursaTransform((IXYZ)oldCoord, BursaTransParams);

            //double[] result = BursaTransParams.Transform(new double[] { oldCoord.X, oldCoord.Y, oldCoord.Z });

            IXYZ xyz = temp;

            if (!TargetCrs.Datum.Equals(GeodeticDatum.WGS84))
            {
                xyz = GeodeticUtils.BursaTransform(temp, ((IGeodeticDatum)TargetCrs.Datum).TransParamsToWgs84.GetInverse());
            }

            return(CoordinateFactory.CreateXyzCoord(xyz.X, xyz.Y, xyz.Z));
        }