fhm.edu.fem.animation
Class GLFEMRenderer

java.lang.Object
  extended by fhm.edu.fem.animation.GLFEMRenderer
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
Direct Known Subclasses:
GLMembraneRenderer, GLSpannerRenderer

public abstract class GLFEMRenderer
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener

Class Description: This class is the base class for all renderers. It offers an abstract method which is automatically called by this class during rendering, where the extended classes can put their render-stuff.

Author:
Thomas Woellert (thomas.woellert@t-online.de), Stefan Weissbach (weissbst@gmx.de)

Field Summary
protected  FEMManager femManager
           
protected  boolean mouseLButtonDown
           
protected  boolean mouseRButtonDown
           
protected  float nRange
           
protected  int prevMouseX
           
protected  int prevMouseY
           
protected  boolean showPointsOnly
           
protected  boolean showPolygons
           
protected  double transX
           
protected  double transY
           
protected  boolean useColorMode
           
protected  boolean viewChangedByUser
           
protected  int viewHeight
           
protected  float viewRotX
           
protected  float viewRotY
           
protected  float viewRotZ
           
protected  int viewWidth
           
protected  int viewX
           
protected  int viewY
           
 
Constructor Summary
GLFEMRenderer()
          Constructor of the FEM Renderer, the mid point is automatically set at the mid of the whole figure shown
GLFEMRenderer(double xMid, double yMid)
          Constructor of the FEM Renderer, manually setting the mid point of the drawing
 
Method Summary
 void display(GLDrawable drawable)
          This method is automatically called in a loop to keep drawing the window
 void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged)
          Method required by the GLEventListener Interface
protected abstract  void drawContents(GLDrawable drawable)
          The abstract draw method which needs to be implemented in all extending renderers
protected  void drawCoordSystem(GLDrawable drawable)
          Draw the coordinate system
 void init(GLDrawable drawable)
          Initialize This method is automatically called by OpenGL
 void keyPressed(java.awt.event.KeyEvent e)
          METHODS NEEDED BY THE KEYLISTENER INTERFACE
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
          Automatically called when the user presses a key
 void mouseClicked(java.awt.event.MouseEvent e)
          METHODS REQUIRED BY THE MOUSE LISTENERS - NOT USED
 void mouseDragged(java.awt.event.MouseEvent e)
          Called when the user drags the mouse
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Called when the user presses any mouse button
 void mouseReleased(java.awt.event.MouseEvent e)
          Called when the user releases the mouse button
 void reshape(GLDrawable drawable, int x, int y, int w, int h)
          This method is called when the user resizes the window
protected  void setMidPointFromNodes()
          Calculate and set the mid point of the graphic based on all nodes in the figure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

femManager

protected FEMManager femManager

mouseLButtonDown

protected boolean mouseLButtonDown

mouseRButtonDown

protected boolean mouseRButtonDown

nRange

protected float nRange

prevMouseX

protected int prevMouseX

prevMouseY

protected int prevMouseY

showPointsOnly

protected boolean showPointsOnly

showPolygons

protected boolean showPolygons

transX

protected double transX

transY

protected double transY

useColorMode

protected boolean useColorMode

viewChangedByUser

protected boolean viewChangedByUser

viewHeight

protected int viewHeight

viewRotX

protected float viewRotX

viewRotY

protected float viewRotY

viewRotZ

protected float viewRotZ

viewWidth

protected int viewWidth

viewX

protected int viewX

viewY

protected int viewY
Constructor Detail

GLFEMRenderer

public GLFEMRenderer()
Constructor of the FEM Renderer, the mid point is automatically set at the mid of the whole figure shown

Parameters:
xMid, - the x-value which should be moved to the middle of the screen
yMid, - the y-value which should be moved to the middle of the screen

GLFEMRenderer

public GLFEMRenderer(double xMid,
                     double yMid)
Constructor of the FEM Renderer, manually setting the mid point of the drawing

Parameters:
xMid, - the x-value which should be moved to the middle of the screen
yMid, - the y-value which should be moved to the middle of the screen
Method Detail

display

public void display(GLDrawable drawable)
This method is automatically called in a loop to keep drawing the window

Parameters:
drawable, - the main GLDrawable given by OpenGL

displayChanged

public void displayChanged(GLDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Method required by the GLEventListener Interface

Parameters:
drawable -
modeChanged -
deviceChanged -

drawContents

protected abstract void drawContents(GLDrawable drawable)
The abstract draw method which needs to be implemented in all extending renderers

Parameters:
drawable, - the main GLDrawable given by OpenGL

drawCoordSystem

protected void drawCoordSystem(GLDrawable drawable)
Draw the coordinate system

Parameters:
drawable, - the main GLDrawable given by OpenGL

init

public void init(GLDrawable drawable)
Initialize This method is automatically called by OpenGL

Parameters:
drawable, - the main GLDrawable given by OpenGL

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
METHODS NEEDED BY THE KEYLISTENER INTERFACE

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Automatically called when the user presses a key

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
e, - the key event

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
METHODS REQUIRED BY THE MOUSE LISTENERS - NOT USED

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Called when the user drags the mouse

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e, - the mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Called when the user presses any mouse button

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e, - the mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Called when the user releases the mouse button

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e, - the mouse event

reshape

public void reshape(GLDrawable drawable,
                    int x,
                    int y,
                    int w,
                    int h)
This method is called when the user resizes the window

Parameters:
drawable, - the main GLDrawable given by OpenGL
x, - the x-value of the view
y, - the y-value of the view
w, - the width of the view
h, - the height of the view

setMidPointFromNodes

protected void setMidPointFromNodes()
Calculate and set the mid point of the graphic based on all nodes in the figure