Class Airspace

java.lang.Object
org.deltava.beans.navdata.Airspace
All Implemented Interfaces:
Serializable, Comparable<Airspace>, GeoLocation, GeospaceLocation, MapEntry, Cacheable
Direct Known Subclasses:
FIR

public class Airspace extends Object implements MapEntry, GeospaceLocation, Comparable<Airspace>, Cacheable
A bean to define arbitrary airspace boundaries.
Since:
7.3
Version:
11.0
Author:
Luke
See Also:
  • Constructor Details

    • Airspace

      public Airspace(String id, AirspaceType type)
      Creates the bean.
      Parameters:
      id - the airspace code
      type - the AirspaceType
  • Method Details

    • init

      public static void init(Collection<Airspace> data)
      Initializes restricted airspace.
      Parameters:
      data - a Collection of Airspace beans
    • isRestricted

      public static Airspace isRestricted(GeospaceLocation loc)
      Returns whether a particular point is in restricted airspace.
      Parameters:
      loc - the GeospaceLocation
      Returns:
      the Airspace bean, or null if none
    • findRestricted

      public static Collection<Airspace> findRestricted(GeoLocation loc, int distance)
      Returns whether any restricted airspace is within a set distance of a point.
      Parameters:
      loc - the GeoLocation
      distance - the distance in miles
      Returns:
      a Collection of Airspace beans
    • getName

      public String getName()
      Returns the Airspace name.
      Returns:
      the name
      See Also:
    • getID

      public String getID()
      Returns the Airspace ID.
      Returns:
      the ID
    • getType

      public AirspaceType getType()
      Returns the Airspace type.
      Returns:
      an AirspaceType
    • getBorder

      public List<GeoLocation> getBorder()
      Returns the coordinates of the FIR boundary.
      Returns:
      a Collection of GeoLocations
      See Also:
    • getCountry

      public Country getCountry()
      Returns the nation containing this Airspace.
      Returns:
      a Country, or null if unknown
    • getMaxAltitude

      public int getMaxAltitude()
      Returns the maximum altitude of this airspace.
      Returns:
      the altitude in feet MSL
    • getMinAltitude

      public int getMinAltitude()
      Returns the minimum altitude of this airspace.
      Returns:
      the altitude in feet MSL
    • getLatitude

      public double getLatitude()
      Description copied from interface: GeoLocation
      Returns the latitude of this location.
      Specified by:
      getLatitude in interface GeoLocation
      Returns:
      the latitude in degrees
    • getLongitude

      public double getLongitude()
      Description copied from interface: GeoLocation
      Returns the longitude of this location.
      Specified by:
      getLongitude in interface GeoLocation
      Returns:
      the longitude in degrees
    • getAltitude

      public int getAltitude()
      Description copied from interface: GeospaceLocation
      Returns the altitude of the location above MSL.
      Specified by:
      getAltitude in interface GeospaceLocation
      Returns:
      the altitude in feet
    • contains

      public boolean contains(GeospaceLocation loc)
      Returns whether a point is contained within this Airspace.
      Parameters:
      loc - a GeospaceLocation
      Returns:
      TRUE if the Airspace contains this point, otherwise FALSE
    • isExclusion

      public boolean isExclusion()
      Returns whether this is an exclusion zone of an existing Airspace.
      Returns:
      TRUE if an exclusion zone, otherwise FALSE
    • addBorderPoint

      public void addBorderPoint(GeoLocation loc)
      Adds a point to the airspace boundary.
      Parameters:
      loc - a GeoLocation
      See Also:
    • setBorder

      public void setBorder(Collection<GeoLocation> locs)
      Sets the airspace boundary.
      Parameters:
      locs - a Collection of GeoLocations
      See Also:
    • setName

      public void setName(String name)
      Sets the Airspace name.
      Parameters:
      name - the name
      Throws:
      NullPointerException - if name is null
      See Also:
    • setExclusion

      public void setExclusion(boolean isExclusion)
      Sets whether this is an exclusion zone of an existing Airspace.
      Parameters:
      isExclusion - TRUE if an exclusion zone, otherwise FALSE
    • setCountry

      public void setCountry(Country c)
      Sets the nation containing this Airspace.
      Parameters:
      c - a Country, or null
    • setMaxAltitude

      public void setMaxAltitude(int alt)
      Sets the maximum altitude of the Airspace.
      Parameters:
      alt - the altitude in feet MSL
    • setMinAltitude

      public void setMinAltitude(int alt)
      Sets the minimum altitude of the Airspace.
      Parameters:
      alt - the altitude in feet MSL
    • getInfoBox

      public String getInfoBox()
      Description copied from interface: MapEntry
      Returns the text to display in this marker's infobox if displayed in a Google Map.
      Specified by:
      getInfoBox in interface MapEntry
      Returns:
      the infobox HTML text, or null if no infobox to be displayed
    • cacheKey

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Returns:
      the cache key for the object
    • equals

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

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

      public int compareTo(Airspace a2)
      Compares two Airspaces by comparing their types and IDs.
      Specified by:
      compareTo in interface Comparable<Airspace>
    • toString

      public String toString()
      Overrides:
      toString in class Object