当前位置: 首页>>代码示例>>C#>>正文


C# ESRI.CreateDefaultRaster方法代码示例

本文整理汇总了C#中ESRI.CreateDefaultRaster方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.CreateDefaultRaster方法的具体用法?C# ESRI.CreateDefaultRaster怎么用?C# ESRI.CreateDefaultRaster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ESRI的用法示例。


在下文中一共展示了ESRI.CreateDefaultRaster方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StretchRenderer

        /// <summary>
        /// 根据单波段灰度渲染
        /// </summary>
        /// <param name="rasterDataset">栅格数据集</param>
        /// <param name="graypos">第几波段</param>
        /// <returns></returns>
        public static IRasterRenderer StretchRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset rasterDataset, int graypos)
        {
            try
            {
                //Define the from and to colors for the color ramp.
                IRgbColor fromColor = new RgbColorClass();
                fromColor.Red = 255;
                fromColor.Green = 0;
                fromColor.Blue = 0;
                IColor toColor = new RgbColorClass();
                fromColor.Red = 0;
                fromColor.Green = 255;
                fromColor.Blue = 0;
                //Create the color ramp.
                IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRampClass();
                colorRamp.Size = 255;
                colorRamp.FromColor = fromColor;
                colorRamp.ToColor = toColor;
                bool createColorRamp;
                colorRamp.CreateRamp(out createColorRamp);
                //Create a stretch renderer.
                IRasterStretchColorRampRenderer stretchRenderer = new
                RasterStretchColorRampRendererClass();

                //设置显示对比度和亮度
                //((IRasterDisplayProps)stretchRenderer).BrightnessValue = -90;
                IRasterRenderer rasterRenderer = (IRasterRenderer)stretchRenderer;

                //Set the renderer properties.
                IRaster raster = rasterDataset.CreateDefaultRaster();
                rasterRenderer.Raster = raster;
                rasterRenderer.Update();
                stretchRenderer.BandIndex = graypos;
                //stretchRenderer.ColorRamp = colorRamp;
                //Set the stretch type.
                IRasterStretch stretchType = (IRasterStretch)rasterRenderer;
                stretchType.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations;
                stretchType.StandardDeviationsParam = 2;
                return rasterRenderer;
            }
            catch
            {
                return null;
            }
        }
开发者ID:xfgxfg,项目名称:CropWatchField,代码行数:51,代码来源:BandCombinationShow.cs

示例2: ClassifyRenderer

        public static IRasterRenderer ClassifyRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset pRasterDataset)
        {
            try
            {
                //create the classify render:创建渲染器
                IRasterClassifyColorRampRenderer pClassifyRenderer=new RasterClassifyColorRampRendererClass();
                IRasterRenderer pRasterRenderer=(IRasterRenderer)pClassifyRenderer;
                IRaster pRaster=pRasterDataset.CreateDefaultRaster();
                pRasterRenderer.Raster=pRaster;
                pClassifyRenderer.ClassCount=10;
                pRasterRenderer.Update();

                //创建颜色
                IRgbColor pFromColor=new RgbColorClass();
                pFromColor.Red=255;
                pFromColor.Green=0;
                pFromColor.Blue=0;
                IRgbColor pToColor=new RgbColorClass();
                pToColor.Red=0;
                pToColor.Green=255;
                pToColor.Blue=255;

                //set the color ramp for the symbology:生成色带
                IAlgorithmicColorRamp pRamp=new AlgorithmicColorRampClass();
                pRamp.Size=10;
                pRamp.FromColor=pFromColor;
                pRamp.ToColor=pToColor;
                bool pBoolColorRamp;
                pRamp.CreateRamp(out pBoolColorRamp);
                //create the symbol for the classes.:创建符号
                IFillSymbol pFillSymbol=new SimpleFillSymbolClass();
                for (int i=0;i<pClassifyRenderer.ClassCount;i++){

                    pFillSymbol.Color=pRamp.get_Color(i);
                    pClassifyRenderer.set_Symbol(i,(ISymbol)pFillSymbol);
                    pClassifyRenderer.set_Label(i,Convert.ToString(i));

                }
                return pRasterRenderer;

            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return null;
            }
        }
开发者ID:wblong,项目名称:RasterOperation,代码行数:47,代码来源:Program.cs

示例3: StretchRenderer

 public IRasterRenderer StretchRenderer(ESRI.ArcGIS.Geodatabase.IRasterDataset pRasterDataset)
 {
     try
     {
         //Define the from and to colors for the color ramp.
         IRgbColor pFromColor = new RgbColorClass();
         pFromColor.Red = 255;
         pFromColor.Green = 0;
         pFromColor.Blue = 0;
         IRgbColor pToColor = new RgbColorClass();
         pToColor.Red = 0;
         pToColor.Green = 255;
         pToColor.Blue = 0;
         //Create the color ramp.
         IAlgorithmicColorRamp pRamp = new AlgorithmicColorRampClass();
         pRamp.Size = 255;
         pRamp.FromColor = pFromColor;
         pRamp.ToColor = pToColor;
         bool createColorRamp;
         pRamp.CreateRamp(out createColorRamp);
         //Create a stretch renderer.
         IRasterStretchColorRampRenderer pStretchRenderer = new
             RasterStretchColorRampRendererClass();
         IRasterRenderer pRasterRenderer = (IRasterRenderer)pStretchRenderer;
         //Set the renderer properties.
         IRaster pRaster = pRasterDataset.CreateDefaultRaster();
         pRasterRenderer.Raster = pRaster;
         pRasterRenderer.Update();
         pStretchRenderer.BandIndex = 0;
         pStretchRenderer.ColorRamp = pRamp;
         //Set the stretch type.
         IRasterStretch pStretchType = (IRasterStretch)pRasterRenderer;
         pStretchType.StretchType =
             esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations;
         pStretchType.StandardDeviationsParam = 2;
         return pRasterRenderer;
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return null;
     }
 }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:43,代码来源:MainForm.cs


注:本文中的ESRI.CreateDefaultRaster方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。