Package com.massifmaps.geometry
Class ManeuverArrowBuilder
java.lang.Object
com.massifmaps.geometry.ManeuverArrowBuilder
A builder that cuts a navigation maneuver arrow out of a route geometry.
The arrow is the piece of the route around the maneuver point - LengthBefore metres of the
leg the driver is on, LengthAfter metres of the leg it turns into - plus the point where it
ends and the compass bearing it ends with.
The result is a FeatureCollection in WGS84 holding ONE line, running the way the driver
goes. The head is drawn by the style, not by this: 'line-end-arrow' puts an arrow on the
last vertex of a line, sized in multiples of the line width and extruded with the line, so
the head keeps its screen size and a casing rule outlines the whole arrow evenly.
The arrow is the piece of the route around the maneuver point - LengthBefore metres of the
leg the driver is on, LengthAfter metres of the leg it turns into - plus the point where it
ends and the compass bearing it ends with.
The result is a FeatureCollection in WGS84 holding ONE line, running the way the driver
goes. The head is drawn by the style, not by this: 'line-end-arrow' puts an arrow on the
last vertex of a line, sized in multiples of the line width and extruded with the line, so
the head keeps its screen size and a casing rule outlines the whole arrow evenly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildArrow(Projection projection, MapPosVector points, MapPos maneuverPos) Builds the arrow around the route point nearest to the given position.buildArrowAtIndex(Projection projection, MapPosVector points, int maneuverIndex) Builds the arrow around the route point at the given index.floatReturns the length of the arrow after the maneuver point.floatReturns the length of the arrow before the maneuver point.voidsetLengthAfter(float length) Sets the length of the arrow after the maneuver point.voidsetLengthBefore(float length) Sets the length of the arrow before the maneuver point.
-
Constructor Details
-
ManeuverArrowBuilder
public ManeuverArrowBuilder()
-
-
Method Details
-
getLengthBefore
public float getLengthBefore()Returns the length of the arrow before the maneuver point.- Returns:
- The length before the maneuver point in meters.
-
setLengthBefore
public void setLengthBefore(float length) Sets the length of the arrow before the maneuver point. The arrow is shortened if the
route is shorter than this. The default is 30.- Parameters:
length- The length before the maneuver point in meters.
-
getLengthAfter
public float getLengthAfter()Returns the length of the arrow after the maneuver point.- Returns:
- The length after the maneuver point in meters.
-
setLengthAfter
public void setLengthAfter(float length) Sets the length of the arrow after the maneuver point. The arrow is shortened if the
route is shorter than this. The default is 30.- Parameters:
length- The length after the maneuver point in meters.
-
buildArrow
Builds the arrow around the route point nearest to the given position.- Parameters:
projection- The projection of the route points. Null means WGS84.points- The route geometry.maneuverPos- The maneuver position, in the same projection as the points.- Returns:
- The arrow features in WGS84. Empty if the route is too short to cut an arrow from.
-
buildArrowAtIndex
public FeatureCollection buildArrowAtIndex(Projection projection, MapPosVector points, int maneuverIndex) Builds the arrow around the route point at the given index. This is the index a routing
instruction refers to.- Parameters:
projection- The projection of the route points. Null means WGS84.points- The route geometry.maneuverIndex- The index of the maneuver point in the route geometry.- Returns:
- The arrow features in WGS84. Empty if the route is too short to cut an arrow from.
-