Ejemplo n.º 1
0
  /**
   * Runs the plugin. The plugin continually runs each shadow transformation until ESC is pressed.
   */
  @Override
  public void run() {
    if (unsupportedImage(display)) {
      cancel("This command only works with a single plane of data");
      return;
    }
    statusService.showStatus("Press ESC to terminate");

    final Dataset input = imgDispService.getActiveDataset(display);
    final RealRect selection = overlayService.getSelectionBounds(display);
    final Dataset originalData = input.duplicate();
    userHasQuit = false;
    while (!userHasQuit) {
      for (int i = 0; i < KERNELS.length; i++) {
        final Convolve3x3Operation operation =
            new Convolve3x3Operation(input, selection, KERNELS[i]);
        operation.run();
        try {
          Thread.sleep(100);
        } catch (final Exception e) {
          // do nothing
        }
        originalData.copyInto(input);
        if (userHasQuit) break;
      }
    }
    statusService.showStatus("Shadows demo terminated");
  }
Ejemplo n.º 2
0
  @Override
  public void run() {
    statusService.showStatus("Creating a small table...");
    createBaseballTable();

    // create a larger table with 10K elements
    statusService.showStatus("Creating a large table...");
    createBigTable();

    // create a simple spreadsheet (with string data values)
    statusService.showStatus("Creating spreadsheet...");
    createSpreadsheet();

    statusService.clearStatus();
  }
Ejemplo n.º 3
0
 /** Stops animation for the given {@link ImageDisplay}. */
 public void stop(final ImageDisplay display) {
   final Animation animation = animations.get(display);
   if (animation != null) {
     animation.stop();
     statusService.showStatus(STOPPED_STATUS);
   }
 }
Ejemplo n.º 4
0
 // drag - publish rectangle dimensions in status bar
 @Override
 public void onMouseDrag(final MsDraggedEvent evt) {
   if (evt.getButton() != MsButtonEvent.LEFT_BUTTON) return;
   final StatusService statusService = evt.getContext().getService(StatusService.class);
   final ImageDisplayService imgService = evt.getContext().getService(ImageDisplayService.class);
   final ImageDisplay imgDisp = imgService.getActiveImageDisplay();
   final IntCoords startPt = new IntCoords(anchor.x, anchor.y);
   final IntCoords endPt = new IntCoords(evt.getX() - anchor.x, evt.getY() - anchor.y);
   final RealCoords startPtModelSpace = imgDisp.getCanvas().panelToImageCoords(startPt);
   final RealCoords endPtModelSpace = imgDisp.getCanvas().panelToImageCoords(endPt);
   final int x = (int) startPtModelSpace.x;
   final int y = (int) startPtModelSpace.y;
   final int w = (int) endPtModelSpace.x;
   final int h = (int) endPtModelSpace.y;
   final String message = String.format("x=%d, y=%d, w=%d, h=%d", x, y, w, h);
   statusService.showStatus(message);
   // NB: Prevent PixelProbe from overwriting the status bar.
   evt.consume();
 }
Ejemplo n.º 5
0
 /** Starts animation for the given {@link ImageDisplay}. */
 public void start(final ImageDisplay display) {
   getAnimation(display).start();
   statusService.showStatus(STARTED_STATUS);
 }
Ejemplo n.º 6
0
 /** Stops all animations. */
 public void stopAll() {
   for (final Animation animation : animations.values()) {
     animation.stop();
   }
   statusService.showStatus(ALL_STOPPED_STATUS);
 }