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

            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);
                    mapControl.Layers.Add(oMapLayer);

                    oLayerfosCollection.Add(new LayerInformations(oMapLayer, oMapLayer.GeoDataset.Name, oLayerType, oMapLayer.shapeType));
                }
                else if (oLayerType == LayerTypeConstants.moImageLayer)
                {
                    ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath);
                    mapControl.Layers.Add(oImageLayer);

                    oLayerfosCollection.Add(new LayerInformations(oImageLayer, oImageLayer.Name, oLayerType, (ShapeTypeConstants)(-1)));
                }
            }

            return(oLayerfosCollection);
        }
Esempio n. 2
0
        /// <summary>
        /// ����ͼ�㼯��
        /// </summary>
        /// <param name="layerPaths">ͼ��·������</param>
        /// <param name="map">��ͼ����</param>
        public List<LayerInformations> LoadLayers(List<string> layerPaths, ref AxMapObjects2.AxMap mapControl)
        {
            BaseHandler.MapManager oMapManager = new GPSTrackingMonitor.BaseHandler.MapManager();
            List<LayerInformations> oLayerfosCollection = new List<LayerInformations>();

            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);
                    mapControl.Layers.Add(oMapLayer);

                    oLayerfosCollection.Add(new LayerInformations(oMapLayer, oMapLayer.GeoDataset.Name, oLayerType, oMapLayer.shapeType));
                }
                else if (oLayerType == LayerTypeConstants.moImageLayer)
                {
                    ImageLayer oImageLayer = oMapManager.GetSingleImageLayer(sLayerPath);
                    mapControl.Layers.Add(oImageLayer);

                    oLayerfosCollection.Add(new LayerInformations(oImageLayer, oImageLayer.Name, oLayerType, (ShapeTypeConstants)(-1)));
                }
            }

            return oLayerfosCollection;
        }