public Object clone() throws CloneNotSupportedException { return copy(); }
public void actionPerformed(ActionEvent e) { IPerspective p = observerCenter_.getSelectedPerspective(); if (p instanceof Perspective2D) { Perspective2D pers = (Perspective2D) p; pers.shiftPosition(direction.copy()); } } });
/** * Returns the clipping box. * @return clipping box */ public Rectangle getClippingBox() { Rectangle box = new Rectangle(); IVector2 pixSize = getPixelSize(); IVector2 boxStart = pixPosition_.copy().divide(pixSize).negate(); box.x = (int)Math.round(boxStart.getXAsDouble()); box.y = (int)Math.round(boxStart.getYAsDouble()); IVector2 boxSize = areaSize_.copy().divide(pixSize); box.width = (int) Math.ceil(boxSize.getXAsDouble()); box.height = (int) Math.ceil(boxSize.getYAsDouble()); return box; }
/** * Returns the size of a pixel. * @retun size of a pixel */ public IVector2 getPixelSize() { Canvas canvas = canvas_; if (canvas == null) return Vector2Double.ZERO; return paddedSize_.copy().divide(new Vector2Double(canvas.getWidth(), canvas.getHeight())); }
public void mouseWheelMoved(MouseWheelEvent e) { IVector2 oldMousePos = getWorldCoordinates(e.getX(), e.getY()); IVector2 zoomShift = size_.copy().multiply(0.1 * -e.getWheelRotation()); IVector2 size = size_.copy().subtract(zoomShift); setSize(size); IVector2 newMousePos = getWorldCoordinates(e.getX(), e.getY()); IVector2 pos = getPosition().copy().subtract(newMousePos.subtract(oldMousePos)); setPosition(pos); }
public void run() { areaSize_ = new Vector2Double(areaSize); setSize(areaSize.copy()); if (preserveAR_) { setPosition(paddedSize_.copy().subtract(areaSize_).multiply(0.5).negate()); } } });
return; if (areaSize_.copy().divide(size).getMean().getAsDouble() > zoomLimit_) return; size_ = new Vector2Double(size);