root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LinkControls.java @ 2981
History | View | Annotate | Download (3.57 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
2 | * Created on 01-jun-2004
|
||
3 | *
|
||
4 | * To change the template for this generated file go to
|
||
5 | * Window>Preferences>Java>Code Generation>Code and Comments
|
||
6 | */
|
||
7 | 1103 | fjp | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 | *
|
||
9 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
10 | *
|
||
11 | * This program is free software; you can redistribute it and/or
|
||
12 | * modify it under the terms of the GNU General Public License
|
||
13 | * as published by the Free Software Foundation; either version 2
|
||
14 | * of the License, or (at your option) any later version.
|
||
15 | *
|
||
16 | * This program is distributed in the hope that it will be useful,
|
||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
19 | * GNU General Public License for more details.
|
||
20 | *
|
||
21 | * You should have received a copy of the GNU General Public License
|
||
22 | * along with this program; if not, write to the Free Software
|
||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
24 | *
|
||
25 | * For more information, contact:
|
||
26 | *
|
||
27 | * Generalitat Valenciana
|
||
28 | * Conselleria d'Infraestructures i Transport
|
||
29 | * Av. Blasco Ib??ez, 50
|
||
30 | * 46010 VALENCIA
|
||
31 | * SPAIN
|
||
32 | *
|
||
33 | * +34 963862235
|
||
34 | * gvsig@gva.es
|
||
35 | * www.gvsig.gva.es
|
||
36 | *
|
||
37 | * or
|
||
38 | *
|
||
39 | * IVER T.I. S.A
|
||
40 | * Salamanca 50
|
||
41 | * 46005 Valencia
|
||
42 | * Spain
|
||
43 | *
|
||
44 | * +34 963163400
|
||
45 | * dac@iver.es
|
||
46 | */
|
||
47 | 312 | fernando | package com.iver.cit.gvsig; |
48 | |||
49 | 596 | fernando | import com.iver.andami.PluginServices; |
50 | import com.iver.andami.plugins.Extension; |
||
51 | 1219 | vcaballero | |
52 | 312 | fernando | import com.iver.cit.gvsig.fmap.FMap; |
53 | 1223 | fernando | import com.iver.cit.gvsig.fmap.MapControl; |
54 | 312 | fernando | import com.iver.cit.gvsig.fmap.layers.FLayer; |
55 | 2508 | nacho | import com.iver.cit.gvsig.fmap.layers.FLayers; |
56 | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
||
57 | 312 | fernando | import com.iver.cit.gvsig.gui.View; |
58 | 2508 | nacho | import com.iver.cit.gvsig.project.ProjectView; |
59 | 312 | fernando | |
60 | 1219 | vcaballero | import org.apache.log4j.Logger; |
61 | 312 | fernando | |
62 | 1219 | vcaballero | |
63 | 312 | fernando | /**
|
64 | 775 | vcaballero | * Extensi?n para gestionar los hiperlinks.
|
65 | 312 | fernando | *
|
66 | * @author Vicente Caballero Navarro
|
||
67 | */
|
||
68 | 596 | fernando | public class LinkControls implements Extension { |
69 | 1219 | vcaballero | private static Logger logger = Logger.getLogger(LinkControls.class.getName()); |
70 | 312 | fernando | |
71 | 1219 | vcaballero | /**
|
72 | * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
||
73 | */
|
||
74 | public void execute(String s) { |
||
75 | View vista = (View) PluginServices.getMDIManager().getActiveView(); |
||
76 | 2429 | caballero | //ProjectView model = vista.getModel();
|
77 | //FMap mapa = model.getMapContext();
|
||
78 | 1223 | fernando | MapControl mapCtrl = vista.getMapControl(); |
79 | 1219 | vcaballero | logger.debug("Comand : " + s);
|
80 | 312 | fernando | |
81 | 1219 | vcaballero | if (s.compareTo("LINK") == 0) { |
82 | mapCtrl.setTool("link");
|
||
83 | } |
||
84 | } |
||
85 | 312 | fernando | |
86 | 1219 | vcaballero | /**
|
87 | * @see com.iver.mdiApp.plugins.Extension#isVisible()
|
||
88 | */
|
||
89 | public boolean isVisible() { |
||
90 | com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
||
91 | .getActiveView(); |
||
92 | 2508 | nacho | |
93 | 1219 | vcaballero | if (f == null) { |
94 | return false; |
||
95 | } |
||
96 | 312 | fernando | |
97 | 1219 | vcaballero | if (f.getClass() == View.class) { |
98 | 312 | fernando | |
99 | 2508 | nacho | FMap mapa = ((View) f).getModel().getMapContext();
|
100 | |||
101 | return mapa.getLayers().getLayersCount() > 0; |
||
102 | 1219 | vcaballero | } else {
|
103 | return false; |
||
104 | } |
||
105 | } |
||
106 | 312 | fernando | |
107 | 1219 | vcaballero | /**
|
108 | * @see com.iver.andami.plugins.Extension#isEnabled()
|
||
109 | */
|
||
110 | public boolean isEnabled() { |
||
111 | View f = (View) PluginServices.getMDIManager().getActiveView(); |
||
112 | 312 | fernando | |
113 | 1219 | vcaballero | if (f == null) { |
114 | return false; |
||
115 | } |
||
116 | 596 | fernando | |
117 | 2508 | nacho | if (f instanceof com.iver.cit.gvsig.gui.View) { |
118 | com.iver.cit.gvsig.gui.View view = (com.iver.cit.gvsig.gui.View) f; |
||
119 | ProjectView model = view.getModel(); |
||
120 | FLayer[] activas = model.getMapContext().getLayers().getActives();
|
||
121 | for(int i=0;i<activas.length;i++){ |
||
122 | if(activas[i] instanceof FLyrRaster) |
||
123 | return false; |
||
124 | } |
||
125 | } |
||
126 | 1219 | vcaballero | FLayer[] selected = f.getModel().getMapContext().getLayers().getActives();
|
127 | |||
128 | return selected.length > 0; |
||
129 | } |
||
130 | |||
131 | 596 | fernando | /**
|
132 | * @see com.iver.andami.plugins.Extension#inicializar()
|
||
133 | */
|
||
134 | public void inicializar() { |
||
135 | } |
||
136 | 312 | fernando | } |