001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2003-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * Created on 23 novembre 2003, 10.35
017: */
018: package org.geotools.map.event;
019:
020: import java.util.EventObject;
021:
022: import org.geotools.map.MapContext;
023: import org.opengis.referencing.crs.CoordinateReferenceSystem;
024:
025: import com.vividsolutions.jts.geom.Envelope;
026:
027: /**
028: * Event object for MapContext area of interest and coordinate system changes.
029: *
030: * @author wolf
031: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/render/src/main/java/org/geotools/map/event/MapBoundsEvent.java $
032: */
033: public class MapBoundsEvent extends EventObject {
034: /** Area of interest changed */
035: public static final int AREA_OF_INTEREST_MASK = 1;
036:
037: /** Coordinate system changed */
038: public static final int COORDINATE_SYSTEM_MASK = 2;
039:
040: /** Used to check that the type flag is acceptable */
041: private static final int NEXT_FLAG = 4;
042:
043: /** Holds value of property type. */
044: private int type;
045:
046: /** Holds value of property oldCoordinateReferenceSystem. */
047: private CoordinateReferenceSystem oldCoordinateReferenceSystem;
048:
049: /** Holds value of property oldAreaOfInterest. */
050: private Envelope oldAreaOfInterest;
051:
052: /**
053: * Creates a new instance of BoundsEvent
054: *
055: * @param source DOCUMENT ME!
056: * @param type DOCUMENT ME!
057: * @param oldAreaOfInterest DOCUMENT ME!
058: * @param oldCoordinateReferenceSystem DOCUMENT ME!
059: *
060: * @throws IllegalArgumentException DOCUMENT ME!
061: */
062: public MapBoundsEvent(MapContext source, int type,
063: Envelope oldAreaOfInterest,
064: CoordinateReferenceSystem oldCoordinateReferenceSystem) {
065: super (source);
066:
067: if (type >= NEXT_FLAG) {
068: throw new IllegalArgumentException(
069: "Type is not acceptable, maximum value is "
070: + (NEXT_FLAG - 1) + ", passed value is "
071: + type);
072: }
073:
074: this .type = type;
075: this .oldAreaOfInterest = oldAreaOfInterest;
076: this .oldCoordinateReferenceSystem = oldCoordinateReferenceSystem;
077: }
078:
079: /**
080: * Getter for property type. The type is a bitwise or of the masks defined above.
081: *
082: * @return Value of property type.
083: */
084: public int getType() {
085: return this .type;
086: }
087:
088: /**
089: * Getter for property oldCoordinateReferenceSystem.
090: *
091: * @return Value of property oldCoordinateReferenceSystem.
092: */
093: public CoordinateReferenceSystem getOldCoordinateReferenceSystem() {
094: return this .oldCoordinateReferenceSystem;
095: }
096:
097: /**
098: * Getter for property oldAreaOfInterest.
099: *
100: * @return Value of property oldAreaOfInterest.
101: */
102: public Envelope getOldAreaOfInterest() {
103: return this.oldAreaOfInterest;
104: }
105: }
|