Class Indication

  • All Implemented Interfaces:
    android.os.Parcelable, MapperInterface

    public class Indication
    extends java.lang.Object
    implements android.os.Parcelable, MapperInterface
    Represents the instruction that a user should follow when on a RouteStep to continue the route
    • Field Detail

      • CALCULATING

        public static final Indication CALCULATING
      • CREATOR

        public static final android.os.Parcelable.Creator<Indication> CREATOR
    • Constructor Detail

      • Indication

        public Indication​(int stepIndex,
                          double orientationChange,
                          double distance,
                          int floorDistance)
        Constructs Indication calculating its GuidanceActionType and GuidanceOrientationType
        Parameters:
        stepIndex - index of the RouteStep whose indication is being calculated
        orientationChange - angle in radians of change in orientation to follow the route (-pi,pi)
        distance - distance of the RouteStep from RouteStep.getDistance()
        floorDistance - : Distance between floors of points origin and destination of the RouteStep
      • Indication

        public Indication​(int stepIndex,
                          double orientationChange,
                          double distance,
                          int floorDistance,
                          java.lang.Integer nextLevel)
        Constructs Indication calculating its GuidanceActionType and GuidanceOrientationType
        Parameters:
        stepIndex - index of the RouteStep whose indication is being calculated
        orientationChange - angle in radians of change in orientation to follow the route (-pi,pi)
        distance - distance of the RouteStep from RouteStep.getDistance()
        floorDistance - : Distance between floors of points origin and destination of the RouteStep
      • Indication

        public Indication()
    • Method Detail

      • toMap

        public java.util.Map<java.lang.String,​java.lang.Object> toMap()
        Description copied from interface: MapperInterface
        Method to transform object into Map
        Specified by:
        toMap in interface MapperInterface
        Returns:
        Map with the information of the object mapped
      • fromMap

        public static Indication fromMap​(java.util.Map<java.lang.String,​java.lang.Object> map)
                                  throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • setOrientation

        public void setOrientation​(double orientation)
      • setDistanceToNextLevel

        public void setDistanceToNextLevel​(int distanceToNextLevel)
      • setStepIdxOrigin

        public void setStepIdxOrigin​(int stepIdxOrigin)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getOrientation

        public double getOrientation()
        Retrieve the angle a user should change his direction in order to go from the origin to the destination.
        Returns:
        double value (radians)
      • getDistance

        public double getDistance()
        Retrieve the distance between the origin and destination
        Returns:
        double value (in meters)
      • isNeededLevelChange

        public boolean isNeededLevelChange()
        Check if the user should change the level in order to arrive to destination
        Returns:
        boolean value
      • getDistanceToNextLevel

        public int getDistanceToNextLevel()
        Retrieve the number of levels between the origin and destination
        Returns:
        integer value representing the number of level to go upstairs (positive values) or downstairs (negative values)
      • getNextLevel

        @Nullable
        public java.lang.Integer getNextLevel()
        Retrieves the next level
        Returns:
        String value representing the next level
      • setDistance

        public void setDistance​(double distance)
      • getStepIdxOrigin

        public int getStepIdxOrigin()
        Retrieve the index of the indication's step of origin
        Returns:
        integer value representing the index of the step of origin
      • getStepIdxDestination

        public int getStepIdxDestination()
        Retrieve the index of the indication's step of destination. If the indication belongs to only one step, it is the same as the step index of origin.
        Returns:
        integer value representing the index of the step of destination
      • isValid

        public boolean isValid()
        Check if a particular guidance make sense
        Returns:
        bolean value determine if the guidance is valid (true) or invalid (false)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isChunckableWith

        public boolean isChunckableWith​(@NonNull
                                        Indication indication2)
        Checks if this Indication can be combined with another one
        Returns:
        boolean
      • toText

        public java.lang.String toText​(@NonNull
                                       android.content.Context context)
        Get a natural language string describing the instruction in the language of the Locale of the device (if translation available). The default language is english.
        Parameters:
        context -
        Returns:
        String
      • toText

        public java.lang.String toText​(@NonNull
                                       android.content.Context context,
                                       @Nullable
                                       java.util.Locale locale)
        Get a natural language string describing the instruction. If locale available it will return a string in that language. Otherwise it will try the system locale Locale. Finally, if neither of them is available, it will return in the default language (english)
        Parameters:
        context -
        locale - Locale of the desired language
        Returns:
        String with the textual indication
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(android.os.Parcel dest,
                                  int flags)
        Specified by:
        writeToParcel in interface android.os.Parcelable