| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ZoomChangeEvent |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Geotoolkit.org - An Open Source Java GIS Toolkit | |
| 3 | * http://www.geotoolkit.org | |
| 4 | * | |
| 5 | * (C) 2001-2012, Open Source Geospatial Foundation (OSGeo) | |
| 6 | * (C) 2009-2012, Geomatys | |
| 7 | * | |
| 8 | * This library is free software; you can redistribute it and/or | |
| 9 | * modify it under the terms of the GNU Lesser General Public | |
| 10 | * License as published by the Free Software Foundation; | |
| 11 | * version 2.1 of the License. | |
| 12 | * | |
| 13 | * This library is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 | * Lesser General Public License for more details. | |
| 17 | */ | |
| 18 | package org.geotoolkit.gui.swing.event; | |
| 19 | ||
| 20 | import java.util.EventObject; | |
| 21 | import java.awt.geom.AffineTransform; | |
| 22 | ||
| 23 | ||
| 24 | /** | |
| 25 | * An event which indicates that a zoom occurred in a component. | |
| 26 | * This event is fired by {@link org.geotoolkit.gui.swing.ZoomPane}. | |
| 27 | * | |
| 28 | * @author Martin Desruisseaux (IRD) | |
| 29 | * @version 3.00 | |
| 30 | * | |
| 31 | * @since 2.0 | |
| 32 | * @module | |
| 33 | */ | |
| 34 | public class ZoomChangeEvent extends EventObject { | |
| 35 | /** | |
| 36 | * For cross-version compatibility. | |
| 37 | */ | |
| 38 | private static final long serialVersionUID = 5063317286699888858L; | |
| 39 | ||
| 40 | /** | |
| 41 | * An affine transform indicating the zoom change. If {@code oldZoom} and {@code newZoom} | |
| 42 | * are the affine transforms before and after the change respectively, then the following | |
| 43 | * relation must hold (within the limits of rounding error): | |
| 44 | * | |
| 45 | * {@preformat java | |
| 46 | * newZoom = oldZoom.concatenate(change) | |
| 47 | * } | |
| 48 | */ | |
| 49 | private final AffineTransform change; | |
| 50 | ||
| 51 | /** | |
| 52 | * Constructs a new event. If {@code oldZoom} and {@code newZoom} are the affine transforms | |
| 53 | * before and after the change respectively, then the following relation must hold (within | |
| 54 | * the limits of rounding error): | |
| 55 | * | |
| 56 | * {@preformat java | |
| 57 | * newZoom = oldZoom.concatenate(change) | |
| 58 | * } | |
| 59 | * | |
| 60 | * @param source The event source (usually a {@link org.geotoolkit.gui.swing.ZoomPane}). | |
| 61 | * @param change An affine transform indicating the zoom change. | |
| 62 | */ | |
| 63 | public ZoomChangeEvent(final Object source, final AffineTransform change) { | |
| 64 | 0 | super(source); |
| 65 | 0 | this.change = change; |
| 66 | 0 | } |
| 67 | ||
| 68 | /** | |
| 69 | * Returns the affine transform indicating the zoom change. | |
| 70 | * <strong>Note:</strong> for performance reasons, this method does not clone | |
| 71 | * the returned transform. Do not change! | |
| 72 | * | |
| 73 | * @return The zoom change as an affine transform (<strong>not</strong> cloned). | |
| 74 | */ | |
| 75 | public AffineTransform getChange() { | |
| 76 | 0 | return change; |
| 77 | } | |
| 78 | } |