Class GLRouteBuilder

java.lang.Object
globus.glmap.GLNativeObject
globus.glroute.GLRouteBuilder

public class GLRouteBuilder extends GLNativeObject
Builds custom routes programmatically (maneuvers, geometry, and instructions).
  • Constructor Details

    • GLRouteBuilder

      public GLRouteBuilder()
      Default constructor
  • Method Details

    • setLanguage

      public void setLanguage(@NonNull String language)
      Sets the language for maneuver instructions.
      Parameters:
      language - The language code (e.g., "en", "fr") for the maneuver instructions.
    • addTargetPoint

      public void addTargetPoint(@NonNull GLRoutePoint point)
      Adds a target point to the route.
      Parameters:
      point - The GLRoutePoint to add.
    • addManeuver

      public void addManeuver(int type, @NonNull MapPoint[] points, @Nullable float[] heights)
      Adds a maneuver to the route.
      Parameters:
      type - The type of the maneuver, defined by GLRouteManeuver.Type.
      points - An array of MapPoint objects representing the points of the maneuver.
      heights - An optional array of heights corresponding to the points, or null if not applicable.
    • addLine

      public void addLine(@NonNull GLMapVectorObject line)
      Adds all polyline segments from the specified vector object as maneuvers.

      The object must contain line geometry; each segment is appended as a StayStraight maneuver, and the builder automatically appends a final Destination maneuver.

      Parameters:
      line - The GLMapVectorObject containing the line geometry to append.
    • setManeuverTime

      public void setManeuverTime(double maneuverTime)
      Sets the time for the maneuver.
      Parameters:
      maneuverTime - The time for the maneuver in seconds.
    • setManeuverInstruction

      public void setManeuverInstruction(int type, @NonNull String instruction)
      Sets a short instruction for the previously added maneuver.
      Parameters:
      type - The type of instruction to set, defined by GLRouteManeuver.InstructionType.
      instruction - The text of the instruction.
    • setManeuverShortInstruction

      public void setManeuverShortInstruction(@NonNull String instruction)
      Sets the short instruction (e.g., "Exit 3A → AZ 202 Loop East") for the previously added maneuver.
      Parameters:
      instruction - The short instruction text.
    • setManeuverTransitionInstruction

      public void setManeuverTransitionInstruction(@NonNull String instruction)
      Sets the transition instruction text for the previously added maneuver.
      Parameters:
      instruction - The transition instruction text.
    • setManeuverVerbalPreTransitionInstruction

      public void setManeuverVerbalPreTransitionInstruction(@NonNull String instruction)
      Sets the verbal pre-transition instruction for the previously added maneuver.
      Parameters:
      instruction - The verbal pre-transition instruction text.
    • setManeuverVerbalTransitionInstruction

      public void setManeuverVerbalTransitionInstruction(@NonNull String instruction)
      Sets the verbal transition instruction for the previously added maneuver.
      Parameters:
      instruction - The verbal transition instruction text.
    • setManeuverVerbalPostTransitionInstruction

      public void setManeuverVerbalPostTransitionInstruction(@NonNull String instruction)
      Sets the verbal post-transition instruction for the previously added maneuver.
      Parameters:
      instruction - The verbal post-transition instruction text.
    • addLane

      public void addLane(int directions, int valid, int active)
      Adds lane metadata for the previously added maneuver.
      Parameters:
      directions - Mask with all possible directions for the lane.
      valid - Mask with directions valid for entering the maneuver initially.
      active - Mask with directions that keep the user on route without additional lane changes.
    • build

      @Nullable public GLRoute build()
      Finalizes the route construction and validates it.
      Returns:
      A GLRoute object representing the built route, or null if the route is invalid.