Beispiel #1
0
    public void Load(string filename, RectangleD boundingBox)
    {
        var fileInfo = new System.IO.FileInfo(filename);

        Console.WriteLine("Loading " + fileInfo.Name + "...");

        Shapefile shapefile = new Shapefile(filename);

        foreach (var shape in shapefile.OfType <ShapePolygon>())
        {
            foreach (var polygon in Polygon.ReadShapePolygon(shape, this.offset, this.namePrefix))
            {
                if (boundingBox.Left < polygon.Center.x && boundingBox.Right > polygon.Center.x && boundingBox.Top > polygon.Center.z && boundingBox.Bottom < polygon.Center.z)
                {
                    this.add(polygon);
                }
            }
        }
        Console.WriteLine("Loaded " + this.polygons.Count() + " polygons in " + this.data.Keys.Count + " buckets.");
    }