Пример #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");
  }
Пример #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();
  }
Пример #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);
   }
 }
Пример #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();
 }
Пример #5
0
 private void createBigTable() {
   final int colCount = 10, rowCount = 10000;
   big = new DefaultResultsTable(colCount, rowCount);
   for (int col = 0; col < colCount; col++) {
     statusService.showProgress(col, colCount);
     for (int row = 0; row < rowCount; row++) {
       big.setValue(col, row, row + col);
     }
   }
 }
Пример #6
0
 /** Starts animation for the given {@link ImageDisplay}. */
 public void start(final ImageDisplay display) {
   getAnimation(display).start();
   statusService.showStatus(STARTED_STATUS);
 }
Пример #7
0
 /** Stops all animations. */
 public void stopAll() {
   for (final Animation animation : animations.values()) {
     animation.stop();
   }
   statusService.showStatus(ALL_STOPPED_STATUS);
 }