Class AbstractAirspace

    • Field Detail

      • DISABLE_TERRAIN_CONFORMANCE

        protected static final java.lang.String DISABLE_TERRAIN_CONFORMANCE
        See Also:
        Constant Field Values
      • GEOMETRY_CACHE_NAME

        protected static final java.lang.String GEOMETRY_CACHE_NAME
        See Also:
        Constant Field Values
      • GEOMETRY_CACHE_KEY

        protected static final java.lang.String GEOMETRY_CACHE_KEY
      • SPLIT_THRESHOLD

        protected static final java.lang.String SPLIT_THRESHOLD
        See Also:
        Constant Field Values
      • VERTICAL_EXAGGERATION

        protected static final java.lang.String VERTICAL_EXAGGERATION
        See Also:
        Constant Field Values
      • DEFAULT_OUTLINE_PICK_WIDTH

        protected static final int DEFAULT_OUTLINE_PICK_WIDTH
        The default outline pick width.
        See Also:
        Constant Field Values
      • DEFAULT_INTERIOR_MATERIAL

        protected static final Material DEFAULT_INTERIOR_MATERIAL
        The default interior color.
      • DEFAULT_OUTLINE_MATERIAL

        protected static final Material DEFAULT_OUTLINE_MATERIAL
        The default outline color.
      • DEFAULT_HIGHLIGHT_MATERIAL

        protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
        The default highlight color.
      • defaultAttributes

        protected static AirspaceAttributes defaultAttributes
        The attributes used if attributes are not specified.
      • visible

        protected boolean visible
      • highlighted

        protected boolean highlighted
      • dragEnabled

        protected boolean dragEnabled
      • lowerAltitude

        protected double lowerAltitude
      • upperAltitude

        protected double upperAltitude
      • lowerTerrainConforming

        protected boolean lowerTerrainConforming
      • upperTerrainConforming

        protected boolean upperTerrainConforming
      • lowerAltitudeDatum

        protected java.lang.String lowerAltitudeDatum
      • upperAltitudeDatum

        protected java.lang.String upperAltitudeDatum
      • groundReference

        protected LatLon groundReference
      • enableLevelOfDetail

        protected boolean enableLevelOfDetail
      • detailLevels

        protected java.util.Collection<DetailLevel> detailLevels
      • enableBatchRendering

        protected boolean enableBatchRendering
      • enableBatchPicking

        protected boolean enableBatchPicking
      • enableDepthOffset

        protected boolean enableDepthOffset
      • outlinePickWidth

        protected int outlinePickWidth
      • delegateOwner

        protected java.lang.Object delegateOwner
      • mustRegenerateSurfaceShape

        protected boolean mustRegenerateSurfaceShape
      • drawSurfaceShape

        protected boolean drawSurfaceShape
      • frameTimeStamp

        protected long frameTimeStamp
      • alwaysOnTop

        protected boolean alwaysOnTop
      • pickLayer

        protected Layer pickLayer
      • expiryTime

        protected long expiryTime
      • minExpiryTime

        protected long minExpiryTime
      • maxExpiryTime

        protected long maxExpiryTime
      • rand

        protected static java.util.Random rand
      • elevationMap

        protected java.util.Map<LatLon,​java.lang.Double> elevationMap
      • outlineShapeRenderer

        protected OutlinedShape outlineShapeRenderer
    • Constructor Detail

      • AbstractAirspace

        public AbstractAirspace()
    • Method Detail

      • computeExtent

        protected abstract Extent computeExtent​(Globe globe,
                                                double verticalExaggeration)
      • computeMinimalGeometry

        protected abstract java.util.List<Vec4> computeMinimalGeometry​(Globe globe,
                                                                       double verticalExaggeration)
      • isVisible

        public boolean isVisible()
        Specified by:
        isVisible in interface Airspace
      • setVisible

        public void setVisible​(boolean visible)
        Specified by:
        setVisible in interface Airspace
      • setAttributes

        public void setAttributes​(ShapeAttributes attributes)
        Description copied from interface: Attributable
        Set the shape's attributes.
        Specified by:
        setAttributes in interface Attributable
        Parameters:
        attributes - the attributes to assign to the shape.
      • setHighlightAttributes

        public void setHighlightAttributes​(ShapeAttributes highlightAttributes)
        Description copied from interface: Attributable
        Set the shape's highlight attributes.
        Specified by:
        setHighlightAttributes in interface Attributable
        Parameters:
        highlightAttributes - the highlight attributes to assign to the shape.
      • setHighlightAttributes

        public void setHighlightAttributes​(AirspaceAttributes highlightAttrs)
        Description copied from interface: Airspace
        Specifies this shape's highlight attributes.
        Specified by:
        setHighlightAttributes in interface Airspace
        Parameters:
        highlightAttrs - the highlight attributes. May be null, in which case default attributes are used.
      • isHighlighted

        public boolean isHighlighted()
        Description copied from interface: Highlightable
        Indicates whether to highlight the shape.
        Specified by:
        isHighlighted in interface Highlightable
        Returns:
        true to highlight the shape, otherwise false.
      • setHighlighted

        public void setHighlighted​(boolean highlighted)
        Description copied from interface: Highlightable
        Specifies whether to highlight the shape.
        Specified by:
        setHighlighted in interface Highlightable
        Parameters:
        highlighted - true to highlight the shape, otherwise false.
      • getAltitudes

        protected double[] getAltitudes​(double verticalExaggeration)
      • isTerrainConforming

        public boolean[] isTerrainConforming()
        Description copied from interface: Airspace
        Returns the old-style indicators of the airspace's lower and upper surface datums.
        Specified by:
        isTerrainConforming in interface Airspace
        Returns:
        the lower and upper surface datums.
      • setTerrainConforming

        public void setTerrainConforming​(boolean lowerTerrainConformant,
                                         boolean upperTerrainConformant)
        Description copied from interface: Airspace
        Sets the altitude datum, which indicates whether airspace altitudes are relative to mean sea level, ground level or a single ground reference location. The datum is normally set via Airspace.setAltitudeDatum(String, String), but this method is provided for backwards compatibility with the means of originally setting the datum. See the argument descriptions below for the mapping of the boolean values of this method to the altitude-datum values.
        Specified by:
        setTerrainConforming in interface Airspace
        Parameters:
        lowerTerrainConformant - the lower altitude datum. A value of true indicates a lower altitude datum of AVKey.ABOVE_GROUND_LEVEL (terrain conforming), a value of false indicates a lower altitude datum of {link AVKey#ABOVE_MEAN_SEA_LEVEL} (not terrain conforming). the terrain-conforming, a value of false indicates that it's not.
        upperTerrainConformant - the upper altitude datum. A value of true indicates an upper altitude datum of AVKey.ABOVE_GROUND_LEVEL (terrain conforming), a value of false indicates an upper altitude datum of {link AVKey#ABOVE_MEAN_SEA_LEVEL} (not terrain conforming. the terrain-conforming, a value of false indicates that it's not.
        See Also:
        Airspace.setAltitudeDatum(String, String)
      • getAltitudeDatum

        public java.lang.String[] getAltitudeDatum()
        Description copied from interface: Airspace
        Returns the current altitude datum of the airspace's lower and upper surfaces.
        Specified by:
        getAltitudeDatum in interface Airspace
        Returns:
        a two-element array containing at position 0 the lower altitude datum, and at position 1 the upper altitude datum.
        See Also:
        Airspace.setAltitudeDatum(String, String)
      • setAltitudeDatum

        public void setAltitudeDatum​(java.lang.String lowerAltitudeDatum,
                                     java.lang.String upperAltitudeDatum)
        Description copied from interface: Airspace
        Sets the altitude datum, which indicates whether airspace altitudes are relative to mean sea level, ground level or a single ground reference location.

        A value of AVKey.ABOVE_MEAN_SEA_LEVEL, the default for both lower and upper datums, indicates a datum of mean sea level. The respective lower or upper surface of the airspace is drawn at the constant altitude specified by Airspace.setAltitude(double).

        A datum of AVKey.ABOVE_GROUND_LEVEL indicates that each position of the respective airspace surface is offset vertically from the altitude specified to Airspace.setAltitude(double) by an amount equal to the terrain elevation at that position. For example, if the specified lower altitude is zero, the lower surface lies on and conforms to the terrain. If non-zero, the surface undulates in tandem with the terrain but relative to the specified altitude.

        A datum of AVKey.ABOVE_GROUND_REFERENCE combines both of the above datums. It indicates that the respective surface is drawn at the altitude specified to Airspace.setAltitude(double) but offset vertically by an amount equal to the elevation at a single reference location on the ground. This is useful for displaying surfaces that are "flat" but are positioned relative to the ground. An example is the roof of a building, which maintains a constant altitude even as the base of its building may conform to varying terrain. One method of representing buildings is to specify a lower altitude of 0, a lower altitude datum of AVKey.ABOVE_GROUND_LEVEL, an upper altitude that's the building's height, and an upper altitude datum of AVKey.ABOVE_GROUND_REFERENCE, where the ground reference is a location at the building's base. The reference position is specifed by Airspace.setGroundReference(LatLon).

        Specified by:
        setAltitudeDatum in interface Airspace
        Parameters:
        lowerAltitudeDatum - the lower altitude datum.
        upperAltitudeDatum - the upper altitude datum
        See Also:
        Airspace.setGroundReference(gov.nasa.worldwind.geom.LatLon), Airspace.setAltitudes(double, double)
      • getGroundReference

        public LatLon getGroundReference()
        Description copied from interface: Airspace
        Returns the current ground reference location.
        Specified by:
        getGroundReference in interface Airspace
        Returns:
        the current ground reference location.
      • setGroundReference

        public void setGroundReference​(LatLon groundReference)
        Description copied from interface: Airspace
        Sets the reference location used to determine the elevation offset for airspace surfaces whose altitude datum is AVKey.ABOVE_GROUND_REFERENCE. The reference location is unused if the altitude datum is a value other than this.
        Specified by:
        setGroundReference in interface Airspace
        Parameters:
        groundReference - the location at which to compute the terrain elevation used to offset an upper or lower airspace surface. The location need not be within the airspace's bounds. If null, an airspace-specific position is chosen from those defining the airspace. See the method descriptions for the individual airspaces to determine the position used.
        See Also:
        Airspace.setAltitudeDatum(String, String)
      • setEnableBatchRendering

        public void setEnableBatchRendering​(boolean enableBatchRendering)
        Specifies whether adjacent shapes of this shape's concrete type in the ordered renderable list may be rendered together if they are contained in the same layer. This increases performance. There is seldom a reason to disable it.
        Specified by:
        setEnableBatchRendering in interface Airspace
        Parameters:
        enableBatchRendering - true to enable batch rendering, otherwise false.
      • setEnableBatchPicking

        public void setEnableBatchPicking​(boolean enableBatchPicking)
        Specifies whether adjacent shapes of this shape's concrete type in the ordered renderable list may be pick-tested together if they are contained in the same layer. This increases performance but allows only the top-most of the polygons to be reported in a SelectEvent even if several of the polygons are at the pick position.

        Batch rendering (Airspace.setEnableBatchRendering(boolean)) must be enabled in order for batch picking to occur.

        Specified by:
        setEnableBatchPicking in interface Airspace
        Parameters:
        enableBatchPicking - true to enable batch rendering, otherwise false.
      • isEnableDepthOffset

        public boolean isEnableDepthOffset()
        Indicates whether the filled sides of this shape should be offset towards the viewer to help eliminate artifacts when two or more faces of this or other filled shapes are coincident.
        Specified by:
        isEnableDepthOffset in interface Airspace
        Returns:
        true if depth offset is applied, otherwise false.
      • setEnableDepthOffset

        public void setEnableDepthOffset​(boolean enableDepthOffset)
        Specifies whether the filled sides of this shape should be offset towards the viewer to help eliminate artifacts when two or more faces of this or other filled shapes are coincident.
        Specified by:
        setEnableDepthOffset in interface Airspace
        Parameters:
        enableDepthOffset - true if depth offset is applied, otherwise false.
      • getOutlinePickWidth

        public int getOutlinePickWidth()
        Indicates the outline line width to use during picking. A larger width than normal typically makes the outline easier to pick.
        Specified by:
        getOutlinePickWidth in interface Airspace
        Returns:
        the outline line width used during picking.
      • setOutlinePickWidth

        public void setOutlinePickWidth​(int outlinePickWidth)
        Specifies the outline line width to use during picking. A larger width than normal typically makes the outline easier to pick.

        Note that the size of the pick aperture also affects the precision necessary to pick.

        Specified by:
        setOutlinePickWidth in interface Airspace
        Parameters:
        outlinePickWidth - the outline pick width. The default is 10.
      • setDelegateOwner

        public void setDelegateOwner​(java.lang.Object delegateOwner)
        Specified by:
        setDelegateOwner in interface Airspace
      • isAlwaysOnTop

        public boolean isAlwaysOnTop()
        Description copied from interface: Airspace
        Indicates the state of this airspace's always-on-top flag.
        Specified by:
        isAlwaysOnTop in interface Airspace
        Returns:
        the state of this airspace's always-on-top flag.
        See Also:
        Airspace.isAlwaysOnTop()
      • setAlwaysOnTop

        public void setAlwaysOnTop​(boolean alwaysOnTop)
        Description copied from interface: Airspace
        Specifies whether this airspace should have visual priority over other displayed shapes in 3D mode. If true, this shape is drawn after all others. This property is ignored by Cake airspaces.
        Specified by:
        setAlwaysOnTop in interface Airspace
        Parameters:
        alwaysOnTop - if true, this airspace is drawn after all others. Otherwise this airspace is drawn with its normal priority, which is its relative distance to the eye point.
      • isDrawSurfaceShape

        public boolean isDrawSurfaceShape()
        Description copied from interface: Airspace
        Indicates whether this surface shape is always drawn flat and on the surface.
        Specified by:
        isDrawSurfaceShape in interface Airspace
        Returns:
        true if this shape is drawn flat and on the surface, otherwise false.
      • setDrawSurfaceShape

        public void setDrawSurfaceShape​(boolean drawSurfaceShape)
        Description copied from interface: Airspace
        Specifies whether this airspace should be drawn flat and on the surface, ignoring any altitude information specified in the shape.
        Specified by:
        setDrawSurfaceShape in interface Airspace
        Parameters:
        drawSurfaceShape - true if this shape is drawn flat and on the surface, otherwise false.
      • adjustForGroundReference

        protected void adjustForGroundReference​(DrawContext dc,
                                                boolean[] terrainConformant,
                                                double[] altitudes,
                                                LatLon groundRef)
      • isAirspaceCollapsed

        public boolean isAirspaceCollapsed()
      • setTerrainConforming

        public void setTerrainConforming​(boolean terrainConformant)
        Description copied from interface: Airspace
        Sets the altitude datum for both the lower and upper airspace surface to the same specified value. The datum is normally set via Airspace.setAltitudeDatum(String, String), but this method is provided for backwards compatibility with the means of originally setting the datum. See the argument descriptions for the mapping of the boolean values of this method to the altitude-datum values.
        Specified by:
        setTerrainConforming in interface Airspace
        Parameters:
        terrainConformant - the altitude datum. See Airspace.setTerrainConforming(boolean, boolean) for a description of the possible values.
      • setEnableLevelOfDetail

        public void setEnableLevelOfDetail​(boolean enableLevelOfDetail)
        Specified by:
        setEnableLevelOfDetail in interface Airspace
      • addDetailLevels

        protected void addDetailLevels​(java.util.Collection<DetailLevel> newDetailLevels)
      • isAirspaceVisible

        public boolean isAirspaceVisible​(DrawContext dc)
        Test if this airspace is visible in the specified draw context. During picking mode, this tests intersection against all of the draw context's pick frustums. During rendering mode, this tests intersection against the draw context's viewing frustum.
        Specified by:
        isAirspaceVisible in interface Airspace
        Parameters:
        dc - the draw context the airspace is related to.
        Returns:
        true if this airspace is visible; false otherwise.
      • getExtent

        public Extent getExtent​(Globe globe,
                                double verticalExaggeration)
        Description copied from interface: Airspace
        Returns this Airspace's enclosing volume as an Extent in model coordinates, given a specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration().
        Specified by:
        getExtent in interface Airspace
        Specified by:
        getExtent in interface ExtentHolder
        Parameters:
        globe - the Globe this Airspace is related to.
        verticalExaggeration - the vertical exaggeration of the scene containing this Airspace.
        Returns:
        this Airspace's Extent in model coordinates.
      • computeMinimalGeometry

        protected java.util.List<Vec4> computeMinimalGeometry​(DrawContext dc)
      • invalidateAirspaceData

        protected void invalidateAirspaceData()
      • getDistanceFromEye

        public double getDistanceFromEye()
        Description copied from interface: OrderedRenderable
        Returns the ordered renderable's distance from the current view's eye point. Intended to be used only to sort a list of ordered renderables according to eye distance, and only during frame generation when a view is active.
        Specified by:
        getDistanceFromEye in interface OrderedRenderable
        Returns:
        the distance of the ordered renderable from the current view's eye point.
      • determineActiveAttributes

        protected void determineActiveAttributes​(DrawContext dc)
        Determines which attributes -- normal, highlight or default -- to use each frame. Places the result in this shape's current active attributes.
        Parameters:
        dc - the current drawing context.
        See Also:
        getActiveAttributes()
      • getActiveAttributes

        public AirspaceAttributes getActiveAttributes()
        Returns this shape's currently active attributes, as determined during the most recent call to determineActiveAttributes(gov.nasa.worldwind.render.DrawContext). The active attributes are either the normal or highlight attributes, depending on this shape's highlight flag, and incorporates default attributes for those not specified in the applicable attribute set.
        Returns:
        this shape's currently active attributes.
      • createSurfaceShape

        protected SurfaceShape createSurfaceShape()
        Returns a SurfaceShape that corresponds to this Airspace and is used for drawing on 2D globes.
        Returns:
        The surface shape to represent this Airspace on a 2D globe.
      • updateSurfaceShape

        protected void updateSurfaceShape​(DrawContext dc,
                                          SurfaceShape shape)
        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.
        Parameters:
        dc - the current drawing context.
        shape - the surface shape to update.
      • regenerateSurfaceShape

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

        public void pick​(DrawContext dc,
                         java.awt.Point pickPoint)
        Description copied from interface: OrderedRenderable
        Executes a pick of the ordered renderable.
        Specified by:
        pick in interface OrderedRenderable
        Parameters:
        dc - the current draw context.
        pickPoint - the pick point.
      • render

        public void render​(DrawContext dc)
        Description copied from interface: Renderable
        Causes this Renderable to render itself using the provided draw context.
        Specified by:
        render in interface Renderable
        Parameters:
        dc - the DrawContext to be used
        See Also:
        DrawContext
      • makeOrderedRenderable

        protected void makeOrderedRenderable​(DrawContext dc)
      • drawOrderedRenderable

        protected void drawOrderedRenderable​(DrawContext dc)
      • drawBatched

        protected void drawBatched​(DrawContext dc)
      • doDrawOrderedRenderable

        protected void doDrawOrderedRenderable​(DrawContext dc,
                                               PickSupport pickCandidates)
      • createPickedObject

        protected PickedObject createPickedObject​(int colorCode)
      • move

        public void move​(Position position)
        Description copied from interface: Movable
        Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
        Specified by:
        move in interface Movable
        Parameters:
        position - the latitude and longitude to add to the shape's reference position.
      • moveTo

        public void moveTo​(Globe globe,
                           Position position)
        Description copied from interface: Movable2
        Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
        Specified by:
        moveTo in interface Movable2
        Parameters:
        globe - the globe on which to move the shape.
        position - the new position of the shape's reference position.
      • isDragEnabled

        public boolean isDragEnabled()
        Description copied from interface: Draggable
        Indicates whether the object is enabled for dragging.
        Specified by:
        isDragEnabled in interface Draggable
        Returns:
        true if the object is enabled, else false.
      • setDragEnabled

        public void setDragEnabled​(boolean enabled)
        Description copied from interface: Draggable
        Controls whether the object is enabled for dragging.
        Specified by:
        setDragEnabled in interface Draggable
        Parameters:
        enabled - true if the object is enabled, else false.
      • doDrag

        protected void doDrag​(DragContext dragContext)
      • moveTo

        public void moveTo​(Position position)
        Description copied from interface: Movable
        Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
        Specified by:
        moveTo in interface Movable
        Parameters:
        position - the new position of the shape's reference position.
      • computeReferencePosition

        protected Position computeReferencePosition​(java.util.List<? extends LatLon> locations,
                                                    double[] altitudes)
      • computeEyeDistance

        protected double computeEyeDistance​(DrawContext dc)
      • doRenderGeometry

        protected abstract void doRenderGeometry​(DrawContext dc,
                                                 java.lang.String drawStyle)
      • beginRendering

        protected void beginRendering​(DrawContext dc)
      • endRendering

        protected void endRendering​(DrawContext dc)
      • mustDrawInterior

        protected boolean mustDrawInterior​(DrawContext dc)
      • drawInterior

        protected void drawInterior​(DrawContext dc)
      • mustDrawOutline

        protected boolean mustDrawOutline​(DrawContext dc)
      • drawOutline

        protected void drawOutline​(DrawContext dc)
      • setGeometryBuilder

        protected void setGeometryBuilder​(GeometryBuilder gb)
      • getGeometryCache

        protected MemoryCache getGeometryCache()
      • updateExpiryCriteria

        protected void updateExpiryCriteria​(DrawContext dc,
                                            Geometry geom)
      • getExpiryTime

        protected long getExpiryTime()
      • setExpiryTime

        protected void setExpiryTime​(long timeMillis)
      • getExpiryRange

        protected long[] getExpiryRange()
      • setExpiryRange

        protected void setExpiryRange​(long minTimeMillis,
                                      long maxTimeMillis)
      • nextExpiryTime

        protected long nextExpiryTime​(DrawContext dc,
                                      boolean[] terrainConformance)
      • clearElevationMap

        protected void clearElevationMap()
      • computePointFromPosition

        public Vec4 computePointFromPosition​(DrawContext dc,
                                             Angle latitude,
                                             Angle longitude,
                                             double elevation,
                                             boolean terrainConformant)
      • computeElevationAt

        protected double computeElevationAt​(DrawContext dc,
                                            Angle latitude,
                                            Angle longitude)
      • makeExtremePoints

        protected void makeExtremePoints​(Globe globe,
                                         double verticalExaggeration,
                                         java.lang.Iterable<? extends LatLon> locations,
                                         java.util.List<Vec4> extremePoints)
      • getRestorableState

        public java.lang.String getRestorableState()
        Description copied from interface: Restorable
        Returns an XML document string describing the object's state. This state can be restored later by calling restoreState and passing the XML document.
        Specified by:
        getRestorableState in interface Restorable
        Returns:
        an XML document string describing the object's state.
      • restoreState

        public void restoreState​(java.lang.String stateInXml)
        Description copied from interface: Restorable
        Restores the object's state to what is described in the specified XML document string.
        Specified by:
        restoreState in interface Restorable
        Parameters:
        stateInXml - an XML document string describing an object's state.