Search in sources :

Example 1 with DataView

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);
    }
}
Also used : DataView(net.imagej.display.DataView) Figure(org.jhotdraw.draw.Figure) EventHandler(org.scijava.event.EventHandler)

Example 2 with DataView

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);
    }
}
Also used : DataView(net.imagej.display.DataView) Figure(org.jhotdraw.draw.Figure) EventHandler(org.scijava.event.EventHandler)

Example 3 with DataView

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));
}
Also used : DataView(net.imagej.display.DataView) Overlay(net.imagej.overlay.Overlay) OverlayView(net.imagej.display.OverlayView)

Example 4 with DataView

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());
            }
        }
    }
}
Also used : DataView(net.imagej.display.DataView) ArrayList(java.util.ArrayList) OverlayView(net.imagej.display.OverlayView)

Example 5 with DataView

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();
        }
    }
}
Also used : DataView(net.imagej.display.DataView) ArrayList(java.util.ArrayList)

Aggregations

DataView (net.imagej.display.DataView)12 OverlayView (net.imagej.display.OverlayView)5 ArrayList (java.util.ArrayList)3 Overlay (net.imagej.overlay.Overlay)3 Figure (org.jhotdraw.draw.Figure)3 ImageDisplay (net.imagej.display.ImageDisplay)2 EventHandler (org.scijava.event.EventHandler)2 Point (java.awt.Point)1 JList (javax.swing.JList)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 Data (net.imagej.Data)1 AxisType (net.imagej.axis.AxisType)1 DatasetView (net.imagej.display.DatasetView)1 OverlayInfo (net.imagej.display.OverlayInfo)1 RectangleOverlay (net.imagej.overlay.RectangleOverlay)1