Interface AbstractBigViewer.AnnotationOverlay

All Known Implementing Classes:
Bvv.AnnotationOverlay
Enclosing class:
AbstractBigViewer

public static interface AbstractBigViewer.AnnotationOverlay
Common contract for all viewer annotation overlays.

Concrete implementations live inside each viewer subclass (e.g., Bvv.AnnotationOverlay, AbstractBigViewer.AnnotationOverlay) and handle the viewer-specific projection and rendering. Components such as BookmarkManager depend only on this interface.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addAnnotation(Object owner, SNTPoint p, float radius, Color color)
    Owner-scoped variant of addAnnotation(SNTPoint, float, Color).
    void
    addAnnotation(SNTPoint p, float radius, Color color)
    Adds a single annotation marker at the given world-space position.
    void
    Removes all annotations, from every layer/owner, and triggers a repaint.
    default void
    clear(Object owner)
    Owner-scoped variant of clear(): removes only owner's annotations, leaving every other owner's layer (and the legacy ownerless one) untouched, and triggers a repaint.
    default void
    Removes every layer's annotations and triggers a repaint.
    int
    Returns the number of annotations currently in the overlay, across all layers.
    default int
    hitTest(int screenX, int screenY)
    Returns the model index of the annotation whose rendered circle/sphere contains the given screen point, or -1 if none is hit.
    default int
    hitTest(Object owner, int screenX, int screenY)
    Owner-scoped variant of hitTest(int, int): only considers owner's own annotations, and - if one is hit - returns an index local to that owner's layer (parallel to what replaceAll(Object, java.util.List, java.util.List, java.util.List) was given for that owner), not a global index into the combined, all-layers list.
    boolean
    Returns true if the overlay is currently rendered.
    default void
    replaceAll(Object owner, List<SNTPoint> points, List<Float> sizes, List<Color> colors)
    Owner-scoped variant of replaceAll(java.util.List, java.util.List, java.util.List): atomically replaces only owner's layer, leaving every other owner's annotations (and the legacy ownerless layer) untouched.
    default void
    replaceAll(List<SNTPoint> points, List<Float> sizes, List<Color> colors)
    Replaces all annotations atomically and requests a single repaint.
    default void
    setSelectedIndex(int index)
    Highlights the annotation at the given model index by rendering it in a contrasting color.
    default void
    setSelectedIndex(Object owner, int index)
    Owner-scoped variant of setSelectedIndex(int): index is local to owner's own layer (e.g. a row index into that owner's model), not a global index into the combined, all-layers annotation list.
    void
    setVisible(boolean visible)
    Shows or hides the overlay without removing its annotations.
    void
    Propagates the current annotation list to the underlying renderer and requests a repaint.
  • Method Details

    • addAnnotation

      void addAnnotation(SNTPoint p, float radius, Color color)
      Adds a single annotation marker at the given world-space position.
      Parameters:
      p - the position (world coordinates)
      radius - sphere radius in physical units
      color - fill color
    • addAnnotation

      default void addAnnotation(Object owner, SNTPoint p, float radius, Color color)
      Owner-scoped variant of addAnnotation(SNTPoint, float, Color). Independent callers (e.g. BookmarkManager and SeedOverlayBigViewerHandler) pass a distinct, stable owner key (typically their own Class object) so their annotations are tracked as a separate layer: clearing/replacing one owner's layer never touches another owner's. All layers - including the legacy ownerless one used by addAnnotation(SNTPoint, float, Color) - are rendered together. Implementations that don't support per-owner layers may fall back to the shared/ownerless behavior.
      Parameters:
      owner - identifies the layer this annotation belongs to
      p - the position (world coordinates)
      radius - sphere radius in physical units
      color - fill color
    • clear

      void clear()
      Removes all annotations, from every layer/owner, and triggers a repaint.
    • clearAll

      default void clearAll()
      Removes every layer's annotations and triggers a repaint. Equivalent to clear() for implementations without per-owner layers; named separately from the owner-scoped clear(Object) to make the "wipe everything" intent explicit at call sites.
    • clear

      default void clear(Object owner)
      Owner-scoped variant of clear(): removes only owner's annotations, leaving every other owner's layer (and the legacy ownerless one) untouched, and triggers a repaint. Implementations that don't support per-owner layers may fall back to clear(), which - unlike this method - clears everything.
      Parameters:
      owner - identifies the layer to clear
    • getCount

      int getCount()
      Returns the number of annotations currently in the overlay, across all layers.
    • isVisible

      boolean isVisible()
      Returns true if the overlay is currently rendered.
    • setVisible

      void setVisible(boolean visible)
      Shows or hides the overlay without removing its annotations.
      Parameters:
      visible - true to show, false to hide
    • updateScene

      void updateScene()
      Propagates the current annotation list to the underlying renderer and requests a repaint. Call after bulk modifications.
    • setSelectedIndex

      default void setSelectedIndex(int index)
      Highlights the annotation at the given model index by rendering it in a contrasting color. Pass -1 to clear any existing highlight.
      Parameters:
      index - model index of the annotation to highlight, or -1 for none
    • setSelectedIndex

      default void setSelectedIndex(Object owner, int index)
      Owner-scoped variant of setSelectedIndex(int): index is local to owner's own layer (e.g. a row index into that owner's model), not a global index into the combined, all-layers annotation list. Implementations that don't support per-owner layers may fall back to setSelectedIndex(int).
      Parameters:
      owner - identifies the layer index is relative to
      index - layer-local index of the annotation to highlight, or -1 for none
    • hitTest

      default int hitTest(int screenX, int screenY)
      Returns the model index of the annotation whose rendered circle/sphere contains the given screen point, or -1 if none is hit.
      Parameters:
      screenX - x coordinate in viewer-display pixels
      screenY - y coordinate in viewer-display pixels
    • hitTest

      default int hitTest(Object owner, int screenX, int screenY)
      Owner-scoped variant of hitTest(int, int): only considers owner's own annotations, and - if one is hit - returns an index local to that owner's layer (parallel to what replaceAll(Object, java.util.List, java.util.List, java.util.List) was given for that owner), not a global index into the combined, all-layers list. Implementations that don't support per-owner layers may fall back to hitTest(int, int).
      Parameters:
      owner - identifies the layer to hit-test against
      screenX - x coordinate in viewer-display pixels
      screenY - y coordinate in viewer-display pixels
    • replaceAll

      default void replaceAll(List<SNTPoint> points, List<Float> sizes, List<Color> colors)
      Replaces all annotations atomically and requests a single repaint. Prefer this over calling clear() + addAnnotation() in a loop, which would trigger one repaint per call and may cause visible flicker.
      Parameters:
      points - list of positions (world coordinates); null entries are skipped
      sizes - sphere radii in physical units, parallel to points
      colors - fill colors, parallel to points; null entries use Color.YELLOW
    • replaceAll

      default void replaceAll(Object owner, List<SNTPoint> points, List<Float> sizes, List<Color> colors)
      Owner-scoped variant of replaceAll(java.util.List, java.util.List, java.util.List): atomically replaces only owner's layer, leaving every other owner's annotations (and the legacy ownerless layer) untouched. This is the method independent features sharing one big-viewer overlay - e.g. bookmarks/markers and detector-derived seeds - should use, so that one feature's sync never wipes another's markers. Implementations that don't support per-owner layers may fall back to replaceAll(java.util.List, java.util.List, java.util.List), which - unlike this method - replaces the single shared/ownerless layer instead.
      Parameters:
      owner - identifies the layer to replace
      points - list of positions (world coordinates); null entries are skipped
      sizes - sphere radii in physical units, parallel to points
      colors - fill colors, parallel to points; null entries use Color.YELLOW