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 PencilDrawingaddDrawingtoSelectedScene(PencilDrawing drawing) Adds a drawing to the selected scene.protected PencilDrawingCreates a drawing and adds it to the selected scene.protected PencilSceneAdds a new empty scene.protected voidaddScene(PencilScene scene) Adds a scene.booleanDetermines if drawings (scenes) are visible.protected voidclearScenes(boolean andRepaint) Removes all scenes.protected voiddispose()Disposes of this drawer and associated PencilControlprotected static voiddispose(TrackerPanel panel) Disposes the PencilDrawer for a specified TrackerPanel.voidfinalize()protected PencilDrawingGets the active drawing, defined as the last one added.protected static PencilDrawergetDrawer(TrackerPanel panel) Gets the PencilDrawer for a specified TrackerPanel.protected PencilControlGets the drawing control for this PencilDrawer.protected CursorGets the pencil cursor for drawing.protected PencilScenegetSceneAtFrame(int frame) Gets the scene at a given frame number.protected PencilScenegetSceneWithCaption(PencilCaption caption) Gets the scene with a given caption.Gets the selected scene.protected voidHandles the drawing mouse actions.static booleanhasDrawings(TrackerPanel panel) Determines if any drawings or captions exist on a given TrackerPanel.static booleanisDrawing(TrackerPanel panel) Determines if a TrackerPanel is actively drawing.protected voidrefresh()Refreshes the PencilControl, if any, associated with this drawer.protected voidremoveScene(PencilScene scene) Removes a scene.voidsetDrawingsVisible(boolean vis, boolean andRepaint) Sets the visibility of all scenes.protected voidsetScenes(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()
-