Package sc.fiji.snt.viewer
Class Bvv.AnnotationOverlay
java.lang.Object
sc.fiji.snt.viewer.Bvv.AnnotationOverlay
- All Implemented Interfaces:
AbstractBigViewer.AnnotationOverlay
- Enclosing class:
Bvv
public static class Bvv.AnnotationOverlay
extends Object
implements AbstractBigViewer.AnnotationOverlay
Renders spherical annotations at
SNTPoint world coordinates.
Rendered with CPU (Java2D) but optimized with caching and batched rendering.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(Object owner, SNTPoint p, float radius, Color color) Owner-scoped variant ofAbstractBigViewer.AnnotationOverlay.addAnnotation(SNTPoint, float, Color).voidaddAnnotation(SNTPoint p, float radius, Color color) Add a single annotation.voidaddAnnotations(Collection<SNTPoint> points, float radius, Color color) Add annotations to the current list.voidclear()Remove all annotations, from every layer/owner.voidOwner-scoped variant ofAbstractBigViewer.AnnotationOverlay.clear(): removes onlyowner's annotations, leaving every other owner's layer (and the legacy ownerless one) untouched, and triggers a repaint.voidclearAll()Removes every layer's annotations and triggers a repaint.intgetCount()Returns the number of annotations currently in the overlay, across all layers/owners.inthitTest(int screenX, int screenY) Hit-tests the last-rendered screen circles against (screenX, screenY).intOwner-scoped hit-test: same screen-circle test ashitTest(int, int), restricted toowner's own [start, end) range within the flattened, currently-rendered annotation list (seelayerRanges), with the result translated back to an owner-local index.booleanReturns true if the overlay is currently rendered.voidOwner-scoped variant: replaces onlyowner's layer with a single repaint, leaving every other owner's annotations (bookmarks, seeds, the legacy ownerless layer, ...)voidReplaces all annotations in one shot with a single repaint.voidsetAnnotations(Collection<SNTPoint> points, float radius, Color color) Replace the current annotations with the provided list.voidsetSelectedIndex(int index) Highlights the annotation at the given model index by rendering it in a contrasting color.voidsetSelectedIndex(Object owner, int index) Owner-scoped variant ofAbstractBigViewer.AnnotationOverlay.setSelectedIndex(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) Show/hide annotationsvoidEnsure renderers/nodes reflect current annotation list.
-
Method Details
-
setAnnotations
Replace the current annotations with the provided list. -
addAnnotations
Add annotations to the current list. -
addAnnotation
Add a single annotation.- Specified by:
addAnnotationin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
p- the position (world coordinates)radius- sphere radius in physical unitscolor- fill color
-
addAnnotation
Description copied from interface:AbstractBigViewer.AnnotationOverlayOwner-scoped variant ofAbstractBigViewer.AnnotationOverlay.addAnnotation(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 byAbstractBigViewer.AnnotationOverlay.addAnnotation(SNTPoint, float, Color)- are rendered together. Implementations that don't support per-owner layers may fall back to the shared/ownerless behavior.- Specified by:
addAnnotationin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
owner- identifies the layer this annotation belongs top- the position (world coordinates)radius- sphere radius in physical unitscolor- fill color
-
clear
public void clear()Remove all annotations, from every layer/owner.- Specified by:
clearin interfaceAbstractBigViewer.AnnotationOverlay
-
clearAll
public void clearAll()Description copied from interface:AbstractBigViewer.AnnotationOverlayRemoves every layer's annotations and triggers a repaint. Equivalent toAbstractBigViewer.AnnotationOverlay.clear()for implementations without per-owner layers; named separately from the owner-scopedAbstractBigViewer.AnnotationOverlay.clear(Object)to make the "wipe everything" intent explicit at call sites.- Specified by:
clearAllin interfaceAbstractBigViewer.AnnotationOverlay
-
clear
Description copied from interface:AbstractBigViewer.AnnotationOverlayOwner-scoped variant ofAbstractBigViewer.AnnotationOverlay.clear(): 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 toAbstractBigViewer.AnnotationOverlay.clear(), which - unlike this method - clears everything.- Specified by:
clearin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
owner- identifies the layer to clear
-
isVisible
public boolean isVisible()Description copied from interface:AbstractBigViewer.AnnotationOverlayReturns true if the overlay is currently rendered.- Specified by:
isVisiblein interfaceAbstractBigViewer.AnnotationOverlay
-
getCount
public int getCount()Returns the number of annotations currently in the overlay, across all layers/owners.- Specified by:
getCountin interfaceAbstractBigViewer.AnnotationOverlay
-
setVisible
public void setVisible(boolean visible) Show/hide annotations- Specified by:
setVisiblein interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
visible- true to show, false to hide
-
updateScene
public void updateScene()Ensure renderers/nodes reflect current annotation list.- Specified by:
updateScenein interfaceAbstractBigViewer.AnnotationOverlay
-
setSelectedIndex
public void setSelectedIndex(int index) Description copied from interface:AbstractBigViewer.AnnotationOverlayHighlights the annotation at the given model index by rendering it in a contrasting color. Pass -1 to clear any existing highlight.- Specified by:
setSelectedIndexin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
index- model index of the annotation to highlight, or -1 for none
-
setSelectedIndex
Description copied from interface:AbstractBigViewer.AnnotationOverlayOwner-scoped variant ofAbstractBigViewer.AnnotationOverlay.setSelectedIndex(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 toAbstractBigViewer.AnnotationOverlay.setSelectedIndex(int).- Specified by:
setSelectedIndexin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
owner- identifies the layerindexis relative toindex- layer-local index of the annotation to highlight, or -1 for none
-
hitTest
public int hitTest(int screenX, int screenY) Hit-tests the last-rendered screen circles against (screenX, screenY). Uses a minimum hit radius of 4 px so tiny markers remain clickable.- Specified by:
hitTestin interfaceAbstractBigViewer.AnnotationOverlay- Parameters:
screenX- x coordinate in viewer-display pixelsscreenY- y coordinate in viewer-display pixels
-
hitTest
Owner-scoped hit-test: same screen-circle test ashitTest(int, int), restricted toowner's own [start, end) range within the flattened, currently-rendered annotation list (seelayerRanges), with the result translated back to an owner-local index.- Specified by:
hitTestin interfaceAbstractBigViewer.AnnotationOverlay- 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 in one shot with a single repaint. Overrides the default to avoid the per-call repaints from clear() and addAnnotation(), which can produce visible flicker.- Specified by:
replaceAllin interfaceAbstractBigViewer.AnnotationOverlay- 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: replaces onlyowner's layer with a single repaint, leaving every other owner's annotations (bookmarks, seeds, the legacy ownerless layer, ...) untouched. This is whatBookmarkManagerandSeedOverlayBigViewerHandleruse, each with its own owner key, so neither wipes the other's markers.- Specified by:
replaceAllin interfaceAbstractBigViewer.AnnotationOverlay- 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
-