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


C# FeatureSet.Dispose方法代码示例

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


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

示例1: MapRasterToTriangulation


//.........这里部分代码省略.........

                                if (m > -1)
                                {
                                    rasterWaterSurfaceMapping[i][j] = k;
                                    mapping[j * xSize + i] = k;
                                    rasterTriangleMapping[i][j] = m;
                                }
                            }
                        }
                    }
                }
                coordinates.Add(coordinate);
            }
        }

        using(IFeatureSet set = new FeatureSet(FeatureType.MultiPoint))
        {
            foreach(var p in coordinates)
            set.AddFeature(new MultiPoint(p));

            set.SaveAs(localWorkspace + "\\" + name + "_point.shp", true);
        }
        //);

        OSGeo.GDAL.Driver driver = Gdal.GetDriverByName(rasterDriver);
        Dataset newRaster = driver.Create(localWorkspace + "\\" + name + "_mapping.tif", xSize, ySize, 1, dataType, new string[] { "TFW=YES", "COMPRESS=LZW" });
        newRaster.GetRasterBand(1).SetNoDataValue(noData);
        newRaster.SetGeoTransform(geoTransformation);
        newRaster.SetProjection(projection);

        Band newRasterBand = newRaster.GetRasterBand(1);
        newRasterBand.WriteRaster(0, 0, xSize, ySize, mapping, xSize, ySize, 0, 0);
        double min, max, mean, stdev;
        newRasterBand.GetStatistics(0, 1, out min, out max, out mean, out stdev);
        newRasterBand.FlushCache();
        newRaster.FlushCache();
        newRaster.Dispose();
        newRaster = null;

        driver.Dispose();
        driver = null;

        using (IFeatureSet fs = new FeatureSet(DotSpatial.Topology.FeatureType.Polygon))
        {
            fs.DataTable.Columns.AddRange(new DataColumn[]
                    {
                      new DataColumn("Identifier" , typeof(int)),
                    });

            int tcount = 0;

            for (int k = 0; k < waterSurfacePolygons.Count; k++)
            {
                WaterSurfacePolygon surface = waterSurfacePolygons[k];

                foreach (TriangleNet.Data.Triangle pgon in surface.Triangles)
                {
                    TriangleNet.Data.Triangle ts = pgon;
                    List<Coordinate> vertices = new List<Coordinate>();

                    Point p0 = surface.Points[ts.P0];
                    Point p1 = surface.Points[ts.P1];
                    Point p2 = surface.Points[ts.P2];

                    Coordinate c1 = new Coordinate(p0.X, p0.Y, p0.Z);
                    Coordinate c2 = new Coordinate(p1.X, p1.Y, p1.Z);
                    Coordinate c3 = new Coordinate(p2.X, p2.Y, p2.Z);

                    vertices.Add(c1);
                    vertices.Add(c2);
                    vertices.Add(c3);

                    Polygon polygon = new Polygon(vertices);

                    IFeature fset = fs.AddFeature(polygon);

                    fset.DataRow.BeginEdit();

                    fset.DataRow["Identifier"] = k;

                    fset.DataRow.EndEdit();

                    tcount++;
                }
            }

            fs.SaveAs(localWorkspace + "\\" + name + "_polygon.shp", true);
            fs.Close();
            fs.Dispose();
        }

        double temp = 100;
        Console.SetCursorPosition(0, Console.CursorTop);
        Console.WriteLine("Progress => " + temp.ToString("###") + " % \n");

        temp = foundCount * 100.0 / (xSize * ySize * 1.0);
        Console.WriteLine(temp.ToString("###.0") + " %  of pixels were found in triangulation \n");

        Console.WriteLine("Finished mapping elevation raster pixels to triangulation !\n");
    }
开发者ID:calebbuahin,项目名称:RCAFF,代码行数:101,代码来源:ForeCastConfiguration.cs


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