/** * Set the component for this camera to <code>component</code>. The * component, if non-null, receives repaint notification from this camera. * * @param component component for this camera */ public void setComponent(final PComponent component) { this.component = component; invalidatePaint(); }
/** * Removes the element at the specified position from the list of layers * viewed by this camera. * * @param index index of the layer to remove * @return the layer previously at the specified position * @throws IndexOutOfBoundsException if the specified index is out of range * (<code>index < 0 || index >= getLayerCount()</code>) */ public PLayer removeLayer(final int index) { final PLayer layer = (PLayer) layers.remove(index); layer.removeCamera(this); invalidatePaint(); firePropertyChange(PROPERTY_CODE_LAYERS, PROPERTY_LAYERS, null, layers); return layer; }
/** * Removes the first occurrence of the specified layer from the list of * layers viewed by this camera, if it is present. * * @param layer layer to be removed * @return the specified layer */ public PLayer removeLayer(final PLayer layer) { layer.removeCamera(this); if (layers.remove(layer)) { invalidatePaint(); firePropertyChange(PROPERTY_CODE_LAYERS, PROPERTY_LAYERS, null, layers); } return layer; }
/** * Inserts the specified layer at the specified position in the list of layers viewed by this camera. * Layers may be viewed by multiple cameras at once. * * @param index index at which the specified layer is to be inserted * @param layer layer to add * @throws IndexOutOfBoundsException if the specified index is out of range * (<code>index < 0 || index >= getLayerCount()</code>) */ public void addLayer(final int index, final PLayer layer) { layers.add(index, layer); layer.addCamera(this); invalidatePaint(); firePropertyChange(PROPERTY_CODE_LAYERS, PROPERTY_LAYERS, null, layers); }
/** * 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); }