Class VariableWidthBuffer
- java.lang.Object
-
- org.locationtech.jts.operation.buffer.VariableWidthBuffer
-
public class VariableWidthBuffer extends java.lang.Object
Creates a buffer polygon with variable width along a line.Only single lines are supported as input, since buffer widths generally need to be specified specifically for each line.
- Author:
- Martin Davis
-
-
Constructor Summary
Constructors Constructor Description VariableWidthBuffer(Geometry line, double[] width)
Creates a generator for a variable-width line buffer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Geometry
buffer(Geometry line, double startWidth, double endWidth)
Creates a buffer polygon along a line with the width interpolated between a start width and an end width.static Geometry
bufferAternating(Geometry line, double width1, double width2)
Geometry
getResult()
Gets the computed variable-width line buffer.static double[]
interpolate(LineString line, double start, double end)
Computes a list of values for the points along a line by interpolating between values for the start and end point.
-
-
-
Constructor Detail
-
VariableWidthBuffer
public VariableWidthBuffer(Geometry line, double[] width)
Creates a generator for a variable-width line buffer.- Parameters:
line
-width
-
-
-
Method Detail
-
buffer
public static Geometry buffer(Geometry line, double startWidth, double endWidth)
Creates a buffer polygon along a line with the width interpolated between a start width and an end width.- Parameters:
line
- the line to bufferstartWidth
- the buffer width at the start of the lineendWidth
- the buffer width at the end of the line- Returns:
- the variable-width buffer polygon
-
bufferAternating
public static Geometry bufferAternating(Geometry line, double width1, double width2)
-
interpolate
public static double[] interpolate(LineString line, double start, double end)
Computes a list of values for the points along a line by interpolating between values for the start and end point. The interpolation is based on the distance of each point along the line relative to the total line length.- Parameters:
line
- the line to interpolate alongstart
- the start valueend
- the end value- Returns:
- the array of interpolated values
-
getResult
public Geometry getResult()
Gets the computed variable-width line buffer.- Returns:
- a polygon
-
-