use of org.cytoscape.ding.impl.ArbitraryGraphicsCanvas in project cytoscape-impl by cytoscape.
the class AnnotationManagerImpl method removeAnnotations.
@Override
public void removeAnnotations(Collection<? extends Annotation> annotations) {
Map<DGraphView, List<DingAnnotation>> annotationsByView = groupByView(annotations);
if (annotationsByView.isEmpty())
return;
invokeOnEDTAndWait(() -> {
annotationsByView.forEach((view, viewAnnotations) -> {
Map<ArbitraryGraphicsCanvas, List<DingAnnotation>> annotationsByCanvas = groupByCanvas(view, viewAnnotations);
annotationsByCanvas.forEach((canvas, dingAnnotations) -> {
// The following code is a batch version of Annotation.removeAnnotation()
for (DingAnnotation a : dingAnnotations) {
GroupAnnotation parent = a.getGroupParent();
if (parent != null) {
parent.removeMember(a);
}
}
canvas.removeAnnotations(getArrows(dingAnnotations));
canvas.removeAnnotations(dingAnnotations);
canvas.repaint();
});
});
});
}
Aggregations