Class Cube

  • All Implemented Interfaces:
    Renderable

    public class Cube
    extends ApplicationTemplate
    implements Renderable
    Example of a custom Renderable that draws a cube at a geographic position. This class shows the simplest possible example of a custom Renderable, while still following WorldWind best practices. See https://worldwind.arc.nasa.gov/java/tutorials/build-a-custom-renderable/ for a complete description of this example.
    • Field Detail

      • position

        protected Position position
        Geographic position of the cube.
      • size

        protected double size
        Length of each face, in meters.
      • pickSupport

        protected PickSupport pickSupport
        Support object to help with pick resolution.
      • frameTimestamp

        protected long frameTimestamp
    • Constructor Detail

      • Cube

        public Cube​(Position position,
                    double sizeInMeters)
    • Method Detail

      • 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
      • intersectsFrustum

        protected boolean intersectsFrustum​(DrawContext dc,
                                            Cube.OrderedCube orderedCube)
        Determines whether the cube intersects the view frustum.
        Parameters:
        dc - the current draw context.
        orderedCube - The cube to check.
        Returns:
        true if this cube intersects the frustum, otherwise false.
      • makeOrderedRenderable

        protected Cube.OrderedCube makeOrderedRenderable​(DrawContext dc)
        Compute per-frame attributes, and add the ordered renderable to the ordered renderable list.
        Parameters:
        dc - Current draw context.
        Returns:
        The resulting cube.
      • drawOrderedRenderable

        protected void drawOrderedRenderable​(DrawContext dc,
                                             PickSupport pickCandidates)
        Set up drawing state, and draw the cube.This method is called when the cube is rendered in ordered rendering mode.
        Parameters:
        dc - Current draw context.
        pickCandidates - The pick candidates list.
      • beginDrawing

        protected void beginDrawing​(DrawContext dc)
        Setup drawing state in preparation for drawing the cube. State changed by this method must be restored in endDrawing.
        Parameters:
        dc - Active draw context.
      • endDrawing

        protected void endDrawing​(DrawContext dc)
        Restore drawing state changed in beginDrawing to the default.
        Parameters:
        dc - Active draw context.
      • drawUnitCube

        protected void drawUnitCube​(DrawContext dc)
        Draw a unit cube, using the active modelview matrix to orient the shape.
        Parameters:
        dc - Current draw context.
      • main

        public static void main​(java.lang.String[] args)