/// <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();
            }
        }
Exemple #2
0
 /// <summary>
 /// Loads the values into the color scheme from pre-defined color scheme.
 /// </summary>
 /// <param name="LowValue">The lowest value in the grid. </param>
 /// <param name="HighValue">The highes value in the grid. </param>
 /// <param name="Preset">Optional. The pre-defined color scheme to be used. The default is
 /// MapWinGIS.PredefinedColorScheme.SummerMountains. </param>
 public void UsePredefined(double LowValue, double HighValue, PredefinedColorScheme Preset)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
 /// <summary>
 /// Tries to retrieve any existing color scheme associated with grid or generates a new one if none is found.
 /// </summary>
 /// <param name="retrievalMethod">Colour scheme retrieval method.</param>
 /// <param name="generateMethod">Colour scheme generation method</param>
 /// <param name="Colors">Predefined set of colours to be mapped to grid values during generation process.</param>
 /// <returns>Color scheme or null if both retrieval and generation failed.</returns>
 /// \new491 Added in version 4.9.1
 public GridColorScheme RetrieveOrGenerateColorScheme(tkGridSchemeRetrieval retrievalMethod, tkGridSchemeGeneration generateMethod,
                                                      PredefinedColorScheme Colors)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
 /// <summary>
 /// Generates colour scheme for the grid.
 /// </summary>
 /// <param name="Method">Method of generation to be used.</param>
 /// <param name="Colors">Predefined colour scheme to be mapped to the values of grid.</param>
 /// <returns>Generated colour scheme or null if the operation failed.</returns>
 /// \new491 Added in version 4.9.1
 public GridColorScheme GenerateColorScheme(tkGridSchemeGeneration Method, PredefinedColorScheme Colors)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 /// <summary>
 /// Clears all the existing breaks and creates new set of breaks specified by predefined colour scheme.
 /// </summary>
 /// <remarks>The number of the newly added breaks depends on the colour scheme chosen, usually 2-3.</remarks>
 public void SetColors4(PredefinedColorScheme Scheme)
 {
     throw new NotImplementedException();
 }