SuperMap.Web.Mapping.LayerContainer.OnResolutionPropertyChanged C# (CSharp) Method

OnResolutionPropertyChanged() private static method

private static OnResolutionPropertyChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
d System.Windows.DependencyObject
e System.Windows.DependencyPropertyChangedEventArgs
return void
        private static void OnResolutionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LayerContainer container = d as LayerContainer;

            if (container != null)
            {
                if ((container.Layer != null) && container.Layer.IsVisible)
                {
                    //在这里判断当分辨率发生变化,是否超出最大,最小可见比例尺的可见性;
                    //设置了最大、小可见分辨率!
                    bool isCollapsed = false;
                    if (container.Layer.MinVisibleResolution != double.Epsilon || !double.IsPositiveInfinity(container.Layer.MaxVisibleResolution))
                    {
                        isCollapsed = (container.Resolution < container.Layer.MinVisibleResolution) || (container.Resolution > container.Layer.MaxVisibleResolution);
                    }  //如果设置了分辨率;
                    else if (container.Layer.Map != null)
                    {
                        isCollapsed = container.Layer.Map.Scale < container.Layer.MinVisibleScale || container.Layer.Map.Scale > container.Layer.MaxVisibleScale;
                    }//如果设置了比例尺; 主要为了在Map初始化完成之前设置了layer的最大最小比例尺

                    if (isCollapsed)
                    {
                        container.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        container.Visibility = Visibility.Visible;
                    }

                }
                container.InvalidateArrange();
            }
        }