• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IRaster类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IRaster的典型用法代码示例。如果您正苦于以下问题:C# IRaster类的具体用法?C# IRaster怎么用?C# IRaster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IRaster类属于命名空间,在下文中一共展示了IRaster类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ExportLayerImage

        public static string ExportLayerImage(IRaster pRaster, string[] bbox, string[] size,string outputUrl,string serveroutDir)
        {
            //判断栅格文件是否已经存在,存在删除,原因是如果存在,不删除的话,保存图片出错

            //创建rasterlayer
            IRasterLayer pRasterLayer = new RasterLayerClass();

            //获取mapServer中所有的图层
            IMap pMap = new MapClass();
            pRasterLayer.CreateFromRaster(pRaster);
            pMap.AddLayer(pRasterLayer as ILayer);            //
            //
            Size pSize = new Size();
            pSize.Width = Convert.ToInt32(size[0]);
            pSize.Height = Convert.ToInt32(size[1]);

            //
            IEnvelope pEnvelop = new EnvelopeClass();
            pEnvelop.PutCoords(Convert.ToDouble(bbox[0]), Convert.ToDouble(bbox[1]), Convert.ToDouble(bbox[2]), Convert.ToDouble(bbox[3]));
            Image pImage = SaveCurrentToImage(pMap, pSize, pEnvelop);
            string imageName = System.DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + ".png";
            //outputUrl="http://localhost:6080/arcgis/rest/directories/arcgisoutput/imageserver/miyunspot_ImageServer/"

            // serveroutDir="D:\arcgisserver\directories\arcgisoutput\imageserver\miyunspot_ImageServer";
            string url = outputUrl + imageName;
            string path = System.IO.Path.Combine(serveroutDir, imageName);
            pImage.Save(path);
            return url;
        }
开发者ID:xyhxyw,项目名称:DeveloperSumit2014,代码行数:29,代码来源:ExportImage.cs


