Пример #1
0
        /// <summary>
        /// Get EPSG code for assigned to drawing coordinate system as string value
        /// </summary>
        /// <returns></returns>
        public static string GetEPSGForCurrentCS()
        {
            Autodesk.Gis.Map.Platform.AcMapMap       map     = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap();
            OSGeo.MapGuide.MgCoordinateSystemFactory factory = new OSGeo.MapGuide.MgCoordinateSystemFactory();
            string wkt  = map.GetMapSRS();
            string EPSG = factory.ConvertWktToEpsgCode(wkt).ToString();

            return(EPSG);
        }
Пример #2
0
        /// <summary>
        /// Node GetCurrentCoordinateSystem return the name of current CS (assigned to drawing)
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentCoordinateSystem()
        {
            Autodesk.Gis.Map.Platform.AcMapMap map = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap();
            string wkt = map.GetMapSRS();

            OSGeo.MapGuide.MgCoordinateSystemFactory factory = new OSGeo.MapGuide.MgCoordinateSystemFactory();
            string csCode = factory.ConvertWktToCoordinateSystemCode(wkt);

            return(csCode);
        }
Пример #3
0
        /// <summary>
        /// Assign CS to drawing from WKT code (as string)
        /// </summary>
        /// <param name="wkt"></param>
        public static void AssignCSFromWKT(string wkt)
        {
            CivilDocument c3d_doc      = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
            var           Units_Window = c3d_doc.Settings.DrawingSettings;

            Document m_Doc = Application.DocumentManager.MdiActiveDocument;
            Database db    = m_Doc.Database;

            OSGeo.MapGuide.MgCoordinateSystemFactory factory = new OSGeo.MapGuide.MgCoordinateSystemFactory();
            string csCode = factory.ConvertWktToCoordinateSystemCode(wkt);

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                Units_Window.UnitZoneSettings.CoordinateSystemCode = csCode;
                tr.Commit();
            }
        }