Class Location

java.lang.Object
es.situm.sdk.model.location.Location
All Implemented Interfaces:
android.os.Parcelable, BuildingResource, FloorResource, MapperInterface

public class Location extends Object implements FloorResource, android.os.Parcelable, MapperInterface
A location. It can be indoor or outdoor, check isIndoor() and isOutdoor(). A valid indoor location has floorIdentifier and cartesianCoordinate.
  • Field Details

    • CREATOR

      public static final android.os.Parcelable.Creator<Location> CREATOR
  • Method Details

    • getPosition

      public Point getPosition()
      Return the position of the location. Only needed if you neede access to the internal Point object. It's better to use directly getCoordinate(), getCartesianCoordinate(), etc. on the Location object
    • isIndoor

      public boolean isIndoor()
      Return true if the location is indoor
      See Also:
    • getDeviceId

      public String getDeviceId()
      Returns the device identifier that has generated the location
    • isOutdoor

      public boolean isOutdoor()
      Return true if the location is outdoor
      See Also:
    • getCoordinate

      public Coordinate getCoordinate()
      Return the coordinate of the location
    • getCartesianCoordinate

      public CartesianCoordinate getCartesianCoordinate()
      Only used in indoor. Return the cartesian coordinate in the corresponding floor of the building image.
    • getBuildingIdentifier

      public String getBuildingIdentifier()
      Only used in indoor. Return the building identifier.
      Specified by:
      getBuildingIdentifier in interface BuildingResource
    • getFloorIdentifier

      public String getFloorIdentifier()
      Only used in indoor. Return the floor identifier.
      Specified by:
      getFloorIdentifier in interface FloorResource
    • getQuality

      public Location.Quality getQuality()
      Only used in indoor. Return an indicative of quality calculated with accuracy and building size.
    • getTime

      public long getTime()
      Return the timestamp of the location.
    • getAccuracy

      public float getAccuracy()
      Return the accuracy radius (in meters)
    • hasCartesianBearing

      public boolean hasCartesianBearing()
      Only used in indoor. Return true if the location has cartesian bearing and the bearing quality is Location.Quality.HIGH, false otherwise.
      See Also:
    • getCartesianBearing

      public Angle getCartesianBearing()
      Only used in indoor. Return the bearing with respect to the building, being 0 the west-east axis. If hasCartesianBearing() is false the bearing returned couldn't be reliable. You can get the bearing quality with getBearingQuality()
    • hasBearing

      public boolean hasBearing()
      Return true if the location has bearing and the bearing quality is Location.Quality.HIGH, false otherwise.
      See Also:
    • getBearing

      public Angle getBearing()
      Return the bearing (in degrees) with respect to the Earth North. If hasBearing() is false it will return a default Angle
    • hasPitch

      public boolean hasPitch()
      Only used in indoor. Return true if the location has pitch, false otherwise.
      See Also:
    • getPitch

      public Angle getPitch()
      Only used in indoor. Return the pitch with respect to the horizon, being 0 perfectly horizontal. If hasPitch() is false the pitch returned could not be reliable.
    • hasRoll

      public boolean hasRoll()
      Only used in indoor. Return true if the location has roll, false otherwise.
      See Also:
    • getRoll

      public Angle getRoll()
      Only used in indoor. Return the roll with respect to the horizon, being 0 perfectly horizontal. If hasRoll() is false the roll returned could not be reliable.
    • hasRotationMatrix

      public Boolean hasRotationMatrix()
      Return true if the location has a valid rotation matrix, false otherwise.
    • getRotationMatrix

      public float[] getRotationMatrix()
      Return the rotation matrix. If hasRotationMatrix() is false the rotation matrix returned could not be reliable.
    • getProvider

      public String getProvider()
    • getBearingQuality

      public Location.Quality getBearingQuality()
      Return the quality of the cartesian bearing. It's recommended to use the value of the bearing only if the quality is Location.Quality.HIGH. If the quality is Location.Quality.LOW the bearing is not reliable. If the location is outdoor and the bearing is set the quality will be Location.Quality.HIGH
    • getCustomFields

      public Map<String,String> getCustomFields()
      Returns map of custom fields, indexed by their name.
      Returns:
      Unmodifiable Map<String, String>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toMap

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

      public static Location fromMap(Map<String,Object> map) throws IllegalArgumentException
      Throws:
      IllegalArgumentException