Class Point

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

    public class Point
    extends java.lang.Object
    implements FloorResource, android.os.Parcelable, MapperInterface
    Associate geographical coordinate (Location) with Building and Floor (Cartography) and cartesian coordinate relative to that building. Instances are immutable.
    • Field Detail

      • EMPTY_INDOOR

        public static final Point EMPTY_INDOOR
      • EMPTY_OUTDOOR

        public static final Point EMPTY_OUTDOOR
      • CREATOR

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

      • Point

        public Point​(@NonNull
                     Coordinate coordinate)
        Create a point placed outdoors. It has no cartesian coordinate nor floor, because it's placed outside the building.
        Parameters:
        coordinate -
      • Point

        public Point​(@NonNull
                     java.lang.String buildingIdentifier,
                     @NonNull
                     Coordinate coordinate)
        Create a point placed outdoors. It has no cartesian coordinate nor floor, because it's placed outside the building.
        Parameters:
        buildingIdentifier -
        coordinate -
      • Point

        public Point​(@NonNull
                     java.lang.String buildingIdentifier,
                     @NonNull
                     java.lang.String floorIdentifier,
                     @NonNull
                     Coordinate coordinate,
                     @NonNull
                     CartesianCoordinate cartesianCoordinate)
        Create a point placed indoors.
        Parameters:
        buildingIdentifier -
        floorIdentifier -
        coordinate -
        cartesianCoordinate -
      • Point

        public Point​(@NonNull
                     Building building,
                     @NonNull
                     java.lang.String floorIdentifier,
                     @NonNull
                     CartesianCoordinate cartesianCoordinate)
        Create a point placed indoors. The geographical coordinate is calculated using the building
      • Point

        public Point​(@NonNull
                     Building building,
                     @NonNull
                     java.lang.String floorIdentifier,
                     @NonNull
                     Coordinate coordinate)
        Create a point placed indoors. The cartesian coordinate is calculated using the building
      • Point

        public Point​(@NonNull
                     Point point)
    • Method Detail

      • getCartesianCoordinate

        @NonNull
        public final CartesianCoordinate getCartesianCoordinate()
        Returns cartesian coordinate (in meters) relative to the Bounds of building's base. If this point is outdoors (isOutdoor == true), this field has no meaning.

        Use isOutdoor() to check if the poi is indoors or outdoors

        Returns:
        Coordinate of this point, or (0,0) if it's outdoors.
      • getCoordinate

        @NonNull
        public final Coordinate getCoordinate()
        Returns geographic coordinate (latitude, longitude) of the point, regardless of whether it's placed inside or outside the building You can obtain this value from CartesianCoordinate using CoordinateConverter.
        Returns:
        Coordinate of this point.
      • getBuildingIdentifier

        @NonNull
        public final java.lang.String getBuildingIdentifier()
        Returns unique identifier for the building to which this point belongs
        Specified by:
        getBuildingIdentifier in interface BuildingResource
      • getFloorIdentifier

        @NonNull
        public final java.lang.String getFloorIdentifier()
        Returns floor identifier (inside the building) where this point is placed. If this point is outdoors, this field has no meaning.

        See isOutdoor() to check if the poi is indoors or outdoors

        Specified by:
        getFloorIdentifier in interface FloorResource
        Returns:
        String. If the point is outdoors, the value is unexpected.
      • isOutdoor

        public final boolean isOutdoor()
        Return if the POI is outside the building.
        Returns:
        true if the building is outdoors. Otherwise, false.
      • isIndoor

        public final boolean isIndoor()
        Return if the POI is inside the building.
        Returns:
        true if the building is indoors. Otherwise, false.
      • sameFloor

        public final boolean sameFloor​(Point that)
      • 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
      • toString

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

        public java.lang.String lookupKey()
      • 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
      • 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 Point fromMap​(java.util.Map<java.lang.String,​java.lang.Object> map)
                             throws java.lang.IllegalArgumentException
        Return a new Point instance object containing the data at the given map. Use MapperInterface to populate the Map. The expected fields are those defined at this class.
        Parameters:
        map - Map containing the data used to populate the new object.
        Returns:
        New instance.
        Throws:
        java.lang.IllegalArgumentException - If there is not enough information at the given map or it is incorrect.