001: /*
002: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
003: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
004: * under the terms of the GNU Lesser General Public License as published by the Free Software
005: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
006: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
007: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
008: */
009: package net.refractions.udig.project;
010:
011: import java.io.IOException;
012: import java.util.List;
013:
014: import net.refractions.udig.project.command.EditCommand;
015: import net.refractions.udig.project.command.MapCommand;
016: import net.refractions.udig.project.internal.LayerFactory;
017: import net.refractions.udig.project.render.IRenderManager;
018: import net.refractions.udig.project.render.IViewportModel;
019:
020: import org.eclipse.core.runtime.IProgressMonitor;
021: import org.eclipse.emf.common.util.URI;
022: import org.geotools.geometry.jts.ReferencedEnvelope;
023:
024: /**
025: * The part of the model that represents a map.
026: * <p>
027: * A Map consists of a ContextModel, a ViewportModel and a LayerManager
028: * </p>
029: * <p>
030: * Responsibilities:
031: * <ul>
032: * <li>Provide access to the active controllers and models, but not viewers.</li>
033: * <li>Create a new map based on the current map is also included</li>
034: * </ul>
035: * </p>
036: * <p>
037: *
038: * @author Jesse
039: * @since 0.5
040: */
041: public interface IMap extends IProjectElement {
042:
043: /**
044: * Returns the layer factory used to create layers for this map.
045: *
046: * @return the layer factory used to create layers for this map.
047: */
048: public LayerFactory getLayerFactory();
049:
050: /**
051: * Returns the Viewport model for this map.
052: *
053: * @return the Viewport model for this map.
054: */
055: public IViewportModel getViewportModel();
056:
057: /**
058: * Returns the map's abstract
059: *
060: * @return the map's abstract
061: */
062: public String getAbstract();
063:
064: /**
065: * Gets the Envelope that indicates the maximum bounding box of the map.
066: * <p>
067: * The bounds returned are in Lat Long and each time the method is called a new object is
068: * returned. Therefore the object can be modified as desired without affecting the model.
069: * </p>
070: * <p>
071: * Note: this is a constant for a given map. It is related to the size of the map data, and is
072: * not dependent on the viewport.
073: * </p>
074: * <b>WARNING</b> This may block.
075: *
076: * @return The Envelope in Lat Long that indicates the maximum bounding box of the map.
077: * @throws IOException
078: */
079: public ReferencedEnvelope getBounds(IProgressMonitor monitor)
080: throws IOException;
081:
082: /**
083: * Returns the Aspect ratio of the map. It is normally no the same as the aspect ratio of the
084: * viewport.
085: *
086: * @return The aspect ratio of the map.
087: */
088: public double getAspectRatio(IProgressMonitor monitor);
089:
090: /**
091: * Returns the EditManager for the current map.
092: *
093: * @return the EditManager for the current map.
094: */
095: public IEditManager getEditManager();
096:
097: /**
098: * Returns the RenderManager for the current map.
099: *
100: * @return the RenderManager for the current map.
101: */
102: public IRenderManager getRenderManager();
103:
104: /**
105: * Returns the list of Layers in the map. The layers are in zorder. The layer at position 0 is
106: * that first layer rendered (The bottom layer in the image); This list is immutable.
107: *
108: * @return An immutable list containing all the Map's layers.
109: */
110: public List<ILayer> getMapLayers();
111:
112: /**
113: * Returns a blackboard for the map. The blackboard is used by various plugins in order to store
114: * data and collaborate.
115: *
116: * @return A blackboard used for collaboration among various plugins.
117: */
118: public IBlackboard getBlackboard();
119:
120: /**
121: * Returns a unique identifier for a map. Shouldn't change between runs.
122: *
123: * @return a unique identifier for a map.
124: */
125: public URI getID();
126:
127: /**
128: * Executes a {@linkplain MapCommand} synchronously. This method blocks.
129: * All commands are ran in a single thread, this is required so that undo/redo
130: * makes sense.
131: *
132: * @param command the {@linkplain EditCommand}to execute.
133: */
134: public void sendCommandSync(MapCommand command);
135:
136: /**
137: * Executes a {@linkplain MapCommand} asynchronously with the calling thread.
138: * All commands are ran in a single thread, this is required so that undo/redo
139: * makes sense.
140: *
141: * @param command the {@linkplain EditCommand}to execute.
142: */
143: public void sendCommandASync(MapCommand command);
144:
145: /**
146: * Executes a {@linkplain MapCommand} synchronously. This method blocks.
147: *
148: * @param command the {@linkplain EditCommand}to execute.
149: */
150: public void executeSyncWithoutUndo(MapCommand command);
151:
152: /**
153: * Executes a {@linkplain MapCommand} asynchronously.
154: *
155: * @param command the {@linkplain EditCommand}to execute.
156: */
157: public void executeASyncWithoutUndo(MapCommand command);
158:
159: /**
160: * Adds a MapListener to this map. A given listener will only be added once.
161: * Events are only fired if the attributes of the Map class are change. For example
162: * name, ViewportModel, Bounds, etc...
163: *
164: * @param listener Listener to be added
165: * @see net.refractions.udig.project.MapEvent.MapEventType
166: */
167: public void addMapListener(IMapListener listener);
168:
169: /**
170: * Removes a MapListener from this map.
171: *
172: * @param listener Listener to be removed
173: */
174: public void removeMapListener(IMapListener listener);
175:
176: /**
177: * Adds a IMapCompositionListener to this map. A given listener will only be added once.
178: * Events are fired when the layers of the Map change: added, removed or reordered.
179: *
180: * @param listener Listener to be added
181: * @see net.refractions.udig.project.MapEvent.MapEventType
182: */
183: public void addMapCompositionListener(
184: IMapCompositionListener listener);
185:
186: /**
187: * Removes a MapListener from this map.
188: *
189: * @param listener Listener to be removed
190: */
191: public void removeMapCompositionListener(
192: IMapCompositionListener listener);
193:
194: }
|