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 TypeMethodDescriptionvoidaddAnnotation(SNTPoint p, float radius, Color color) Adds a single annotation marker at the given world-space position.voidclear()Removes all annotations from the overlay and triggers a repaint.intgetCount()Returns the number of annotations currently in the overlay.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.booleanReturns true if the overlay is currently rendered.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.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
-
clear
void clear()Removes all annotations from the overlay and triggers a repaint. -
getCount
int getCount()Returns the number of annotations currently in the overlay. -
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
-
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
-
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
-