Class SurfacePaint
java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.SurfacePaint
- All Implemented Interfaces:
ActionListener,MouseListener,MouseMotionListener,EventListener
public class SurfacePaint
extends Object
implements ActionListener, MouseListener, MouseMotionListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javax.vecmath.Vector3dPickDirection, the direction of the PickShape.private booleanEnables paintingprivate JPanelSurfaceReference to the JPanelSurface:private com.sun.j3d.utils.picking.PickCanvasPickCanvas, for triangle picking.private intCurent paint mode.private intcurrent paint brush sizeprivate JTextFieldPaint brush size text fieldprivate ButtonGroupButton group for paint functions:private JColorChooserColor Chooser dialog.private JButtonColor selection buttonprivate JToggleButtonPaint dropper buttonprivate JButtonErase all buttonprivate JToggleButtonEraser paint buttonprivate javax.media.j3d.TransformGroupRotation transform for transforming the triangle normal into world coordinates.private floatCurrent paint opacityprivate JButtonOpacity paint buttonprivate JToggleButtonPaint brush buttonprivate JToggleButtonPaint can buttonprivate javax.vecmath.Color4fCurrent paint colorprivate JDialogPaintGrowPaint Grow Dialog.private JToolBarPaint user-interface ToolBarprivate javax.media.j3d.PickShapePickShape, for pickingstatic final intPaint into the 3D texture map:static final intPaint the ModelTriangleMesh vertex color: -
Constructor Summary
ConstructorsConstructorDescriptionSurfacePaint(JPanelSurface parent, SurfaceRender parentScene) Default Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) actionPerformed, listens for interface events.voiddispose()Deletes all member variables, clean memory.voidenableSurfacePaint(boolean flag) Enables/disables the Surface per-vertex paint user-interfacevoidenableSurfacePaintCan(boolean flag) Enables/disables the Paint Can user-interfacebooleanReturns true if the user has enabled the paint brush.private voidgetModelColor(javax.vecmath.Point3f kPickPoint) Display the ModelImage color in the JDialogPaintGrow interface.Returns the ModelImage to paint into.private com.sun.j3d.utils.picking.PickResultgetPickResult(MouseEvent kMouseEvent) Returns the pick result based on the input mouse event.private voidinit()voidmouseClicked(MouseEvent kMouseEvent) One of the overrides necessary to be a MouseListener.voidmouseDragged(MouseEvent kMouseEvent) mouseDragged.voidmouseEntered(MouseEvent kMouseEvent) One of the overrides necessary to be a MouseListener.voidmouseExited(MouseEvent kMouseEvent) One of the overrides necessary to be a MouseListener.voidmouseMoved(MouseEvent kMouseEvent) Invoked when the mouse moves.voidmousePressed(MouseEvent kMouseEvent) One of the overrides necessary to be a MouseListener.voidmouseReleased(MouseEvent kMouseEvent) One of the overrides necessary to be a MouseListener.voidregionGrow(ModelImage kImage, javax.vecmath.Point3f kSeedPoint) Grows a region based on a starting point supplied.voidsetEnabled(boolean flag) Enables/disables the user-interfacevoidsetOpacity(float opacity) Sets the opacity of the paint.voidsetPaintMode(int mode) Sets the type of paint, either vertex-color or texture value:voidsetPickCanvas(com.sun.j3d.utils.picking.PickCanvas kPickCanvas) Access function to set the pickCanvas.
-
Field Details
-
VERTEX
public static final int VERTEXPaint the ModelTriangleMesh vertex color:- See Also:
-
TEXTURE
public static final int TEXTUREPaint into the 3D texture map:- See Also:
-
m_PaintMode
private int m_PaintModeCurent paint mode. -
m_bEnabled
private boolean m_bEnabledEnables painting -
m_kPickCanvas
private com.sun.j3d.utils.picking.PickCanvas m_kPickCanvasPickCanvas, for triangle picking. -
mPickShape
private javax.media.j3d.PickShape mPickShapePickShape, for picking -
kPickDirection
private javax.vecmath.Vector3d kPickDirectionPickDirection, the direction of the PickShape. -
m_kPanel
Reference to the JPanelSurface: -
mPaintToolBar
Paint user-interface ToolBar -
mButtonGroup
Button group for paint functions: -
mPaintBrushButton
Paint brush button -
mDropperButton
Paint dropper button -
mPaintCanButton
Paint can button -
mEraserButton
Eraser paint button -
mEraseAllButton
Erase all button -
mBrushSizeText
Paint brush size text field -
mBrushSize
private int mBrushSizecurrent paint brush size -
mColorPaintButton
Color selection button -
mPaintColor
private javax.vecmath.Color4f mPaintColorCurrent paint color -
mOpacityPaintButton
Opacity paint button -
mOpacity
private float mOpacityCurrent paint opacity -
mColorChooser
Color Chooser dialog. -
mPaintGrowDialog
Paint Grow Dialog. -
mMouseRotate
private javax.media.j3d.TransformGroup mMouseRotateRotation transform for transforming the triangle normal into world coordinates.
-
-
Constructor Details
-
SurfacePaint
Default Constructor
-
-
Method Details
-
init
private void init() -
setEnabled
public void setEnabled(boolean flag) Enables/disables the user-interface- Parameters:
flag- when true the user-interface is enabled, when false the user-interface is disabled.
-
enableSurfacePaintCan
public void enableSurfacePaintCan(boolean flag) Enables/disables the Paint Can user-interface- Parameters:
flag- when true Paint Can is enabled, when false the Paint Can is disabled.
-
enableSurfacePaint
public void enableSurfacePaint(boolean flag) Enables/disables the Surface per-vertex paint user-interface- Parameters:
flag- when true per-vertex paint is enabled, when false the per-vertex paint is disabled is disabled.
-
getEnabled
public boolean getEnabled()Returns true if the user has enabled the paint brush.- Returns:
- the enabled/disbled status of the paint brush.
-
getPaintImage
Returns the ModelImage to paint into.- Returns:
- paint/texture ModelImage
-
actionPerformed
actionPerformed, listens for interface events.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
event- ActionEvent generated by the interface.
-
getToolBar
-
setPaintMode
public void setPaintMode(int mode) Sets the type of paint, either vertex-color or texture value:- Parameters:
mode- SurfacePaint.TEXTURE or SurfacePaint.VERTEX
-
dispose
public void dispose()Deletes all member variables, clean memory. -
mouseClicked
One of the overrides necessary to be a MouseListener. This function is invoked when a button has been pressed and released.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
kMouseEvent- the mouse event generated by a mouse clicked
-
mouseDragged
mouseDragged.- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
kMouseEvent- MouseEvent
-
mouseEntered
One of the overrides necessary to be a MouseListener. Invoked when the mouse enters a component.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
kMouseEvent- the mouse event generated by a mouse entered
-
mouseExited
One of the overrides necessary to be a MouseListener. Invoked when the mouse leaves a component.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
kMouseEvent- the mouse event generated by a mouse exit
-
mouseMoved
Invoked when the mouse moves.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
kMouseEvent- MouseEvent
-
mousePressed
One of the overrides necessary to be a MouseListener. Invoked when a mouse button is pressed.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
kMouseEvent- the mouse event generated by a mouse press
-
mouseReleased
One of the overrides necessary to be a MouseListener. Invoked when a mouse button is released.- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
kMouseEvent- the mouse event generated by a mouse release
-
getPickResult
Returns the pick result based on the input mouse event.- Parameters:
kMouseEvent- the current mouse position.- Returns:
- kPickResult, the picked object.
-
setPickCanvas
public void setPickCanvas(com.sun.j3d.utils.picking.PickCanvas kPickCanvas) Access function to set the pickCanvas.- Parameters:
kPickCanvas- PickCanvas
-
setOpacity
public void setOpacity(float opacity) Sets the opacity of the paint.- Parameters:
opacity- paint opacity.
-
getModelColor
private void getModelColor(javax.vecmath.Point3f kPickPoint) Display the ModelImage color in the JDialogPaintGrow interface.- Parameters:
kPickPoint- the model triangle mesh point under the mouse.
-
regionGrow
Grows a region based on a starting point supplied. A voxel is added to the the paintMask mask if its intensity is between the the bounds which are also supplied.- Parameters:
kImage- the image to grow the region inkSeedPoint- the starting point in the image
-