Revision 43410 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 | ||
---|---|---|
157 | 157 |
MapControl mapControl = this.getMapCtrl(); |
158 | 158 |
MapContext mc = mapControl.getMapContext(); |
159 | 159 |
MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
160 |
Boolean needCalculateEnvelope = mc.getViewPort().getEnvelope() == null; |
|
160 | 161 |
TablesListItem[] tables = getSelectedTables(); |
161 | 162 |
|
162 | 163 |
List<FLayer> all_layers = new ArrayList(); |
163 | 164 |
String groupName = null; |
164 |
Boolean needCalculateEnvelope = mc.getViewPort().getEnvelope() == null; |
|
165 |
Envelope env = null; |
|
166 | 165 |
DBStoreParameters parameter; |
167 | 166 |
TablesListItem table; |
168 | 167 |
FeatureStore store; |
... | ... | |
203 | 202 |
store |
204 | 203 |
); |
205 | 204 |
all_layers.add(layer); |
206 |
if( needCalculateEnvelope ) { |
|
207 |
if (env == null) { |
|
208 |
env = layer.getFullEnvelope(); |
|
209 |
} else { |
|
210 |
env.add(layer.getFullEnvelope()); |
|
211 |
} |
|
212 |
} |
|
213 | 205 |
} catch (Exception e) { |
214 | 206 |
logger.warn("Can't create layer '"+userTableSettingsPanel.getUserLayerName()+"'.",e); |
215 | 207 |
} |
... | ... | |
238 | 230 |
} catch (CancelationException e) { |
239 | 231 |
logger.warn("Can't add group to mapcontext layers.",e); |
240 | 232 |
} |
241 |
if ( needCalculateEnvelope && env!=null ) { |
|
242 |
mapControl.getViewPort().setEnvelope(env); |
|
243 |
} |
|
233 |
|
|
244 | 234 |
} finally { |
245 | 235 |
mc.endAtomicEvent(); |
246 | 236 |
} |
... | ... | |
261 | 251 |
} catch (CancelationException e) { |
262 | 252 |
return; |
263 | 253 |
} |
264 |
|
|
265 |
if ( needCalculateEnvelope && env!=null ) { |
|
266 |
mapControl.getViewPort().setEnvelope(env); |
|
267 |
} |
|
268 | 254 |
} finally { |
269 | 255 |
mc.endAtomicEvent(); |
270 | 256 |
} |
271 | 257 |
return; |
272 | 258 |
} |
273 | 259 |
} |
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 |
} |
|
276 |
|
|
274 | 277 |
} finally { |
275 | 278 |
// Dispose all created layers. If they have been included into |
276 | 279 |
// a FLayers object, they will have been binded there. |
Also available in: Unified diff