Ejemplo n.º 1
0
        /// <summary>
        /// Adds the specified finite display scale to the Map Definition
        /// </summary>
        /// <param name="map"></param>
        /// <param name="scale"></param>
        public static void AddFiniteDisplayScale(this IMapDefinition map, double scale)
        {
            Check.NotNull(map, "map"); //NOXLATE

            if (map.BaseMap != null)
            {
                map.InitBaseMap();
            }

            map.BaseMap.AddFiniteDisplayScale(scale);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the specified finite display scale to the Map Definition
        /// </summary>
        /// <param name="map"></param>
        /// <param name="scale"></param>
        public static void AddFiniteDisplayScale(this IMapDefinition map, double scale)
        {
            Check.ArgumentNotNull(map, nameof(map));

            if (map.BaseMap != null)
            {
                map.InitBaseMap();
            }

            map.BaseMap.AddFiniteDisplayScale(scale);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the specified base layer group to the map definition
        /// </summary>
        /// <param name="map"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IBaseMapGroup AddBaseLayerGroup(this IMapDefinition map, string name)
        {
            Check.NotNull(map, "map");    //NOXLATE
            Check.NotEmpty(name, "name"); //NOXLATE

            if (map.BaseMap == null)
            {
                map.InitBaseMap();
            }

            return(map.BaseMap.AddBaseLayerGroup(name));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the specified base layer group to the map definition
        /// </summary>
        /// <param name="map"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IBaseMapGroup AddBaseLayerGroup(this IMapDefinition map, string name)
        {
            Check.ArgumentNotNull(map, nameof(map));
            Check.ArgumentNotEmpty(name, nameof(name));

            if (map.BaseMap == null)
            {
                map.InitBaseMap();
            }

            return(map.BaseMap.AddBaseLayerGroup(name));
        }
Ejemplo n.º 5
0
        public FiniteScaleListCtrl(IMapDefinition parent, IEditorService editorSvc)
            : this()
        {
            _parent = parent;
            _parent.InitBaseMap();

            _tileSet = _parent.BaseMap;
            _edSvc   = editorSvc;
            //Init scale list
            if (_tileSet != null)
            {
                foreach (var scale in _tileSet.FiniteDisplayScale)
                {
                    _scales.Add(scale);
                }
            }
            //Now wire change events
            _scales.ListChanged += new ListChangedEventHandler(OnScaleListChanged);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Updates and replaces the layer/group structure of the specified Map Definition with the
        /// layer/group structure of this Runtime Map
        /// </summary>
        /// <param name="newMdf"></param>
        public void UpdateMapDefinition(IMapDefinition newMdf)
        {
            newMdf.RemoveAllLayers();
            newMdf.RemoveAllGroups();
            newMdf.RemoveBaseMap();

            var baseGroups = new List<RuntimeMapGroup>();

            newMdf.CoordinateSystem = this.CoordinateSystem;
            newMdf.Extents = this.MapExtent;

            //Add dynamic groups
            for (int i = this.Groups.Count - 1; i >= 0; i--)
            {
                //Deal with base groups later
                if (this.Groups[i].Type == RuntimeMapGroup.kBaseMap)
                {
                    baseGroups.Add(this.Groups[i]);
                    continue;
                }

                var rtGroup = this.Groups[i];
                var newGroup = newMdf.AddGroup(rtGroup.Name);
                newGroup.Group = rtGroup.Group;
                newGroup.ExpandInLegend = rtGroup.ExpandInLegend;
                newGroup.LegendLabel = rtGroup.LegendLabel;
                newGroup.ShowInLegend = rtGroup.ShowInLegend;
                newGroup.Visible = rtGroup.Visible;
            }

            var baseLayers = new List<RuntimeMapLayer>();

            //Populate dynamic layers. Loop in reverse order so that they are added in correct draw order
            for (int i = this.Layers.Count - 1; i >= 0; i--)
            {
                //Deal with base layers later
                if (this.Layers[i].Type == RuntimeMapLayer.kBaseMap)
                {
                    baseLayers.Add(this.Layers[i]);
                    continue;
                }

                var rtLayer = this.Layers[i];
                var newLayer = newMdf.AddLayer(rtLayer.Group, rtLayer.Name, rtLayer.LayerDefinitionID);
                newLayer.ExpandInLegend = rtLayer.ExpandInLegend;
                newLayer.LegendLabel = rtLayer.LegendLabel;
                newLayer.Selectable = rtLayer.Selectable;
                newLayer.ShowInLegend = rtLayer.ShowInLegend;
                newLayer.Visible = rtLayer.Visible;
            }

            if (baseLayers.Count > 0 && baseGroups.Count > 0)
            {
                newMdf.InitBaseMap();

                //Add finite scales first
                for (int i = _finiteDisplayScales.Length - 1; i >= 0; i--)
                {
                    newMdf.BaseMap.AddFiniteDisplayScale(_finiteDisplayScales[i]);
                }

                var baseGroupsByName = new Dictionary<string, IBaseMapGroup>();

                //Now groups
                for (int i = baseGroups.Count - 1; i >= 0; i--)
                {
                    var rtGroup = baseGroups[i];
                    var newGroup = newMdf.BaseMap.AddBaseLayerGroup(rtGroup.Name);
                    newGroup.ExpandInLegend = rtGroup.ExpandInLegend;
                    newGroup.LegendLabel = rtGroup.LegendLabel;
                    newGroup.ShowInLegend = rtGroup.ShowInLegend;
                    newGroup.Visible = rtGroup.Visible;

                    baseGroupsByName.Add(newGroup.Name, newGroup);
                }

                //Then layers. Loop in reverse order so that they are added in correct draw order
                for (int i = baseLayers.Count - 1; i >= 0; i--)
                {
                    var rtLayer = baseLayers[i];
                    //Should always happen
                    if (baseGroupsByName.ContainsKey(rtLayer.Group))
                    {
                        var newLayer = baseGroupsByName[rtLayer.Group].AddLayer(rtLayer.Name, rtLayer.LayerDefinitionID);
                        newLayer.ExpandInLegend = rtLayer.ExpandInLegend;
                        newLayer.LegendLabel = rtLayer.LegendLabel;
                        newLayer.Selectable = rtLayer.Selectable;
                        newLayer.ShowInLegend = rtLayer.ShowInLegend;
                    }
                }
            }
        }