Package jpicedt.graphic.toolkit
Class DrawToolFactory.AbstractCurveDrawTool
- java.lang.Object
-
- java.awt.event.KeyAdapter
-
- jpicedt.graphic.toolkit.MouseTool
-
- jpicedt.graphic.toolkit.DrawToolFactory.AbstractCurveDrawTool
-
- All Implemented Interfaces:
java.awt.event.KeyListener,java.util.EventListener,PEMouseInputListener
- Enclosing class:
- DrawToolFactory
protected class DrawToolFactory.AbstractCurveDrawTool extends MouseTool
a MouseTool suited for drawing any element inheriting from AbstractCurve. Because of slight differences that appear in the drawing sequence, this class currently specializes on PicMultiCurve, PicPsCurve and PicSmoothPolygon. This should be improved in the near future by providing a common interface [SR:pending].The drawing sequence is as follows : OPEN curve : mpress add 0,1,2,3->drag 1->move 3->mpress add 4,5,6->drag 4->move 6->... CLOSED curve : mpress add 0,1,2->drag 1->mrel add 3,4,5->move 3->mpress->drag 4->mrel add 6,7,8->move and is terminated by a right-button click.
- Author:
- Vincent Guirardel, Sylvain Reynal
-
-
Field Summary
-
Fields inherited from class jpicedt.graphic.toolkit.MouseTool
lastMouseEvent, mouseOutside
-
-
Constructor Summary
Constructors Constructor Description AbstractCurveDrawTool(AbstractCurve prototype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()called when this tool is being replaced by another mouse-tool in the hosting editor kit ; this is mainly for mousetools using more than one sequence, for it gives them a chance to clean themselves up for the next timevoidinit()called when this tool is being activated in the hosting editor kitvoidmouseDragged(PEMouseEvent e)set the current pointvoidmouseMoved(PEMouseEvent e)set cursor for canvas, then call mouseDraggedvoidmousePressed(PEMouseEvent e)A popup-trigger mouse event (e.g.voidmouseReleased(PEMouseEvent e)CLOSED curve only : add a new point by splitting last segmentvoidpaint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)This method is called by the hosting EditorKit : this implementation paints the current element's highlighter.-
Methods inherited from class jpicedt.graphic.toolkit.MouseTool
getLastMouseEvent, keyPressed, keyReleased, mouseClicked, mouseEntered, mouseExited, processKeyEvent
-
-
-
-
Constructor Detail
-
AbstractCurveDrawTool
public AbstractCurveDrawTool(AbstractCurve prototype)
- Parameters:
prototype- Prototype which will be cloned, then added to the drawing.
-
-
Method Detail
-
mousePressed
public void mousePressed(PEMouseEvent e)
A popup-trigger mouse event (e.g. a right click on Unix/Windows) :
- switches back to SELECT_MODE if the iterator is completed
- or terminates the drawing process. A left-button SINGLE click either :
- (re)start the task iterator if completed ;
- or add a new point ;- Specified by:
mousePressedin interfacePEMouseInputListener- Overrides:
mousePressedin classMouseTool
-
mouseReleased
public void mouseReleased(PEMouseEvent e)
CLOSED curve only : add a new point by splitting last segment- Specified by:
mouseReleasedin interfacePEMouseInputListener- Overrides:
mouseReleasedin classMouseTool
-
mouseDragged
public void mouseDragged(PEMouseEvent e)
set the current point- Specified by:
mouseDraggedin interfacePEMouseInputListener- Overrides:
mouseDraggedin classMouseTool
-
mouseMoved
public void mouseMoved(PEMouseEvent e)
set cursor for canvas, then call mouseDragged- Specified by:
mouseMovedin interfacePEMouseInputListener- Overrides:
mouseMovedin classMouseTool
-
init
public void init()
called when this tool is being activated in the hosting editor kit
-
flush
public void flush()
called when this tool is being replaced by another mouse-tool in the hosting editor kit ; this is mainly for mousetools using more than one sequence, for it gives them a chance to clean themselves up for the next time
-
-