com.partnersoft.gui
Class EZ2DGL

java.lang.Object
  extended by com.partnersoft.gui.EZ2DGL
All Implemented Interfaces:
RoverConstants

public class EZ2DGL
extends java.lang.Object
implements RoverConstants

A wrapper for GLCanvas that provides a simpler, 2D-only API. Takes care of fonts, textures, events, etc.

Author:
Paul Reavis Copyright 2004 Partner Software, Inc.

Field Summary
 EZ2DGLCanvas canvas
           
 double centerX
           
 double centerY
           
 GLFont currentFont
           
 int currentFontID
           
 GLTexture currentTexture
           
 int currentTextureID
           
 javax.media.opengl.GL gl
           
 javax.media.opengl.glu.GLU glu
           
 double originX
           
 double originY
           
 double rotation
           
 double scale
           
protected  java.nio.ByteBuffer selectionBufferBytes
           
 double tileScale
           
 
Fields inherited from interface com.partnersoft.io.formats.rover.RoverConstants
ALIGN_BOTTOM_CENTER, ALIGN_BOTTOM_FIT, ALIGN_BOTTOM_LEFT, ALIGN_BOTTOM_RIGHT, ALIGN_CENTER, ALIGN_CENTER_LEFT, ALIGN_CENTER_RIGHT, ALIGN_CODE_CENTER, ALIGN_CODE_FIT, ALIGN_CODE_HIGH, ALIGN_CODE_LOW, ALIGN_FIT, ALIGN_FIT_LEFT, ALIGN_FIT_RIGHT, ALIGN_TOP_CENTER, ALIGN_TOP_FIT, ALIGN_TOP_LEFT, ALIGN_TOP_RIGHT, COMMENT, DATA_FIELDS_MAX, EOF, FLOAT_COORDS, GEOMETRY_TYPE_NAMES, HAS_DATA, HAS_OFFSET, HAS_ROTATION, LIST, MASK_TYPECODE, NAMING, POINT, POINT_COLOR, POLYGON, POLYLINE, POP, PUSH, RENDER_FINDITEM, RENDER_INDICATION, RENDER_NORMAL, RENDER_SELECTION, ROTATION_MULT, TEXEL_COORD_MAX, TEXEL_COORD_SIZE, TEXT, TILE_COORD_MAX, TILE_SIZE_PIXELS, VALUE
 
Constructor Summary
EZ2DGL(EZ2DGLCanvas canvas, javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu)
           
 
Method Summary
 void clear()
          Clears the buffer and sets it to the background color.
 void displayThumbTwiddle()
           
 void drawBullseye()
           
 void drawCircle(int dataID, double centerX, double centerY, double radius)
           
 void drawPolygon(int dataID, DoubleBuffer coords)
          Draws a filled polygon in the foreground color.
 void drawPolyline(int dataID, DoubleBuffer coords)
          Draws a filled polyline in the foreground color.
 void drawString(int fontID, double x, double y, float rotation, int alignment, double fontScale, java.lang.String text)
           
 void drawTexture(int dataID, int textureID, double x, double y, double rotation, double textureScale)
          Just draws the given texture as a rotated, scaled icon.
 void drawTexture(int dataID, int textureID, double x, double y, double rotation, double scale, double red, double green, double blue, double alpha)
          Just draws the given texture as a rotated, scaled icon.
 void drawTriangle(double x1, double y1, double x2, double y2, double x3, double y3, double z)
           
 int[][] endSelection()
           
 void endTile()
           
 EZ2DGLCanvas getCanvas()
           
 void popName()
           
 void pushName(int ID)
           
 void setBackgroundColor(int rgb)
           
 void setCurrentTexture(int textureID)
          Sets up for drawing with textures.
 void setForegroundColor(int rgb)
           
 void setLineStipple(int stipple)
           
 void setLineWidth(float newWidth)
           
 void setMarchingAnts(boolean marching, boolean animated)
           
 void setModelView(double centerX, double centerY, double rotation, double scale)
          This sets the viewing parameters, specified as a centerpoint, rotation, and scale.
 void startSelection()
           
 void startTile(double originX, double originY, double tileScale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

centerX

public double centerX

centerY

public double centerY

rotation

public double rotation

scale

public double scale

originX

public double originX

originY

public double originY

tileScale

public double tileScale

currentTexture

public GLTexture currentTexture

currentTextureID

public int currentTextureID

gl

public javax.media.opengl.GL gl

glu

public javax.media.opengl.glu.GLU glu

currentFontID

public int currentFontID

currentFont

public GLFont currentFont

canvas

public EZ2DGLCanvas canvas

selectionBufferBytes

protected transient java.nio.ByteBuffer selectionBufferBytes
Constructor Detail

EZ2DGL

public EZ2DGL(EZ2DGLCanvas canvas,
              javax.media.opengl.GL gl,
              javax.media.opengl.glu.GLU glu)
Method Detail

displayThumbTwiddle

public void displayThumbTwiddle()

clear

public void clear()
Clears the buffer and sets it to the background color.


setBackgroundColor

public void setBackgroundColor(int rgb)

setForegroundColor

public void setForegroundColor(int rgb)

setLineWidth

public void setLineWidth(float newWidth)

setLineStipple

public void setLineStipple(int stipple)

drawTexture

public void drawTexture(int dataID,
                        int textureID,
                        double x,
                        double y,
                        double rotation,
                        double textureScale)
Just draws the given texture as a rotated, scaled icon.


drawTexture

public void drawTexture(int dataID,
                        int textureID,
                        double x,
                        double y,
                        double rotation,
                        double scale,
                        double red,
                        double green,
                        double blue,
                        double alpha)
Just draws the given texture as a rotated, scaled icon.


drawPolygon

public void drawPolygon(int dataID,
                        DoubleBuffer coords)
Draws a filled polygon in the foreground color.


drawCircle

public void drawCircle(int dataID,
                       double centerX,
                       double centerY,
                       double radius)

drawPolyline

public void drawPolyline(int dataID,
                         DoubleBuffer coords)
Draws a filled polyline in the foreground color.


drawString

public void drawString(int fontID,
                       double x,
                       double y,
                       float rotation,
                       int alignment,
                       double fontScale,
                       java.lang.String text)

getCanvas

public EZ2DGLCanvas getCanvas()

setModelView

public void setModelView(double centerX,
                         double centerY,
                         double rotation,
                         double scale)
This sets the viewing parameters, specified as a centerpoint, rotation, and scale.


startTile

public void startTile(double originX,
                      double originY,
                      double tileScale)

endTile

public void endTile()

drawTriangle

public void drawTriangle(double x1,
                         double y1,
                         double x2,
                         double y2,
                         double x3,
                         double y3,
                         double z)

startSelection

public void startSelection()

endSelection

public int[][] endSelection()

setCurrentTexture

public void setCurrentTexture(int textureID)
Sets up for drawing with textures. TextureID 0 disabled.


drawBullseye

public void drawBullseye()

pushName

public void pushName(int ID)

popName

public void popName()

setMarchingAnts

public void setMarchingAnts(boolean marching,
                            boolean animated)