Class AbstractShape

    • Field Detail

      • 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.
      • DEFAULT_ALTITUDE_MODE

        protected static final int DEFAULT_ALTITUDE_MODE
        The default altitude mode.
        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_GEOMETRY_GENERATION_INTERVAL

        protected static final int DEFAULT_GEOMETRY_GENERATION_INTERVAL
        The default geometry regeneration interval.
        See Also:
        Constant Field Values
      • VBO_THRESHOLD

        protected static final int VBO_THRESHOLD
        Indicates the number of vertices that must be present in order for VBOs to be used to render this shape.
      • defaultAttributes

        protected static ShapeAttributes defaultAttributes
        The attributes used if attributes are not specified.
      • normalAttrs

        protected ShapeAttributes normalAttrs
        This shape's normal, non-highlighted attributes.
      • highlightAttrs

        protected ShapeAttributes highlightAttrs
        This shape's highlighted attributes.
      • activeAttributes

        protected ShapeAttributes activeAttributes
        The attributes active for a particular pick and render pass. These are determined according to the highlighting mode.
      • highlighted

        protected boolean highlighted
      • dragEnabled

        protected boolean dragEnabled
      • visible

        protected boolean visible
      • altitudeMode

        protected int altitudeMode
      • enableBatchRendering

        protected boolean enableBatchRendering
      • enableBatchPicking

        protected boolean enableBatchPicking
      • enableDepthOffset

        protected boolean enableDepthOffset
      • outlinePickWidth

        protected int outlinePickWidth
      • sector

        protected Sector sector
      • referencePosition

        protected Position referencePosition
      • delegateOwner

        protected java.lang.Object delegateOwner
      • maxExpiryTime

        protected long maxExpiryTime
      • minExpiryTime

        protected long minExpiryTime
      • viewDistanceExpiration

        protected boolean viewDistanceExpiration
      • pickLayer

        protected Layer pickLayer
      • currentData

        protected AbstractShape.AbstractShapeData currentData
        Identifies the active globe-dependent data for the current invocation of render(DrawContext). The active data is drawn from this shape's data cache at the beginning of the render method.
    • Constructor Detail

      • AbstractShape

        protected AbstractShape()
        Invokes initialize() during construction and sets the data cache's expiration time to a default value.
      • AbstractShape

        protected AbstractShape​(AbstractShape source)
    • Method Detail

      • intersect

        public abstract java.util.List<Intersection> intersect​(Line line,
                                                               Terrain terrain)
                                                        throws java.lang.InterruptedException
        Compute the intersections of a specified line with this shape. If the shape's altitude mode is other than WorldWind.ABSOLUTE, the shape's geometry is created relative to the specified terrain rather than the terrain used during rendering, which may be at lower level of detail than required for accurate intersection determination.
        Parameters:
        line - the line to intersect.
        terrain - the Terrain to use when computing the shape's geometry.
        Returns:
        a list of intersections identifying where the line intersects the shape, or null if the line does not intersect the shape.
        Throws:
        java.lang.InterruptedException - if the operation is interrupted.
        See Also:
        Terrain
      • initialize

        protected abstract void initialize()
        Called during construction to establish any subclass-specific state such as different default values than those set by this class.
      • mustApplyTexture

        protected abstract boolean mustApplyTexture​(DrawContext dc)
        Indicates whether texture should be applied to this shape. Called during rendering to determine whether texture state should be established during preparation for interior drawing.

        Note: This method always returns false during the pick pass.

        Parameters:
        dc - the current draw context
        Returns:
        true if texture should be applied, otherwise false.
      • doMakeOrderedRenderable

        protected abstract boolean doMakeOrderedRenderable​(DrawContext dc)
        Produces the geometry and other state necessary to represent this shape as an ordered renderable. Places this shape on the draw context's ordered renderable list for subsequent rendering. This method is called during pick(DrawContext, java.awt.Point) and render(DrawContext) when it's been determined that the shape is likely to be visible.
        Parameters:
        dc - the current draw context.
        Returns:
        true if the ordered renderable state was successfully computed, otherwise false, in which case the current pick or render pass is terminated for this shape. Subclasses should return false if it is not possible to create the ordered renderable state.
        See Also:
        pick(DrawContext, java.awt.Point), render(DrawContext)
      • isOrderedRenderableValid

        protected abstract boolean isOrderedRenderableValid​(DrawContext dc)
        Determines whether this shape's ordered renderable state is valid and can be rendered. Called by makeOrderedRenderable(DrawContext)just prior to adding the shape to the ordered renderable list.
        Parameters:
        dc - the current draw context.
        Returns:
        true if this shape is ready to be rendered as an ordered renderable.
      • fillVBO

        protected abstract void fillVBO​(DrawContext dc)
        Fill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • doExportAsKML

        protected abstract void doExportAsKML​(javax.xml.stream.XMLStreamWriter xmlWriter)
                                       throws java.io.IOException,
                                              javax.xml.stream.XMLStreamException
        Exports shape-specific fields.
        Parameters:
        xmlWriter - the export writer to write to.
        Throws:
        java.io.IOException - if an IO error occurs while writing to the output destination.
        javax.xml.stream.XMLStreamException - if an exception occurs converting this shape's fields to XML.
      • createCacheEntry

        protected abstract AbstractShape.AbstractShapeData createCacheEntry​(DrawContext dc)
        Creates and returns a new cache entry specific to the subclass.
        Parameters:
        dc - the current draw context.
        Returns:
        a data cache entry for the state in the specified draw context.
      • getCurrentData

        protected AbstractShape.AbstractShapeData getCurrentData()
        Returns the data cache entry for the current rendering.
        Returns:
        the data cache entry for the current rendering.
      • reset

        protected void reset()
        Invalidates computed values. Called when this shape's contents or certain attributes change.
      • getAttributes

        public ShapeAttributes getAttributes()
        Returns this shape's normal (as opposed to highlight) attributes.
        Specified by:
        getAttributes in interface Attributable
        Returns:
        this shape's normal attributes. May be null.
      • setAttributes

        public void setAttributes​(ShapeAttributes normalAttrs)
        Specifies this shape's normal (as opposed to highlight) attributes.
        Specified by:
        setAttributes in interface Attributable
        Parameters:
        normalAttrs - the normal attributes. May be null, in which case default attributes are used.
      • setHighlightAttributes

        public void setHighlightAttributes​(ShapeAttributes highlightAttrs)
        Specifies this shape's highlight attributes.
        Specified by:
        setHighlightAttributes in interface Attributable
        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.
      • isVisible

        public boolean isVisible()
        Indicates whether this shape is drawn during rendering.
        Returns:
        true if this shape is drawn, otherwise false.
        See Also:
        setVisible(boolean)
      • setVisible

        public void setVisible​(boolean visible)
        Specifies whether this shape is drawn during rendering.
        Parameters:
        visible - true to draw this shape, otherwise false. The default value is true.
        See Also:
        setAttributes(ShapeAttributes)
      • getAltitudeMode

        public int getAltitudeMode()
        Returns this shape's altitude mode.
        Returns:
        this shape's altitude mode.
        See Also:
        setAltitudeMode(int)
      • 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.
      • isEnableBatchRendering

        public boolean isEnableBatchRendering()
        Indicates whether batch rendering is enabled for the concrete shape type of this shape.
        Returns:
        true if batch rendering is enabled, otherwise false.
        See Also:
        setEnableBatchRendering(boolean)
      • 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.
        Parameters:
        enableBatchRendering - true to enable batch rendering, otherwise false.
      • isEnableBatchPicking

        public boolean isEnableBatchPicking()
        Indicates whether batch picking is enabled.
        Returns:
        true if batch rendering is enabled, otherwise false.
        See Also:
        setEnableBatchPicking(boolean)
      • 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 (setEnableBatchRendering(boolean)) must be enabled in order for batch picking to occur.

        Parameters:
        enableBatchPicking - true to enable batch rendering, 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.
        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.

        Parameters:
        outlinePickWidth - the outline pick width. The default is 10.
        Throws:
        java.lang.IllegalArgumentException - if the width is less than 0.
      • 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.
        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. See Offset.
        Parameters:
        enableDepthOffset - true if depth offset is applied, otherwise false.
      • setGeometryRegenerationInterval

        public void setGeometryRegenerationInterval​(int geometryRegenerationInterval)
        Specifies the maximum length of time between geometry regenerations. The geometry is regenerated when this shape's altitude mode is WorldWind.CLAMP_TO_GROUND or WorldWind.RELATIVE_TO_GROUND in order to capture changes to the terrain. (The terrain changes when its resolution changes or when new elevation data is returned from a server.) Decreasing this value causes the geometry to more quickly track terrain changes but at the cost of performance. Increasing this value often does not have much effect because there are limiting factors other than geometry regeneration.
        Parameters:
        geometryRegenerationInterval - the geometry regeneration interval, in milliseconds. The default is two seconds.
      • setReferencePosition

        public void setReferencePosition​(Position referencePosition)
        Specifies the position to use as a reference position for computed geometry. This value should typically left to the default value of the first position in the polygon's outer boundary.
        Parameters:
        referencePosition - the reference position. May be null, in which case the first position of the outer boundary is the reference position.
      • getDelegateOwner

        public java.lang.Object getDelegateOwner()
      • setDelegateOwner

        public void setDelegateOwner​(java.lang.Object delegateOwner)
      • getExtent

        public Extent getExtent()
        Returns this shape's extent in model coordinates.
        Returns:
        this shape's extent, or null if an extent has not been computed.
      • getReferencePoint

        public Vec4 getReferencePoint()
        Returns the Cartesian coordinates of this shape's reference position as computed during the most recent rendering.
        Returns:
        the Cartesian coordinates corresponding to this shape's reference position, or null if the point has not been computed.
      • getExtent

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

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

        public ShapeAttributes getActiveAttributes()
        Returns this shape's currently active attributes, as determined during the most recent call to determineActiveAttributes(). 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.
      • mustRegenerateGeometry

        protected boolean mustRegenerateGeometry​(DrawContext dc)
        Indicates whether this shape's renderable geometry must be recomputed, either as a result of an attribute or property change or the expiration of the geometry regeneration interval.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
        Returns:
        true if this shape's geometry must be regenerated, otherwise false.
      • shouldUseVBOs

        protected boolean shouldUseVBOs​(DrawContext dc)
        Indicates whether this shape should use OpenGL vertex buffer objects.
        Parameters:
        dc - the current draw context.
        Returns:
        true if this shape should use vertex buffer objects, otherwise false.
      • mustDrawInterior

        protected boolean mustDrawInterior()
        Indicates whether this shape's interior must be drawn.
        Returns:
        true if an interior must be drawn, otherwise false.
      • mustDrawOutline

        protected boolean mustDrawOutline()
        Indicates whether this shape's outline must be drawn.
        Returns:
        true if the outline should be drawn, otherwise false.
      • mustApplyLighting

        protected boolean mustApplyLighting​(DrawContext dc)
        Indicates whether standard lighting must be applied by consulting the current active attributes. Calls mustApplyLighting(DrawContext, ShapeAttributes), specifying null for the activeAttrs.
        Parameters:
        dc - the current draw context
        Returns:
        true if lighting must be applied, otherwise false.
      • mustApplyLighting

        protected boolean mustApplyLighting​(DrawContext dc,
                                            ShapeAttributes activeAttrs)
        Indicates whether standard lighting must be applied by consulting either the specified active attributes or the current active attributes.
        Parameters:
        dc - the current draw context
        activeAttrs - the attribute bundle to consider when determining whether lighting is applied. May be null, in which case the current active attributes are used.
        Returns:
        true if lighting must be applied, otherwise false.
      • mustCreateNormals

        protected boolean mustCreateNormals​(DrawContext dc)
        Indicates whether normal vectors must be computed by consulting the current active attributes. Calls mustCreateNormals(DrawContext, ShapeAttributes), specifying null for the activeAttrs.
        Parameters:
        dc - the current draw context
        Returns:
        true if normal vectors must be computed, otherwise false.
      • mustCreateNormals

        protected boolean mustCreateNormals​(DrawContext dc,
                                            ShapeAttributes activeAttrs)
        Indicates whether normal vectors must be computed by consulting either the specified active attributes or the current active attributes. Calls mustApplyLighting(DrawContext, ShapeAttributes), passing the specified active attrs.
        Parameters:
        dc - the current draw context
        activeAttrs - the attribute bundle to consider when determining whether normals should be computed. May be null, in which case the current active attributes are used.
        Returns:
        true if normal vectors must be computed, otherwise false.
      • makeTexture

        protected WWTexture makeTexture​(java.lang.Object imageSource)
        Creates a WWTexture for a specified image source.
        Parameters:
        imageSource - the image source for which to create the texture.
        Returns:
        the new WWTexture.
        Throws:
        java.lang.IllegalArgumentException - if the image source is null.
      • createSurfaceShape

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

        protected void updateSurfaceShape()
        Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this shape on 2D globes. Subclasses should override this method if they need to update more than the highlighted state, visibility state and delegate owner.
      • 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)
        Determines whether to add this shape to the draw context's ordered renderable list. Creates this shapes renderable geometry.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • addOrderedRenderable

        protected void addOrderedRenderable​(DrawContext dc)
        Adds this shape to the draw context's ordered renderable list.
        Parameters:
        dc - the current draw context.
      • isTerrainDependent

        protected boolean isTerrainDependent()
        Indicates whether this shape's geometry depends on the terrain.
        Returns:
        true if this shape's geometry depends on the terrain, otherwise false.
      • isViewDistanceExpiration

        public boolean isViewDistanceExpiration()
        Indicates whether this shape's terrain-dependent geometry is continually computed as its distance from the eye point changes. This is often necessary to ensure that the shape is updated as the terrain precision changes. But it's often not necessary as well, and can be disabled.
        Returns:
        true if the terrain dependent geometry is updated as the eye distance changes, otherwise false. The default is true.
      • setViewDistanceExpiration

        public void setViewDistanceExpiration​(boolean viewDistanceExpiration)
        Specifies whether this shape's terrain-dependent geometry is continually computed as its distance from the eye point changes. This is often necessary to ensure that the shape is updated as the terrain precision changes. But it's often not necessary as well, and can be disabled.
        Parameters:
        viewDistanceExpiration - true to enable view distance expiration, otherwise false.
      • checkViewDistanceExpiration

        protected void checkViewDistanceExpiration​(DrawContext dc)
        Determines whether this shape's geometry should be invalidated because the view distance changed, and if so, invalidates the geometry.
        Parameters:
        dc - the current draw context.
      • intersectsFrustum

        protected boolean intersectsFrustum​(DrawContext dc)
        Determines whether this shape intersects the view frustum.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
        Returns:
        true if this shape intersects the frustum, otherwise false.
      • drawOrderedRenderable

        protected void drawOrderedRenderable​(DrawContext dc)
        Draws this shape as an ordered renderable.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • drawBatched

        protected void drawBatched​(DrawContext dc)
        Draws this ordered renderable and all subsequent Path ordered renderables in the ordered renderable list. If the current pick mode is true, only shapes within the same layer are drawn as a batch.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • doDrawOrderedRenderable

        protected void doDrawOrderedRenderable​(DrawContext dc,
                                               PickSupport pickCandidates)
        Draw this shape as an ordered renderable. If in picking mode, add it to the picked object list of specified PickSupport. The PickSupport may not be the one associated with this instance. During batch picking the PickSupport of the instance initiating the batch picking is used so that all shapes rendered in batch are added to the same pick list.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
        pickCandidates - a pick support holding the picked object list to add this shape to.
      • createPickedObject

        protected PickedObject createPickedObject​(int colorCode)
        Creates a PickedObject for this shape and the specified unique pick color code. The PickedObject returned by this method will be added to the pick list to represent the current shape.
        Parameters:
        colorCode - the unique color code for this shape.
        Returns:
        a new picked object.
      • beginDrawing

        protected OGLStackHandler beginDrawing​(DrawContext dc,
                                               int attrMask)
        Establish the OpenGL state needed to draw this shape.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
        attrMask - an attribute mask indicating state the caller will set. This base class implementation sets GL_CURRENT_BIT, GL_LINE_BIT, GL_HINT_BIT, GL_POLYGON_BIT, GL_COLOR_BUFFER_BIT, and GL_TRANSFORM_BIT.
        Returns:
        the stack handler used to set the OpenGL state. Callers should use this to set additional state, especially state indicated in the attribute mask argument.
      • drawOutline

        protected void drawOutline​(DrawContext dc)
        Draws this shape's outline.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • prepareToDrawOutline

        protected void prepareToDrawOutline​(DrawContext dc,
                                            ShapeAttributes activeAttrs,
                                            ShapeAttributes defaultAttrs)
        Establishes OpenGL state for drawing the outline, including setting the color/material, line smoothing, line width and stipple. Disables texture.
        Parameters:
        dc - the current draw context.
        activeAttrs - the attributes indicating the state value to set.
        defaultAttrs - the attributes to use if activeAttrs does not contain a necessary value.
      • drawInterior

        protected void drawInterior​(DrawContext dc)
        Draws this shape's interior.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • prepareToDrawInterior

        protected void prepareToDrawInterior​(DrawContext dc,
                                             ShapeAttributes activeAttrs,
                                             ShapeAttributes defaultAttrs)
        Establishes OpenGL state for drawing the interior, including setting the color/material. Enabling texture is left to the subclass.
        Parameters:
        dc - the current draw context.
        activeAttrs - the attributes indicating the state value to set.
        defaultAttrs - the attributes to use if activeAttrs does not contain a necessary value.
      • computePoint

        protected Vec4 computePoint​(Terrain terrain,
                                    Position position)
        Computes a model-coordinate point from a position, applying this shape's altitude mode.
        Parameters:
        terrain - the terrain to compute a point relative to the globe's surface.
        position - the position to compute a point for.
        Returns:
        the model-coordinate point corresponding to the position and this shape's shape type.
      • computePoint

        protected Vec4 computePoint​(DrawContext dc,
                                    Terrain terrain,
                                    Position position)
        Computes a model-coordinate point from a position, applying this shape's altitude mode, and using CLAMP_TO_GROUND if the current globe is 2D.
        Parameters:
        dc - the current draw context.
        terrain - the terrain to compute a point relative to the globe's surface.
        position - the position to compute a point for.
        Returns:
        the model-coordinate point corresponding to the position and this shape's shape type.
      • computeExtentFromPositions

        protected Extent computeExtentFromPositions​(Globe globe,
                                                    double verticalExaggeration,
                                                    java.lang.Iterable<? extends LatLon> positions)
        Computes this shape's approximate extent from its positions.
        Parameters:
        globe - the globe to use to compute the extent.
        verticalExaggeration - the vertical exaggeration to apply to computed terrain points.
        positions - the positions to compute the extent for.
        Returns:
        the extent, or null if an extent cannot be computed. Null is returned if either globe or positions is null.
      • getVboIds

        protected int[] getVboIds​(DrawContext dc)
        Get or create OpenGL resource IDs for the current data cache entry.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
        Returns:
        an array containing the coordinate vertex buffer ID in the first position and the index vertex buffer ID in the second position.
      • clearCachedVbos

        protected void clearCachedVbos​(DrawContext dc)
        Removes from the GPU resource cache the entry for the current data cache entry's VBOs.

        A AbstractShape.AbstractShapeData must be current when this method is called.

        Parameters:
        dc - the current draw context.
      • countTriangleVertices

        protected int countTriangleVertices​(java.util.List<java.util.List<java.lang.Integer>> prims,
                                            java.util.List<java.lang.Integer> primTypes)
      • move

        public void move​(Position delta)
        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:
        delta - 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)
      • export

        public void export​(java.lang.String mimeType,
                           java.lang.Object output)
                    throws java.io.IOException,
                           java.lang.UnsupportedOperationException
        Description copied from interface: Exportable
        Exports the object to a format.
        Specified by:
        export in interface Exportable
        Parameters:
        mimeType - Desired export format. Call Exportable.isExportFormatSupported(String) to make sure that the object supports the format before trying to export, or be prepared to handle UnsupportedOperationException.
        output - Object that will receive the exported data. The type of this object depends on the export format. All formats should support java.io.OutputStream. Text based format (for example, XML formats) should also support java.io.Writer. Certain formats may also support other object types.
        Throws:
        java.io.IOException - if an exception occurs while exporting the data.
        java.lang.UnsupportedOperationException - if the format is not supported by this object, or if the output argument is not of a supported type.
        See Also:
        Exportable.isExportFormatSupported(String)
      • exportAsKML

        protected void exportAsKML​(java.lang.Object output)
                            throws java.io.IOException,
                                   javax.xml.stream.XMLStreamException
        Export the placemark to KML as a <Placemark> element. The output object will receive the data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter
        Parameters:
        output - Object to receive the generated KML.
        Throws:
        javax.xml.stream.XMLStreamException - If an exception occurs while writing the KML
        java.io.IOException - if an exception occurs while exporting the data.
        See Also:
        export(String, Object)
      • 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.