Class GreatArcPath.Builder
java.lang.Object
org.apache.commons.geometry.spherical.twod.GreatArcPath.Builder
- Enclosing class:
GreatArcPath
Class used to build arc paths.
-
Method Summary
Modifier and TypeMethodDescriptionAppend an arc to the end of the path.Add a vertex to the end of this path.appendVertices(Collection<Point2S> vertices) Convenience method for appending a collection of vertices to the path in a single method call.appendVertices(Point2S... vertices) Convenience method for appending multiple vertices to the path at once.build()Build aGreatArcPathinstance from the configured path.build(boolean close) Build aGreatArcPathinstance from the configured path.close()Close the current path and build a newGreatArcPathinstance.Get the arc at the end of the path or null if it does not exist.Get the arc at the start of the path or null if it does not exist.Prepend an arc to the beginning of the path.Add a vertex to the front of this path.prependPoints(Collection<Point2S> vertices) Convenience method for prepending a collection of vertices to the path in a single method call.prependPoints(Point2S... vertices) Convenience method for prepending multiple vertices to the path in a single method call.setPrecision(org.apache.commons.numbers.core.Precision.DoubleEquivalence builderPrecision) Set the precision context.
-
Method Details
-
setPrecision
public GreatArcPath.Builder setPrecision(org.apache.commons.numbers.core.Precision.DoubleEquivalence builderPrecision) Set the precision context. This context is used only when creating arcs from appended or prepended points. It is not used when adding existingGreatArcinstances since those contain their own precision contexts.- Parameters:
builderPrecision- precision context to use when creating arcs from points- Returns:
- this instance
-
getStartArc
Get the arc at the start of the path or null if it does not exist.- Returns:
- the arc at the start of the path
-
getEndArc
-
append
Append an arc to the end of the path.- Parameters:
arc- arc to append to the path- Returns:
- the current builder instance
- Throws:
IllegalStateException- if the path contains a previous arc and the end point of the previous arc is not equivalent to the start point of the given arc
-
append
Add a vertex to the end of this path. If the path already has an end vertex, then an arc is added between the previous end vertex and this vertex, using the configured precision context.- Parameters:
vertex- the vertex to add- Returns:
- this instance
- See Also:
-
appendVertices
Convenience method for appending a collection of vertices to the path in a single method call.- Parameters:
vertices- the vertices to append- Returns:
- this instance
- See Also:
-
appendVertices
Convenience method for appending multiple vertices to the path at once.- Parameters:
vertices- the points to append- Returns:
- this instance
- See Also:
-
prepend
Prepend an arc to the beginning of the path.- Parameters:
arc- arc to prepend to the path- Returns:
- the current builder instance
- Throws:
IllegalStateException- if the path contains a start arc and the end point of the given arc is not equivalent to the start point of the start arc
-
prepend
Add a vertex to the front of this path. If the path already has a start vertex, then an arc is added between this vertex and the previous start vertex, using the configured precision context.- Parameters:
vertex- the vertex to add- Returns:
- this instance
- See Also:
-
prependPoints
Convenience method for prepending a collection of vertices to the path in a single method call. The vertices are logically prepended as a single group, meaning that the first vertex in the given collection appears as the first vertex in the path after this method call. Internally, this means that the vertices are actually passed to theprepend(Point2S)method in reverse order.- Parameters:
vertices- the points to prepend- Returns:
- this instance
- See Also:
-
prependPoints
Convenience method for prepending multiple vertices to the path in a single method call. The vertices are logically prepended as a single group, meaning that the first vertex in the given collection appears as the first vertex in the path after this method call. Internally, this means that the vertices are actually passed to theprepend(Point2S)method in reverse order.- Parameters:
vertices- the vertices to prepend- Returns:
- this instance
- See Also:
-
close
Close the current path and build a newGreatArcPathinstance. This method is equivalent tobuilder.build(true).- Returns:
- new closed path instance
-
build
Build aGreatArcPathinstance from the configured path. This method is equivalent tobuilder.build(false).- Returns:
- new path instance
-
build
Build aGreatArcPathinstance from the configured path.- Parameters:
close- if true, the path will be closed by adding an end point equivalent to the start point- Returns:
- new path instance
-