Class GuidedTutorial
AbstractBigViewer (Bdv or Bvv, including Stream mode):
flies the camera to a region of interest, shows a CalloutManager callout describing what to do there, and
only advances once a caller-supplied check confirms the user did it. A failed check re-shows an earlier (by default,
the same) step instead of silently moving on.
This class owns no tracing logic and reads only public SNT/PathAndFillManager state, so the same tutorial
works whether the viewer is Bdv or Bvv, and regardless of the data backing it (in-memory image or Stream mode).
Positioning relies on AbstractBigViewer.flyTo(BoundingBox) always centering its target on screen:
a single reused, invisible anchor kept at the canvas's center is enough to point a callout at "wherever flyTo just
centered", with no per-frame tracking of the camera transform. The anchor's screen position is read from
AbstractBigViewer.getViewerCanvas().
- Author:
- Tiago Ferreira
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Consumer<AbstractBigViewer> rotate(int axis, double degrees, long durationMs) Returns aGuidedTutorial.Stepcamera action that orbits the view bydegreesaroundaxis(0 = X, i.e. tumbling around the horizontal screen axis; 1 = Y, tumbling around the vertical screen axis; 2 = Z, spinning in-plane around the line of sight), pivoting on the current screen center - i.e. on whatever the step's ownroijust centered viaAbstractBigViewer.flyTo(BoundingBox)- so the framed region stays put and only orbits, rather than swinging off-screen.setPostAction(Runnable postAction) Sets a one-off action to run at the end ofstop(), once the tutorial's own teardown is done e.g., to undo whateversetPreAction(Runnable)changed.setPreAction(Runnable preAction) Sets a one-off action to run at the top ofstart(), before the first step is shown, e.g. switching the viewer into whatever tracing mode the tutorial expects.setPreAction(Runnable preAction, long settleMs) AssetPreAction(Runnable), but waitssettleMsafter runningpreActionbefore showing the first step, instead of showing it immediately.voidstart()RunssetPreAction(java.lang.Runnable), waits its settle delay (if any), then starts the tutorial from its first stepvoidstop()Aborts the tutorial: hides the current callout, forgets the anchor, unregisters the state listener, then runssetPostAction(java.lang.Runnable).
-
Constructor Details
-
GuidedTutorial
- Parameters:
viewer- the live viewer to fly around and anchor callouts tosteps- the tutorial, in order; seeGuidedTutorial.Step
-
-
Method Details
-
setPreAction
Sets a one-off action to run at the top ofstart(), before the first step is shown, e.g. switching the viewer into whatever tracing mode the tutorial expects. Replaces any previously set action;null(the default) runs nothing.- Returns:
- this, for chaining onto the constructor call
-
setPreAction
AssetPreAction(Runnable), but waitssettleMsafter runningpreActionbefore showing the first step, instead of showing it immediately. Useful whenpreActiontriggers window arranging/resizing or anything else whose on-screen effects don't land synchronously.- Returns:
- this, for chaining onto the constructor call
-
setPostAction
Sets a one-off action to run at the end ofstop(), once the tutorial's own teardown is done e.g., to undo whateversetPreAction(Runnable)changed. Runs exactly once perstart()/stop()pair, even thoughstop()itself is safe to call more than once; runs even if the teardown above throws Replaces any previously set action;null(the default) runs nothing.- Returns:
- this, for chaining onto the constructor call
-
start
public void start()RunssetPreAction(java.lang.Runnable), waits its settle delay (if any), then starts the tutorial from its first step -
stop
public void stop()Aborts the tutorial: hides the current callout, forgets the anchor, unregisters the state listener, then runssetPostAction(java.lang.Runnable). Called automatically once the last step is dismissed, or as soon as the viewer's window closes. -
rotate
Returns aGuidedTutorial.Stepcamera action that orbits the view bydegreesaroundaxis(0 = X, i.e. tumbling around the horizontal screen axis; 1 = Y, tumbling around the vertical screen axis; 2 = Z, spinning in-plane around the line of sight), pivoting on the current screen center - i.e. on whatever the step's ownroijust centered viaAbstractBigViewer.flyTo(BoundingBox)- so the framed region stays put and only orbits, rather than swinging off-screen. Animates overdurationMs(0 = immediate).The pivot-preserving matrix is composed by hand (plain
get/setarithmetic) rather than viaAffineTransform3D#rotate, which pivots on the transform's own (world) origin, not on whatever is currently centered on screen.
-