org.mt4j.components.visibleComponents
Class AbstractVisibleComponent

java.lang.Object
  extended by org.mt4j.components.MTComponent
      extended by org.mt4j.components.visibleComponents.AbstractVisibleComponent
All Implemented Interfaces:
IMTComponent, IMTComponent3D, IMTInputEventListener, IGestureEventListener
Direct Known Subclasses:
AbstractShape, TouchTailComponent

public abstract class AbstractVisibleComponent
extends MTComponent

    

The Class AbstractVisibleComponent. Abstract class for creating visible components. It provides methods for storing and changing style information, like the fill- and stroke color.

Author:
Christopher Ruff

Constructor Summary
AbstractVisibleComponent(processing.core.PApplet pApplet)
          Instantiates a new abstract visible component.
AbstractVisibleComponent(processing.core.PApplet pApplet, Icamera globalCamera, Icamera objectCamera)
          Instantiates a new abstract visible component.
AbstractVisibleComponent(processing.core.PApplet pApplet, java.lang.String name, Icamera objectCamera)
          Instantiates a new abstract visible component.
 
Method Summary
protected  void applyStyle()
          Apply style.
protected abstract  boolean componentContainsPointLocal(Vector3D testPoint)
          Checks whether the specified point is contained in this component.
abstract  void drawComponent(processing.core.PGraphics g)
          Draws this component only (Not its children!).
 MTColor getFillColor()
          Gets the fill color.
 int getFillDrawMode()
          Gets the fill draw mode.
 FillPaint getFillPaint()
          Gets the fill paint.
abstract  Vector3D getIntersectionLocal(Ray ray)
          Returns the intersection point of the ray and this component (children are not checked for intersections).
 short getLineStipple()
          Gets the line stipple.
 GLMaterial getMaterial()
          Gets the material.
 MTColor getStrokeColor()
          Gets the stroke color.
 float getStrokeWeight()
          Gets the stroke weight.
 StyleInfo getStyleInfo()
          Gets the style info.
 boolean isDrawSmooth()
          Checks if is draw smooth.
 boolean isNoFill()
          Checks if is no fill.
 boolean isNoStroke()
          Checks if is no stroke.
 void postDraw(processing.core.PGraphics graphics)
          Post draw.
 void postDrawChildren(processing.core.PGraphics g)
          Post draw Children.
 void preDraw(processing.core.PGraphics graphics)
          This method is called just before the components drawComponent method is invoked.
 void setDrawSmooth(boolean drawSmooth)
          Sets the draw smooth.
 void setFillColor(MTColor fillColor)
          Sets the fill color.
 void setFillDrawMode(int fillDrawMode)
          Sets the draw mode which will be used for creating display lists.
 void setFillPaint(FillPaint fillPaint)
          Sets the fill paint.
 void setLineStipple(short stipplePattern)
          Sets a line stipple pattern for drawing outlines.
 void setMaterial(GLMaterial material)
          Sets the material used by opengl lightning.
 void setNoFill(boolean noFill)
          Sets the no fill.
 void setNoStroke(boolean noStroke)
          Sets the no stroke.
 void setStrokeColor(MTColor strokeColor)
          Sets the stroke color.
 void setStrokeWeight(float strokeWeight)
          Sets the stroke weight.
 void setStyleInfo(StyleInfo styleInfo)
          Sets the style info.
 
