Esempio n. 1
0
        /// <summary>
        /// 从CGM地图文件中复原地图
        /// </summary>
        internal void GenerateMapFromCGM(string FileName)
        {
            treeViewLayers.Nodes.Clear();

            MapReader.CGM newCGM = new MapReader.CGM(FileName);
            myMap        = newCGM.MyMap;
            ratio        = newCGM.Ratio;
            scaleIndex   = newCGM.ScaleIndex;
            centerLngLat = newCGM.CenterPos;
            centerXY     = ETCProjection.LngLat2XY(centerLngLat); //同步更新屏幕中心点投影坐标系坐标

            int      i       = 0;
            TreeNode mapNode = new TreeNode(myMap.MapName, 1, 1);       //添加根节点,Map节点

            mapNode.Checked = true;
            treeViewLayers.Nodes.Add(mapNode);
            for (i = 0; i < myMap.LayerNum; i++)                  //添加空间数据对象节点
            {
                TreeNode layerNode = new TreeNode(myMap.GetLayerName(i), 2, 2);
                layerNode.Checked = true;
                treeViewLayers.Nodes[0].Nodes.Add(layerNode);
            }
            if (myMap.hasBaseMap)
            {
                TreeNode basemapNode = new TreeNode(myMap.GetLayerName(i), 1, 1);   //添加basemap对象节点
                basemapNode.Checked = true;
                treeViewLayers.Nodes[0].Nodes.Add(basemapNode);
            }
            treeViewLayers.ExpandAll();                                           //打开所有节点
            picBoxMap.MouseWheel += new MouseEventHandler(picBoxMap_MouseWheel);  //添加鼠标滑轮缩放地图
            mapImg = new Bitmap(picBoxMap.Bounds.Width, picBoxMap.Bounds.Height); //构造地图内存图
            UpdateMapImg();
        }
Esempio n. 2
0
 internal void SaveCGM(string path)
 {
     MapReader.CGM newCGM = new MapReader.CGM(myMap, centerLngLat, ratio, scaleIndex);
     newCGM.Save(path);
 }