Пример #1
0
 private void Configure()
 {
     _elevationFactor = 1 / 3640000f;
     _isElevation     = true;
     _extrusion       = 1;
     _shadedRelief    = new ShadedRelief();
     _noDataColor     = Color.Transparent;
     Scheme           = new ColorScheme();
     if (_raster != null)
     {
         _scheme.ApplyScheme(ColorSchemeType.FallLeaves, _raster);
     }
 }
Пример #2
0
        private void Configure()
        {
            _shadedRelief = new ShadedRelief();
            _noDataColor  = Color.Transparent;
            Scheme        = new ColorScheme();
            if (_raster != null)
            {
                var colors = _raster.CategoryColors();
                if (colors != null && colors.Length > 0)
                {
                    // Use colors that are built into the raster, e.g. GeoTIFF with palette
                    _isElevation = false;

                    // use all colors instead of unique colors because unique colors are not always set/correct
                    int lastColor = colors[0].ToArgb(); // changed by jany_ 2015-06-02
                    int firstNr   = 0;

                    // group succeeding values with the same color to the same category
                    for (int i = 1; i < colors.Length; i++)
                    {
                        int hash = colors[i].ToArgb();
                        if (hash != lastColor)
                        {
                            // the current color differs from the one before so we add a category for the color before
                            AddCategory(firstNr, i - 1, colors[firstNr]);
                            firstNr   = i;
                            lastColor = hash;
                        }

                        if (i == colors.Length - 1) // this is the last color, so we add the last category
                        {
                            AddCategory(firstNr, i, colors[firstNr]);
                        }
                    }
                }
                else
                {
                    // Assume grid is elevation
                    _elevationFactor = 1 / 3640000f;
                    _isElevation     = true;
                    _extrusion       = 1;
                    _scheme.ApplyScheme(ColorSchemeType.FallLeaves, _raster);
                }
            }
        }
Пример #3
0
        private void QuickSchemeClicked(object sender, EventArgs e)
        {
            _ignoreRefresh = true;
            _newScheme.EditorSettings.NumBreaks = 2;
            nudCategoryCount.Value = 2;
            _ignoreRefresh         = false;

            if (sender is not ToolStripMenuItem mi)
            {
                return;
            }

            ColorSchemeType cs = (ColorSchemeType)Enum.Parse(typeof(ColorSchemeType), mi.Text);

            _newScheme.ApplyScheme(cs, _raster);
            UpdateTable();
            UpdateStatistics(true); // if the parameter is true, even on manual, the breaks are reset.
            breakSliderGraph1.Invalidate();
        }
Пример #4
0
 private void Configure()
 {
     _shadedRelief = new ShadedRelief();
     _noDataColor  = Color.Transparent;
     Scheme        = new ColorScheme();
     if (_raster != null)
     {
         var Colors = _raster.CategoryColors();
         if (Colors != null && Colors.Length > 0)
         {   // Use colors that are built into the raster, e.g. GeoTIFF with palette
             var  Names        = _raster.CategoryNames();
             bool overMaxCount = false;
             var  UniqueValues = _raster.GetUniqueValues(Colors.Length, out overMaxCount);
             _isElevation = false;
             for (int i = 0; i < Colors.Length; i++)
             {   //Only add colors to the legend if they appear in the layer
                 //NLCD CategoryColors include 256 colors, but only 16 are valid
                 if (UniqueValues.Contains(Convert.ToDouble(i)))
                 {   // It seems buggy that using value i - 1 below works
                     ICategory newCat = new ColorCategory(i - 1, Colors[i]);
                     if (Names != null && Names.Length > i)
                     {
                         newCat.LegendText = Names[i];
                     }
                     else
                     {
                         newCat.LegendText = i.ToString();
                     }
                     Scheme.AddCategory(newCat);
                 }
             }
         }
         else // Assume grid is elevation
         {
             _elevationFactor = 1 / 3640000f;
             _isElevation     = true;
             _extrusion       = 1;
             _scheme.ApplyScheme(ColorSchemeType.FallLeaves, _raster);
         }
     }
 }
Пример #5
0
        private void Configure()
        {
            _shadedRelief = new ShadedRelief();
            _noDataColor  = Color.Transparent;
            Scheme        = new ColorScheme();
            if (_raster != null)
            {
                var Colors = _raster.CategoryColors();
                if (Colors != null && Colors.Length > 0)
                {   // Use colors that are built into the raster, e.g. GeoTIFF with palette
                    _isElevation = false;

                    //use all colors instead of unique colors because unique colors are not allways set/correct
                    int lastColor = Colors[0].ToArgb(); //changed by jany_ 2015-06-02
                    int firstNr   = 0;

                    //group succeding values with the same color to the same category
                    for (int i = 1; i < Colors.Length; i++)
                    {
                        int hash = Colors[i].ToArgb();
                        if (hash != lastColor || i == Colors.Length - 1)
                        {
                            ICategory newCat = new ColorCategory(firstNr, i - 1, Colors[firstNr], Colors[firstNr]);
                            newCat.Range.MaxIsInclusive = true;
                            newCat.Range.MinIsInclusive = true;
                            newCat.LegendText           = firstNr.ToString();
                            Scheme.AddCategory(newCat);
                            firstNr   = i;
                            lastColor = hash;
                        }
                    }
                }
                else // Assume grid is elevation
                {
                    _elevationFactor = 1 / 3640000f;
                    _isElevation     = true;
                    _extrusion       = 1;
                    _scheme.ApplyScheme(ColorSchemeType.FallLeaves, _raster);
                }
            }
        }