Exemplo n.º 1
0
 public Layer(ESRI.ArcGIS.Client.Layer layer, int index)
 {
     Index   = index;
     ID      = layer.ID;
     Opacity = layer.Opacity;
     Visible = layer.Visible;
 }
Exemplo n.º 2
0
        /// <summary>
        /// LayerProperty property changed handler.
        /// </summary>
        /// <param name="d">LayerCheckBox that changed its Layer.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LayerCheckBox dp = d as LayerCheckBox;

            ESRI.ArcGIS.Client.Layer newLayer = (ESRI.ArcGIS.Client.Layer)e.NewValue;
            ESRI.ArcGIS.Client.Layer oldLayer = (ESRI.ArcGIS.Client.Layer)e.OldValue;
            if (dp.Map != null)
            {
                if (oldLayer != null)
                {
                    dp.Map.Layers.Remove(oldLayer);
                }
                if (newLayer != null && dp.IsChecked.Value)
                {
                    dp.Map.Layers.Add(newLayer);
                }
            }
            if (dp.Configurator != null)
            {
                dp.Configurator.Layer = newLayer;
                if (newLayer != null)
                {
                    dp.Configurator.Title = newLayer.ID;
                }
            }
        }
Exemplo n.º 3
0
        private void Reorder(int layerIndex, int direction)
        {
            ESRI.ArcGIS.Client.Layer l = Map.Layers[layerIndex];
            if (l == null || direction == 0)
            {
                return;
            }
            int newIndex = layerIndex + direction;

            if (newIndex < 1)
            {
                newIndex = 1;
            }
            if (newIndex >= Map.Layers.Count)
            {
                newIndex = Map.Layers.Count - 1;
            }
            if (Map.Layers[newIndex].ID == "Annotations")
            {
                newIndex--;
            }
            if (newIndex == layerIndex)
            {
                return;
            }
            Map.Layers.Remove(l);
            //if (direction > 0) newIndex--;
            Map.Layers.Insert(newIndex, l);
        }