Пример #1
0
        public static void CreateMap(MG_Map map, string mapPath)
        {//  c:\\data\\hello.map    c:\\data\\layer.shp
            if (map == null)
            {
                return;
            }
            // set MapPath
            map.SetMapPath(mapPath);

            // save map  (layerCount  n * layerPath)
            int count = map.GetLayerCount();

            StreamWriter sw = new StreamWriter(mapPath); // stream writer

            sw.WriteLine(count);                         // layerCount

            for (int i = 0; i < count; i++)
            {
                string   mapFolder = Path.GetDirectoryName(mapPath);
                MG_Layer layer     = map.GetLayer(i);

                string layerPath = mapFolder + "\\" + layer.GetLayerName() + ".shp";
                CreateShapeFile(layer, layerPath); //save layer

                sw.WriteLine(layerPath);           // layerPath
            }
            sw.Close();
        }
Пример #2
0
 public static void RenderMap(MG_Map map, MG_MapView mapview, Graphics g)
 {
     for (int i = 0; i < map.GetLayerCount(); i++)
     {
         RenderLayer(map.GetLayer(i), mapview, g);
     }
 }
Пример #3
0
        public static MG_Map LoadMap(string mapPath)
        {
            string mapName = Path.GetFileNameWithoutExtension(mapPath);

            MG_Map map = new MG_Map();

            map.SetMapName(mapName);
            map.SetMapPath(mapPath);

            StreamReader sr    = new StreamReader(mapPath);  // stream reader
            int          count = Int32.Parse(sr.ReadLine()); // layerCount

            for (int i = 0; i < count; i++)
            {
                string layerPath = sr.ReadLine(); // layerPath

                MG_Layer layer = LoadShapeFile(layerPath);
                map.AddLayer(layer);
            }
            sr.Close();
            return(map);
        }
Пример #4
0
 public MG_ToolPan(MG_Map map, MG_MapView mapview)
     : base(MG_ToolType.Tool_Pan, null, mapview)
 {
     this.CurrentMap = map;
 }