Revision 41258 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/AddLayer.java
AddLayer.java | ||
---|---|---|
45 | 45 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
46 | 46 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
47 | 47 |
import org.gvsig.fmap.mapcontrol.MapControl; |
48 |
import org.slf4j.Logger; |
|
49 |
import org.slf4j.LoggerFactory; |
|
48 | 50 |
|
49 | 51 |
/** |
50 | 52 |
* Extensi�n que abre un di�logo para seleccionar la capa o capas que se |
... | ... | |
52 | 54 |
* |
53 | 55 |
*/ |
54 | 56 |
public class AddLayer extends Extension { |
55 |
|
|
56 |
public AddLayerDialog fopen = null; |
|
57 |
|
|
57 |
private static final Logger logger = LoggerFactory.getLogger(AddLayer.class); |
|
58 |
|
|
58 | 59 |
private static ArrayList<Class<? extends WizardPanel>> wizardStack = null; |
59 | 60 |
|
60 | 61 |
static { |
... | ... | |
104 | 105 |
IProjection proj = lyr.getProjection(); |
105 | 106 |
// Comprobar que la projecci�n es la misma que la vista |
106 | 107 |
if (proj == null) { |
107 |
// SUPONEMOS que la capa est� en la proyecci�n que
|
|
108 |
// SUPONEMOS que la capa est� en la proyecci�n que |
|
108 | 109 |
// estamos pidiendo (que ya es mucho suponer, ya). |
109 | 110 |
lyrVect.setProjection(viewPort.getProjection()); |
110 | 111 |
return; |
... | ... | |
154 | 155 |
* @return FOpenDialog |
155 | 156 |
*/ |
156 | 157 |
private AddLayerDialog createFOpenDialog(MapControl mapControl) { |
157 |
fopen = new AddLayerDialog(); |
|
158 |
|
|
159 |
// after that, all registerez tabs (wizardpanels implementations) |
|
158 |
AddLayerDialog fopen = new AddLayerDialog(); |
|
160 | 159 |
for (int i = 0; i < wizardStack.size(); i++) { |
161 | 160 |
WizardPanel wp; |
162 | 161 |
try { |
163 | 162 |
wp = AddLayer.getInstance(i, mapControl); |
164 | 163 |
|
165 | 164 |
fopen.addWizardTab(wp.getTabName(), wp); |
166 |
} catch (IllegalArgumentException e) { |
|
167 |
e.printStackTrace(); |
|
168 |
} catch (SecurityException e) { |
|
169 |
e.printStackTrace(); |
|
170 |
} catch (InstantiationException e) { |
|
171 |
e.printStackTrace(); |
|
172 |
} catch (IllegalAccessException e) { |
|
173 |
e.printStackTrace(); |
|
174 |
} catch (InvocationTargetException e) { |
|
175 |
e.printStackTrace(); |
|
176 |
} catch (NoSuchMethodException e) { |
|
177 |
e.printStackTrace(); |
|
165 |
} catch (Exception e) { |
|
166 |
logger.warn("Can't create layer open dialog.",e); |
|
178 | 167 |
} |
179 |
}// for
|
|
168 |
} |
|
180 | 169 |
return fopen; |
181 | 170 |
} |
182 | 171 |
|
... | ... | |
199 | 188 |
* Abre dialogo para a�adir capas y las a�ade en mapControl |
200 | 189 |
* |
201 | 190 |
* Devuelve true si se han a�adido capas. |
191 |
* @param mapControl |
|
192 |
* @return |
|
202 | 193 |
*/ |
203 | 194 |
public boolean addLayers(MapControl mapControl) { |
204 | 195 |
// create and show the modal fopen dialog |
205 |
fopen = createFOpenDialog(mapControl); |
|
206 |
PluginServices.getMDIManager().addWindow(fopen); |
|
196 |
AddLayerDialog fopen = null; |
|
197 |
try { |
|
198 |
fopen = createFOpenDialog(mapControl); |
|
199 |
PluginServices.getMDIManager().addWindow(fopen); |
|
207 | 200 |
|
208 |
if (fopen.isAccepted()) { |
|
209 |
if (fopen.getSelectedTab() instanceof WizardPanel) { |
|
210 |
WizardPanel wp = (WizardPanel) fopen.getSelectedTab(); |
|
211 |
return loadGenericWizardPanelLayers(mapControl, wp); |
|
212 |
} else { |
|
213 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
214 |
.getMainFrame(), PluginServices.getText(this, "ninguna_capa_seleccionada")); |
|
201 |
if (fopen.isAccepted()) { |
|
202 |
if (fopen.getSelectedTab() instanceof WizardPanel) { |
|
203 |
WizardPanel wp = (WizardPanel) fopen.getSelectedTab(); |
|
204 |
return loadGenericWizardPanelLayers(mapControl, wp); |
|
205 |
} else { |
|
206 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
207 |
.getMainFrame(), PluginServices.getText(this, "ninguna_capa_seleccionada")); |
|
208 |
} |
|
215 | 209 |
} |
210 |
return false; |
|
211 |
} finally { |
|
212 |
if (fopen != null) { |
|
213 |
fopen.dispose(); |
|
214 |
fopen = null; |
|
215 |
} |
|
216 | 216 |
} |
217 |
return false; |
|
218 | 217 |
} |
219 | 218 |
|
220 | 219 |
public void initialize() { |
Also available in: Unified diff