Class Dimensions

  • All Implemented Interfaces:
    android.os.Parcelable

    public class Dimensions
    extends Object
    implements android.os.Parcelable
    Define 2D dimensions of a rectangular area. Instances are immutable.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T extends Object>, android.os.Parcelable.Creator<T extends Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static android.os.Parcelable.Creator<Dimensions> CREATOR  
      static Dimensions EMPTY  
      • Fields inherited from interface android.os.Parcelable

        CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
    • Constructor Summary

      Constructors 
      Constructor Description
      Dimensions​(double width, double height)  
    • 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
      • hashCode

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

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