Esempio n. 1
0
        public ColorPalette(float minHeight, float maxHeight)
        {
            cR = new float[256];
            cG = new float[256];
            cB = new float[256];

            this.minHeight = minHeight;
            this.maxHeight = maxHeight;

            ColorMode = ColoringType.Monochrome;

            ConstructHeightMap();

            FillWithSampleValues();
        }
Esempio n. 2
0
 /// <summary>
 /// A shortcut to apply new coloring type for each of the breaks of the colors scheme.
 /// </summary>
 /// <param name="ColoringType">New coloring type.</param>
 /// \new491 Added in version 4.9.1
 public void ApplyColoringType(ColoringType ColoringType)
 {
     throw new NotImplementedException();
 }
Esempio n. 3
0
        /// <summary>
        /// Rebuilds color scheme for image layer represented by grid. Grid may be opened directly or using proxy image.
        /// </summary>
        public static void RebuildGridWithNewColorScheme(Image img, PredefinedColorScheme colors, ColoringType coloringType, int bandIndex, bool allowExternalColorScheme)
        {
            // generating new scheme
            var grid = img.OpenAsGrid();

            grid.OpenBand(bandIndex);
            var scheme = grid.GenerateColorScheme(tkGridSchemeGeneration.gsgGradient, colors);

            scheme.ApplyColoringType(coloringType);

            if (img.IsGridProxy)
            {
                var extents = axMap1.Extents;

                // we need to rebuild the proxy layer completely
                axMap1.RemoveAllLayers();

                // in fact it will be removed in grid.CreateProxy, but let's do it explicitly
                if (!grid.RemoveImageProxy())
                {
                    MessageBox.Show("Failed to remove image proxy");
                }
                else
                {
                    grid.GlobalCallback = callback;

                    // first approach
                    grid.OpenBand(bandIndex);

                    // in fact map.AddLayer will make this call internally; but for understanding sake I add it here
                    var newProxy = grid.CreateImageProxy(scheme);
                    if (newProxy == null)
                    {
                        MessageBox.Show("Failed to create image proxy");
                        return;
                    }
                    grid.PreferedDisplayMode = tkGridProxyMode.gpmUseProxy;
                    axMap1.AddLayer(grid, true);
                }

                axMap1.Extents = extents;
            }
            else
            {
                // it's enough to set new color scheme
                img.SourceGridBandIndex = bandIndex;
                img.CustomColorScheme   = scheme;
                img.AllowGridRendering  = allowExternalColorScheme ? tkGridRendering.grForceForAllFormats : tkGridRendering.grForGridsOnly;
                axMap1.Redraw();
            }
        }