Class Dimensions

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

    public class Dimensions
    extends java.lang.Object
    implements android.os.Parcelable, MapperInterface
    Define 2D dimensions of a rectangular area. Instances are immutable.
    • Field Detail

      • CREATOR

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

      • Dimensions

        public Dimensions​(double width,
                          double height)
        Parameters:
        width - in meters
        height - in meters
    • Method Detail

      • getWidth

        public double getWidth()
        Returns width of rectangle in meters
        Returns:
        double. Default is 0
      • getHeight

        public double getHeight()
        Returns height of rectangle in meters.
        Returns:
        double. Default is 0
      • contains

        public boolean contains​(double x,
                                double y)
        Check if the cartesian coordinates of a point are inside the dimension.
        Parameters:
        x - value in meters (usually this is related with the x cartesian coordinate of a Point
        y - value in meters (usually this is related with the y cartesian coordinate of a Point
        Returns:
        boolean value that indicates if the coordinates are inside the dimensions. true means it belongs the dimension, false means it does not belong the dimension.
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • 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
      • 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