Package sc.fiji.snt.viewer
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 TypeMethodDescriptiondefault voidaddAnnotation(Object owner, SNTPoint p, float radius, Color color) Owner-scoped variant ofaddAnnotation(SNTPoint, float, Color).voidaddAnnotation(SNTPoint p, float radius, Color color) Adds a single annotation marker at the given world-space position.voidclear()Removes all annotations, from every layer/owner, and triggers a repaint.default voidOwner-scoped variant ofclear(): removes onlyowner's annotations, leaving every other owner's layer (and the legacy ownerless one) untouched, and triggers a repaint.default voidclearAll()Removes every layer's annotations and triggers a repaint.intgetCount()Returns the number of annotations currently in the overlay, across all layers.default inthitTest(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 intOwner-scoped variant ofhitTest(int, int): only considersowner's own annotations, and - if one is hit - returns an index local to that owner's layer (parallel to whatreplaceAll(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.booleanReturns true if the overlay is currently rendered.default voidOwner-scoped variant ofreplaceAll(java.util.List, java.util.List, java.util.List): atomically replaces onlyowner's layer, leaving every other owner's annotations (and the legacy ownerless layer) untouched.default voidReplaces all annotations atomically and requests a single repaint.default voidsetSelectedIndex(int index) Highlights the annotation at the given model index by rendering it in a contrasting color.default voidsetSelectedIndex(Object owner, int index) Owner-scoped variant ofsetSelectedIndex(int):indexis local toowner's own layer (e.g. a row index into that owner's model), not a global index into the combined, all-layers annotation list.voidsetVisible(boolean visible) Shows or hides the overlay without removing its annotations.voidPropagates the current annotation list to the underlying renderer and requests a repaint.
-
Method Details
-
addAnnotation
Adds a single annotation marker at the given world-space position.- Parameters:
p- the position (world coordinates)radius- sphere radius in physical unitscolor- fill color
-
addAnnotation
Owner-scoped variant ofaddAnnotation(SNTPoint, float, Color). Independent callers (e.g.BookmarkManagerandSeedOverlayBigViewerHandler) pass a distinct, stableownerkey (typically their ownClassobject) 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 byaddAnnotation(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 top- the position (world coordinates)radius- sphere radius in physical unitscolor- 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 toclear()for implementations without per-owner layers; named separately from the owner-scopedclear(Object)to make the "wipe everything" intent explicit at call sites. -
clear
Owner-scoped variant ofclear(): removes onlyowner'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 toclear(), 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
Owner-scoped variant ofsetSelectedIndex(int):indexis local toowner'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 tosetSelectedIndex(int).- Parameters:
owner- identifies the layerindexis relative toindex- 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 pixelsscreenY- y coordinate in viewer-display pixels
-
hitTest
Owner-scoped variant ofhitTest(int, int): only considersowner's own annotations, and - if one is hit - returns an index local to that owner's layer (parallel to whatreplaceAll(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 tohitTest(int, int).- Parameters:
owner- identifies the layer to hit-test againstscreenX- x coordinate in viewer-display pixelsscreenY- y coordinate in viewer-display pixels
-
replaceAll
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 skippedsizes- sphere radii in physical units, parallel to pointscolors- fill colors, parallel to points; null entries use Color.YELLOW
-
replaceAll
Owner-scoped variant ofreplaceAll(java.util.List, java.util.List, java.util.List): atomically replaces onlyowner'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 toreplaceAll(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 replacepoints- list of positions (world coordinates); null entries are skippedsizes- sphere radii in physical units, parallel to pointscolors- fill colors, parallel to points; null entries use Color.YELLOW
-