/** * Set the view constraint to apply to the view to <code>viewConstraint</code>. The view constraint must be one of * {@link #VIEW_CONSTRAINT_NONE}, {@link #VIEW_CONSTRAINT_CENTER}, or {@link #VIEW_CONSTRAINT_CENTER}. * * @param viewConstraint constraint to apply to the view * @throws IllegalArgumentException if <code>viewConstraint</code> is not one of {@link #VIEW_CONSTRAINT_NONE}, * {@link #VIEW_CONSTRAINT_CENTER}, or {@link #VIEW_CONSTRAINT_CENTER} */ public void setViewConstraint(final int viewConstraint) { if (viewConstraint != VIEW_CONSTRAINT_NONE && viewConstraint != VIEW_CONSTRAINT_CENTER && viewConstraint != VIEW_CONSTRAINT_ALL) { throw new IllegalArgumentException("view constraint must be one " + "of VIEW_CONSTRAINT_NONE, VIEW_CONSTRAINT_CENTER, or VIEW_CONSTRAINT_ALL"); } this.viewConstraint = viewConstraint; applyViewConstraints(); }
/** * Set the offset for the view transform applied to the list of layers * viewed by this camera to <code>[x, y]</code>. * * @param x offset x * @param y offset y */ public void setViewOffset(final double x, final double y) { viewTransform.setOffset(x, y); applyViewConstraints(); invalidatePaint(); firePropertyChange(PROPERTY_CODE_VIEW_TRANSFORM, PROPERTY_VIEW_TRANSFORM, null, viewTransform); }
/** * Translate the view transform applied to the list of layers viewed by this * camera by <code>[dx, dy]</code>. * * @param dx translate delta x * @param dy translate delta y */ public void translateView(final double dx, final double dy) { viewTransform.translate(dx, dy); applyViewConstraints(); invalidatePaint(); firePropertyChange(PROPERTY_CODE_VIEW_TRANSFORM, PROPERTY_VIEW_TRANSFORM, null, viewTransform); }
/** * Set the view transform applied to the list of layers * viewed by this camera to <code>viewTransform</code>. * * @param viewTransform view transform applied to the list of layers * viewed by this camera */ public void setViewTransform(final AffineTransform viewTransform) { this.viewTransform.setTransform(viewTransform); applyViewConstraints(); invalidatePaint(); firePropertyChange(PROPERTY_CODE_VIEW_TRANSFORM, PROPERTY_VIEW_TRANSFORM, null, this.viewTransform); }
/** * Scale the view transform applied to the list of layers viewed by this * camera by <code>scale</code> about the specified point * <code>[x, y]</code>. * * @param scale view transform scale * @param x scale about point, x coordinate * @param y scale about point, y coordinate */ public void scaleViewAboutPoint(final double scale, final double x, final double y) { viewTransform.scaleAboutPoint(scale, x, y); applyViewConstraints(); invalidatePaint(); firePropertyChange(PROPERTY_CODE_VIEW_TRANSFORM, PROPERTY_VIEW_TRANSFORM, null, viewTransform); }