Class PathPlayer

java.lang.Object
sc.fiji.snt.viewer.PathPlayer

public class PathPlayer extends Object
Plays a walkthrough along paths in a AbstractBigViewer: the view is centered on a point that travels along each path at constant speed. The camera only translates (rotation is preserved, and the zoom is left untouched unless a field of view is requested), so the user may rotate the view during playback.

The distance covered per tick is fixed (speed * tick period), i.e., it does not depend on how fast the viewer renders: every playback samples the same positions, and the total elapsed time reflects how well the viewer keeps up. This makes playback suitable for reproducible performance tests. Clicking on the display aborts playback.

Author:
Tiago Ferreira
  • Method Details

    • onFinished

      public PathPlayer onFinished(Runnable r)
      Sets a callback to be run (on the EDT) once playback ends, aborted or not
      Parameters:
      r - the callback
      Returns:
      this player, for chaining
    • onPath

      public PathPlayer onPath(Consumer<String> c)
      Sets a callback notified (on the EDT) with the name of each path as playback reaches it
      Parameters:
      c - the callback
      Returns:
      this player, for chaining
    • isPlaying

      public boolean isPlaying()
      Returns:
      true if playback is in progress
    • isAborted

      public boolean isAborted()
      Returns:
      true if playback ended because it was stopped before the end of the last path
    • getTotalLength

      public double getTotalLength()
      Returns:
      the total length of the paths (world units)
    • getSummary

      public String getSummary()
      Returns:
      a one-line summary of the last playback (elapsed time, ticks, stalls), or null if playback has not finished
    • play

      public PathPlayer play()
      Starts playback (non-blocking). Does nothing if already playing or if there is nothing to play
      Returns:
      this player, for chaining
    • stop

      public void stop()
      Stops playback. Safe to call at any time