Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.vistech.roi
Class ShapeMarker

    java.lang.Object
      |
      +--com.vistech.roi.ShapeMarker

All Implemented Interfaces:
  java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

public class ShapeMarker
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Enables users to interactively mark shapes over an image. The shapes supported by this class are: Freehand, rectangle, and ellipse.

Version:
  1.0 4 Oct 2000
Author:
  Lawrence Rodrigues

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

### FREEHAND

    public static final int FREEHAND

### RECTANGLE

    public static final int RECTANGLE

### ELLIPSE

    public static final int ELLIPSE

### shapeType

    protected int shapeType

### currentShape

    protected java.awt.Shape currentShape

### prevShape

    protected java.awt.Shape prevShape

### imageCanvas

    protected DrawingCanvas imageCanvas

### path

    protected java.awt.geom.GeneralPath path

### shapeEventListeners

    protected java.util.Vector shapeEventListeners

### roiOn

    protected boolean roiOn

### drawingColor

    protected java.awt.Color drawingColor

Constructor Detail

### ShapeMarker

    public ShapeMarker(DrawingCanvas viewer)

  The ShapeMarker constructor.
  Parameters:
    `viewer` - the drawing canvas.

Method Detail

### setRoiOn

    public void setRoiOn(boolean onOrOff)

  Parameters:
    `onOrOff` - if true, the ROI feature is turned on.

### getRoiOn

    public boolean getRoiOn()

### setShapeType

    public void setShapeType(int type)

  Sets the shape type.
  Parameters:
    `type` - the type of the shape which can be one of FREEHAND, RECATNGLE, or ELLIPSE.

### getShapeType

    public int getShapeType()

### setDrawingColor

    public void setDrawingColor(java.awt.Color color)

  Sets the drawing color of the shape outline.
  Parameters:
    `color` - the drawing color of the shape outline.

### getDrawingColor

    public java.awt.Color getDrawingColor()

### eraseShapes

    public void eraseShapes()

  Erases shapes

### startDraw

    public void startDraw(int x,
                          int y)

  Initiates shape drawing at the specified position.
  Parameters:
    `x` - the coordinate of the starting position of the shape.
    `y` - the coordinate of the starting position of the shape.

### draw

    public void draw(int x,
                     int y)

  Draws the current shape at the specified end position.
  Parameters:
    `x` - the coordinate of the current end position of the shape.
    `y` - the coordinate of the current end position of the shape.

### updateROIPanel

    protected void updateROIPanel()

  Fires the shapes event to the registered listeners.

### mousePressed

    public 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.
  Specified by:
    `mousePressed` in interface `java.awt.event.MouseListener`
  Parameters:
    `e` - the MouseEvent state object, which carries the mouse position.

### mouseReleased

    public 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.
  Specified by:
    `mouseReleased` in interface `java.awt.event.MouseListener`
  Parameters:
    `e` - the MouseEvent state object, which carries the mouse position.

### mouseClicked

    public void mouseClicked(java.awt.event.MouseEvent e)

  Specified by:
    `mouseClicked` in interface `java.awt.event.MouseListener`

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Specified by:
    `mouseEntered` in interface `java.awt.event.MouseListener`

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Specified by:
    `mouseExited` in interface `java.awt.event.MouseListener`

### mouseDragged

    public 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.
  Specified by:
    `mouseDragged` in interface `java.awt.event.MouseMotionListener`
  Parameters:
    `e` - the MouseEvent state object, which carries the mouse position.

### mouseMoved

    public void mouseMoved(java.awt.event.MouseEvent e)

  Specified by:
    `mouseMoved` in interface `java.awt.event.MouseMotionListener`

### addShapeEventListener

    public void addShapeEventListener(ShapeEventListener s)

### removeShapeEventListener

    public void removeShapeEventListener(ShapeEventListener s)

### fireShapeEvent

    protected void fireShapeEvent()

  Fires a shape event to registered listeners

### reset

    public void reset()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD