Inheritance: System.Windows.Controls.Control
Exemplo n.º 1
0
        private static void OnLayerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OverviewMap ovmap = d as OverviewMap;

            if (ovmap.OVMapImage != null)
            {
                ovmap.OVMapImage.Layers.Clear();
                if (ovmap.Layer != null)
                {
                    ovmap.OVMapImage.Layers.Add(ovmap.Layer);
                }
            }
            if (ovmap.Layer != null)
            {
                bool isInit = ovmap.Layer.IsInitialized;
                if (isInit)
                {
                    ovmap.Layer_LayersInitialized(ovmap.Layer, null);
                }
                else
                {
                    ovmap.Layer.Initialized += ovmap.Layer_LayersInitialized;
                }
            }
        }
Exemplo n.º 2
0
        private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OverviewMap ovmap  = d as OverviewMap;
            Map         oldMap = e.OldValue as Map;

            if (oldMap != null)             //clean up
            {
                if (ovmap.OVMapImage != null)
                {
                    ovmap.OVMapImage.Layers.Clear();
                }
                oldMap.ExtentChanged   -= ovmap.UpdateOVMap;
                oldMap.RotationChanged -= ovmap.map_RotationChanged;
            }
            Map newMap = e.NewValue as Map;

            if (newMap != null)
            {
                newMap.ExtentChanged   += ovmap.UpdateOVMap;
                newMap.RotationChanged += ovmap.map_RotationChanged;
                if (ovmap.Layer != null && ovmap.OVMapImage != null && !ovmap.OVMapImage.Layers.Contains(ovmap.Layer))
                {
                    ovmap.OVMapImage.Layers.Add(ovmap.Layer);
                }
                ovmap.UpdateOVMap();
            }
        }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ESRI.SilverlightViewer;component/Widgets/OverviewMapWidget.xaml", System.UriKind.Relative));
     this.OverviewMapPanel         = ((System.Windows.Controls.Border)(this.FindName("OverviewMapPanel")));
     this.OverviewPanelTransform   = ((System.Windows.Media.TranslateTransform)(this.FindName("OverviewPanelTransform")));
     this.myOverviewMap            = ((ESRI.ArcGIS.Client.Toolkit.OverviewMap)(this.FindName("myOverviewMap")));
     this.OverviewToggler          = ((System.Windows.Controls.HyperlinkButton)(this.FindName("OverviewToggler")));
     this.OverviewTogglerTransform = ((System.Windows.Media.RotateTransform)(this.FindName("OverviewTogglerTransform")));
 }
Exemplo n.º 4
0
        private static void OnMaximumExtentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OverviewMap ov        = d as OverviewMap;
            Envelope    newExtent = e.NewValue as Envelope;

            if (newExtent != null)
            {
                if (ov.OVMapImage == null || ov.OVMapImage.Layers == null)
                {
                    return;
                }
                ov.maxWidth  = newExtent.Width;
                ov.maxHeight = newExtent.Height;
                ov.UpdateOVMap();
                if (ov.IsStatic)
                {
                    if (ov.isInitialized)
                    {
                        ov.UpdateExtentToMaixumExtent();
                    }
                    else
                    {
                        ov.OVMapImage.Layers.LayersInitialized += (s, arg) => { ov.UpdateExtentToMaixumExtent(); }
                    };
                }
                else
                {
                    if (ov.isInitialized)
                    {
                        ov.ZoomToNewExtent();
                    }
                }
            }
            else
            {
                if (ov.isInitialized)
                {
                    ov.fullExtent = ov.OVMapImage.Layers.GetFullExtent();
                    if (ov.fullExtent != null)
                    {
                        ov.maxWidth  = ov.fullExtent.Width;
                        ov.maxHeight = ov.fullExtent.Height;
                    }
                    ov.UpdateOVMap();
                }
            }
        }