예제 #1
0
        public StyleListControl(MapLayerInfoStruct layerInfos)
        {
            InitializeComponent();

            this._layerStruct = layerInfos;
            InitGridView();
        }
예제 #2
0
        public MapLayerInfoStruct LoadLayerInfos(MapObjects2.MapLayer layer, string fileName, double minScale, double maxScale)
        {
            MapLayerInfoStruct oMapLayerStruct = new MapLayerInfoStruct();

            oMapLayerStruct.AliasName   = layer.Name;
            oMapLayerStruct.DataSetName = System.IO.Path.GetFileNameWithoutExtension(fileName);
            oMapLayerStruct.FileName    = fileName;
            oMapLayerStruct.ShapeType   = (short)layer.shapeType;
            oMapLayerStruct.MinLevel    = minScale;
            oMapLayerStruct.MaxLevel    = maxScale;

            this.DeconvertSymbol(layer.Symbol, oMapLayerStruct.Symbol);
            oMapLayerStruct.Render = this.ExportLayerRender(layer);

            return(oMapLayerStruct);
        }
예제 #3
0
        public void SaveMapInfosToProject(AxMapObjects2.AxMap mapControl, string saveFileName, MapStruct currentMapInfos)
        {
            MapStruct oMapStruct = new MapStruct();

            oMapStruct.BBox.MinX   = mapControl.Extent.Left;
            oMapStruct.BBox.MinY   = mapControl.Extent.Top;
            oMapStruct.BBox.MaxX   = mapControl.Extent.Right;
            oMapStruct.BBox.MaxY   = mapControl.Extent.Bottom;
            oMapStruct.BBox.Width  = mapControl.Extent.Width;
            oMapStruct.BBox.Height = mapControl.Extent.Height;

            // oMapStruct.CoordinateSystem = mapControl.CoordinateSystem;

            short iLayersCount = mapControl.Layers.Count;

            for (short i = (short)(iLayersCount - 1); i >= 0; i--)
            {
                object oLayer = mapControl.Layers.Item(i);

                if (oLayer is MapObjects2.MapLayer)
                {
                    MapObjects2.MapLayer oMapLayer       = oLayer as MapObjects2.MapLayer;
                    MapLayerInfoStruct   oMapLayerStruct = new MapLayerInfoStruct();

                    oMapLayerStruct.FileName    = currentMapInfos.FindLayer(oMapLayer.Name).FileName;
                    oMapLayerStruct.LayerType   = (short)oMapLayer.LayerType;
                    oMapLayerStruct.AliasName   = oMapLayer.Name;
                    oMapLayerStruct.DataSetName = System.IO.Path.GetFileNameWithoutExtension(oMapLayerStruct.FileName);
                    oMapLayerStruct.ShapeType   = (short)oMapLayer.shapeType;
                    oMapLayerStruct.Visible     = oMapLayer.Visible;
                    oMapLayerStruct.MinLevel    = int.Parse(oMapLayer.Tag.Split('-')[0]);
                    oMapLayerStruct.MaxLevel    = int.Parse(oMapLayer.Tag.Split('-')[1]);

                    oMapLayerStruct.Render = this.ExportLayerRender(oMapLayer);
                    this.DeconvertSymbol(oMapLayer.Symbol, oMapLayerStruct.Symbol);
                    oMapStruct.Layers.Add(oMapLayerStruct as ILayerStruct);
                }
                else if (oLayer is MapObjects2.ImageLayer)
                {
                    throw new NotImplementedException();
                }
            }

            this.SerializeProject(oMapStruct, saveFileName);
        }