Package PamView.paneloverlay.overlaymark
Class OverlayMarker
java.lang.Object
PamView.paneloverlay.overlaymark.ExtMouseAdapter
PamView.paneloverlay.overlaymark.OverlayMarker
- All Implemented Interfaces:
MarkManager
- Direct Known Subclasses:
BTOverlayMarker
,ClipDisplayMarker
,SpectrogramMarker
,StandardOverlayMarker
Receive mouse actions made on the map, turn them into regions
displayed as an overlay on the map and send the region information
off to any observers who might be interested in those data.
In some ways this class behaves in a very similar manner to the spectrogram mark observer system.
- Author:
- Doug Gillespie
-
Constructor Summary
ConstructorDescriptionOverlayMarker
(Object markSource, int markChannels, GeneralProjector projector) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserver
(OverlayMarkObserver observer) boolean
canDestroyMark
(javafx.scene.input.MouseEvent e) Check whether a current mark can be destroyed.boolean
canMark
(OverlayMarkObserver markObserver) createJPopMenu
(javafx.scene.input.MouseEvent e) Create the JPopupMenu.void
destroyCurrentMark
(javafx.scene.input.MouseEvent e) Destroy the current mark.findClosestData
(javafx.scene.input.MouseEvent e, double maxDistance) Find the closest data unit to the mouse point.abstract String
Get the current mark warning.int
Get the number of observers.Get the list of observers.List<javafx.scene.control.MenuItem>
getPopupMenuItems
(javafx.scene.input.MouseEvent e) getSelectedMarkedDataUnits
(OverlayMark overlayMark, MarkDataSelector markDataSelector) Get a list of marked and selected data units.getSelectedMarkedDataUnits
(OverlayMark overlayMark, MarkDataSelector markDataSelector, int minOverlap) boolean
isCanMark
(javafx.scene.input.MouseEvent e) boolean
boolean
isMouseContained
(javafx.scene.input.MouseEvent e) Check whether a mouse event is contained within the current mark shapeboolean
Now markingboolean
mouseClicked
(javafx.scene.input.MouseEvent e) boolean
mouseDragged
(javafx.scene.input.MouseEvent e) boolean
mouseMoved
(javafx.scene.input.MouseEvent e) boolean
mousePressed
(javafx.scene.input.MouseEvent e) boolean
mouseReleased
(javafx.scene.input.MouseEvent e) boolean
boolean
notifyObservers
(int markStatus, javafx.scene.input.MouseEvent mouseEvent, OverlayMarker overlayMarker, OverlayMark overlayMark) void
removeObserver
(OverlayMarkObserver observer) void
setCurrentMark
(OverlayMark currentMark) Set the current mark.void
setNowMarking
(boolean nowMarking) Set if markingvoid
setProjector
(GeneralProjector<PamCoordinate> projector) boolean
showNoObserverPopup
(javafx.scene.input.MouseEvent e) An optional additional popup that can occur even if there were no observers of the popup This get's used on displays that are starting to label data units using generic annotations, thereby avoiding the need for more advanced marks and groupers.boolean
showObserverPopups
(javafx.scene.input.MouseEvent e) Show any popup menus form the mark observers in response to the mouse going down with a right click.void
Update the marked display.Methods inherited from class PamView.paneloverlay.overlaymark.ExtMouseAdapter
fxMouse, mouseClicked, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, mouseWheelMoved, swingMouse
-
Constructor Details
-
OverlayMarker
-
-
Method Details
-
getProjector
- Returns:
- the projector
-
getMarkerName
-
isCanMark
public boolean isCanMark(javafx.scene.input.MouseEvent e) -
mousePressed
public boolean mousePressed(javafx.scene.input.MouseEvent e) - Overrides:
mousePressed
in classExtMouseAdapter
-
mouseReleased
public boolean mouseReleased(javafx.scene.input.MouseEvent e) - Overrides:
mouseReleased
in classExtMouseAdapter
-
showNoObserverPopup
public boolean showNoObserverPopup(javafx.scene.input.MouseEvent e) An optional additional popup that can occur even if there were no observers of the popup This get's used on displays that are starting to label data units using generic annotations, thereby avoiding the need for more advanced marks and groupers.- Parameters:
e
- Mouse event (needed for popup coordinates)- Returns:
- true if a menu was shown.
-
createJPopMenu
Create the JPopupMenu. this is a composite menu made up from all observers of a particular marker.- Returns:
- the jpop up menu with overlay options.
-
getPopupMenuItems
- Overrides:
getPopupMenuItems
in classExtMouseAdapter
-
showObserverPopups
public boolean showObserverPopups(javafx.scene.input.MouseEvent e) Show any popup menus form the mark observers in response to the mouse going down with a right click.If a mark has been made, and is in existence, then
- Parameters:
e
- Mouse event- Returns:
- true if a menu was shown.
-
findClosestData
Find the closest data unit to the mouse point.- Parameters:
e
- Mouse informatoinmaxDistance
- Maximum distance to consider.- Returns:
-
destroyCurrentMark
public void destroyCurrentMark(javafx.scene.input.MouseEvent e) Destroy the current mark. -
mouseClicked
public boolean mouseClicked(javafx.scene.input.MouseEvent e) - Overrides:
mouseClicked
in classExtMouseAdapter
-
needPaused
public boolean needPaused()- Returns:
- true if whatever is going on makes it desirable to pause display scrolling.
-
canDestroyMark
public boolean canDestroyMark(javafx.scene.input.MouseEvent e) Check whether a current mark can be destroyed.- Parameters:
e
- - the mouse event- Returns:
- true if mark can be destroyed. False otherwise.
-
addObserver
-
removeObserver
-
getObserverCount
public int getObserverCount()Get the number of observers.- Returns:
- The number of things observing this marker.
-
getObservers
Get the list of observers.- Returns:
- the observers
-
notifyObservers
public boolean notifyObservers(int markStatus, javafx.scene.input.MouseEvent mouseEvent, OverlayMarker overlayMarker, OverlayMark overlayMark) -
mouseMoved
public boolean mouseMoved(javafx.scene.input.MouseEvent e) - Overrides:
mouseMoved
in classExtMouseAdapter
-
isMarkComplete
public boolean isMarkComplete() -
mouseDragged
public boolean mouseDragged(javafx.scene.input.MouseEvent e) - Overrides:
mouseDragged
in classExtMouseAdapter
-
getCurrentMark
- Specified by:
getCurrentMark
in interfaceMarkManager
-
getSelectedMarkedDataUnits
public List<PamDataUnit> getSelectedMarkedDataUnits(OverlayMark overlayMark, MarkDataSelector markDataSelector) Get a list of marked and selected data units. For now, work off the hover data within the projector, but feel free to override or use a totally different system of working out what's in the mark - that's the responsibility of whatever display has the mark. The MarkDataSelector comes from the Mark Observer, i.e. the thing that uses the data.- Parameters:
overlayMark
-markDataSelector
-- Returns:
-
getSelectedMarkedDataUnits
public List<PamDataUnit> getSelectedMarkedDataUnits(OverlayMark overlayMark, MarkDataSelector markDataSelector, int minOverlap) -
canMark
- Parameters:
markObserver
-- Returns:
- true if this marker can send marks to this observer.
-
isNowMarking
public boolean isNowMarking()Now marking- Returns:
- true if now marking.
-
setProjector
- Parameters:
projector
- the projector to set
-
updateMarkedDisplay
public void updateMarkedDisplay()Update the marked display. This can be called after the mark has been used to repaint the owner display. Forcing a repaint will generally make the mark disappear and may also recolour any changed dataunits. -
isMouseContained
public boolean isMouseContained(javafx.scene.input.MouseEvent e) Check whether a mouse event is contained within the current mark shape- Parameters:
e
- - the mouse event- Returns:
- true if the mouse event is cointained within the shape.
-
setNowMarking
public void setNowMarking(boolean nowMarking) Set if marking -
setCurrentMark
Set the current mark.- Parameters:
currentMark
- - set the current mark
-
getMarkWarning
Get the current mark warning. Can be null.- Returns:
- the current mark warning.
-