public override void Bind(IEditorService service)
        {
            _init = true;
            try
            {
                _edsvc = service;
                _edsvc.RegisterCustomNotifier(this);
                _rl = (IRasterLayerDefinition)((ILayerDefinition)service.GetEditedResource()).SubLayer;

                _activeRange = _rl.GetScaleRangeAt(0);
                _colorStyle = _activeRange.ColorStyle;

                _backgroundColor = _colorStyle.GetColorRuleAt(0);
                _foregroundColor = _colorStyle.GetColorRuleAt(1);

                txtVisibleFrom.Text = (_activeRange.MinScale.HasValue ? _activeRange.MinScale.Value : 0).ToString();
                txtRebuildFactor.Text = _activeRange.RebuildFactor.ToString();
                cmbVisibleTo.Text = (_activeRange.MaxScale.HasValue ? _activeRange.MaxScale.Value.ToString() : Strings.Infinity);

                string fg = _foregroundColor.Color.GetValue();
                string bg = _backgroundColor.Color.GetValue();

                if (!string.IsNullOrEmpty(fg))
                    cmbForegroundColor.CurrentColor = Utility.ParseHTMLColor(fg);
                if (!string.IsNullOrEmpty(bg))
                    cmbBackgroundColor.CurrentColor = Utility.ParseHTMLColor(bg);
            }
            finally
            {
                _init = false;
            }
        }
        public override void Bind(IEditorService service)
        {
            _init = true;
            try
            {
                _edsvc = service;
                _edsvc.RegisterCustomNotifier(this);
                _rl = (IRasterLayerDefinition)((ILayerDefinition)service.GetEditedResource()).SubLayer;

                _activeRange = _rl.GetScaleRangeAt(0);
                _colorStyle  = _activeRange.ColorStyle;

                _backgroundColor = _colorStyle.GetColorRuleAt(0);
                _foregroundColor = _colorStyle.GetColorRuleAt(1);

                txtVisibleFrom.Text   = (_activeRange.MinScale.HasValue ? _activeRange.MinScale.Value : 0).ToString();
                txtRebuildFactor.Text = _activeRange.RebuildFactor.ToString();
                cmbVisibleTo.Text     = (_activeRange.MaxScale.HasValue ? _activeRange.MaxScale.Value.ToString() : Strings.Infinity);

                string fg = _foregroundColor.Color.GetValue();
                string bg = _backgroundColor.Color.GetValue();

                if (!string.IsNullOrEmpty(fg))
                {
                    cmbForegroundColor.CurrentColor = Utility.ParseHTMLColor(fg);
                }
                if (!string.IsNullOrEmpty(bg))
                {
                    cmbBackgroundColor.CurrentColor = Utility.ParseHTMLColor(bg);
                }
            }
            finally
            {
                _init = false;
            }
        }
 /// <summary>
 /// Sets the color of the transparency.
 /// </summary>
 /// <param name="style">The style.</param>
 /// <param name="c">The c.</param>
 public static void SetTransparencyColor(this IGridColorStyle style, Color c)
 {
     Check.NotNull(style, "style"); //NOXLATE
     style.TransparencyColor = Utility.SerializeHTMLColor(c, true);
 }
