getLineCurve method
This method handles single points as well as LineStrings. LineStrings are assumed not to be closed (the function will not fail for closed lines, but will generate superfluous line caps).
@param inputPts the vertices of the line to offset @param distance the offset distance
@return a Coordinate array representing the curve or null if the curve is empty
Implementation
List<Coordinate>? getLineCurve(List<Coordinate> inputPts, double distance) {
this.distance = distance;
// a zero or negative width buffer of a line/point is empty
if (distance < 0.0 && !bufParams.isSingleSided) return null;
if (distance == 0.0) return null;
double posDistance = distance.abs();
OffsetSegmentGenerator segGen = getSegGen(posDistance);
if (inputPts.length <= 1) {
computePointCurve(inputPts[0], segGen);
} else {
if (bufParams.isSingleSided) {
bool isRightSide = distance < 0.0;
computeSingleSidedBufferCurve(inputPts, isRightSide, segGen);
} else
computeLineBufferCurve(inputPts, segGen);
}
List<Coordinate> lineCoord = segGen.getCoordinates();
return lineCoord;
}