Class PencilDrawer
java.lang.Object
org.opensourcephysics.cabrillo.tracker.PencilDrawer
A PencilDrawer draws and manages PencilScenes for a TrackerPanel.
- Author:
- Douglas Brown
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected PencilDrawing
addDrawingtoSelectedScene
(PencilDrawing drawing) Adds a drawing to the selected scene.protected PencilDrawing
Creates a drawing and adds it to the selected scene.protected PencilScene
Adds a new empty scene.protected void
addScene
(PencilScene scene) Adds a scene.boolean
Determines if drawings (scenes) are visible.protected void
clearScenes
(boolean andRepaint) Removes all scenes.protected void
dispose()
Disposes of this drawer and associated PencilControlprotected static void
dispose
(TrackerPanel panel) Disposes the PencilDrawer for a specified TrackerPanel.void
finalize()
protected PencilDrawing
Gets the active drawing, defined as the last one added.protected static PencilDrawer
getDrawer
(TrackerPanel panel) Gets the PencilDrawer for a specified TrackerPanel.protected PencilControl
Gets the drawing control for this PencilDrawer.protected Cursor
Gets the pencil cursor for drawing.protected PencilScene
getSceneAtFrame
(int frame) Gets the scene at a given frame number.protected PencilScene
getSceneWithCaption
(PencilCaption caption) Gets the scene with a given caption.Gets the selected scene.protected void
Handles the drawing mouse actions.static boolean
hasDrawings
(TrackerPanel panel) Determines if any drawings or captions exist on a given TrackerPanel.static boolean
isDrawing
(TrackerPanel panel) Determines if a TrackerPanel is actively drawing.protected void
refresh()
Refreshes the PencilControl, if any, associated with this drawer.protected void
removeScene
(PencilScene scene) Removes a scene.void
setDrawingsVisible
(boolean vis, boolean andRepaint) Sets the visibility of all scenes.protected void
setScenes
(ArrayList<PencilScene> pencilScenes) Replaces all scenes with new ones.
-
Field Details
-
frame
-
panelID
-
-
Method Details
-
getDrawer
Gets the PencilDrawer for a specified TrackerPanel.- Parameters:
panel
- the TrackerPanel- Returns:
- the PencilDrawer
-
isDrawing
Determines if a TrackerPanel is actively drawing.- Parameters:
panel
- the TrackerPanel- Returns:
- true if drawing
-
hasDrawings
Determines if any drawings or captions exist on a given TrackerPanel.- Parameters:
panel
- the TrackerPanel- Returns:
- true if drawings exist
-
dispose
Disposes the PencilDrawer for a specified TrackerPanel.- Parameters:
panel
- the TrackerPanel
-
areDrawingsVisible
public boolean areDrawingsVisible()Determines if drawings (scenes) are visible.- Returns:
- true if drawings are visible
-
setDrawingsVisible
public void setDrawingsVisible(boolean vis, boolean andRepaint) Sets the visibility of all scenes.- Parameters:
vis
- true to show all scenesandRepaint
- TODO
-
addNewDrawingtoSelectedScene
Creates a drawing and adds it to the selected scene. If no scene is selected a new one is created.- Returns:
- the newly added drawing
-
addDrawingtoSelectedScene
Adds a drawing to the selected scene. If no scene is selected a new one is created.- Parameters:
drawing
- the PencilDrawing to add- Returns:
- the newly added drawing
-
getActiveDrawing
Gets the active drawing, defined as the last one added. May return null.- Returns:
- the active drawing
-
clearScenes
protected void clearScenes(boolean andRepaint) Removes all scenes.- Parameters:
andRepaint
- TODO
-
removeScene
Removes a scene.- Parameters:
scene
- the scene to remove
-
addScene
Adds a scene.- Parameters:
scene
- the scene to add
-
addNewScene
Adds a new empty scene.- Returns:
- the new scene
-
setScenes
Replaces all scenes with new ones.- Parameters:
pencilScenes
- a list of scenes
-
getSelectedScene
Gets the selected scene. May return null.- Returns:
- the selected scene
-
getSceneAtFrame
Gets the scene at a given frame number. May return null.- Parameters:
frame
- the frame number- Returns:
- the earliest scene that starts at the frame or whose range includes the frame
-
getSceneWithCaption
Gets the scene with a given caption. May return null.- Parameters:
caption
- a PencilCaption- Returns:
- the earliest scene with the caption, if any
-
getDrawingControl
Gets the drawing control for this PencilDrawer.- Returns:
- the drawing control
-
getPencilCursor
Gets the pencil cursor for drawing.- Returns:
- a pencil cursor
-
handleMouseAction
Handles the drawing mouse actions.- Parameters:
e
- the mouse event
-
dispose
protected void dispose()Disposes of this drawer and associated PencilControl -
refresh
protected void refresh()Refreshes the PencilControl, if any, associated with this drawer. -
finalize
public void finalize()
-