use of net.imagej.display.DataView in project imagej-ui-swing by imagej.
the class JHotDrawImageCanvas method onEvent.
@EventHandler
protected void onEvent(final DataViewDeselectedEvent event) {
final DataView view = event.getView();
final FigureView figureView = getFigureView(view);
// not one of this canvas's views
if (figureView == null)
return;
final Figure figure = figureView.getFigure();
if (drawingView.getSelectedFigures().contains(figure)) {
drawingView.removeFromSelection(figure);
}
}
use of net.imagej.display.DataView in project imagej-ui-swing by imagej.
the class JHotDrawImageCanvas method onEvent.
// -- Event handlers --
@EventHandler
protected void onEvent(final DataViewSelectedEvent event) {
final DataView view = event.getView();
final FigureView figureView = getFigureView(view);
// not one of this canvas's views
if (figureView == null)
return;
final Figure figure = figureView.getFigure();
if (!drawingView.getSelectedFigures().contains(figure)) {
drawingView.addToSelection(figure);
}
}
use of net.imagej.display.DataView in project imagej-ui-swing by imagej.
the class JHotDrawService method linkOverlay.
/**
* Links a new {@link Overlay} and {@link OverlayView}, created by the given
* {@link JHotDrawAdapter}, to the specified JHotDraw {@link Figure} of a
* particular {@link ImageDisplay}.
*/
public <F extends Figure> void linkOverlay(final F figure, final JHotDrawAdapter<F> adapter, final ImageDisplay display) {
final Overlay overlay = adapter.createNewOverlay();
final DataView view = imageDisplayService.createDataView(overlay);
if (!(view instanceof OverlayView)) {
throw new IllegalStateException("Unexpected data view: " + view);
}
final OverlayView overlayView = (OverlayView) view;
adapter.updateOverlay(figure, overlayView);
eventService.publish(new FigureCreatedEvent(overlayView, figure, display));
}
use of net.imagej.display.DataView in project imagej-plugins-commands by imagej.
the class RemoveOverlay method run.
// -- run() method --
@Override
public void run() {
final ArrayList<DataView> views = new ArrayList<DataView>(display);
for (final DataView view : views) {
if (view.isSelected()) {
if (view instanceof OverlayView) {
OverlayView overlayView = (OverlayView) view;
oService.removeOverlay(overlayView.getData());
}
}
}
}
use of net.imagej.display.DataView in project imagej-plugins-commands by imagej.
the class RemoveOverlayReferences method run.
@Override
public void run() {
final ArrayList<DataView> views = new ArrayList<DataView>(display);
for (final DataView view : views) {
if (view.isSelected()) {
display.remove(view);
view.dispose();
display.update();
}
}
}
Aggregations