public SimpleFeature convertDwgArc ( String typeName , String layerName , DwgArc arc , int id ) { double [ ] c = arc . getCenter ( ) ; Point2D center = new Point2D . Double ( c [ 0 ] , c [ 1 ] ) ; double radius = ( arc ) . getRadius ( ) ; double initAngle = Math . toDegrees ( ( arc ) . getInitAngle ( ) ) ; double endAngle = Math . toDegrees ( ( arc ) . getEndAngle ( ) ) ; Point2D [ ] ptos = GisModelCurveCalculator . calculateGisModelArc ( center , radius , initAngle , endAngle ) ; CoordinateList coordList = new CoordinateList ( ) ; for ( int j = 0 ; j < ptos . length ; j ++ ) { Coordinate coord = new Coordinate ( ptos [ j ] . getX ( ) , ptos [ j ] . getY ( ) , 0.0 ) ; coordList . add ( coord ) ; } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder ( ) ; b . setName ( typeName ) ; b . setCRS ( crs ) ; b . add ( THE_GEOM , LineString . class ) ; b . add ( LAYER , String . class ) ; SimpleFeatureType type = b . buildFeatureType ( ) ; SimpleFeatureBuilder builder = new SimpleFeatureBuilder ( type ) ; Geometry lineString = gF . createLineString ( coordList . toCoordinateArray ( ) ) ; Object [ ] values = new Object [ ] { lineString , layerName } ; builder . addAll ( values ) ; return builder . buildFeature ( typeName + "." + id ) ; }
Builds a line feature from a dwg arc .