I have polygon geometries that represent building footprints in a shapefile
and I want to extrude them according to an attribute "height" and turn them
3B objects as polyhedral surfaces via extrusion. For this purpose I am
writing an extrusion function. I am using geotools to access and extract
geometries and attributes from shapefile. I am creating top and bottom faces
of buildings as polygon geometries but I could not generate vertical faces.
I could not write a loop that traverse positions and create vertical faces
as polygon geometries. I am stuck with it. I can't create vertical polygon
faces of buildings recırsively. I hope a solution will come out. Any help
would be appreciated. Here is the rest of my code after I extract polygons ;

List<Polygon> polygons = bb.getBboxFeature(shapeFilePath); // returns
polygon geometries

List<PolyhedralSurface> mesh = new ArrayList<PolyhedralSurface>();

for(Polygon poly : polygons) {

    Coordinate[] coords = poly.getCoordinates();
    List<Polygon> faces = new ArrayList<Polygon>();

    for (int i =0; i<coords.length; i++) {

        Double h = 15.00; // height for extrusion

        GeometryBuilder builder = new
GeometryBuilder(DefaultGeographicCRS.WGS84_3D);
        List&lt;Position> dpsBottom = new ArrayList<Position>();
        List<Position> dpsTop = new ArrayList<Position>();

        //bottom positions created using coordinates

        dpsBottom.add(builder.createDirectPosition(new double[]
{coords[i].x, coords[i].y, 0}));

        //top positions created using coordinates

        dpsTop.add(builder.createDirectPosition(new double[] {coords[i].x,
coords[i].y, h}));

My final purpose is create vertical faces and add them to a polygon list.
Then, finaly giving this list to createPolyhedralSurface() function as input
and create building as polyhedral geometry. Maybe there are more efficient
solutions for my purpose which I did not think of it. If there is I am open
to all suggestions.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/geotools-devel-f4265016.html

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to