Beispiel #1
0
        /// <summary>
        /// 清空图层并保存
        /// </summary>
        public void ClearLayers()
        {
            IMapDocument pMapDoc     = new MapDocumentClass();
            string       strfilename = AxMapControlMainMap.DocumentFilename;

            pMapDoc.Open(strfilename, "");
            pMapDoc.Map[0].ClearLayers();
            pMapDoc.Save();
            pMapDoc.Close();
            AxMapControlMainMap.LoadMxFile(strfilename);
        }
Beispiel #2
0
        /// <summary>
        /// 新建地图文档
        /// </summary>
        /// <param name="fileName">地图文档路径</param>
        /// <param name="mapName">地图名称</param>
        /// <param name="loadMapAfterBuilt">是否将地图文档加载到地图控件</param>
        /// <returns></returns>
        public IMapDocument NewMap(string fileName, string mapName = "图层", bool loadMapAfterBuilt = true)
        {
            IMapDocument mapDoc = new MapDocumentClass();

            mapDoc.New(fileName);
            mapDoc.Map[0].Name = mapName;
            if (loadMapAfterBuilt)
            {
                AxMapControlMainMap.LoadMxFile(fileName);
            }
            return(mapDoc);
        }
Beispiel #3
0
        /// <summary>
        /// 加载地图
        /// </summary>
        /// <param name="mxdFilePath"></param>
        public void LoadFile(string mxdFilePath)
        {
            if (MapDoc != null && File.Exists(MapDoc.DocumentFilename))
            {
                MapDoc.Close();
            }

            MapDoc = new MapDocumentClass();
            MapDoc.Open(mxdFilePath);

            AxMapControlMainMap.LoadMxFile(mxdFilePath);
        }
Beispiel #4
0
 /// <summary>
 /// 刷新地图
 /// </summary>
 public void RefreshMap()
 {
     AxMapControlMainMap.Refresh();
     AxMapControlMainMap.Update();
 }