Methods inherited from class org.mt4j.components.MTComponent
addChild, addChild, addChildren, addGestureListener, addInputListener, addStateChangeListener, applyLocalMatrix, attachCamera, containsChild, containsDirectChild, containsPointGlobal, destroy, destroyComponent, fireInputEvent, fireStateChange, fireStateChange, getAttachedCamera, getChildbyID, getChildByIndex, getChildByName, getChildClip, getChildCount, getChildIndexOf, getChildList, getChildren, getClip, getController, getCustomViewportSetting, getDefaultViewportSetting, getGestureListeners, getGlobalInverseMatrix, getGlobalMatrix, getGlobalVecToParentRelativeSpace, getID, getInputListeners, getInputProcessors, getIntersectionGlobal, getLight, getLocalInverseMatrix, getLocalMatrix, getLocalVecToParentRelativeSpace, getName, getParent, getRenderer, getRoot, getTransformToDestinationLocalSpace, getTransformToDestinationParentSpace, getUserData, getViewingCamera, globalToLocal, globalToLocal, hasCustomViewPort, isComposite, isContainedIn, isDepthBufferDisabled, isEnabled, isGestureAllowed, isPickable, isVisible, localToGlobal, pick, pick, processGestureEvent, processInputEvent, registerInputProcessor, removeAllChildren, removeAllGestureEventListeners, removeAllGestureEventListeners, removeChild, removeChild, removeFromParent, removeGestureEventListener, removeInputListener, removeStateChangeListener, reOrthogonalize, rotateX, rotateX, rotateXGlobal, rotateY, rotateY, rotateYGlobal, rotateZ, rotateZ, rotateZGlobal, scale, scale, scaleGlobal, sendChildToFront, sendToFront, setChildClip, setClip, setComposite, setController, setDepthBufferDisabled, setEnabled, setGestureAllowance, setLight, setLocalMatrix, setMatricesDirty, setName, setPickable, setUserData, setViewPortSettings, setVisible, toString, transform, translate, translate, translateGlobal, unregisterAllInputProcessors, unregisterInputProcessor, updateComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractVisibleComponent

public AbstractVisibleComponent(processing.core.PApplet pApplet)
Instantiates a new abstract visible component.

Parameters:
pApplet - the applet

AbstractVisibleComponent

public AbstractVisibleComponent(processing.core.PApplet pApplet,
                                Icamera globalCamera,
                                Icamera objectCamera)
Instantiates a new abstract visible component.

Parameters:
pApplet - the applet
globalCamera - the global camera
objectCamera - the object camera

AbstractVisibleComponent

public AbstractVisibleComponent(processing.core.PApplet pApplet,
                                java.lang.String name,
                                Icamera objectCamera)
Instantiates a new abstract visible component.

Parameters:
pApplet - the applet
name - the name
objectCamera - the object camera
Method Detail

getFillPaint

public FillPaint getFillPaint()
Gets the fill paint.

Returns:
the fill paint

setFillPaint

public void setFillPaint(FillPaint fillPaint)
Sets the fill paint.

Parameters:
fillPaint - the new fill paint

preDraw

public void preDraw(processing.core.PGraphics graphics)
Description copied from class: MTComponent
This method is called just before the components drawComponent method is invoked. It sets up the components matrix, clipping and other stuff.

Overrides:
preDraw in class MTComponent
Parameters:
graphics - the graphics context

postDraw

public void postDraw(processing.core.PGraphics graphics)
Description copied from class: MTComponent
Post draw. Called immediatly after drawing this component.

Overrides:
postDraw in class MTComponent

postDrawChildren

public void postDrawChildren(processing.core.PGraphics g)
Description copied from class: MTComponent
Post draw Children. Called after drawing this component and its children.

Overrides:
postDrawChildren in class MTComponent
Parameters:
g - the graphics context

getStyleInfo

public StyleInfo getStyleInfo()
Gets the style info.

Returns:
the styleInfo

setStyleInfo

public void setStyleInfo(StyleInfo styleInfo)
Sets the style info.

Parameters:
styleInfo - the styleInfo to set

applyStyle

protected void applyStyle()
Apply style.


getIntersectionLocal

public abstract Vector3D getIntersectionLocal(Ray ray)
Description copied from class: MTComponent
Returns the intersection point of the ray and this component (children are not checked for intersections).
The ray is assumed to already be in component space (not in global space).
If the component is not intersected, null is returned.

Overrides:
getIntersectionLocal in class MTComponent
Parameters:
ray - the rays, in local space
Returns:
the component intersection point
See Also:
MTComponent.globalToLocal(org.mt4j.util.math.Vector3D)

drawComponent

public abstract void drawComponent(processing.core.PGraphics g)
Description copied from class: MTComponent
Draws this component only (Not its children!).
This method can be overridden in subclasses and filled with drawing commands.

Specified by:
drawComponent in interface IMTComponent
Overrides:
drawComponent in class MTComponent
Parameters:
g - the graphics context

componentContainsPointLocal

protected abstract boolean componentContainsPointLocal(Vector3D testPoint)
Description copied from class: MTComponent
Checks whether the specified point is contained in this component. This method gets called from the componentContainsPointGlobal method. So in a extending class we would override the componentContainsPointLocal with our intersection code only!

Overrides:
componentContainsPointLocal in class MTComponent
Parameters:
testPoint - the test point
Returns:
true, if successful

setFillColor

public void setFillColor(MTColor fillColor)
Sets the fill color.

Parameters:
fillColor - the new fill color

getFillColor

public MTColor getFillColor()
Gets the fill color.

Returns:
the fill color

setStrokeColor

public void setStrokeColor(MTColor strokeColor)
Sets the stroke color.

Parameters:
strokeColor - the new stroke color

getStrokeColor

public MTColor getStrokeColor()
Gets the stroke color.

Returns:
the stroke color

getStrokeWeight

public float getStrokeWeight()
Gets the stroke weight.

Returns:
the stroke weight
See Also:
StyleInfo.getStrokeWeight()

isDrawSmooth

public boolean isDrawSmooth()
Checks if is draw smooth.

Returns:
true, if checks if is draw smooth
See Also:
StyleInfo.isDrawSmooth()

isNoFill

public boolean isNoFill()
Checks if is no fill.

Returns:
true, if checks if is no fill
See Also:
StyleInfo.isNoFill()

isNoStroke

public boolean isNoStroke()
Checks if is no stroke.

Returns:
true, if checks if is no stroke
See Also:
StyleInfo.isNoStroke()

setDrawSmooth

public void setDrawSmooth(boolean drawSmooth)
Sets the draw smooth.

Parameters:
drawSmooth - the draw smooth
See Also:
StyleInfo.setDrawSmooth(boolean)

setNoFill

public void setNoFill(boolean noFill)
Sets the no fill.

Parameters:
noFill - the no fill
See Also:
StyleInfo.setNoFill(boolean)

setNoStroke

public void setNoStroke(boolean noStroke)
Sets the no stroke.

Parameters:
noStroke - the no stroke
See Also:
StyleInfo.setNoStroke(boolean)

setStrokeWeight

public void setStrokeWeight(float strokeWeight)
Sets the stroke weight.

Parameters:
strokeWeight - the stroke weight
See Also:
StyleInfo.setStrokeWeight(float)

getFillDrawMode

public int getFillDrawMode()
Gets the fill draw mode.

Returns:
the fill draw mode

setFillDrawMode

public void setFillDrawMode(int fillDrawMode)
Sets the draw mode which will be used for creating display lists.
Modes are the opengl draw modes, e.g. GL_POLYGON, GL_TRIANGLE_FAN, GL_LINES etc.
Default mode is GL_TRIANGLE_FAN

Parameters:
fillDrawMode - the fill draw mode

setLineStipple

public void setLineStipple(short stipplePattern)
Sets a line stipple pattern for drawing outlines.
Only supported when using the OpenGL renderer!
Example: shape.setLineStipple((short)0xDDDD);
Default value is '0'. No stipple pattern is used then.

Parameters:
stipplePattern - the stipple pattern

getLineStipple

public short getLineStipple()
Gets the line stipple.

Returns:
the line stipple

setMaterial

public void setMaterial(GLMaterial material)
Sets the material used by opengl lightning.

Parameters:
material - the new material

getMaterial

public GLMaterial getMaterial()
Gets the material.

Returns:
the material