Exemplo n.º 1
0
        private void SetUpRasterLayer()
        {
            FeatureLayer myRasterLayer = _map.Layers["florida"] as FeatureLayer;

            _rasterTable = myRasterLayer.Table;


            RasterStyle rs = new RasterStyle();

            rs.Contrast  = 33;
            rs.Grayscale = true;

            // this composite style will affect the raster as intended
            CompositeStyle csRaster           = new CompositeStyle(rs);
            FeatureOverrideStyleModifier fosm =
                new FeatureOverrideStyleModifier("Style Mod", csRaster);

            FeatureStyleModifiers modifiers = myRasterLayer.Modifiers;

            modifiers.Append(fosm);
        }
Exemplo n.º 2
0
		private void StyleButton_Click(object sender, System.EventArgs e)
		{
			if (_mStyle == null)
			{
				MessageBox.Show("Please click GridInfo before clicking Style.");
				return;
			}

			GridStyle aStyle = _mStyle.Clone() as GridStyle;

			GridStyleForm f = new GridStyleForm();
			f.AlphaTextBox.Text = aStyle.Alpha.ToString();
			f.BrightnessBox.Text = aStyle.Brightness.ToString();
			f.ContrastBox.Text = aStyle.Contrast.ToString();
			f.GrayScale.CheckState = (aStyle.Grayscale) ? CheckState.Checked : CheckState.Unchecked;
			f.Transparency.CheckState = (aStyle.Transparent) ? CheckState.Checked : CheckState.Unchecked;
			f.DisplayHillshade.CheckState = (aStyle.DisplayHillshade) ? CheckState.Checked : CheckState.Unchecked;
			f.TransparentColor.BackColor = aStyle.TransparentColor;
			if (f.ShowDialog() == DialogResult.OK)
			{
				aStyle.Alpha = int.Parse(f.AlphaTextBox.Text);
				aStyle.Brightness = int.Parse(f.BrightnessBox.Text);
				aStyle.Contrast = int.Parse(f.ContrastBox.Text);
				aStyle.Grayscale = f.GrayScale.CheckState == CheckState.Checked ? true : false;
				aStyle.Transparent = (f.Transparency.CheckState == CheckState.Checked) ? true : false;
				aStyle.DisplayHillshade = (f.DisplayHillshade.CheckState == CheckState.Checked) ? true : false;
				aStyle.TransparentColor = f.TransparentColor.BackColor;

				// this composite style will affect the raster as intended 
				CompositeStyle csRaster = new CompositeStyle(aStyle); 
				FeatureOverrideStyleModifier fosm = 
					new FeatureOverrideStyleModifier("Style Mod", csRaster); 

				FeatureStyleModifiers modifiers = _lyr.Modifiers; 
				modifiers.Clear();
				modifiers.Append(fosm);			
			}
		}