nl.kun.Engine3D
Class TPhysCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--nl.kun.Engine3D.TPhysCanvas

public class TPhysCanvas
extends java.awt.Canvas

A canvas that can be used to display all items inherited from TEntity3D. The camera is set with the following constructor input: (0,0,10, 0,0,-1,0,1,0); A 10 points Times new roman font is used for all string output. All TEntity3D's should be appended with the function Append().

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
 TCamera3D camera
          A camera object, on which the scenery is projected
 boolean threadSuspended
          Flag to determine if the thread is Suspended or not
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
TPhysCanvas(double _Xmin, double _Ymin, double _Xmax, double _Ymax)
          Constructor This canvas resizes itself to the maximum area it gets from the applet, so no need to input a pixel height and width Input variables determine the rectangle in physical coordinates that can be shown at Z=0 in camera coordinate system.
 
Method Summary
 void Append(TEntity3D _ent)
          Appends a TEntity3D object to the objectlist of the canvas.
 boolean bufferDraw()
          Called by the user to draw the simulation to an offline buffer if there are any buffers ready.
 java.lang.String BufferDrawn2String()
          Used for debugging.
 java.lang.String BufferReady2String()
          Used for debugging.
 void initGraphics()
          Initialize all the graphics.
 void paint(java.awt.Graphics g)
          This function paint the buffer to the screen if an offline buffer is ready.
 void redraw()
          This function calls the paint() with a graphics object it gets from the canvas.
 void setActive()
          Activates the simulation.
 void setInactive()
          Deactivates the simulation.
 void update(java.awt.Graphics g)
          Called by JVM to redraw the canvas when necessary.
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

camera

public TCamera3D camera
A camera object, on which the scenery is projected

threadSuspended

public boolean threadSuspended
Flag to determine if the thread is Suspended or not
Constructor Detail

TPhysCanvas

public TPhysCanvas(double _Xmin,
                   double _Ymin,
                   double _Xmax,
                   double _Ymax)
Constructor This canvas resizes itself to the maximum area it gets from the applet, so no need to input a pixel height and width Input variables determine the rectangle in physical coordinates that can be shown at Z=0 in camera coordinate system. Remember that this IS a 3D engine! The input variables will be resized to assure that the pixels are square.
Parameters:
_Xmin - The minimum X value at Z=0 that can be displayed on screen.
_Ymin - The minimum Y value at Z=0 that can be displayed on screen.
_Xmax - The maximum X value at Z=0 that can be displayed on screen.
_Ymax - The maximum Y value at Z=0 that can be displayed on screen.
Method Detail

paint

public void paint(java.awt.Graphics g)
This function paint the buffer to the screen if an offline buffer is ready. It should never be called by the user. Instead call redraw().
Overrides:
paint in class java.awt.Canvas

redraw

public void redraw()
This function calls the paint() with a graphics object it gets from the canvas. It will only paint if there is a buffer ready to be drawn to screen.

update

public void update(java.awt.Graphics g)
Called by JVM to redraw the canvas when necessary. Never called by user.
Overrides:
update in class java.awt.Component

setActive

public void setActive()
Activates the simulation.

setInactive

public void setInactive()
Deactivates the simulation.

bufferDraw

public boolean bufferDraw()
Called by the user to draw the simulation to an offline buffer if there are any buffers ready.

initGraphics

public void initGraphics()
Initialize all the graphics. This can not be done in the constructor because some details of the canvas are not know at that time. Should be called in the start() subroutine of the applet, everytime the physical boundaries of the canvas are changed, or if you want to reset the buffers.

Append

public void Append(TEntity3D _ent)
Appends a TEntity3D object to the objectlist of the canvas. It will be drawn next time, if it is vissible.

BufferReady2String

public java.lang.String BufferReady2String()
Used for debugging.

BufferDrawn2String

public java.lang.String BufferDrawn2String()
Used for debugging.