public SimpleFeature convertDwgSolid( String typeName, String layerName, DwgSolid solid, int id ) {
        double[] p1 = solid.getCorner1();
        double[] p2 = solid.getCorner2();
        double[] p3 = solid.getCorner3();
        double[] p4 = solid.getCorner4();
        Point2D[] ptos = new Point2D[]{new Point2D.Double(p1[0], p1[1]),
                new Point2D.Double(p2[0], p2[1]), new Point2D.Double(p3[0], p3[1]),
                new Point2D.Double(p4[0], p4[1])};
        CoordinateList coordList = new CoordinateList();
        for( int j = 0; j < ptos.length; j++ ) {
            Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY());
            coordList.add(coord);
        }
        coordList.closeRing();

        SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
        b.setName(typeName);
        b.setCRS(crs);
        b.add(THE_GEOM, Polygon.class);
        b.add(LAYER, String.class);
        SimpleFeatureType type = b.buildFeatureType();
        SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
        LinearRing linearRing = gF.createLinearRing(coordList.toCoordinateArray());
        Geometry polygon = gF.createPolygon(linearRing, null);
        Object[] values = new Object[]{polygon, layerName};
        builder.addAll(values);
        return builder.buildFeature(typeName + "." + id);
    }
public SimpleFeature convertDwgSolid ( String typeName , String layerName , DwgSolid solid , int id ) { double [ ] p1 = solid . getCorner1 ( ) ; double [ ] p2 = solid . getCorner2 ( ) ; double [ ] p3 = solid . getCorner3 ( ) ; double [ ] p4 = solid . getCorner4 ( ) ; Point2D [ ] ptos = new Point2D [ ] { new Point2D . Double ( p1 [ 0 ] , p1 [ 1 ] ) , new Point2D . Double ( p2 [ 0 ] , p2 [ 1 ] ) , new Point2D . Double ( p3 [ 0 ] , p3 [ 1 ] ) , new Point2D . Double ( p4 [ 0 ] , p4 [ 1 ] ) } ; CoordinateList coordList = new CoordinateList ( ) ; for ( int j = 0 ; j < ptos . length ; j ++ ) { Coordinate coord = new Coordinate ( ptos [ j ] . getX ( ) , ptos [ j ] . getY ( ) ) ; coordList . add ( coord ) ; } coordList . closeRing ( ) ; SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder ( ) ; b . setName ( typeName ) ; b . setCRS ( crs ) ; b . add ( THE_GEOM , Polygon . class ) ; b . add ( LAYER , String . class ) ; SimpleFeatureType type = b . buildFeatureType ( ) ; SimpleFeatureBuilder builder = new SimpleFeatureBuilder ( type ) ; LinearRing linearRing = gF . createLinearRing ( coordList . toCoordinateArray ( ) ) ; Geometry polygon = gF . createPolygon ( linearRing , null ) ; Object [ ] values = new Object [ ] { polygon , layerName } ; builder . addAll ( values ) ; return builder . buildFeature ( typeName + "." + id ) ; }
Builds a polygon feature from a dwg solid.