Class Location

  • All Implemented Interfaces:
    Cloneable

    public class Location
    extends Object
    implements Cloneable
    Location data for a geographical query. This is mutable and clonable. It's identifty is decided by its content.
    Author:
    Steinar Knutsen, arnej27959
    • Constructor Detail

      • Location

        public Location()
      • Location

        public Location​(String rawLocation)
    • Method Detail

      • hasDimensions

        public boolean hasDimensions()
      • setDimensions

        public void setDimensions​(int d)
      • getDimensions

        public int getDimensions()
      • setBoundingBox

        public void setBoundingBox​(double n,
                                   double s,
                                   double e,
                                   double w)
      • setGeoCircle

        public void setGeoCircle​(double ns,
                                 double ew,
                                 double radius_in_degrees)
      • setXyCircle

        public void setXyCircle​(int px,
                                int py,
                                int radius_in_units)
      • backendString

        public String backendString()
      • getBoundingWidth

        public int getBoundingWidth()
        Returns width of bounding box (actual width if rectangle, bounding square if circle)
        Returns:
        width of bounding box
      • getBoundingHeight

        public int getBoundingHeight()
        Returns height of bounding box (actual height if rectangle, bounding square if circle)
        Returns:
        height of bounding box
      • hashCode

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

        public boolean hasAttribute()
      • getAttribute

        public String getAttribute()
      • setAttribute

        public void setAttribute​(String attributeName)
      • isGeoCircle

        public boolean isGeoCircle()
        check whether this Location contains a 2D circle
      • hasBoundingBox

        public boolean hasBoundingBox()
      • degNS

        public double degNS()
        Obtain degrees latitude (North-South direction); negative numbers are degrees South. Expected range is [-90.0,+90.0] only. May only be called when isGeoCircle() returns true.
      • degEW

        public double degEW()
        Obtain degrees longitude (East-West direction); negative numbers are degrees West. Expected range is [-180.0,+180.0] only. May only be called when isGeoCircle() returns true.
      • degRadius

        public double degRadius()
        Obtain circle radius (in degrees). Note that "no radius" or "infinite radius" is represented as -1. May only be called when isGeoCircle() returns true.
      • encode

        public int encode​(ByteBuffer buffer)
        Encodes the location to the given buffer and returns the length. For internal use.