svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / gui / DefaultViewPanel.java @ 41965
History | View | Annotate | Download (22.1 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 modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.app.project.documents.view.gui; |
24 |
|
25 |
import java.awt.BorderLayout; |
26 |
import java.awt.Color; |
27 |
import java.awt.Dimension; |
28 |
import java.beans.PropertyChangeEvent; |
29 |
import java.beans.PropertyChangeListener; |
30 |
import java.util.HashMap; |
31 |
import java.util.Iterator; |
32 |
|
33 |
import javax.swing.JSplitPane; |
34 |
import javax.swing.SwingUtilities; |
35 |
|
36 |
import org.cresques.cts.IProjection; |
37 |
|
38 |
import org.gvsig.andami.PluginServices; |
39 |
import org.gvsig.andami.messages.NotificationManager; |
40 |
import org.gvsig.andami.ui.mdiFrame.NewStatusBar; |
41 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
42 |
import org.gvsig.app.project.DefaultProject; |
43 |
import org.gvsig.app.project.documents.Document; |
44 |
import org.gvsig.app.project.documents.view.MapOverview; |
45 |
import org.gvsig.app.project.documents.view.ViewDocument; |
46 |
import org.gvsig.app.project.documents.view.toc.gui.TOC; |
47 |
import org.gvsig.app.project.documents.view.toolListeners.AreaListener; |
48 |
import org.gvsig.app.project.documents.view.toolListeners.InfoListener; |
49 |
import org.gvsig.app.project.documents.view.toolListeners.MeasureListener; |
50 |
import org.gvsig.app.project.documents.view.toolListeners.PanListener; |
51 |
import org.gvsig.app.project.documents.view.toolListeners.PointSelectListener; |
52 |
import org.gvsig.app.project.documents.view.toolListeners.PolygonSelectListener; |
53 |
import org.gvsig.app.project.documents.view.toolListeners.RectangleSelectListener; |
54 |
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener; |
55 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomInListener; |
56 |
import org.gvsig.app.project.documents.view.toolListeners.ZoomOutListener; |
57 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
58 |
import org.gvsig.fmap.mapcontext.MapContext; |
59 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
60 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
61 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
62 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
63 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
64 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
65 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
66 |
import org.gvsig.fmap.mapcontrol.MapControlCreationException; |
67 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
68 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
69 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
70 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
71 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior; |
72 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior; |
73 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
74 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior; |
75 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior; |
76 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior; |
77 |
import org.gvsig.tools.observer.Observable; |
78 |
import org.gvsig.tools.observer.Observer; |
79 |
import org.gvsig.utils.console.JConsole; |
80 |
import org.gvsig.utils.console.JDockPanel; |
81 |
import org.gvsig.utils.console.ResponseListener; |
82 |
import org.gvsig.utils.console.jedit.JEditTextArea; |
83 |
|
84 |
/**
|
85 |
* <p>
|
86 |
* <b>Class View</b>. This class represents the gvSIG specific internal window
|
87 |
* where the maps are displayed and where the events coming from the user are
|
88 |
* captured.
|
89 |
* </p>
|
90 |
* <p>
|
91 |
* It is composed by three main visual areas:
|
92 |
* </p>
|
93 |
* <ol>
|
94 |
* <li>
|
95 |
* <b>Map control</b>: the map area located in the right area of the window. It
|
96 |
* takes up the biggest part of the window.</li>
|
97 |
* <li>
|
98 |
* <b>Table of contents (TOC)</b>: is a list of layers displayed in the view.
|
99 |
* The TOC is located on the left-top corner of the View and is the place where
|
100 |
* the user can modify the order, the legends, the visibility and other
|
101 |
* properties of the layers.</li>
|
102 |
* <li>
|
103 |
* <b>Map overview</b>: is a small MapControl located in the left-bottom corner
|
104 |
* of the View where the user can put some layers which summarizes the view. It
|
105 |
* is used to make the navigation easier and faster.</li>
|
106 |
* </ol>
|
107 |
*
|
108 |
* @author 2005- Vicente Caballero
|
109 |
* @author 2009- Joaquin del Cerro
|
110 |
*
|
111 |
*/
|
112 |
public class DefaultViewPanel extends AbstractViewPanel implements Observer { |
113 |
|
114 |
/**
|
115 |
*
|
116 |
*/
|
117 |
private static final long serialVersionUID = -4044661458841786519L; |
118 |
|
119 |
private JConsole console;
|
120 |
private JDockPanel dockConsole = null; |
121 |
protected ResponseAdapter consoleResponseAdapter = new ResponseAdapter(); |
122 |
protected boolean isShowConsole = false; |
123 |
private ViewPortListener viewPortListener;
|
124 |
|
125 |
private static MapControlManager mapControlManager = MapControlLocator |
126 |
.getMapControlManager(); |
127 |
|
128 |
/**
|
129 |
* Creates a new View object. Before being used, the object must be
|
130 |
* initialized.
|
131 |
*
|
132 |
* @see initialize()
|
133 |
*/
|
134 |
public DefaultViewPanel() {
|
135 |
super();
|
136 |
this.setName("View"); |
137 |
// TODO Remove this when the system lo load libraries is finished
|
138 |
if (mapControlManager == null) { |
139 |
mapControlManager = MapControlLocator.getMapControlManager(); |
140 |
} |
141 |
} |
142 |
|
143 |
public DefaultViewPanel(Document document) { |
144 |
this();
|
145 |
this.initialize(((ViewDocument) document).getMapContext());
|
146 |
this.setDocument(document);
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* Create the internal componentes and populate the window with them. If the
|
151 |
* layout properties were set using the
|
152 |
* <code>setWindowData(WindowData)</code> method, the window will be
|
153 |
* populated according to this properties.
|
154 |
*/
|
155 |
protected void initialize(MapContext mapContext) { |
156 |
super.initialize();
|
157 |
initComponents(mapContext); |
158 |
hideConsole(); |
159 |
getConsolePanel().addResponseListener(consoleResponseAdapter); |
160 |
} |
161 |
|
162 |
public void setDocument(Document document) { |
163 |
setModel((ViewDocument) document); |
164 |
} |
165 |
|
166 |
public Document getDocument() { |
167 |
return this.modelo; |
168 |
} |
169 |
|
170 |
public void setModel(ViewDocument model) { |
171 |
this.modelo = model;
|
172 |
// Se registra como listener de cambios en FMap
|
173 |
MapContext fmap = modelo.getMapContext(); |
174 |
|
175 |
FLayers layers = fmap.getLayers(); |
176 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
177 |
if (layers.getLayer(i).isEditing()
|
178 |
&& layers.getLayer(i) instanceof FLyrVect) {
|
179 |
this.showConsole();
|
180 |
} |
181 |
} |
182 |
|
183 |
// Se configura el mapControl
|
184 |
m_TOC.setMapContext(fmap); |
185 |
m_MapControl.getMapContext().getLayers().addLegendListener(m_TOC); |
186 |
|
187 |
m_MapControl.setBackground(new Color(255, 255, 255)); |
188 |
if (modelo.getMapOverViewContext() != null) { |
189 |
m_MapLoc.setModel(modelo.getMapOverViewContext()); |
190 |
} |
191 |
model.addPropertyChangeListener(new PropertyChangeListener() { |
192 |
public void propertyChange(PropertyChangeEvent evt) { |
193 |
if (evt.getPropertyName().equals("name")) { |
194 |
PluginServices.getMDIManager() |
195 |
.getWindowInfo(DefaultViewPanel.this) |
196 |
.setTitle( |
197 |
PluginServices.getText(this, "Vista") + ": " |
198 |
+ (String) evt.getNewValue());
|
199 |
} |
200 |
} |
201 |
}); |
202 |
if (m_MapControl.getViewPort() != null) { |
203 |
viewPortListener = new ViewPortListener() {
|
204 |
public void extentChanged(ExtentEvent e) { |
205 |
if (PluginServices.getMainFrame() != null) { |
206 |
PluginServices |
207 |
.getMainFrame() |
208 |
.getStatusBar() |
209 |
.setControlValue( |
210 |
"view-change-scale",
|
211 |
String.valueOf(m_MapControl
|
212 |
.getMapContext().getScaleView())); |
213 |
PluginServices |
214 |
.getMainFrame() |
215 |
.getStatusBar() |
216 |
.setMessage( |
217 |
"projection",
|
218 |
getMapControl().getViewPort() |
219 |
.getProjection().getAbrev()); |
220 |
} |
221 |
} |
222 |
|
223 |
public void backColorChanged(ColorEvent e) { |
224 |
// Do nothing
|
225 |
} |
226 |
|
227 |
public void projectionChanged(ProjectionEvent e) { |
228 |
m_MapLoc.setProjection(e.getNewProjection()); |
229 |
} |
230 |
}; |
231 |
m_MapControl.getViewPort().addViewPortListener(viewPortListener); |
232 |
} |
233 |
} |
234 |
|
235 |
public JConsole getConsolePanel() {
|
236 |
if (console == null) { |
237 |
console = new JConsole(true); |
238 |
// Para distinguir cuando se est? escribiendo sobre la consola y
|
239 |
// cuando no.
|
240 |
console.setJTextName("CADConsole");
|
241 |
} |
242 |
return console;
|
243 |
} |
244 |
|
245 |
private JDockPanel getDockConsole() {
|
246 |
if (dockConsole == null) { |
247 |
dockConsole = new JDockPanel(getConsolePanel());
|
248 |
} |
249 |
return dockConsole;
|
250 |
} |
251 |
|
252 |
public void addConsoleListener(String prefix, ResponseListener listener) { |
253 |
consoleResponseAdapter.putSpaceListener(prefix, listener); |
254 |
|
255 |
} |
256 |
|
257 |
public void removeConsoleListener(ResponseListener listener) { |
258 |
consoleResponseAdapter.deleteListener(listener); |
259 |
|
260 |
} |
261 |
|
262 |
public void focusConsole(String text) { |
263 |
getConsolePanel().addResponseText(text); |
264 |
|
265 |
JEditTextArea jeta = getConsolePanel().getTxt(); |
266 |
jeta.requestFocusInWindow(); |
267 |
jeta.setCaretPosition(jeta.getText().length()); |
268 |
|
269 |
} |
270 |
|
271 |
public void hideConsole() { |
272 |
isShowConsole = false;
|
273 |
getDockConsole().setVisible(false);
|
274 |
|
275 |
} |
276 |
|
277 |
public void showConsole() { |
278 |
if (isShowConsole || disableConsole) {
|
279 |
return;
|
280 |
} |
281 |
isShowConsole = true;
|
282 |
getMapControl().remove(getDockConsole()); |
283 |
getMapControl().setLayout(new BorderLayout()); |
284 |
getMapControl().add(getDockConsole(), BorderLayout.SOUTH);
|
285 |
getDockConsole().setVisible(true);
|
286 |
|
287 |
} |
288 |
|
289 |
static class ResponseAdapter implements ResponseListener { |
290 |
|
291 |
private HashMap<String, ResponseListener> spaceListener |
292 |
= new HashMap<String, ResponseListener>(); |
293 |
|
294 |
public void putSpaceListener(String namespace, ResponseListener listener) { |
295 |
spaceListener.put(namespace, listener); |
296 |
} |
297 |
|
298 |
public void acceptResponse(String response) { |
299 |
boolean nameSpace = false; |
300 |
int n = -1; |
301 |
if (response != null) { |
302 |
if ((n = response.indexOf(':')) != -1) { |
303 |
nameSpace = true;
|
304 |
} |
305 |
} |
306 |
|
307 |
if (nameSpace) {
|
308 |
ResponseListener listener |
309 |
= spaceListener.get(response.substring(0, n));
|
310 |
if (listener != null) { |
311 |
listener.acceptResponse(response.substring(n + 1));
|
312 |
} |
313 |
} else {
|
314 |
Iterator<ResponseListener> i
|
315 |
= spaceListener.values().iterator(); |
316 |
while (i.hasNext()) {
|
317 |
ResponseListener listener = i.next(); |
318 |
listener.acceptResponse(response); |
319 |
} |
320 |
} |
321 |
} |
322 |
|
323 |
/**
|
324 |
* @param listener
|
325 |
*/
|
326 |
public void deleteListener(ResponseListener listener) { |
327 |
Iterator<String> i = spaceListener.keySet().iterator(); |
328 |
while (i.hasNext()) {
|
329 |
String namespace = i.next();
|
330 |
ResponseListener l = spaceListener.get(namespace); |
331 |
if (l == listener) {
|
332 |
spaceListener.remove(namespace); |
333 |
} |
334 |
} |
335 |
} |
336 |
|
337 |
} |
338 |
|
339 |
protected void initComponents(MapContext mapContext) { // GEN-BEGIN:initComponents |
340 |
// Remember to activate it
|
341 |
try {
|
342 |
m_MapControl = mapControlManager.createJMapControlPanel(mapContext); |
343 |
m_MapControl.setMapControlDrawer(mapControlManager |
344 |
.createDefaultMapControlDrawer()); |
345 |
} catch (MapControlCreationException e) {
|
346 |
NotificationManager.addError(e); |
347 |
} |
348 |
|
349 |
m_MapControl.addExceptionListener(mapControlExceptionListener); |
350 |
m_TOC = new TOC();
|
351 |
|
352 |
// Ponemos el localizador
|
353 |
m_MapLoc = new MapOverview(m_MapControl);
|
354 |
try {
|
355 |
m_MapLoc.setMapControlDrawer(mapControlManager |
356 |
.createDefaultMapControlDrawer()); |
357 |
} catch (MapControlCreationException e) {
|
358 |
NotificationManager.addError(e); |
359 |
} |
360 |
removeAll(); |
361 |
tempMainSplit = new ViewSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
362 |
|
363 |
if (windowLayout == null) { |
364 |
m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
365 |
tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
366 |
} |
367 |
|
368 |
if (!isPalette()) {
|
369 |
tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
370 |
tempSplitToc.setTopComponent(m_TOC); |
371 |
tempSplitToc.setBottomComponent(m_MapLoc); |
372 |
tempSplitToc.setResizeWeight(0.7);
|
373 |
tempMainSplit.setLeftComponent(tempSplitToc); |
374 |
} else {
|
375 |
tempMainSplit.setLeftComponent(m_TOC); |
376 |
} |
377 |
m_TOC.setVisible(true);
|
378 |
tempMainSplit.setRightComponent(m_MapControl); |
379 |
this.setLayout(new BorderLayout()); |
380 |
this.add(tempMainSplit, BorderLayout.CENTER); |
381 |
|
382 |
if (windowLayout != null) { |
383 |
try {
|
384 |
tempMainSplit.setDividerLocation(Integer.valueOf(
|
385 |
windowLayout.get("MainDivider.Location")).intValue());
|
386 |
if (windowLayout.get("TOCDivider.Location") != null) { |
387 |
tempSplitToc.setDividerLocation(Integer.valueOf(
|
388 |
windowLayout.get("TOCDivider.Location")).intValue());
|
389 |
} |
390 |
} catch (NumberFormatException ex) { |
391 |
PluginServices.getLogger().error( |
392 |
"Error restoring View properties");
|
393 |
} |
394 |
} |
395 |
|
396 |
// Zoom out (pinchas y el mapa se centra y te muestra m?s).
|
397 |
// No es dibujando un rect?ngulo, es solo pinchando.
|
398 |
ZoomOutListener zoomOutListener = new ZoomOutListener(m_MapControl);
|
399 |
m_MapControl.addBehavior("zoomOut", new Behavior[]{ |
400 |
new PointBehavior(zoomOutListener)});
|
401 |
|
402 |
// Zoom por rect?ngulo
|
403 |
ZoomInListener zoomInListener = new ZoomInListener(m_MapControl);
|
404 |
m_MapControl.addBehavior("zoomIn", new Behavior[]{ |
405 |
new RectangleBehavior(zoomInListener),
|
406 |
new PointBehavior(zoomOutListener, PointBehavior.RIGHT)});
|
407 |
|
408 |
// pan
|
409 |
PanListener panListener = new PanListener(m_MapControl);
|
410 |
m_MapControl.addBehavior("pan", new Behavior[]{new MoveBehavior(panListener)}); |
411 |
|
412 |
// Medir
|
413 |
MeasureListener mli = new MeasureListener(m_MapControl);
|
414 |
m_MapControl.addBehavior("medicion", new Behavior[]{ |
415 |
new PolylineBehavior(mli)});
|
416 |
|
417 |
// Area
|
418 |
AreaListener ali = new AreaListener(m_MapControl);
|
419 |
m_MapControl.addBehavior("area", new Behavior[]{ |
420 |
new PolygonBehavior(ali)});
|
421 |
|
422 |
// Info por punto
|
423 |
InfoListener il = new InfoListener(m_MapControl);
|
424 |
m_MapControl.addBehavior("info", new Behavior[]{ |
425 |
new PointBehavior(il)});
|
426 |
|
427 |
// Seleccion por punto
|
428 |
PointSelectListener psl = new PointSelectListener(m_MapControl);
|
429 |
m_MapControl.addBehavior("pointSelection", new Behavior[]{ |
430 |
new PointBehavior(psl)});
|
431 |
|
432 |
// Selecci?n por rect?ngulo
|
433 |
RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl);
|
434 |
m_MapControl.addBehavior("rectSelection", new Behavior[]{ |
435 |
new RectangleBehavior(rsl)});
|
436 |
|
437 |
// Selecci?n por pol?gono
|
438 |
PolygonSelectListener poligSel = new PolygonSelectListener(m_MapControl);
|
439 |
m_MapControl.addBehavior("polSelection", new Behavior[]{ |
440 |
new PolygonBehavior(poligSel)});
|
441 |
|
442 |
|
443 |
|
444 |
m_MapControl.setTool("zoomIn");
|
445 |
|
446 |
|
447 |
// Listener de eventos de movimiento que pone las coordenadas del rat?n
|
448 |
// en la barra de estado
|
449 |
StatusBarListener statusBarListener = new StatusBarListener(m_MapControl);
|
450 |
|
451 |
m_MapControl.addCombinedBehavior(new MouseMovementBehavior(statusBarListener));
|
452 |
m_MapControl.addCombinedBehavior(new MouseWheelBehavior());
|
453 |
m_MapControl.addCombinedBehavior(new MoveBehavior(panListener, MoveBehavior.MIDDLE));
|
454 |
} |
455 |
|
456 |
public void windowActivated() { |
457 |
super.windowActivated();
|
458 |
|
459 |
NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
460 |
MapContext mapContext = this.getMapControl().getMapContext();
|
461 |
|
462 |
statusbar.setMessage("units",
|
463 |
PluginServices.getText(this, mapContext.getDistanceName()));
|
464 |
statusbar.setControlValue("view-change-scale",
|
465 |
String.valueOf(mapContext.getScaleView()));
|
466 |
IProjection proj = getMapControl().getViewPort().getProjection(); |
467 |
if (proj != null) { |
468 |
statusbar.setMessage("projection", proj.getAbrev());
|
469 |
} else {
|
470 |
statusbar.setMessage("projection", ""); |
471 |
} |
472 |
} |
473 |
|
474 |
public void windowClosed() { |
475 |
super.windowClosed();
|
476 |
if (viewPortListener != null) { |
477 |
getMapControl().getViewPort().removeViewPortListener( |
478 |
viewPortListener); |
479 |
} |
480 |
if (getMapOverview() != null) { |
481 |
getMapOverview().getViewPort().removeViewPortListener( |
482 |
getMapOverview()); |
483 |
} |
484 |
|
485 |
} |
486 |
|
487 |
public void toPalette() { |
488 |
isPalette = true;
|
489 |
m_MapLoc.setPreferredSize(new Dimension(200, 150)); |
490 |
m_MapLoc.setSize(new Dimension(200, 150)); |
491 |
movp = new MapOverViewPalette(m_MapLoc, this); |
492 |
PluginServices.getMDIManager().addWindow(movp); |
493 |
FLayer[] layers
|
494 |
= getViewDocument().getMapContext().getLayers().getActives(); |
495 |
if (layers.length > 0 && layers[0] instanceof FLyrVect) { |
496 |
if (((FLyrVect) layers[0]).isEditing()) { |
497 |
showConsole(); |
498 |
return;
|
499 |
} |
500 |
} |
501 |
hideConsole(); |
502 |
|
503 |
} |
504 |
|
505 |
public void restore() { |
506 |
isPalette = false;
|
507 |
PluginServices.getMDIManager().closeWindow(movp); |
508 |
FLayer[] layers
|
509 |
= getViewDocument().getMapContext().getLayers().getActives(); |
510 |
if (layers.length > 0 && layers[0] instanceof FLyrVect) { |
511 |
if (((FLyrVect) layers[0]).isEditing()) { |
512 |
showConsole(); |
513 |
return;
|
514 |
} |
515 |
} |
516 |
hideConsole(); |
517 |
JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
518 |
tempSplitToc.setTopComponent(m_TOC); |
519 |
tempSplitToc.setBottomComponent(m_MapLoc); |
520 |
tempSplitToc.setResizeWeight(0.7);
|
521 |
tempMainSplit.setLeftComponent(tempSplitToc); |
522 |
} |
523 |
|
524 |
/**
|
525 |
* Sets the default map overview background color that will be used in
|
526 |
* subsequent projects.
|
527 |
*
|
528 |
* @param color
|
529 |
* @deprecated use instead
|
530 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
531 |
*/
|
532 |
public static void setDefaultMapOverViewBackColor(Color color) { |
533 |
DefaultProject.getPreferences().setDefaultOverviewBackColor(color); |
534 |
} |
535 |
|
536 |
/**
|
537 |
* Returns the current default map overview background color defined which
|
538 |
* is the color defined when the user does not define any other one
|
539 |
*
|
540 |
* @return java.awt.Color
|
541 |
* @deprecated use instead
|
542 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
543 |
*/
|
544 |
public static Color getDefaultMapOverViewBackColor() { |
545 |
return DefaultProject.getPreferences().getDefaultOverviewBackColor();
|
546 |
} |
547 |
|
548 |
/**
|
549 |
* Returns the current default view background color defined which is the
|
550 |
* color defined when the user does not define any other one
|
551 |
*
|
552 |
* @return java.awt.Color
|
553 |
* @deprecated use instead Project.getPreferences().getDefaultViewBackColor
|
554 |
*/
|
555 |
public static Color getDefaultBackColor() { |
556 |
return DefaultProject.getPreferences().getDefaultViewBackColor();
|
557 |
} |
558 |
|
559 |
/**
|
560 |
* @deprecated use instead Project.getPreferences().setDefaultViewBackColor
|
561 |
*/
|
562 |
public static void setDefaultBackColor(Color color) { |
563 |
DefaultProject.getPreferences().setDefaultViewBackColor(color); |
564 |
} |
565 |
|
566 |
public Object getWindowProfile() { |
567 |
return WindowInfo.EDITOR_PROFILE;
|
568 |
} |
569 |
|
570 |
/* (non-Javadoc)
|
571 |
* @see org.gvsig.tools.observer.Observer#update(org.gvsig.tools.observer.Observable, java.lang.Object)
|
572 |
*/
|
573 |
public void update(final Observable observable, final Object notification) { |
574 |
|
575 |
if (notification instanceof FeatureStoreNotification) { |
576 |
FeatureStoreNotification event |
577 |
= (FeatureStoreNotification) notification; |
578 |
if (event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING
|
579 |
|| event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) { |
580 |
|
581 |
if (!SwingUtilities.isEventDispatchThread()) { |
582 |
SwingUtilities.invokeLater(new Runnable() { |
583 |
public void run() { |
584 |
update(observable, notification); |
585 |
} |
586 |
}); |
587 |
return;
|
588 |
} |
589 |
getMapControl().setTool("zoomIn");
|
590 |
hideConsole(); |
591 |
repaintMap(); |
592 |
} |
593 |
} |
594 |
} |
595 |
|
596 |
private static boolean disableConsole = false; |
597 |
|
598 |
public static void setDisableConsole(boolean disable) { |
599 |
disableConsole = disable; |
600 |
} |
601 |
|
602 |
} |