Package gov.nasa.worldwind.render
Class FrameFactory
- java.lang.Object
-
- gov.nasa.worldwind.render.FrameFactory
-
public class FrameFactory extends java.lang.Object
Static class for drawing 2D frames.All shapes are drawn inside a bounding rectangle whose lower left corner is at the origin. Shapes with a leader use an offset point that indicate where the leader triangle should point at - it usually has a negative y since the leader connects at the bottom of the frame (at y = 0).
- See Also:
AbstractAnnotation
-
-
Constructor Summary
Constructors Constructor Description FrameFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.DoubleBuffer
createShapeBuffer(java.lang.String shape, double width, double height, int cornerRadius, java.nio.DoubleBuffer buffer)
Create a vertex buffer for a shape with the specified width, height and corner radius.static java.nio.DoubleBuffer
createShapeWithLeaderBuffer(java.lang.String shape, double width, double height, java.awt.Point leaderOffset, double leaderGapWidth, int cornerRadius, java.nio.DoubleBuffer buffer)
Create a vertex buffer for a shape with the specified width, height and corner radius.static void
drawBuffer(DrawContext dc, int mode, int count, java.nio.DoubleBuffer verts)
Draw a vertex buffer in a given gl mode.static void
drawBuffer(DrawContext dc, int mode, int count, java.nio.DoubleBuffer verts, java.nio.DoubleBuffer coords)
Draw a vertex buffer with texture coordinates in a given gl mode.static void
drawBuffer(DrawContext dc, int mode, java.nio.DoubleBuffer verts)
static void
drawShape(DrawContext dc, java.lang.String shape, double width, double height, int glMode, int cornerRadius)
Draw a shape with the specified width and height, gl mode and corner radius.static void
drawShapeWithLeader(DrawContext dc, java.lang.String shape, double width, double height, java.awt.Point leaderOffset, double leaderGapWidth, int glMode, int cornerRadius)
Draw a shape with the specified width and height, gl mode and corner radius.
-
-
-
Method Detail
-
drawShape
public static void drawShape(DrawContext dc, java.lang.String shape, double width, double height, int glMode, int cornerRadius)
Draw a shape with the specified width and height, gl mode and corner radius. GL mode came be one ofGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
. Corner radius only apply toSHAPE_RECTANGLE
- set to zero for square corners.- Parameters:
dc
- the currentDrawContext
.shape
- the shape - can be one ofSHAPE_RECTANGLE
orSHAPE_ELLIPSE
.width
- the width of the overall shape.height
- the height of the shape.glMode
- the GL mode - can be one ofGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
.cornerRadius
- the rounded corners radius. Set to zero for square corners.
-
drawShapeWithLeader
public static void drawShapeWithLeader(DrawContext dc, java.lang.String shape, double width, double height, java.awt.Point leaderOffset, double leaderGapWidth, int glMode, int cornerRadius)
Draw a shape with the specified width and height, gl mode and corner radius. The shape includes a leader triangle pointing to a specified point. GL mode came be one ofGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
. Corner radius only apply toSHAPE_RECTANGLE
- set to zero for square corners.- Parameters:
dc
- the currentDrawContext
.shape
- the shape - can be one ofSHAPE_RECTANGLE
orSHAPE_ELLIPSE
.width
- the width of the overall shape.height
- the height of the shape excluding the leader.leaderOffset
- the coordinates of the point to which the leader leads.leaderGapWidth
- the starting width of the leader shape.glMode
- the GL mode - can be one ofGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
.cornerRadius
- the rounded corners radius. Set to zero for square corners.
-
createShapeBuffer
public static java.nio.DoubleBuffer createShapeBuffer(java.lang.String shape, double width, double height, int cornerRadius, java.nio.DoubleBuffer buffer)
Create a vertex buffer for a shape with the specified width, height and corner radius. Corner radius only apply toSHAPE_RECTANGLE
- set to zero for square corners.- Parameters:
shape
- the shape - can be one ofSHAPE_RECTANGLE
orSHAPE_ELLIPSE
.width
- the width of the overall shape.height
- the height of the shape.cornerRadius
- the rounded corners radius. Set to zero for square corners.buffer
- the buffer to store shape vertices, or null to allocate a new buffer.- Returns:
- the vertex buffer.
-
createShapeWithLeaderBuffer
public static java.nio.DoubleBuffer createShapeWithLeaderBuffer(java.lang.String shape, double width, double height, java.awt.Point leaderOffset, double leaderGapWidth, int cornerRadius, java.nio.DoubleBuffer buffer)
Create a vertex buffer for a shape with the specified width, height and corner radius. The shape includes a leader triangle pointing to a specified point. Corner radius only apply toSHAPE_RECTANGLE
- set to zero for square corners.- Parameters:
shape
- the shape - can be one ofSHAPE_RECTANGLE
orSHAPE_ELLIPSE
.width
- the width of the overall shape.height
- the height of the shape excluding the leader.leaderOffset
- the coordinates of the point to which the leader leads.leaderGapWidth
- the starting width of the leader shape.cornerRadius
- the rounded corners radius. Set to zero for square corners.buffer
- the buffer to store shape vertices, or null to allocate a new buffer.- Returns:
- the vertex buffer.
-
drawBuffer
public static void drawBuffer(DrawContext dc, int mode, int count, java.nio.DoubleBuffer verts)
Draw a vertex buffer in a given gl mode. Vertex buffers coming from the createShapeBuffer() methods support bothGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
.- Parameters:
dc
- the current DrawContext.mode
- the desired drawing GL mode.count
- the number of vertices to draw.verts
- the vertex buffer to draw.
-
drawBuffer
public static void drawBuffer(DrawContext dc, int mode, int count, java.nio.DoubleBuffer verts, java.nio.DoubleBuffer coords)
Draw a vertex buffer with texture coordinates in a given gl mode. Vertex buffers coming from the createShapeBuffer() methods support bothGL.GL_TRIANGLE_FAN
andGL.LINE_STRIP
.- Parameters:
dc
- the current DrawContext.mode
- the desired drawing GL mode.count
- the number of vertices to draw.verts
- the vertex buffer to draw.coords
- the buffer containing the shape texture coordinates.
-
drawBuffer
public static void drawBuffer(DrawContext dc, int mode, java.nio.DoubleBuffer verts)
-
-