svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.fmap.control / src / main / java / org / gvsig / fmap / mapcontrol / MapControlManager.java @ 43913
History | View | Annotate | Download (9.44 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/* gvSIG. Geographic Information System of the Valencian Government
|
25 |
*
|
26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
27 |
* of the Valencian Government (CIT)
|
28 |
*
|
29 |
* This program is free software; you can redistribute it and/or
|
30 |
* modify it under the terms of the GNU General Public License
|
31 |
* as published by the Free Software Foundation; either version 2
|
32 |
* of the License, or (at your option) any later version.
|
33 |
*
|
34 |
* This program is distributed in the hope that it will be useful,
|
35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
37 |
* GNU General Public License for more details.
|
38 |
*
|
39 |
* You should have received a copy of the GNU General Public License
|
40 |
* along with this program; if not, write to the Free Software
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
42 |
* MA 02110-1301, USA.
|
43 |
*
|
44 |
*/
|
45 |
|
46 |
/*
|
47 |
* AUTHORS (In addition to CIT):
|
48 |
* 2009 {Iver T.I.} {Task}
|
49 |
*/
|
50 |
|
51 |
package org.gvsig.fmap.mapcontrol; |
52 |
|
53 |
import java.util.Map; |
54 |
import java.util.prefs.Preferences; |
55 |
import javax.swing.JButton; |
56 |
import javax.swing.JTextField; |
57 |
import javax.swing.JToggleButton; |
58 |
import javax.swing.tree.TreeModel; |
59 |
import org.cresques.cts.IProjection; |
60 |
import org.gvsig.fmap.geom.Geometry; |
61 |
import org.gvsig.fmap.geom.primitive.Envelope; |
62 |
|
63 |
import org.gvsig.fmap.mapcontext.MapContext; |
64 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
65 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
66 |
import org.gvsig.fmap.mapcontrol.swing.dynobject.LayersDynObjectSetComponent; |
67 |
import org.gvsig.fmap.mapcontrol.swing.pickercontroller.impl.EnvelopePickerControllerImpl; |
68 |
import org.gvsig.fmap.mapcontrol.tools.snapping.snappers.ISnapper; |
69 |
import org.gvsig.tools.dynobject.DynObject; |
70 |
import org.gvsig.tools.dynobject.DynObjectSet; |
71 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
72 |
|
73 |
/**
|
74 |
* <p>
|
75 |
* This class is the manager of the MapControl library. It is used to
|
76 |
* manage all the properties related with the drawing of objects
|
77 |
* in a map, including default symbols used to draw objects
|
78 |
* in a map, the tolerance used by the selection or edition tools...
|
79 |
* </p>
|
80 |
* <p>
|
81 |
* It also holds the implementations of the {@link MapControlDrawer}'s,
|
82 |
* that is the responsible to draw graphical objects in a map.
|
83 |
* </p>
|
84 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
85 |
*/
|
86 |
public interface MapControlManager { |
87 |
|
88 |
public MapControl createJMapControlPanel(MapContext mapContext) throws MapControlCreationException; |
89 |
|
90 |
public void addMapControlCreationListener(MapControlCreationListener listener); |
91 |
|
92 |
/**
|
93 |
* Register a <code>MapControlDrawer</code> by name.
|
94 |
* @param name
|
95 |
* Name of the <code>MapControlDrawer</code>.
|
96 |
* @param mapControolDrawerClass
|
97 |
* Class used to draw graphical objects on a map.
|
98 |
*/
|
99 |
public void registerMapControlDrawer(String name, Class mapControolDrawerClass); |
100 |
|
101 |
/**
|
102 |
* Creates a <code>MapControlDrawer</code> from a name.
|
103 |
* @param name
|
104 |
* Name of the <code>MapControlDrawer</code>.
|
105 |
* @return
|
106 |
* A <code>MapControlDrawer</code>.
|
107 |
* @throws MapControlCreationException
|
108 |
*/
|
109 |
public MapControlDrawer createMapControlDrawer(String name) throws MapControlCreationException; |
110 |
|
111 |
/**
|
112 |
* It registers the default implementation for the <code>MapControlDrawer</code>.
|
113 |
* @param mapControlDrawerClass
|
114 |
* A <code>MapControlDrawer</code>.
|
115 |
*/
|
116 |
public void registerDefaultMapControlDrawer(Class mapControlDrawerClass); |
117 |
|
118 |
/**
|
119 |
* It returns the default implementation for the <code>MapControlDrawer</code>.
|
120 |
* @return
|
121 |
* The default <code>MapControlDrawer</code>.
|
122 |
* @throws MapControlCreationException
|
123 |
*/
|
124 |
public MapControlDrawer createDefaultMapControlDrawer() throws MapControlCreationException; |
125 |
|
126 |
/**
|
127 |
* Returns a snapper in a concrete position;
|
128 |
* @param index
|
129 |
* Snapper position.
|
130 |
* @return
|
131 |
* A snapper.
|
132 |
*/
|
133 |
public ISnapper getSnapperAt(int index); |
134 |
|
135 |
/**
|
136 |
* Returns the number of registered snappers.
|
137 |
* @return
|
138 |
* The number of registered snappers.
|
139 |
*/
|
140 |
public int getSnapperCount(); |
141 |
|
142 |
/**
|
143 |
* Add a snapper.
|
144 |
* @param snapper
|
145 |
*/
|
146 |
public void registerSnapper(String name, Class snapperClass); |
147 |
|
148 |
|
149 |
public Preferences getEditionPreferences(); |
150 |
|
151 |
/**
|
152 |
* Tolerance (in pixels) that has to be used by the tools
|
153 |
* that use snapping.
|
154 |
* @return
|
155 |
* The distance in pixels.
|
156 |
*/
|
157 |
public int getTolerance(); |
158 |
|
159 |
/**
|
160 |
* Sets the tolerance (in pixels) that has to be used by the
|
161 |
* tools that use snapping.
|
162 |
* @param tolerance
|
163 |
* The tolerance to apply
|
164 |
*/
|
165 |
public void setTolerance(int tolerance); |
166 |
|
167 |
/**
|
168 |
* Sets the symbol that has to be used to draw a geometry when
|
169 |
* it is selected.
|
170 |
* @param selectionSymbol
|
171 |
* The symbol to apply.
|
172 |
* @deprecated the symbol for edition is the selection symbol
|
173 |
*/
|
174 |
public void setSelectionSymbol(ISymbol selectionSymbol); |
175 |
|
176 |
/**
|
177 |
* Gets the symbol used to draw the selected geometries.
|
178 |
* @return
|
179 |
* The symbol used to draw the selected geometries.
|
180 |
* @deprecated the symbol for edition is the selection symbol
|
181 |
*/
|
182 |
public ISymbol getSelectionSymbol();
|
183 |
|
184 |
/**
|
185 |
* Sets the symbol that has to be used to draw a geometry that
|
186 |
* represent the axis of a geometry.
|
187 |
* @param axisReferencesSymbol
|
188 |
* The symbol to apply.
|
189 |
*/
|
190 |
public void setAxisReferenceSymbol(ISymbol axisReferencesSymbol); |
191 |
|
192 |
/**
|
193 |
* Gets the symbol used to draw the axis of a geometry.
|
194 |
* @return
|
195 |
* The symbol used to draw the axis of a geometry.
|
196 |
*/
|
197 |
public ISymbol getAxisReferenceSymbol();
|
198 |
|
199 |
/**
|
200 |
* Sets the symbol that has to be used to draw a geometry when
|
201 |
* it is selected.
|
202 |
* @param geometrySelectionSymbol
|
203 |
* The symbol to apply.
|
204 |
*/
|
205 |
public void setGeometrySelectionSymbol(ISymbol geometrySelectionSymbol); |
206 |
|
207 |
/**
|
208 |
* Gets the symbol used to draw the selected geometries.
|
209 |
* @return
|
210 |
* The symbol used to draw the selected geometries.
|
211 |
*/
|
212 |
public ISymbol getGeometrySelectionSymbol();
|
213 |
|
214 |
/**
|
215 |
* Sets the symbol that has to be used to draw the handlers.
|
216 |
* @param handlerSymbol
|
217 |
* The symbol to apply.
|
218 |
*/
|
219 |
public void setHandlerSymbol(ISymbol handlerSymbol); |
220 |
|
221 |
/**
|
222 |
* Gets the symbol used to draw the handlers.
|
223 |
* @return
|
224 |
* The symbol used to draw the handlers.
|
225 |
*/
|
226 |
public ISymbol getHandlerSymbol();
|
227 |
|
228 |
/**
|
229 |
* Creates a readonly component to view information of a set of layers. The
|
230 |
* information must be provided as a set of {@link DynObject}s, through a
|
231 |
* {@link DynObjectSet}.
|
232 |
*
|
233 |
* @param layerName2InfoByPoint
|
234 |
* the map of {@link DynObjectSet} for each layer.
|
235 |
* @return the component to view the information
|
236 |
*/
|
237 |
public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
|
238 |
Map<String, DynObjectSet> layerName2InfoByPoint); |
239 |
|
240 |
/**
|
241 |
* Creates a component to view information of a set of layers. The
|
242 |
* information must be provided as a set of {@link DynObject}s, through a
|
243 |
* {@link DynObjectSet}.
|
244 |
*
|
245 |
* @param layerName2InfoByPoint
|
246 |
* the map of {@link DynObjectSet} for each layer.
|
247 |
* @param writable
|
248 |
* if the DynObjects loaded must be able to be edited
|
249 |
* @return the component to view the information
|
250 |
*/
|
251 |
public LayersDynObjectSetComponent createLayersDynObjectSetComponent(
|
252 |
Map<String, DynObjectSet> layerName2InfoByPoint, boolean writable); |
253 |
|
254 |
/**
|
255 |
* Create a TreeModel based in the MapControl's layers.
|
256 |
*
|
257 |
* @param mapContext
|
258 |
* @return the TreeModel
|
259 |
*/
|
260 |
public TreeModel createLayersTreeModel(MapContext mapContext); |
261 |
|
262 |
/**
|
263 |
* Create a TreeModel based in the layers collection.
|
264 |
* @param layers the layers collection to use for create the TreeModel
|
265 |
* @return the TreeModel
|
266 |
*/
|
267 |
public TreeModel createLayersTreeModel(FLayers layers); |
268 |
|
269 |
/**
|
270 |
* Create a TreeModel based in the layers collection of all project's views.
|
271 |
* @return the TreeModel
|
272 |
*/
|
273 |
public TreeModel createCompoundLayersTreeModel(); |
274 |
|
275 |
public double perimeter(Geometry geom, IProjection proj, int distanceUnits); |
276 |
|
277 |
public double area(Geometry geom, IProjection proj, int areaUnits); |
278 |
|
279 |
public PickerController<Envelope> createEnvelopePickerController(
|
280 |
MapControl mapControl, |
281 |
JTextField txtUpperLeftX,
|
282 |
JTextField txtUpperLeftY,
|
283 |
JTextField txtLowerRightX,
|
284 |
JTextField txtLowerRightY,
|
285 |
JButton btnMapControlEnvelope,
|
286 |
JToggleButton btnCapture
|
287 |
); |
288 |
|
289 |
public PickerController<Envelope> createEnvelopePickerController(
|
290 |
MapControl mapControl, |
291 |
JTextField txtEnvelope,
|
292 |
JButton btnMapControlEnvelope,
|
293 |
final JToggleButton btnCapture |
294 |
); |
295 |
} |
296 |
|