示例2: UnionEnvelope

 /// <summary>
 /// Expands the first envelope to include the second.
 /// </summary>
 /// <param name="input1">The first input raster to union the envelope for.</param>
 /// <param name="input2">The second input raster to union the envelope for.</param>
 /// <returns>The expanded envelope.</returns>
 private static Extent UnionEnvelope(IRaster input1, IRaster input2)
 {
     Extent e1 = input1.Bounds.Extent;
     Extent e2 = input2.Bounds.Extent;
     e1.ExpandToInclude(e2);
     return e1;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:13,代码来源:RasterMagic.cs


示例3: CreateGridFromExtents

        /// <summary>
        /// This function creates the HDR of Gridfile
        /// </summary>
        /// <param name="inExtents"> Extension of grid</param>
        /// <param name="cellSize">Size cell of the grid</param>
        /// <param name="projection">Projection (the same that shapefile)</param>
        /// <param name="noDataValue">No value definition</param>
        /// <param name="outGridPath">Path of the output</param>
        /// <param name="outGrid">Name of the output grid</param>
        public static void CreateGridFromExtents(
            Extent inExtents, double cellSize, ProjectionInfo projection, double noDataValue, string outGridPath, out IRaster outGrid)
        {

            double height = Math.Abs(inExtents.MaxY - inExtents.MinY);
            double width = Math.Abs(inExtents.MaxX - inExtents.MinX);
            int numberRows = Convert.ToInt32(Math.Ceiling(height / cellSize)) + 1;
            int numberCols = Convert.ToInt32(Math.Ceiling(width / cellSize)) + 1;

            // outGrid = Raster.CreateRaster(@outGridPath, null, demRaster.NumColumns, demRaster.NumRows, 1, demRaster.DataType, rasterOptions);
            outGrid = Raster.CreateRaster(@outGridPath, null, numberCols, numberRows, 1, typeof(float), new String[] { });
            outGrid.NoDataValue = noDataValue;
            outGrid.Projection = projection;
            outGrid.CellHeight = cellSize;
            outGrid.CellWidth = cellSize;
            //if (inExtents.MinX < 0)
            //    outGrid.Xllcenter = inExtents.MinX + (cellSize / 2.0);
            //else
            outGrid.Xllcenter = inExtents.MinX;// -(cellSize / 2.0);

            //if (inExtents.MinY < 0)
            //    outGrid.Yllcenter = inExtents.MinY + (cellSize / 2.0);
            //else
            outGrid.Yllcenter = inExtents.MinY;// -(cellSize / 2.0);
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:34,代码来源:Clip2.cs


示例4: export

        public void export(string name,IRaster raster)
        {
            //GATGrid grid = new GATGrid();
            //grid.DataFileName = name;
            //grid.WriteChangesToFile = true;
            //grid.West = raster.Bounds.Left();
            //grid.North = raster.Bounds.Top();
            //grid.South = raster.Bounds.Bottom();
            //grid.East = raster.Bounds.Right();
            //grid.GridResolution = raster.CellHeight;
            //grid.DataType = "float";
            //grid.DataScale = "continuous";
            //grid.InitializeGrid(raster.NumColumns, raster.NumRows);
            //grid.Maximum = (float)raster.Maximum;
            //grid.Minimum = (float)raster.Minimum;

            //grid.SetBlockData();
            //grid.HeaderFileName = name;
            //for (int row = 0; row < raster.NumRows; row++)
            //    for (int col = 0; col < raster.NumColumns; col++)
            //    {
            //        float v = (float)raster.Value[row, col];
            //        grid[col, row] = v;

            //    }


            //grid.WriteHeaderFile();
            //grid.WriteDataInMemoryToFile();
            //grid.ReleaseMemoryResources();
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:31,代码来源:WhiteBoxDep.cs


示例5: ApplyMLClassifyFunction

        public static string ApplyMLClassifyFunction(IImageServer imageServer, IRaster pRaster, string signaturfile)
        {
            //Define a  function.
            IRasterFunction hillshadeFunction = new MLClassifyFunctionClass();

            IRasterFunctionArguments functionArgument = new MLClassifyFunctionArgumentsClass();
            functionArgument.PutValue("Raster", pRaster);
            functionArgument.PutValue("SignatureFile", signaturfile);

            //Attach the function to a rendering rule.
            IRenderingRule renderRule = new RenderingRuleClass();
            renderRule.Function = hillshadeFunction;
            renderRule.Arguments = functionArgument;
            renderRule.VariableName = "DEM";

            //Define the image description.
            IGeoImageDescription geoImageDesc = new GeoImageDescriptionClass();
            geoImageDesc.Compression = "LZ77";
            geoImageDesc.Extent = imageServer.ServiceInfo.Extent;
            geoImageDesc.Width = 800;
            geoImageDesc.Height = 600;
            geoImageDesc.Interpolation = rstResamplingTypes.RSP_BilinearInterpolation;
            IGeoImageDescription2 geoImageDesc2 = (IGeoImageDescription2)geoImageDesc;

            geoImageDesc2.RenderingRule = renderRule;

            //Define the return image type.
            IImageType imgType = new ImageTypeClass();
            imgType.Format = esriImageFormat.esriImagePNG;
            imgType.ReturnType = esriImageReturnType.esriImageReturnURL;

            //Export the image.
            IImageResult imgResult = imageServer.ExportImage(geoImageDesc2, imgType);
            return imgResult.URL;
        }
开发者ID:xyhxyw,项目名称:DeveloperSumit2014,代码行数:35,代码来源:Classify.cs


示例6: QueryRasterLayer

 public QueryRasterLayer(IMapLayerInfo mapLayerInfo, IRaster raster)
 {
     this.Name = mapLayerInfo.Name;
     this.ID = mapLayerInfo.ID;
     this.Extent = mapLayerInfo.Extent;
     this.Raster = raster;
 }
开发者ID:NGFieldScope,项目名称:FieldScope-SOE,代码行数:7,代码来源:QueryRasterSOE.cs


示例7: buildStats

        public static void buildStats(IRaster inputRaster, string functionModelPath)
        {
            IRasterProps rsProps = (IRasterProps)inputRaster;
            double[] noDataArr = (double[])rsProps.NoDataValue;
            IRasterBandCollection rsBc = (IRasterBandCollection)inputRaster;
            string statPath = functionModelPath.Replace(".fds",".sta");
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(statPath))
            {
                for (int i = 0; i < rsBc.Count; i++)
                {
                    double ndVl = noDataArr[i];
                    IRasterBand rsBand = rsBc.Item(i);
                    IRasterStatistics rsStats = rsBand.Statistics;
                    double max = checkStatNumber(rsStats.Maximum,ndVl);
                    double min = checkStatNumber(rsStats.Minimum,ndVl);
                    double mean = checkStatNumber(rsStats.Mean,ndVl);
                    double std = checkStatNumber(rsStats.StandardDeviation,ndVl);
                    string bndStatsLn = max.ToString() + ":" + mean.ToString() + ":" + min.ToString() + ":" + std.ToString()+ ":"+rsStats.SkipFactorX.ToString()+":"+rsStats.SkipFactorY;
                    List<string> igVlLst = new List<string>();
                    if (!(rsStats.IgnoredValues == null))
                    {
                        System.Array ignoredVl = (System.Array)rsStats.IgnoredValues;

                        for (int j = 0; j < ignoredVl.Length; j++)
                        {
                            string vl = checkStatNumber((double)ignoredVl.GetValue(j),ndVl).ToString();
                            igVlLst.Add(vl);
                        }
                    }
                    bndStatsLn = bndStatsLn + ":" + String.Join(",", igVlLst.ToArray());
                    sw.WriteLine(bndStatsLn);
                }
                sw.Close();
            }
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:35,代码来源:functionModel.cs


示例8: ReSample

        /// <summary>
        /// This will resample the cells.
        /// If the cell size is zero, this will default to the shorter of the width or height
        /// divided by 256.
        /// </summary>
        /// <param name="input1">Input Raster.</param>
        /// <param name="cellHeight">New Cell Height or Null.</param>
        /// <param name="cellWidth">New Cell Width or Null.</param>
        /// <param name="destFilename">Output Raster Name.</param>
        /// <param name="progressHandler">An interface for handling the progress messages.</param>
        /// <returns>Resampled raster.</returns>
        public static IRaster ReSample(IRaster input1,double cellHeight, double cellWidth, string destFilename, IProgressHandler progressHandler)
        {
            if (input1 == null)
                return null;

            IEnvelope envelope = input1.Bounds.Envelope;

            if (cellHeight == 0)
            {
                cellHeight = envelope.Height / 256;
            }
            if(cellWidth==0)
            {
                cellWidth = envelope.Width / 256;
            }
                
            //Calculate new number of columns and rows
            int noOfCol = Convert.ToInt32(Math.Abs(envelope.Width / cellWidth));
            int noOfRow = Convert.ToInt32(Math.Abs(envelope.Height / cellHeight));


            IRaster output = Raster.Create(destFilename, "", noOfCol, noOfRow, 1, input1.DataType, new[] { "" });
            RasterBounds bound = new RasterBounds(noOfRow, noOfCol, envelope);
            output.Bounds = bound;

            output.NoDataValue = input1.NoDataValue;

            RcIndex index1;
            int max = (output.Bounds.NumRows);
            ProgressMeter pm = new ProgressMeter(progressHandler, "ReSize Cells", max);
            //Loop throug every cell for new value

            for (int i = 0; i < max; i++)
            {
                for (int j = 0; j < output.Bounds.NumColumns; j++)
                {
                    //Projet the cell position to Map
                    Coordinate cellCenter = output.CellToProj(i, j);
                    index1 = input1.ProjToCell(cellCenter);

                    double val;
                    if (index1.Row <= input1.EndRow && index1.Column <= input1.EndColumn && index1.Row > -1 && index1.Column > -1)
                    {
                        if (input1.Value[index1.Row, index1.Column] == input1.NoDataValue)
                            val = output.NoDataValue;
                        else
                            val = input1.Value[index1.Row, index1.Column];
                    }
                    else
                        val = output.NoDataValue;

                    output.Value[i, j] = val;
                }
                pm.CurrentPercent = i;
            }

            output.Save();
            pm.Reset();
            return output;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:71,代码来源:ReSampleCells.cs


示例9: addRasterToComboBox

 public void addRasterToComboBox(string rstName, IRaster rst)
 {
     if (!cmbInRaster1.Items.Contains(rstName))
     {
         cmbInRaster1.Items.Add(rstName);
         rstDic[rstName] = rst;
     }
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:8,代码来源:frmNDVIRaster.cs


示例10: addRasterToComboBox

 public void addRasterToComboBox(string rstName, IRaster rst)
 {
     if (!cmbRaster.Items.Contains(rstName))
     {
         cmbRaster.Items.Add(rstName);
         rstDic.Add(rstName, rst);
     }
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:8,代码来源:frmSampleRaster.cs


示例11: dataPrepAdjustAccuracyAssessment

 public dataPrepAdjustAccuracyAssessment(IFeatureClass ProjectArea, IRaster Map, string originalAccuracyAssessmentModel, string adjustedAccuracyAssessmentModel)
 {
     projectArea = ProjectArea;
     rstMap = Map;
     oModel = originalAccuracyAssessmentModel;
     aModel = adjustedAccuracyAssessmentModel;
     rsUtil = new rasterUtil();
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:8,代码来源:dataPrepAdjustAccuracyAssessment.cs


示例12: GetStartColumn

        /// <summary>
        /// Finds the first raster column corresponding to the left-most edge of the poly
        /// </summary>
        /// <param name="polygon">the polygon</param>
        /// <param name="inputRaster">the input raster</param>
        /// <returns>The raster column corresponding to the left-most edge of the poly 
        /// (if raster starts before left edge of the poly)
        /// or the first raster column (if raster starts after left edge of the poly)</returns>
        /// <remarks>If the poly sits to the left of the raster then the first column of the raster is returned.</remarks>
        private static int GetStartColumn(IFeature polygon, IRaster inputRaster)
        {
            double rasterMinXCenter = inputRaster.Xllcenter;

            // Does the poly sit to the left of the raster or does the raster start before the left edge of the poly
            if (polygon.Envelope.Minimum.X < rasterMinXCenter)
                return 0;
            else
                return ColumnIndexToProcess(polygon.Envelope.Minimum.X, rasterMinXCenter, inputRaster.CellWidth);
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:19,代码来源:ClipRaster.cs


示例13: GetEndColumn

        /// <summary>
        /// Finds the last raster column corresponding to the right-most edge of the poly
        /// </summary>
        /// <param name="polygon">the polygon</param>
        /// <param name="inputRaster">the input raster</param>
        /// <returns>The raster column corresponding to the right-most edge of the poly 
        /// (if raster ends after the right edge of the poly)
        /// or the last raster column (if raster ends before right edge of the poly)</returns>
        private static int GetEndColumn(IFeature polygon, IRaster inputRaster)
        {
            double rasterMaxXCenter = inputRaster.Extent.MaxX - inputRaster.CellWidth / 2;

            // Does the poly sit to the right of the raster or does the raster end after the right edge of the poly
            if (polygon.Envelope.Right() > rasterMaxXCenter)
                return inputRaster.NumColumns - 1;
            else
                return ColumnIndexToProcess(polygon.Envelope.Right(), rasterMaxXCenter, inputRaster.CellWidth);
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:18,代码来源:ClipRaster.cs


示例14: CreateDefaultRasterRenderer

        public IRasterRenderer CreateDefaultRasterRenderer(IRaster raster)
        {

            //Get raster dataset
            IRasterBandCollection rasterBandCollection = (IRasterBandCollection)raster;
            IRasterBand rasterBand = rasterBandCollection.Item(0);
            IRasterDataset rasterDataset = (IRasterDataset)rasterBand;

            //Check for TIFF format
            string format_Renamed = rasterDataset.Format;
            if (format_Renamed.Substring(0, 4) != "TIFF")
            {
                return null;
            }

            //check for bit depth
            IRasterProps rasterProps = (IRasterProps)rasterBand;
            if (rasterProps.PixelType != rstPixelType.PT_U1)
            {
                return null;
            }

            //create renderer for 1 bit raster
            //Create a unique value renderer and associate it with raster
            IRasterUniqueValueRenderer rasterUniqueValueRenderer = new RasterUniqueValueRendererClass();
            IRasterRenderer rasterRenderer = (IRasterRenderer)rasterUniqueValueRenderer;
            rasterRenderer.Raster = raster;
            rasterRenderer.Update();

            //Define the renderer
            rasterUniqueValueRenderer.HeadingCount = 1;
            rasterUniqueValueRenderer.set_Heading(0, "");
            rasterUniqueValueRenderer.set_ClassCount(0, 2);
            rasterUniqueValueRenderer.Field = "VALUE";
            rasterUniqueValueRenderer.AddValue(0, 0, 0);
            rasterUniqueValueRenderer.AddValue(0, 1, 1);
            rasterUniqueValueRenderer.set_Label(0, 0, "0");
            rasterUniqueValueRenderer.set_Label(0, 1, "1");

            // Define symbology for rendering value 0
            IColor color1 = (IColor)(CreateRGBColor(200, 50, 0)); //Brown color

            ISimpleFillSymbol simpleFillSymbol1 = new SimpleFillSymbolClass();
            simpleFillSymbol1.Color = color1;
            rasterUniqueValueRenderer.set_Symbol(0, 0, (ISymbol)simpleFillSymbol1);

            IColor color2 = new RgbColorClass();
            color2.NullColor = true;

            ISimpleFillSymbol simpleFillSymbol2 = new SimpleFillSymbolClass();
            simpleFillSymbol2.Color = color2;

            rasterUniqueValueRenderer.set_Symbol(0, 1, (ISymbol)simpleFillSymbol2);
            return rasterRenderer;
        }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:55,代码来源:RasterRenderMaker_1bitTiff_csharp.cs


示例15: Process

        public Dictionary<int, HashSet<Point>> Process(IRaster input)
        {
            _input = input;

            _width = input.NumColumns;
            _height = input.NumRows;
            _board = new int[_width, _height];

            Dictionary<int, HashSet<Point>> patterns = Find(_width, _height);
            return patterns;
        }
开发者ID:tdhopper,项目名称:Connected-Component-Labeling-Algorithm,代码行数:11,代码来源:CCL.cs


示例16: dataPrepStrata

 public dataPrepStrata(IRaster VariableRaster, IRaster strataRaster)
 {
     InValueRaster = VariableRaster;
     InStrataRaster = strataRaster;
     VariableFieldNames = new string[((IRasterBandCollection)InValueRaster).Count];
     for (int i = 0; i < VariableFieldNames.Length; i++)
     {
         VariableFieldNames[i] = (i + 1).ToString();
     }
     buildModel();
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:11,代码来源:dataPrepStrata.cs


示例17: GetXYCell

        public Coordinate GetXYCell(IRaster raster, int col, int row)
        {
            double xmin = raster.Xllcenter;
            double ymin = raster.Yllcenter;
            double cell = raster.CellWidth;
            int numColumns = raster.NumColumns;
            int numRows = raster.NumRows;

            double y = ((numRows - row) * cell) + ymin;
            double x = (col * cell) + xmin;
            return new Coordinate(x, y);
        }
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:12,代码来源:ViewRasterDataForm.cs


示例18: dataPrepPrincipleComponents

 public dataPrepPrincipleComponents(IRaster raster,string varianceCovariancePath=null)
 {
     inraster = raster;
     IRasterBandCollection bc = (IRasterBandCollection)inraster;
     int bcCnt = bc.Count;
     VariableFieldNames = new string[bcCnt];
     for (int i = 0; i < bcCnt; i++)
     {
         VariableFieldNames[i] = "band_" + (i + 1).ToString();
     }
     varcovpath = varianceCovariancePath;
     buildModel();
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:13,代码来源:dataPrepPrincipleComponents.cs


示例19: ExportData

 /// <summary>
 /// Export data from a raster layer.
 /// </summary>
 /// <param name="e"></param>
 public void ExportData(IRaster e)
 {
     using (var sfd = new SaveFileDialog
         {
             Filter = DataManager.DefaultDataManager.RasterWriteFilter
         })
     {
         if (ShowDialog(sfd) == DialogResult.OK)
         {
             e.SaveAs(sfd.FileName);        
         }
     }
 }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:17,代码来源:RasterLayerActions.cs


示例20: dataPrepCluster

 public dataPrepCluster(IRaster raster, int numberOfClasses)
 {
     inraster = raster;
     IRasterBandCollection bc = (IRasterBandCollection)inraster;
     int bcCnt = bc.Count;
     VariableFieldNames = new string[bcCnt];
     for (int i = 0; i < bcCnt; i++)
     {
         VariableFieldNames[i] = "band_" + (i + 1).ToString();
     }
     k = numberOfClasses;
     buildModel();
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:13,代码来源:dataPrepCluster.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IRdfHandler类代码示例发布时间:2022-05-24
下一篇:
C# IRange类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap