de.grogra.imp3d
Class WireframeCanvas

java.lang.Object
  extended by de.grogra.imp.awt.ViewComponentAdapter
      extended by de.grogra.imp.awt.CanvasAdapter
          extended by de.grogra.imp3d.WireframeCanvas
All Implemented Interfaces:
ViewComponent, RenderState, ComponentWrapper, Selectable, Disposable, java.awt.image.ImageObserver, java.lang.Runnable

public class WireframeCanvas
extends CanvasAdapter
implements RenderState, Selectable


Nested Class Summary
 
Nested classes/interfaces inherited from class de.grogra.imp.awt.CanvasAdapter
CanvasAdapter.CanvasComponent
 
Field Summary
protected static int COLOR
           
protected static int DRAW_POLY
           
protected static int DRAW_RECT
           
protected static int FILL_POLY
           
protected static int FILL_RECT
           
protected static int FONT
           
protected static int ICON
           
protected static int LINE
           
static int OVERLAY
           
 Pool pool
           
protected static int STRING
           
 
Fields inherited from class de.grogra.imp.awt.CanvasAdapter
antialiasing, IDENTITY, sceneBuffer
 
Fields inherited from class de.grogra.imp.awt.ViewComponentAdapter
DISPOSED, DISPOSING, RENDERED_IMAGE, RENDERING, REPAINT_MASK
 
Fields inherited from interface de.grogra.imp3d.RenderState
CURRENT_HIGHLIGHT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Fields inherited from interface de.grogra.imp.ViewComponent
ALL, CHANGED, MIN_USER_FLAG, SCENE, SELECTION, TOOLS
 
Constructor Summary
WireframeCanvas()
           
 
Method Summary
 void closeLayer()
           
 void drawBox(float halfWidth, float halfLength, float height, Shader sh, int highlight, Matrix4d t)
           
 void drawFrustum(float height, float baseRadius, float topRadius, boolean baseClosed, boolean topClosed, float scaleV, Shader sh, int highlight, Matrix4d t)
           
 void drawIcon(int vertex, int dx, int dy, javax.swing.Icon icon)
           
 void drawLine(int v1, int v2)
           
 void drawLine(int v1, int v2, boolean accentuated)
           
 void drawLine(Tuple3f origin, Tuple3f end, Tuple3f color, int highlight, Matrix4d t)
           
protected  void drawOverlay(int type)
           
 void drawParallelogram(float height, Vector3f secondAxis, float scaleU, float scaleV, Shader sh, int highlight, Matrix4d t)
           
 void drawPlane(Shader sh, int highlight, Matrix4d t)
           
 void drawPoint(Tuple3f origin, int size, Tuple3f color, int highlight, Matrix4d t)
           
 void drawPointCloud(float[] locations, float pointSize, Tuple3f color, int highlight, Matrix4d t)
          Draw a set of points.
 void drawPolygon(int vertex, java.awt.Polygon polygon)
           
 void drawPolygons(Polygonizable pz, java.lang.Object obj, boolean asNode, Shader sh, int highlight, Matrix4d t)
           
 void drawRect(int vertex, int dx, int dy, int width, int height)
           
 void drawRectangle(int x, int y, int w, int h, Tuple3f color)
           
 void drawSphere(float radius, Shader sh, int highlight, Matrix4d t)
           
 void drawString(int vertex, int dx, int dy, java.lang.String s)
           
 void drawString(int x, int y, java.lang.String text, java.awt.Font font, Tuple3f color)
           
 void drawSupershape(float a, float b, float m1, float n11, float n12, float n13, float m2, float n21, float n22, float n23, Shader sh, int highlight, Matrix4d t)
          Draw a supershape around the origin (0/0/0).
 float estimateScaleAt(Tuple3f point)
           
 void fillPolygon(int vertex, java.awt.Polygon polygon)
           
 void fillRect(int vertex, int dx, int dy, int width, int height)
           
 void fillRectangle(int x, int y, int w, int h, Tuple3f color)
           
protected  void finalizePaint()
           
 java.awt.Color getColor()
           
 int getCurrentHighlight()
           
 Shader getCurrentShader()
           
 Pool getPool()
           
 View3D getView3D()
           
 boolean getWindowPos(Tuple3f origin, Tuple2f out)
          Computes the window coordinates in pixels of a location in the current object coordinates.
protected  void initPaint(int flags, int width, int height)
           
 void initView(View view, EventListener listener)
          Initializes this component.
 void openLayer(int layer)
           
protected  void optionValueChanged(java.lang.String name, java.lang.Object value)
           
protected  void paintHighlight(int flags, java.awt.Graphics2D g)
           
