Class PlayHeadMarker
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.markerlayer.Marker
-
- org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker
-
- All Implemented Interfaces:
ILatLon
,IQuadBucketType
,Destroyable
,TemplateEngineDataProvider
public final class PlayHeadMarker extends Marker
Singleton marker class to track position of audio.- Since:
- 572
-
-
Field Summary
Fields Modifier and Type Field Description private double
animationInterval
private int
dropTolerance
private boolean
enabled
private boolean
jumpToMarker
private LatLon
oldCoor
private MapMode
oldMode
private static PlayHeadMarker
playHead
private javax.swing.Timer
timer
private boolean
wasPlaying
-
Fields inherited from class org.openstreetmap.josm.gui.layer.markerlayer.Marker
LABEL_PATTERN_AUTO, LABEL_PATTERN_DESC, LABEL_PATTERN_NAME, MARKER_FORMATTED_OFFSET, MARKER_OFFSET, offset, parentLayer, symbol, time
-
Fields inherited from interface org.openstreetmap.josm.data.coor.ILatLon
MAX_SERVER_PRECISION
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PlayHeadMarker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
animate()
Animates the marker along the track.boolean
containsPoint(java.awt.Point p)
Checks whether the marker display area contains the given point.static PlayHeadMarker
create()
Returns the unique instance ofPlayHeadMarker
.void
drag(EastNorth en)
apply the new position resulting from a drag in progressprivate void
endDrag(boolean reset)
reinstate the old map mode after switching temporarily to do a play head dragvoid
paint(java.awt.Graphics g, MapView mv)
Paint the marker icon in the given graphics context.void
reposition(EastNorth en)
reposition the play head at the point on the track nearest position given, providing we are within reasonable distance from the track; otherwise reset to the original position.void
startDrag()
called back from drag mode to say when we started dragging for real (at least a short distance)void
synchronize(EastNorth en)
Synchronize the audio at the position where the play head was paused before dragging with the position on the track where it was dropped.void
timerAction()
callback for moving play head marker according to audio player position-
Methods inherited from class org.openstreetmap.josm.gui.layer.markerlayer.Marker
actionPerformed, appendMarkerProducer, convertToWayPoint, createMarkers, destroy, evaluateCondition, getBBox, getCoor, getTemplateKeys, getTemplateValue, getText, getTextTemplateKey, isErroneous, lat, lon, paint, paintIcon, prependMarkerProducer, setCoor, setEastNorth, setErroneous, updateText
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.coor.ILatLon
bearing, distanceSq, distanceSq, equalsEpsilon, equalsEpsilon, getEastNorth, greatCircleDistance, interpolate, isLatLonKnown
-
-
-
-
Field Detail
-
timer
private javax.swing.Timer timer
-
animationInterval
private double animationInterval
-
playHead
private static volatile PlayHeadMarker playHead
-
enabled
private final boolean enabled
-
wasPlaying
private boolean wasPlaying
-
dropTolerance
private int dropTolerance
-
jumpToMarker
private boolean jumpToMarker
-
-
Constructor Detail
-
PlayHeadMarker
private PlayHeadMarker()
-
-
Method Detail
-
create
public static PlayHeadMarker create()
Returns the unique instance ofPlayHeadMarker
.- Returns:
- The unique instance of
PlayHeadMarker
.
-
containsPoint
public boolean containsPoint(java.awt.Point p)
Description copied from class:Marker
Checks whether the marker display area contains the given point. Markers not interested in mouse clicks may always return false.- Overrides:
containsPoint
in classMarker
- Parameters:
p
- The point to check- Returns:
true
if the marker "hotspot" contains the point.
-
startDrag
public void startDrag()
called back from drag mode to say when we started dragging for real (at least a short distance)
-
endDrag
private void endDrag(boolean reset)
reinstate the old map mode after switching temporarily to do a play head drag- Parameters:
reset
- whether to reset state (pause audio and restore old coordinates)
-
drag
public void drag(EastNorth en)
apply the new position resulting from a drag in progress- Parameters:
en
- the new position in map terms
-
reposition
public void reposition(EastNorth en)
reposition the play head at the point on the track nearest position given, providing we are within reasonable distance from the track; otherwise reset to the original position.- Parameters:
en
- the position to start looking from
-
synchronize
public void synchronize(EastNorth en)
Synchronize the audio at the position where the play head was paused before dragging with the position on the track where it was dropped. If this is quite near an audio marker, we use that marker as the sync. location, otherwise we create a new marker at the trackpoint nearest the end point of the drag point to apply the sync to.- Parameters:
en
- : the EastNorth end point of the drag
-
paint
public void paint(java.awt.Graphics g, MapView mv)
Paint the marker icon in the given graphics context.- Parameters:
g
- The graphics contextmv
- The map
-
animate
public void animate()
Animates the marker along the track.
-
timerAction
public void timerAction()
callback for moving play head marker according to audio player position
-
-