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
ConstructorsConstructorDescriptionOverlayMarker
(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) protected boolean
completeMark
(javafx.scene.input.MouseEvent e) Complete the mark.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.protected MarkExtraInfo
findExtraInfo
(Object mouseSource) See if the display making the mark has any extra information.protected PamCoordinate
getCoordinate
(javafx.scene.input.MouseEvent e) Get an x,y coordinate as a lat long.protected int
abstract String
protected Object
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) protected boolean
protected boolean
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) protected void
setAllowPolygons
(boolean allowPolygons) protected void
setAllowRectangles
(boolean allowRectangles) void
setCurrentMark
(OverlayMark currentMark) Set the current mark.protected void
setMarkChannels
(int markChannels) protected void
setMarkSource
(Object markSource) protected void
setMarkSTartXY
(javafx.geometry.Point3D point3d) 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.protected void
updateObservers
(int markStatus, javafx.scene.input.MouseEvent mouseEvent, OverlayMark overlayMark) Methods inherited from class PamView.paneloverlay.overlaymark.ExtMouseAdapter
fxMouse, mouseClicked, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, mouseWheelMoved, swingMouse
-
Constructor Details
-
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
-
findExtraInfo
See if the display making the mark has any extra information.- Parameters:
mouseSource
-- Returns:
-
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.
-
updateObservers
protected void updateObservers(int markStatus, javafx.scene.input.MouseEvent mouseEvent, OverlayMark overlayMark) -
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() -
completeMark
protected boolean completeMark(javafx.scene.input.MouseEvent e) Complete the mark.- Parameters:
e
- - mouse event
-
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) -
getCoordinate
Get an x,y coordinate as a lat long.- Parameters:
e
- Mouse event- Returns:
- coordinate.
-
canMark
- Parameters:
markObserver
-- Returns:
- true if this marker can send marks to this observer.
-
isAllowRectangles
protected boolean isAllowRectangles()- Returns:
- the allowRectangles
-
setAllowRectangles
protected void setAllowRectangles(boolean allowRectangles) - Parameters:
allowRectangles
- the allowRectangles to set
-
isAllowPolygons
protected boolean isAllowPolygons()- Returns:
- the allowPolygons
-
setAllowPolygons
protected void setAllowPolygons(boolean allowPolygons) - Parameters:
allowPolygons
- the allowPolygons to set
-
getMarkSource
- Returns:
- the markSource
-
setMarkSource
- Parameters:
markSource
- the markSource to set
-
getMarkChannels
protected int getMarkChannels()- Returns:
- the markChannels
-
setMarkChannels
protected void setMarkChannels(int markChannels) - Parameters:
markChannels
- the markChannels to set
-
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
-
setMarkSTartXY
protected void setMarkSTartXY(javafx.geometry.Point3D point3d) -
getMarkWarning
Get the current mark warning. Can be null.- Returns:
- the current mark warning.
-