protected  void paintScene(int flags, java.awt.Graphics2D g)
           
 void setColor(java.awt.Color color)
           
 void setFont(java.awt.Font font)
           
 void setVertex(int index, double x, double y, double z, Matrix4d t)
           
 void setVertex(int index, float x, float y, float z)
           
 void setVertex(int index, Tuple3d v)
           
 void setVertex(int index, Tuple3d v, Matrix4d t)
           
 void setVertex(int index, Tuple3f v)
           
 void setVertex(int index, Tuple3f v, Matrix4d t)
           
 
Methods inherited from class de.grogra.imp.awt.CanvasAdapter
checkBuffers, getComponent, getGraphics, getObserverForRenderer, imageUpdate, initCanvas, initRender, invokeRender, makeSnapshot, render, resetGraphicsTransform, setColor, setColor, setColor, setColor, setColor, writeEPS
 
Methods inherited from class de.grogra.imp.awt.ViewComponentAdapter
checkRepaint, checkRepaintWrapException, dispose, disposeRenderer, getColor, getColor, getFactory, getFontMetrics, getGlobalLOD, getIntColor, getInterruptedException, getOption, getRenderGraphState, getView, initFactory, installListeners, invokeRenderSync, render, render, renderUninterruptibly, repaint, run, toSelection, uninstallListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.grogra.imp3d.RenderState
getFontMetrics, getRenderGraphState
 
Methods inherited from interface de.grogra.pf.ui.edit.Selectable
toSelection
 

Field Detail

COLOR

protected static final int COLOR
See Also:
Constant Field Values

DRAW_POLY

protected static final int DRAW_POLY
See Also:
Constant Field Values

DRAW_RECT

protected static final int DRAW_RECT
See Also:
Constant Field Values

FILL_POLY

protected static final int FILL_POLY
See Also:
Constant Field Values

FILL_RECT

protected static final int FILL_RECT
See Also:
Constant Field Values

FONT

protected static final int FONT
See Also:
Constant Field Values

ICON

protected static final int ICON
See Also:
Constant Field Values

LINE

protected static final int LINE
See Also:
Constant Field Values

OVERLAY

public static final int OVERLAY
See Also:
Constant Field Values

pool

public final Pool pool

STRING

protected static final int STRING
See Also:
Constant Field Values
Constructor Detail

WireframeCanvas

public WireframeCanvas()
Method Detail

closeLayer

public final void closeLayer()

drawBox

public void drawBox(float halfWidth,
                    float halfLength,
                    float height,
                    Shader sh,
                    int highlight,
                    Matrix4d t)
Specified by:
drawBox in interface RenderState

drawFrustum

public void drawFrustum(float height,
                        float baseRadius,
                        float topRadius,
                        boolean baseClosed,
                        boolean topClosed,
                        float scaleV,
                        Shader sh,
                        int highlight,
                        Matrix4d t)
Specified by:
drawFrustum in interface RenderState

drawIcon

public final void drawIcon(int vertex,
                           int dx,
                           int dy,
                           javax.swing.Icon icon)

drawLine

public final void drawLine(int v1,
                           int v2)

drawLine

public final void drawLine(int v1,
                           int v2,
                           boolean accentuated)

drawLine

public void drawLine(Tuple3f origin,
                     Tuple3f end,
                     Tuple3f color,
                     int highlight,
                     Matrix4d t)
Specified by:
drawLine in interface RenderState

drawOverlay

protected void drawOverlay(int type)

drawParallelogram

public void drawParallelogram(float height,
                              Vector3f secondAxis,
                              float scaleU,
                              float scaleV,
                              Shader sh,
                              int highlight,
                              Matrix4d t)
Specified by:
drawParallelogram in interface RenderState

drawPlane

public void drawPlane(Shader sh,
                      int highlight,
                      Matrix4d t)
Specified by:
drawPlane in interface RenderState

drawPoint

public void drawPoint(Tuple3f origin,
                      int size,
                      Tuple3f color,
                      int highlight,
                      Matrix4d t)
Specified by:
drawPoint in interface RenderState

drawPointCloud

public void drawPointCloud(float[] locations,
                           float pointSize,
                           Tuple3f color,
                           int highlight,
                           Matrix4d t)
Description copied from interface: RenderState
Draw a set of points. The array locations contains a sequence of points given as triples of floats for x, y and z position of each point. If the same reference for the array location is passed in the implementation might assume that the contents of the array are the same as well. This is necessary for GLDisplay, for instance, to ensure a performant implementation. The class PointCloud ensures that this is the case.

Specified by:
drawPointCloud in interface RenderState
Parameters:
locations - array containing a sequence (x,y,z) of points
pointSize - size of the point on screen
color - color of the point
t - transformation of the point cloud

drawPolygon

public final void drawPolygon(int vertex,
                              java.awt.Polygon polygon)

drawPolygons

public void drawPolygons(Polygonizable pz,
                         java.lang.Object obj,
                         boolean asNode,
                         Shader sh,
                         int highlight,
                         Matrix4d t)
