Class Box

    • Field Detail

      • faceCount

        protected int faceCount
      • subdivisions

        protected int subdivisions
    • Constructor Detail

      • Box

        public Box()
        Construct a box with default parameters
      • Box

        public Box​(Position centerPosition,
                   double northSouthRadius,
                   double verticalRadius,
                   double eastWestRadius)
        Construct a box from a specified center position and axes lengths.
        Parameters:
        centerPosition - the box's center position.
        northSouthRadius - the box's north-south radius, in meters.
        verticalRadius - the box's vertical radius, in meters.
        eastWestRadius - the box's east-west radius, in meters.
        Throws:
        java.lang.IllegalArgumentException - if the center position is null or any of the radii are not greater than 0.
      • Box

        public Box​(Position centerPosition,
                   double northSouthRadius,
                   double verticalRadius,
                   double eastWestRadius,
                   Angle heading,
                   Angle tilt,
                   Angle roll)
        Construct a Box from a specified center position, axes lengths and rotation angles. All angles are specified in degrees and positive angles are counter-clockwise.
        Parameters:
        centerPosition - the Box's center position.
        northSouthRadius - the Box's north-south radius, in meters.
        verticalRadius - the Box's vertical radius, in meters.
        eastWestRadius - the Box's east-west radius, in meters.
        heading - the Box's azimuth, its rotation about its vertical axis.
        tilt - the Box pitch, its rotation about its east-west axis.
        roll - the Box's roll, its rotation about its north-south axis.
    • Method Detail

      • getFaceCount

        public int getFaceCount()
        Description copied from class: RigidShape
        Returns the number of separate faces that comprise this shape.
        Overrides:
        getFaceCount in class RigidShape
        Returns:
        number of faces
      • computeSubdivisions

        protected void computeSubdivisions​(DrawContext dc,
                                           RigidShape.ShapeData shapeData)
        Computes the number of subdivisions necessary to achieve the expected Level of Detail given the shape's relationship to the viewer.
        Specified by:
        computeSubdivisions in class RigidShape
        Parameters:
        dc - the current drawContext.
        shapeData - the current globe-specific shape data
      • makeGeometry

        protected void makeGeometry​(RigidShape.ShapeData shapeData)
        Sets the Geometry mesh for this Box, either by pulling it from the geometryCache, or by creating it anew if the appropriate geometry does not yet exist in the cache.
        Specified by:
        makeGeometry in class RigidShape
        Parameters:
        shapeData - this shape's current shape data.
      • makeUnitBox

        protected void makeUnitBox​(int subdivisions,
                                   java.util.List<Geometry> meshes)
        Generates a unit box geometry, including the vertices, indices, normals and texture coordinates, tessellated with the specified number of divisions.
        Parameters:
        subdivisions - the number of times to subdivide the unit box geometry
        meshes - the Geometry list to hold the computed points, etc. for all Geometries
      • drawGeometry

        protected void drawGeometry​(DrawContext dc,
                                    int mode,
                                    int count,
                                    int type,
                                    java.nio.Buffer elementBuffer,
                                    RigidShape.ShapeData shapeData,
                                    int face)
        Renders the Box, using data from the provided buffer and the given parameters.
        Specified by:
        drawGeometry in class RigidShape
        Parameters:
        dc - the current draw context
        mode - the render mode
        count - the number of elements to be drawn
        type - the data type of the elements to be drawn
        elementBuffer - the buffer containing the list of elements to be drawn
        shapeData - this shape's current globe-specific shape data
        face - the index of the shape face to render
      • doExportAsKML

        protected void doExportAsKML​(javax.xml.stream.XMLStreamWriter xmlWriter)
                              throws java.io.IOException,
                                     javax.xml.stream.XMLStreamException
        Description copied from class: AbstractShape
        Exports shape-specific fields.
        Specified by:
        doExportAsKML in class AbstractShape
        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.