Beispiel #4
0
        public override void Bind(IEditorService service)
        {
            _init = true;
            try
            {
                _edsvc = service;
                _rl    = (IRasterLayerDefinition)((ILayerDefinition)service.GetEditedResource()).SubLayer;
                _edsvc.RegisterCustomNotifier(this);

                //Set active range. There has to be one!
                _activeRange = _rl.GetScaleRangeAt(0);

                //Assign color style. If this range has none, we'll create
                //one and assign that. Changing the checkbox will attach/detach
                //this object
                if (_activeRange.ColorStyle == null)
                {
                    _colorStyle = _activeRange.CreateColorStyle();
                }
                else
                {
                    _colorStyle = _activeRange.ColorStyle;
                }

                //Assign surface style. If this range has none, we'll create
                //one and assign that. Changing the checkbox will attach/detach
                //this object
                if (_activeRange.SurfaceStyle == null)
                {
                    _surfaceStyle = _activeRange.CreateSurfaceStyle();
                }
                else
                {
                    _surfaceStyle = _activeRange.SurfaceStyle;
                }

                if (_colorStyle.HillShade == null)
                {
                    _hillShade = _colorStyle.CreateHillShade();
                }
                else
                {
                    _hillShade = _colorStyle.HillShade;
                }

                txtBrightnessFactor.Text = _colorStyle.BrightnessFactor.HasValue ? _colorStyle.BrightnessFactor.Value.ToString() : "0"; //NOXLATE
                txtContrastFactor.Text   = _colorStyle.ContrastFactor.HasValue ? _colorStyle.ContrastFactor.Value.ToString() : "0";     //NOXLATE

                if (!string.IsNullOrEmpty(_colorStyle.TransparencyColor))
                {
                    cmbTransparencyColor.CurrentColor = Utility.ParseHTMLColor(_colorStyle.TransparencyColor);
                }

                txtHillshadeAltitude.Text    = _hillShade.Altitude.ToString();
                txtHillshadeAzimuth.Text     = _hillShade.Azimuth.ToString();
                txtHillshadeBand.Text        = _hillShade.Band;
                txtHillshadeScaleFactor.Text = _hillShade.ScaleFactor.ToString();

                txtSurfaceBand.Text        = _surfaceStyle.Band;
                txtSurfaceScaleFactor.Text = _surfaceStyle.ScaleFactor.ToString();
                txtSurfaceZeroValue.Text   = _surfaceStyle.ZeroValue.ToString();

                if (!string.IsNullOrEmpty(_surfaceStyle.DefaultColor))
                {
                    cmbSurfaceDefaultColor.CurrentColor = Utility.ParseHTMLColor(_surfaceStyle.DefaultColor);
                }

                chkAdvanced.Checked         = _colorStyle.ContrastFactor.HasValue && _colorStyle.BrightnessFactor.HasValue && !string.IsNullOrEmpty(_colorStyle.TransparencyColor);
                txtBrightnessFactor.Enabled = txtContrastFactor.Enabled = cmbTransparencyColor.Enabled = chkAdvanced.Checked;
                EnableSurface.Checked       = (_activeRange.SurfaceStyle != null);
                EnableHillshade.Checked     = (_colorStyle.HillShade != null);
            }
            finally
            {
                _init = false;
            }
        }
        public override void Bind(IEditorService service)
        {
            _init = true;
            try
            {
                _edsvc = service;
                _rl = (IRasterLayerDefinition)((ILayerDefinition)service.GetEditedResource()).SubLayer;
                _edsvc.RegisterCustomNotifier(this);

                //Set active range. There has to be one!
                _activeRange = _rl.GetScaleRangeAt(0);

                //Assign color style. If this range has none, we'll create
                //one and assign that. Changing the checkbox will attach/detach
                //this object
                if (_activeRange.ColorStyle == null)
                    _colorStyle = _activeRange.CreateColorStyle();
                else
                    _colorStyle = _activeRange.ColorStyle;

                //Assign surface style. If this range has none, we'll create
                //one and assign that. Changing the checkbox will attach/detach
                //this object
                if (_activeRange.SurfaceStyle == null)
                    _surfaceStyle = _activeRange.CreateSurfaceStyle();
                else
                    _surfaceStyle = _activeRange.SurfaceStyle;

                if (_colorStyle.HillShade == null)
                    _hillShade = _colorStyle.CreateHillShade();
                else
                    _hillShade = _colorStyle.HillShade;

                txtBrightnessFactor.Text = _colorStyle.BrightnessFactor.HasValue ? _colorStyle.BrightnessFactor.Value.ToString() : "0"; //NOXLATE
                txtContrastFactor.Text = _colorStyle.ContrastFactor.HasValue ? _colorStyle.ContrastFactor.Value.ToString() : "0"; //NOXLATE

                if (!string.IsNullOrEmpty(_colorStyle.TransparencyColor))
                {
                    cmbTransparencyColor.CurrentColor = Utility.ParseHTMLColor(_colorStyle.TransparencyColor);
                }

                txtHillshadeAltitude.Text = _hillShade.Altitude.ToString();
                txtHillshadeAzimuth.Text = _hillShade.Azimuth.ToString();
                txtHillshadeBand.Text = _hillShade.Band;
                txtHillshadeScaleFactor.Text = _hillShade.ScaleFactor.ToString();

                txtSurfaceBand.Text = _surfaceStyle.Band;
                txtSurfaceScaleFactor.Text = _surfaceStyle.ScaleFactor.ToString();
                txtSurfaceZeroValue.Text = _surfaceStyle.ZeroValue.ToString();

                if (!string.IsNullOrEmpty(_surfaceStyle.DefaultColor))
                    cmbSurfaceDefaultColor.CurrentColor = Utility.ParseHTMLColor(_surfaceStyle.DefaultColor);

                chkAdvanced.Checked = _colorStyle.ContrastFactor.HasValue && _colorStyle.BrightnessFactor.HasValue && !string.IsNullOrEmpty(_colorStyle.TransparencyColor);
                txtBrightnessFactor.Enabled = txtContrastFactor.Enabled = cmbTransparencyColor.Enabled = chkAdvanced.Checked;
                EnableSurface.Checked = (_activeRange.SurfaceStyle != null);
                EnableHillshade.Checked = (_colorStyle.HillShade != null);
            }
            finally
            {
                _init = false;
            }
        }