svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.timesupport.app / org.gvsig.timesupport.app.viewfilter / src / main / java / org / gvsig / timesupport / app / extension / MapContextListener.java @ 42003
History | View | Annotate | Download (2.91 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
package org.gvsig.timesupport.app.extension; |
23 |
|
24 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
25 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent; |
26 |
import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent; |
27 |
import org.gvsig.timesupport.swing.api.panel.TimeSelectorPanel; |
28 |
|
29 |
|
30 |
/**
|
31 |
* @author gvSIG Team
|
32 |
* @version $Id$
|
33 |
*
|
34 |
*/
|
35 |
public class MapContextListener implements org.gvsig.fmap.mapcontext.layers.LayerCollectionListener{ |
36 |
private final MapContextToInterval mapContextToInterval; |
37 |
private final TimeSelectorPanel timeSelectorPanel; |
38 |
|
39 |
public MapContextListener(MapContextToInterval mapContextToInterval, TimeSelectorPanel timeSelectorPanel) {
|
40 |
super();
|
41 |
this.mapContextToInterval = mapContextToInterval;
|
42 |
this.timeSelectorPanel = timeSelectorPanel;
|
43 |
} |
44 |
|
45 |
public void layerAdded(LayerCollectionEvent e) { |
46 |
mapContextUpdated(); |
47 |
} |
48 |
|
49 |
public void layerMoved(LayerPositionEvent e) { |
50 |
// TODO Auto-generated method stub
|
51 |
|
52 |
} |
53 |
|
54 |
public void layerRemoved(LayerCollectionEvent e) { |
55 |
mapContextUpdated(); |
56 |
} |
57 |
|
58 |
public void layerAdding(LayerCollectionEvent e) throws CancelationException { |
59 |
// TODO Auto-generated method stub
|
60 |
|
61 |
} |
62 |
|
63 |
public void layerMoving(LayerPositionEvent e) throws CancelationException { |
64 |
// TODO Auto-generated method stub
|
65 |
|
66 |
} |
67 |
|
68 |
public void layerRemoving(LayerCollectionEvent e) |
69 |
throws CancelationException {
|
70 |
// TODO Auto-generated method stub
|
71 |
|
72 |
} |
73 |
|
74 |
public void visibilityChanged(LayerCollectionEvent e) |
75 |
throws CancelationException {
|
76 |
// TODO Auto-generated method stub
|
77 |
|
78 |
} |
79 |
|
80 |
private void mapContextUpdated(){ |
81 |
mapContextToInterval.update(); |
82 |
if (mapContextToInterval.getInterval() == null){ |
83 |
timeSelectorPanel.setVisible(false);
|
84 |
}else{
|
85 |
timeSelectorPanel.setVisible(true);
|
86 |
timeSelectorPanel.initialize(mapContextToInterval.getInterval()); |
87 |
timeSelectorPanel.setInstants(mapContextToInterval.getTimes()); |
88 |
} |
89 |
} |
90 |
} |