Class SphereAirspace

  • All Implemented Interfaces:
    AVList, Draggable, MessageListener, ExtentHolder, Movable, Movable2, Airspace, Attributable, Highlightable, OrderedRenderable, PreRenderable, Renderable, Restorable, WWObject, java.beans.PropertyChangeListener, java.util.EventListener

    public class SphereAirspace
    extends AbstractAirspace
    A spherical airspace shape defined by a center location and a radius. The sphere's center altitude and terrain conformance attributes are taken from the lower altitude and lower terrain conformance. When terrain conformance is disabled, the sphere's altitude behaves as a height above mean sea level. When terrain conformance is enabled, the sphere's altitude will behave as a height offset above the terrain. Unlike other airspace shapes, the sphere's geometry will not morph to the terrain beneath it.
    • Field Detail

    • Constructor Detail

      • SphereAirspace

        public SphereAirspace​(LatLon location,
                              double radius)
      • SphereAirspace

        public SphereAirspace()
    • Method Detail

      • getLocation

        public LatLon getLocation()
        Returns the center location of the sphere.
        Returns:
        location of the sphere.
      • setLocation

        public void setLocation​(LatLon location)
        Sets the center location of the sphere.
        Parameters:
        location - the location of the sphere.
        Throws:
        java.lang.IllegalArgumentException - if location is null
      • getRadius

        public double getRadius()
        Returns the radius of the sphere in meters.
        Returns:
        radius of the sphere in meters.
      • setRadius

        public void setRadius​(double radius)
        Sets the radius of the sphere in meters. This will also set the altitude limits to match the new radius and center elevation.
        Parameters:
        radius - the radius of the sphere.
        Throws:
        java.lang.IllegalArgumentException - if radius is less than zero
      • getReferencePosition

        public Position getReferencePosition()
        Description copied from interface: Movable
        A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.
        Returns:
        the object's reference position, or null if no reference position is available.
      • getExtent

        public Extent getExtent​(DrawContext dc)
        Returns this SphereAirspace's Extent for the specified DrawContext. This overrides AbstractAirspace.getExtent(gov.nasa.worldwind.render.DrawContext) in order to bypass the superclass' extent caching. Unlike other Airspace's Extents, SphereAirspace's Extent is a perfect fitting Sphere, who's center point depends on the current surface geometry. For this reason SphereAirspace's exact bounding volume can be easily computed, and should not be cached.
        Specified by:
        getExtent in interface Airspace
        Overrides:
        getExtent in class AbstractAirspace
        Parameters:
        dc - the current DrawContext.
        Returns:
        this SphereAirspace's Extent in model coordinates.
        Throws:
        java.lang.IllegalArgumentException - if the DrawContext is null, or if the Globe held by the DrawContext is null.
      • updateSurfaceShape

        protected void updateSurfaceShape​(DrawContext dc,
                                          SurfaceShape shape)
        Description copied from class: AbstractAirspace
        Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes. Subclasses should override this method if they need to update more than the attributes and the delegate owner.
        Overrides:
        updateSurfaceShape in class AbstractAirspace
        Parameters:
        dc - the current drawing context.
        shape - the surface shape to update.
      • regenerateSurfaceShape

        protected void regenerateSurfaceShape​(DrawContext dc,
                                              SurfaceShape shape)
        Description copied from class: AbstractAirspace
        Regenerates surface shape geometry prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes.
        Overrides:
        regenerateSurfaceShape in class AbstractAirspace
        Parameters:
        dc - the current drawing context.
        shape - the surface shape to regenerate.
      • getSubdivisions

        protected int getSubdivisions()
      • setSubdivisions

        protected void setSubdivisions​(int subdivisions)
      • drawSphere

        protected void drawSphere​(DrawContext dc)
      • drawUnitSphere

        protected void drawUnitSphere​(DrawContext dc,
                                      int subdivisions)
      • makeSphere

        protected void makeSphere​(double radius,
                                  int subdivisions,
                                  Geometry dest)