Revision 43639 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/vectorialdb/wizard/WizardVectorialDB.java
WizardVectorialDB.java | ||
---|---|---|
154 | 154 |
|
155 | 155 |
@Override |
156 | 156 |
public void execute() { |
157 |
executeWizard(); |
|
158 |
} |
|
159 |
|
|
160 |
@Override |
|
161 |
public Object executeWizard() { |
|
157 | 162 |
MapControl mapControl = this.getMapCtrl(); |
158 | 163 |
MapContext mc = mapControl.getMapContext(); |
159 | 164 |
MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
160 |
Boolean needCalculateEnvelope = mc.getViewPort().getEnvelope() == null; |
|
165 |
// Boolean needCalculateEnvelope = mc.getViewPort().getEnvelope() == null;
|
|
161 | 166 |
TablesListItem[] tables = getSelectedTables(); |
162 | 167 |
|
163 | 168 |
List<FLayer> all_layers = new ArrayList(); |
... | ... | |
193 | 198 |
parameter); |
194 | 199 |
} catch (Exception e) { |
195 | 200 |
logger.warn("While opening DB store.", e); |
196 |
return; |
|
201 |
return null;
|
|
197 | 202 |
} |
198 | 203 |
try { |
199 | 204 |
|
... | ... | |
225 | 230 |
mc.beginAtomicEvent(); |
226 | 231 |
try { |
227 | 232 |
try { |
228 |
mc.getLayers().addLayer(group);
|
|
233 |
mapControl.addLayer(group);
|
|
229 | 234 |
group.dispose(); |
230 | 235 |
} catch (CancelationException e) { |
231 | 236 |
logger.warn("Can't add group to mapcontext layers.",e); |
... | ... | |
234 | 239 |
} finally { |
235 | 240 |
mc.endAtomicEvent(); |
236 | 241 |
} |
237 |
return; |
|
238 |
} else { |
|
239 |
if (all_layers.size() == 1) { |
|
240 |
layer = (FLayer) all_layers.get(0); |
|
241 |
if (!(layer.isOk())) { |
|
242 |
// if the layer is not okay (it has errors) process them |
|
243 |
processErrorsOfLayer(layer, mapControl); |
|
244 |
} |
|
242 |
return null; |
|
243 |
} else if (all_layers.size() == 1) { |
|
244 |
layer = (FLayer) all_layers.get(0); |
|
245 |
if (!(layer.isOk())) { |
|
246 |
// if the layer is not okay (it has errors) process them |
|
247 |
processErrorsOfLayer(layer, mapControl); |
|
248 |
} |
|
245 | 249 |
|
246 |
layer.setVisible(true); |
|
247 |
mc.beginAtomicEvent(); |
|
250 |
layer.setVisible(true); |
|
251 |
mc.beginAtomicEvent(); |
|
252 |
try { |
|
248 | 253 |
try { |
249 |
try { |
|
250 |
mc.getLayers().addLayer(layer); |
|
251 |
} catch (CancelationException e) { |
|
252 |
return; |
|
253 |
} |
|
254 |
} finally { |
|
255 |
mc.endAtomicEvent(); |
|
254 |
mapControl.addLayer(layer); |
|
255 |
} catch (CancelationException e) { |
|
256 |
return null; |
|
256 | 257 |
} |
257 |
return; |
|
258 |
} finally { |
|
259 |
mc.endAtomicEvent(); |
|
258 | 260 |
} |
261 |
return null; |
|
262 |
|
|
259 | 263 |
} |
260 |
if ( needCalculateEnvelope ) { |
|
261 |
Envelope env = null; |
|
262 |
for( FLayer theLayer : all_layers) { |
|
263 |
try { |
|
264 |
if (env == null) { |
|
265 |
env = theLayer.getFullEnvelope(); |
|
266 |
} else { |
|
267 |
env.add(theLayer.getFullEnvelope()); |
|
268 |
} |
|
269 |
} catch(Exception ex) { |
|
270 |
// Ignore |
|
271 |
} |
|
272 |
|
|
273 |
} |
|
274 |
mapControl.getViewPort().setEnvelope(env); |
|
275 |
} |
|
264 |
// if ( needCalculateEnvelope ) {
|
|
265 |
// Envelope env = null;
|
|
266 |
// for( FLayer theLayer : all_layers) {
|
|
267 |
// try {
|
|
268 |
// if (env == null) {
|
|
269 |
// env = theLayer.getFullEnvelope();
|
|
270 |
// } else {
|
|
271 |
// env.add(theLayer.getFullEnvelope());
|
|
272 |
// }
|
|
273 |
// } catch(Exception ex) {
|
|
274 |
// // Ignore
|
|
275 |
// }
|
|
276 |
// |
|
277 |
// }
|
|
278 |
// mapControl.getViewPort().setEnvelope(env);
|
|
279 |
// }
|
|
276 | 280 |
|
277 | 281 |
} finally { |
278 | 282 |
// Dispose all created layers. If they have been included into |
... | ... | |
282 | 286 |
layer.dispose(); |
283 | 287 |
} |
284 | 288 |
} |
289 |
return null; |
|
285 | 290 |
} |
286 | 291 |
|
287 | 292 |
@Override |
Also available in: Unified diff