Specified by:
drawPolygons in interface RenderState

drawRect

public final void drawRect(int vertex,
                           int dx,
                           int dy,
                           int width,
                           int height)

drawRectangle

public void drawRectangle(int x,
                          int y,
                          int w,
                          int h,
                          Tuple3f color)
Specified by:
drawRectangle in interface RenderState

drawSphere

public void drawSphere(float radius,
                       Shader sh,
                       int highlight,
                       Matrix4d t)
Specified by:
drawSphere in interface RenderState

drawString

public final void drawString(int vertex,
                             int dx,
                             int dy,
                             java.lang.String s)

drawString

public void drawString(int x,
                       int y,
                       java.lang.String text,
                       java.awt.Font font,
                       Tuple3f color)
Specified by:
drawString in interface RenderState

drawSupershape

public void drawSupershape(float a,
                           float b,
                           float m1,
                           float n11,
                           float n12,
                           float n13,
                           float m2,
                           float n21,
                           float n22,
                           float n23,
                           Shader sh,
                           int highlight,
                           Matrix4d t)
Draw a supershape around the origin (0/0/0). An implementation of Johan Gielis's Superformula which was published in the American Journal of Botany 90(3): 333–338. 2003. INVITED SPECIAL PAPER A GENERIC GEOMETRIC TRANSFORMATION THAT UNIFIES A WIDE RANGE OF NATURAL AND ABSTRACT SHAPES

Specified by:
drawSupershape in interface RenderState
Parameters:
a, - b length of curves
m, - n shape parameters
shader -
highlight -
t - transformation of the point cloud

estimateScaleAt

public float estimateScaleAt(Tuple3f point)
Specified by:
estimateScaleAt in interface RenderState

fillPolygon

public final void fillPolygon(int vertex,
                              java.awt.Polygon polygon)

fillRect

public final void fillRect(int vertex,
                           int dx,
                           int dy,
                           int width,
                           int height)

fillRectangle

public void fillRectangle(int x,
                          int y,
                          int w,
                          int h,
                          Tuple3f color)
Specified by:
fillRectangle in interface RenderState

finalizePaint

protected void finalizePaint()

getColor

public final java.awt.Color getColor()

getCurrentHighlight

public int getCurrentHighlight()
Specified by:
getCurrentHighlight in interface RenderState

getCurrentShader

public Shader getCurrentShader()
Specified by:
getCurrentShader in interface RenderState

getPool

public Pool getPool()
Specified by:
getPool in interface RenderState

getView3D

public View3D getView3D()

getWindowPos

public boolean getWindowPos(Tuple3f origin,
                            Tuple2f out)
Description copied from interface: RenderState
Computes the window coordinates in pixels of a location in the current object coordinates.

Specified by:
getWindowPos in interface RenderState
Parameters:
origin - a location in local object coordinates
out - the computed window coordinates are placed in here
Returns:
true iff the window coordinates are valid (i.e., the location is in the clipping region)

initPaint

protected void initPaint(int flags,
                         int width,
                         int height)
Specified by:
initPaint in class CanvasAdapter

initView

public void initView(View view,
                     EventListener listener)
Description copied from interface: ViewComponent
Initializes this component. This method sets the view within which this view component is used to display the graph. It also sets an event listener. this has to be informed of mouse and keys events within the view component by implementations of this method.

Specified by:
initView in interface ViewComponent
Overrides:
initView in class CanvasAdapter
Parameters:
view - the containing view
listener - mouse and key events will be reported to this listener

openLayer

public final void openLayer(int layer)

optionValueChanged

protected void optionValueChanged(java.lang.String name,
                                  java.lang.Object value)
Overrides:
optionValueChanged in class CanvasAdapter

paintHighlight

protected void paintHighlight(int flags,
                              java.awt.Graphics2D g)
Specified by:
paintHighlight in class CanvasAdapter

paintScene

protected void paintScene(int flags,
                          java.awt.Graphics2D g)
                   throws java.lang.InterruptedException
Specified by:
paintScene in class CanvasAdapter
Throws:
java.lang.InterruptedException

setColor

public void setColor(java.awt.Color color)
Specified by:
setColor in class CanvasAdapter

setFont

public final void setFont(java.awt.Font font)

setVertex

public final void setVertex(int index,
                            double x,
                            double y,
                            double z,
                            Matrix4d t)

setVertex

public final void setVertex(int index,
                            float x,
                            float y,
                            float z)

setVertex

public final void setVertex(int index,
                            Tuple3d v)

setVertex

public final void setVertex(int index,
                            Tuple3d v,
                            Matrix4d t)

setVertex

public final void setVertex(int index,
                            Tuple3f v)

setVertex

public final void setVertex(int index,
                            Tuple3f v,
                            Matrix4d t)