public class BasicInterpreter extends AbstractInteractor
Modifier and Type | Field and Description |
---|---|
protected SketchController |
_controller
The sketch controller that uses this interpreter to interpret
sketch input.
|
protected TimedStroke |
_curStroke
The current stroke that's being drawn, gets its data from
_strokeBuffer and is reallocated at the end of a stroke.
|
protected StrokeSymbol |
_curSymbol
The current symbol which wraps the current stroke and keeps
visual information about the stroke (color, line width).
|
protected TimedStroke |
_strokeBuffer
A buffer for the stroke that's currently being drawn.
|
Constructor and Description |
---|
BasicInterpreter(SketchController c)
Create a BasicInterpreter which is used by the
specified controller to interpret sketch input.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendStroke(LayerEvent e)
Append the given new point/timestamp to the current
stroke.
|
protected void |
finishStroke(LayerEvent e)
Called at the end of the mouseReleased method to
finish the drawing of a stroke.
|
SketchController |
getController()
Return the controller that uses this interpreter.
|
TimedStroke |
getCurrentStroke()
Return the current stroke being drawn.
|
Symbol |
getCurrentSymbol()
Return the symbol for current stroke being drawn.
|
boolean |
isMotionEnabled()
We're consuming motion events.
|
void |
mouseDragged(LayerEvent e)
Update the current stroke and its visual representation.
|
void |
mouseEntered(LayerEvent e)
Consume the event, for efficiency.
|
void |
mouseExited(LayerEvent e)
Consume the event, for efficiency.
|
void |
mouseMoved(LayerEvent e)
Consume the event, for efficiency.
|
void |
mousePressed(LayerEvent e)
Instantiate a new stroke and add its visual representation
as a symbol in the pane.
|
void |
mouseReleased(LayerEvent e)
Update the current stroke and its visual representation,
then reset the stroke to "null".
|
void |
removeCurrentSymbol()
Remove the current figure from the figure layer.
|
protected void |
startStroke(LayerEvent e)
This method is invoked upon mouse down.
|
accept, getMouseFilter, isConsuming, isEnabled, mouseClicked, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
protected SketchController _controller
protected TimedStroke _strokeBuffer
protected TimedStroke _curStroke
protected StrokeSymbol _curSymbol
public BasicInterpreter(SketchController c)
protected void appendStroke(LayerEvent e)
protected void finishStroke(LayerEvent e)
public final SketchController getController()
public final TimedStroke getCurrentStroke()
public final Symbol getCurrentSymbol()
public boolean isMotionEnabled()
isMotionEnabled
in interface Interactor
isMotionEnabled
in class AbstractInteractor
public void mouseDragged(LayerEvent e)
mouseDragged
in interface LayerListener
mouseDragged
in class AbstractInteractor
public void mouseEntered(LayerEvent e)
mouseEntered
in interface LayerMotionListener
mouseEntered
in class AbstractInteractor
public void mouseExited(LayerEvent e)
mouseExited
in interface LayerMotionListener
mouseExited
in class AbstractInteractor
public void mouseMoved(LayerEvent e)
mouseMoved
in interface LayerMotionListener
mouseMoved
in class AbstractInteractor
public void mousePressed(LayerEvent e)
mousePressed
in interface LayerListener
mousePressed
in class AbstractInteractor
public void mouseReleased(LayerEvent e)
mouseReleased
in interface LayerListener
mouseReleased
in class AbstractInteractor
public void removeCurrentSymbol()
protected void startStroke(LayerEvent e)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.