|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.vistech.roi.ShapeMarker
Enables users to interactively mark shapes over an image. The shapes supported by this class are: Freehand, rectangle, and ellipse.
Field Summary | |
protected java.awt.Shape |
currentShape
|
protected java.awt.Color |
drawingColor
|
static int |
ELLIPSE
|
static int |
FREEHAND
|
protected DrawingCanvas |
imageCanvas
|
protected java.awt.geom.GeneralPath |
path
|
protected java.awt.Shape |
prevShape
|
static int |
RECTANGLE
|
protected boolean |
roiOn
|
protected java.util.Vector |
shapeEventListeners
|
protected int |
shapeType
|
Constructor Summary | |
ShapeMarker(DrawingCanvas viewer)
The ShapeMarker constructor. |
Method Summary | |
void |
addShapeEventListener(ShapeEventListener s)
|
void |
draw(int x,
int y)
Draws the current shape at the specified end position. |
void |
eraseShapes()
Erases shapes |
protected void |
fireShapeEvent()
Fires a shape event to registered listeners |
java.awt.Color |
getDrawingColor()
|
boolean |
getRoiOn()
|
int |
getShapeType()
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Called when the shape drawing is in progree, i.e., when the mouse is dragged by the user. |
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the shape drawing starts, i.e., when the mouse is pressed by the user to initiate the drawing. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Called when the shape drawing ends, i.e., when the mouse is released by the user to end the drawing. |
void |
removeShapeEventListener(ShapeEventListener s)
|
void |
reset()
|
void |
setDrawingColor(java.awt.Color color)
Sets the drawing color of the shape outline. |
void |
setRoiOn(boolean onOrOff)
|
void |
setShapeType(int type)
Sets the shape type. |
void |
startDraw(int x,
int y)
Initiates shape drawing at the specified position. |
protected void |
updateROIPanel()
Fires the shapes event to the registered listeners. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FREEHAND
public static final int RECTANGLE
public static final int ELLIPSE
protected int shapeType
protected java.awt.Shape currentShape
protected java.awt.Shape prevShape
protected DrawingCanvas imageCanvas
protected java.awt.geom.GeneralPath path
protected java.util.Vector shapeEventListeners
protected boolean roiOn
protected java.awt.Color drawingColor
Constructor Detail |
public ShapeMarker(DrawingCanvas viewer)
viewer
- the drawing canvas.Method Detail |
public void setRoiOn(boolean onOrOff)
onOrOff
- if true, the ROI feature is turned on.public boolean getRoiOn()
public void setShapeType(int type)
type
- the type of the shape which can be one of FREEHAND, RECATNGLE, or ELLIPSE.public int getShapeType()
public void setDrawingColor(java.awt.Color color)
color
- the drawing color of the shape outline.public java.awt.Color getDrawingColor()
public void eraseShapes()
public void startDraw(int x, int y)
x
- the coordinate of the starting position of the shape.y
- the coordinate of the starting position of the shape.public void draw(int x, int y)
x
- the coordinate of the current end position of the shape.y
- the coordinate of the current end position of the shape.protected void updateROIPanel()
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- the MouseEvent state object, which carries the mouse position.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- the MouseEvent state object, which carries the mouse position.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- the MouseEvent state object, which carries the mouse position.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void addShapeEventListener(ShapeEventListener s)
public void removeShapeEventListener(ShapeEventListener s)
protected void fireShapeEvent()
public void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |