Class OffsetCurveBuilder


  • public class OffsetCurveBuilder
    extends Object
    Builds a offset curve, that is, a line parallel to the provided geometry at a given distance. An offset curve is not the same as a buffer, the line is built only on one side of the original geometry, and will self intersect if the original geometry does the same.
    Author:
    Andrea Aime - GeoSolutions
    • Constructor Summary

      Constructors 
      Constructor Description
      OffsetCurveBuilder​(double offset)
      Creates an offset builder with the given offset and the default number of quadrant segments QUADRANT_SEGMENTS_DEFAULT
      OffsetCurveBuilder​(double offset, int quadrantSegments)
      Creates an offset builder with the given offset and number of quadrant segments
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Geometry offset​(Geometry g)
      Builds and return the perpendicular offset geometry.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • QUADRANT_SEGMENTS_DEFAULT

        public static int QUADRANT_SEGMENTS_DEFAULT
      • DEFAULT_THRESHOLD_RATIO

        public static double DEFAULT_THRESHOLD_RATIO
    • Constructor Detail

      • OffsetCurveBuilder

        public OffsetCurveBuilder​(double offset)
        Creates an offset builder with the given offset and the default number of quadrant segments QUADRANT_SEGMENTS_DEFAULT
        Parameters:
        offset - The offset distance. The offset line will be on the left for positive values, on the right otherwise
      • OffsetCurveBuilder

        public OffsetCurveBuilder​(double offset,
                                  int quadrantSegments)
        Creates an offset builder with the given offset and number of quadrant segments
        Parameters:
        offset - The offset distance. The offset line will be on the left for positive values, on the right otherwise
        quadrantSegments - The number of segments per quadrant, must be positive
    • Method Detail

      • offset

        public Geometry offset​(Geometry g)
        Builds and return the perpendicular offset geometry. Only the linestring elements in the input geometries will be subject to offset, the returned geometry will be either a LineString or a MultiLineString
        Parameters:
        g - The source geometry
        Returns:
        The offset geometry (a single linestring for single line inputs, a multi-linestring for multi-line inputs), or null if no offset geometry could be computed (e.g. the input geometry is made of points)