Ejemplo n.º 1
0
        public void SetMap(IMap map, string mapName)
        {

            this.name = mapName;
            this.map = map;
            int i = 0;
            int idv = 0;

            if (map != null)
            {
                foreach (IMapLayer ila in map.GetPolygonLayers())
                {
                    if (!string.IsNullOrEmpty(ila.LegendText))
                        this.uxLayerMask.Items.Add(ila.LegendText);
                }

                foreach (IMapLayer ila in map.GetFeatureLayers())
                {
                    if (!string.IsNullOrEmpty(ila.LegendText))
                    {
                        this.uxLayer.Items.Add(ila.LegendText);

                        if (ila.LegendText == mapName)
                            idv = i;

                        i++;
                    }
                }

                foreach (IMapGroup ila1 in map.MapFrame.GetAllGroups())
                {
                    foreach (IMapLayer ila in ila1)
                    {
                        if (!string.IsNullOrEmpty(ila.LegendText))
                        {
                            this.uxLayer.Items.Add(ila.LegendText);

                            if (ila.LegendText == mapName)
                                idv = i;

                            i++;
                        }
                    }
                }
            }

            if (this.uxLayer.Items.Count > 0)
            {
                this.uxLayer.SelectedIndex = idv;
            }

            if (this.uxLayerMask.Items.Count > 0)
            {
                this.uxLayerMask.SelectedIndex = 0;
                this.uxLayerMask.Enabled = true;
                this.uxMask.Checked = true;
            }
        }