예제 #1
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   final int wheelRotation = e.getWheelRotation();
   final double newZoomFactor =
       layerCanvas.getViewport().getZoomFactor() * Math.pow(1.1, wheelRotation);
   layerCanvas.getViewport().setZoomFactor(newZoomFactor);
 }
예제 #2
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
 public static void installLayerCanvasNavigation(LayerCanvas layerCanvas) {
   layerCanvas.setNavControlShown(true);
   final MouseHandler mouseHandler = new MouseHandler(layerCanvas);
   layerCanvas.addMouseListener(mouseHandler);
   layerCanvas.addMouseMotionListener(mouseHandler);
   layerCanvas.addMouseWheelListener(mouseHandler);
 }
예제 #3
0
 private void zoomToPixelResolution() {
   final ProductSceneView view = getCurrentView();
   if (view != null) {
     final LayerCanvas layerCanvas = view.getLayerCanvas();
     layerCanvas.getViewport().setZoomFactor(layerCanvas.getDefaultZoomFactor());
     maybeSynchronizeCompatibleProductViews();
   }
 }
예제 #4
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
  public static void displayImages(
      String title,
      RenderedImage[] images,
      AffineTransform[] imageToModelTransforms,
      int levelCount) {
    final LayerCanvas layerCanvas = new LayerCanvas();
    installLayerCanvasNavigation(layerCanvas);
    final Layer collectionLayer = layerCanvas.getLayer();
    for (int i = 0; i < images.length; i++) {
      final ImageLayer layer = new ImageLayer(images[i], imageToModelTransforms[i], levelCount);
      collectionLayer.getChildren().add(layer);
    }

    openFrame(layerCanvas, title, new Rectangle(0, 0, 512, 512));
  }
예제 #5
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
 public static void displayImage(
     File location, String extension, AffineTransform imageToModelTransform, int levelCount) {
   final LayerCanvas layerCanvas = new LayerCanvas();
   installLayerCanvasNavigation(layerCanvas);
   final Layer collectionLayer = layerCanvas.getLayer();
   final MultiLevelSource source =
       FileMultiLevelSource.create(location, extension, imageToModelTransform, levelCount);
   final ImageLayer layer = new ImageLayer(source);
   collectionLayer.getChildren().add(layer);
   final Rectangle viewportBounds = new Rectangle(0, 0, 640, 480);
   layerCanvas.setPreferredSize(new Dimension(640, 480));
   layerCanvas.getViewport().setViewBounds(viewportBounds);
   layerCanvas.getViewport().zoom(layer.getModelBounds());
   openFrame(layerCanvas, location.getPath(), viewportBounds);
 }
예제 #6
0
파일: Tools.java 프로젝트: Holdlen2DH/nest
 @Override
 public void mouseDragged(MouseEvent e) {
   final Point p = e.getPoint();
   final double dx = p.x - p0.x;
   final double dy = p.y - p0.y;
   layerCanvas.getViewport().moveViewDelta(dx, dy);
   p0 = p;
 }