Example #1
0
        /// <summary>
        /// 将几何对象从投影转换到84
        /// </summary>
        /// <returns></returns>
        public static bool ConvertGeoPrjToEarth(this Geometry SourceGeo, PrjCoordSysType coordSysType)
        {
            CoordSysTransParameter cstp = new CoordSysTransParameter();

            return(CoordSysTranslator.Convert(SourceGeo
                                              , new PrjCoordSys(coordSysType)
                                              , new PrjCoordSys(PrjCoordSysType.EarthLongitudeLatitude)
                                              , new CoordSysTransParameter()
                                              , CoordSysTransMethod.GeocentricTranslation));
        }
Example #2
0
        /// <summary>
        /// 转换主函数
        /// Main function of transformation
        /// </summary>
        /// <param name="type">对应不同的投影类型 Projection type</param>
        /// <returns>转换后投影的描述信息 The description information of projection after transformed</returns>
        public String TransformPrj(int type)
        {
            try
            {
                m_srcMapControl.Map.Layers.Clear();
                this.CopyDataset(m_bufPrjDataName);

                PrjCoordSys gaussPrjSys = this.GetTargetPrjCoordSys(type);
                Boolean     result      = CoordSysTranslator.Convert(m_processDataset, gaussPrjSys, new CoordSysTransParameter(), CoordSysTransMethod.GeocentricTranslation);

                m_srcMapControl.Map.Layers.Add(m_processDataset, true);
                m_srcMapControl.Map.Center = m_srcMapControl.Map.Bounds.Center;
                m_srcMapControl.Map.Scale  = m_srcMapControl.Map.Scale;
                m_srcMapControl.Map.Refresh();

                return(this.GetPrjStr(m_processDataset));
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            return(null);
        }