edu.mines.jtk.mesh
Class TriMeshView

java.lang.Object
  extended by edu.mines.jtk.mosaic.TiledView
      extended by edu.mines.jtk.mesh.TriMeshView

public class TriMeshView
extends TiledView

Tiled view of a tri mesh.

Version:
2008.09.11
Author:
Dave Hale, Colorado School of Mines

Nested Class Summary
static class TriMeshView.Orientation
          Orientation of tri-mesh axes x and y.
static interface TriMeshView.TriPainter
          Interface for custom triangle painting.
 
Constructor Summary
TriMeshView(TriMesh mesh)
          Constructs a new view of the specified tri mesh.
 
Method Summary
 TriMeshView.Orientation getOrientation()
          Gets the orientation of (x,y) axes.
 void hideNodes()
          Hides (does not draw) the nodes.
 void hidePolyBounds()
          Hides (does not draw) the poly bounds.
 void hidePolys()
          Hides (does not draw) the polygons.
 void hideTriBounds()
          Hides (does not draw) the tri bounds.
 void hideTris()
          Hides (does not draw) the tris.
 void paint(java.awt.Graphics2D g2d)
          Paints this tiled view.
 void setLineColor(java.awt.Color lineColor)
          Sets the color of lines used to draw edges of triangles and polygons.
 void setLineWidth(int lineWidth)
          Sets the width of lines used to draw edges of triangles.
 void setMarkColor(java.awt.Color markColor)
          Sets the color of marks used to draw nodes.
 void setMarkWidth(int markWidth)
          Sets the width of marks used to draw nodes.
 void setMesh(TriMesh mesh)
          Sets the tri mesh rendered by this view.
 void setNodesVisible(boolean drawNodes)
          Sets the visibility (drawing or no drawing) of nodes.
 void setOrientation(TriMeshView.Orientation orientation)
          Sets the orientation of mesh (x,y) axes.
 void setPolyBoundsVisible(boolean drawPolyBounds)
          Sets the visibility (drawing or no drawing) of poly bounds.
 void setPolyColor(java.awt.Color lineColor)
          Sets the color of lines used to draw edges of polygons.
 void setPolysVisible(boolean drawPolys)
          Sets the visibility (drawing or no drawing) of polygons.
 void setSubTrisVisible(boolean drawSubTris)
          Sets the visibility (drawing or no drawing) of subdivided tris.
 void setTriBoundsVisible(boolean drawTriBounds)
          Sets the visibility (drawing or no drawing) of tri bounds.
 void setTriColor(java.awt.Color lineColor)
          Sets the color of lines used to draw edges of triangles.
 void setTriEdgeWeights(java.util.Map<TriMesh.Edge,java.lang.Float> triEdgeWeights)
          Sets the map from triangle edges to weights.
 void setTriPainter(TriMeshView.TriPainter triPainter)
          Sets the custom triangle painter.
 void setTrisVisible(boolean drawTris)
          Sets the visibility (drawing or no drawing) of tris.
 void showNodes()
          Shows (draws) the nodes.
 void showPolyBounds()
          Shows (draws) the poly bounds.
 void showPolys()
          Shows (draws) the polygons.
 void showTriBounds()
          Shows (draws) the tri bounds.
 void showTris()
          Shows (draws) the tris.
 
Methods inherited from class edu.mines.jtk.mosaic.TiledView
getBestHorizontalProjector, getBestVerticalProjector, getHorizontalProjector, getLineWidth, getTile, getTranscaler, getVerticalProjector, repaint, setBestProjectors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriMeshView

public TriMeshView(TriMesh mesh)
Constructs a new view of the specified tri mesh.

Method Detail

setMesh

public void setMesh(TriMesh mesh)
Sets the tri mesh rendered by this view.

Parameters:
mesh - the tri mesh.

setOrientation

public void setOrientation(TriMeshView.Orientation orientation)
Sets the orientation of mesh (x,y) axes.

Parameters:
orientation - the orientation.

getOrientation

public TriMeshView.Orientation getOrientation()
Gets the orientation of (x,y) axes.

Returns:
the orientation.

setNodesVisible

public void setNodesVisible(boolean drawNodes)
Sets the visibility (drawing or no drawing) of nodes.

Parameters:
drawNodes - true, to draw nodes; false, otherwise. The default is true.

setTrisVisible

public void setTrisVisible(boolean drawTris)
Sets the visibility (drawing or no drawing) of tris.

Parameters:
drawTris - true, to draw tris; false, otherwise. The default is true.

setSubTrisVisible

public void setSubTrisVisible(boolean drawSubTris)
Sets the visibility (drawing or no drawing) of subdivided tris.

Parameters:
drawSubTris - true, to draw subdivided tris; false, otherwise. The default is false.

setPolysVisible

public void setPolysVisible(boolean drawPolys)
Sets the visibility (drawing or no drawing) of polygons.

Parameters:
drawPolys - true, to draw polygons; false, otherwise. The default is false.

setTriBoundsVisible

public void setTriBoundsVisible(boolean drawTriBounds)
Sets the visibility (drawing or no drawing) of tri bounds.

Parameters:
drawTriBounds - true, to draw tri bounds; false, otherwise. The default is false.

setPolyBoundsVisible

public void setPolyBoundsVisible(boolean drawPolyBounds)
Sets the visibility (drawing or no drawing) of poly bounds.

Parameters:
drawPolyBounds - true, to draw poly bounds; false, otherwise. The default is false.

showNodes

public void showNodes()
Shows (draws) the nodes.


hideNodes

public void hideNodes()
Hides (does not draw) the nodes.


showTris

public void showTris()
Shows (draws) the tris.


hideTris

public void hideTris()
Hides (does not draw) the tris.


showPolys

public void showPolys()
Shows (draws) the polygons.


hidePolys

public void hidePolys()
Hides (does not draw) the polygons.


showTriBounds

public void showTriBounds()
Shows (draws) the tri bounds.


hideTriBounds

public void hideTriBounds()
Hides (does not draw) the tri bounds.


showPolyBounds

public void showPolyBounds()
Shows (draws) the poly bounds.


hidePolyBounds

public void hidePolyBounds()
Hides (does not draw) the poly bounds.


setLineColor

public void setLineColor(java.awt.Color lineColor)
Sets the color of lines used to draw edges of triangles and polygons.

Parameters:
lineColor - the line color.

setTriColor

public void setTriColor(java.awt.Color lineColor)
Sets the color of lines used to draw edges of triangles.

Parameters:
lineColor - the line color.

setTriEdgeWeights

public void setTriEdgeWeights(java.util.Map<TriMesh.Edge,java.lang.Float> triEdgeWeights)
Sets the map from triangle edges to weights. If set, this map overrides the tri line color.


setPolyColor

public void setPolyColor(java.awt.Color lineColor)
Sets the color of lines used to draw edges of polygons.

Parameters:
lineColor - the line color.

setLineWidth

public void setLineWidth(int lineWidth)
Sets the width of lines used to draw edges of triangles.

Parameters:
lineWidth - line width in pixels (or points, as for a font).

setMarkColor

public void setMarkColor(java.awt.Color markColor)
Sets the color of marks used to draw nodes.

Parameters:
markColor - mark color.

setMarkWidth

public void setMarkWidth(int markWidth)
Sets the width of marks used to draw nodes.

Parameters:
markWidth - mark width in pixels (or points, as for a font).

setTriPainter

public void setTriPainter(TriMeshView.TriPainter triPainter)
Sets the custom triangle painter.

Parameters:
triPainter - the painter.

paint

public void paint(java.awt.Graphics2D g2d)
Description copied from class: TiledView
Paints this tiled view. This method is implemented by classes that extend this abstract base class. Implementations may modify the specified graphics context freely. Such modifications will not affect the paintings of other tiled views in the same tile or mosaic.

Tiled views should not replace (set) entirely the transform in the specified graphics context. This transform may already have been set by the tile or its mosaic. Therefore, tiled views should modify this transform only by specifying additional scaling, translation, etc.

Specified by:
paint in class TiledView
Parameters:
g2d - the graphics context in which to paint.