public static Geometry computeOffsetCurve ( Geometry geometry , double offset , BufferParameters bufferParameters ) { ArrayList < LineString > lineStrings = new ArrayList < LineString > ( ) ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom . getDimension ( ) == 1 ) { lineStringOffSetCurve ( lineStrings , ( LineString ) subGeom , offset , bufferParameters ) ; } else { geometryOffSetCurve ( lineStrings , subGeom , offset , bufferParameters ) ; } } if ( ! lineStrings . isEmpty ( ) ) { if ( lineStrings . size ( ) == 1 ) { return lineStrings . get ( 0 ) ; } else { return geometry . getFactory ( ) . createMultiLineString ( lineStrings . toArray ( new LineString [ 0 ] ) ) ; } } return null ; }
Method to compute the offset line