Esempio n. 1
0
        /// <summary>
        /// 加载图层集合
        /// </summary>
        /// <param name="layerPaths">图层路径集合</param>
        /// <param name="map">地图对象</param>
        public void LoadLayers(List <string> layerPaths, MapStruct mapInfoCollection, AxMapObjects2.AxMap mapControl)
        {
            BaseHandler.MapManager oMapManager          = new BaseHandler.MapManager();
            ProjectSerialization   oProjectSerilization = new ProjectSerialization();

            foreach (string sLayerPath in layerPaths)
            {
                string             sFileExtent = System.IO.Path.GetExtension(sLayerPath);
                LayerTypeConstants oLayerType  = oMapManager.GetLayerTypeByFileExtent(sFileExtent);

                if (oLayerType == LayerTypeConstants.moMapLayer)
                {
                    MapLayer oMapLayer = oMapManager.GetSingleVectorLayer(sLayerPath);
                    oMapLayer.Tag = "0-0";
                    mapControl.Layers.Add(oMapLayer);

                    MapLayerInfoStruct oMapLayerStruct = oProjectSerilization.LoadLayerInfos(oMapLayer, sLayerPath, -1, -1);
                    mapInfoCollection.Layers.Insert(0, oMapLayerStruct);
                }
                else if (oLayerType == LayerTypeConstants.moImageLayer)
                {
                    ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath);
                    oImageLayer.Tag = "0-0";
                    mapControl.Layers.Add(oImageLayer);

                    ImageLayerInfoStruct oImageLayerStruct = oProjectSerilization.LoadLayerInfos(oImageLayer, sLayerPath, -1, -1);
                    mapInfoCollection.Layers.Insert(0, oImageLayerStruct);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// ����ͼ�㼯��
        /// </summary>
        /// <param name="layerPaths">ͼ��·������</param>
        /// <param name="map">��ͼ����</param>
        public void LoadLayers(List<string> layerPaths,MapStruct mapInfoCollection, AxMapObjects2.AxMap mapControl)
        {
            BaseHandler.MapManager oMapManager = new BaseHandler.MapManager();
            ProjectSerialization oProjectSerilization = new ProjectSerialization();

            foreach (string sLayerPath in layerPaths)
            {
                string sFileExtent = System.IO.Path.GetExtension(sLayerPath);
                LayerTypeConstants oLayerType = oMapManager.GetLayerTypeByFileExtent(sFileExtent);

                if (oLayerType == LayerTypeConstants.moMapLayer)
                {
                    MapLayer oMapLayer = oMapManager.GetSingleVectorLayer(sLayerPath);
                    oMapLayer.Tag = "0-0";
                    mapControl.Layers.Add(oMapLayer);

                    MapLayerInfoStruct oMapLayerStruct = oProjectSerilization.LoadLayerInfos(oMapLayer, sLayerPath, -1, -1);
                    mapInfoCollection.Layers.Insert(0,oMapLayerStruct);
                }
                else if (oLayerType == LayerTypeConstants.moImageLayer)
                {
                    ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath);
                    oImageLayer.Tag =  "0-0";
                    mapControl.Layers.Add(oImageLayer);

                    ImageLayerInfoStruct oImageLayerStruct = oProjectSerilization.LoadLayerInfos(oImageLayer, sLayerPath, -1, -1);
                    mapInfoCollection.Layers.Insert(0,oImageLayerStruct);
                }
            }
        }