Revision 7128 org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterToolsUtil.java
RasterToolsUtil.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.raster.tools.app.basic; |
23 | 23 |
|
24 | 24 |
import java.awt.Component; |
25 | 25 |
import java.awt.Dimension; |
26 | 26 |
import java.awt.Point; |
27 |
import java.awt.Window; |
|
27 | 28 |
import java.io.File; |
28 | 29 |
import java.util.ArrayList; |
30 |
import java.util.Iterator; |
|
29 | 31 |
|
30 | 32 |
import javax.swing.ImageIcon; |
31 | 33 |
import javax.swing.JOptionPane; |
32 | 34 |
|
35 |
import org.cresques.cts.IProjection; |
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
33 | 39 |
import org.gvsig.andami.IconThemeHelper; |
40 |
import org.gvsig.andami.Launcher; |
|
34 | 41 |
import org.gvsig.andami.PluginServices; |
35 | 42 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
43 |
import org.gvsig.app.ApplicationLocator; |
|
44 |
import org.gvsig.app.ApplicationManager; |
|
45 |
import org.gvsig.app.prepareAction.PrepareContextView_v1; |
|
36 | 46 |
import org.gvsig.app.project.Project; |
37 | 47 |
import org.gvsig.app.project.ProjectManager; |
38 | 48 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
49 |
import org.gvsig.app.project.documents.view.toc.actions.LayerErrorsPanel; |
|
39 | 50 |
import org.gvsig.fmap.dal.DALLocator; |
40 | 51 |
import org.gvsig.fmap.dal.DataManager; |
41 | 52 |
import org.gvsig.fmap.dal.DataStore; |
53 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
54 |
import org.gvsig.fmap.dal.DataStoreProviderFactory; |
|
42 | 55 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
43 | 56 |
import org.gvsig.fmap.dal.coverage.datastruct.Param; |
44 | 57 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
45 | 58 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
46 | 59 |
import org.gvsig.fmap.dal.coverage.util.ProviderServices; |
60 |
import org.gvsig.fmap.dal.exception.DataException; |
|
47 | 61 |
import org.gvsig.fmap.dal.exception.InitializeException; |
48 | 62 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
49 | 63 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
64 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter; |
|
65 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
66 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
67 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
|
68 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel; |
|
69 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.FilesystemExplorerWizardPanel.MyFileFilter; |
|
70 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
50 | 71 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
51 | 72 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
52 | 73 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
53 | 74 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
54 | 75 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
76 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
55 | 77 |
import org.gvsig.gui.beans.propertiespanel.PropertiesComponent; |
56 | 78 |
import org.gvsig.gui.beans.propertiespanel.PropertyStruct; |
57 | 79 |
import org.gvsig.i18n.Messages; |
58 | 80 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
59 | 81 |
import org.gvsig.raster.util.RasterNotLoadException; |
82 |
import org.gvsig.tools.ToolsLocator; |
|
83 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
84 |
import org.gvsig.tools.dynobject.DynObject; |
|
85 |
import org.gvsig.tools.i18n.I18nManager; |
|
86 |
import org.gvsig.tools.identitymanagement.UnauthorizedException; |
|
87 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
88 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
60 | 89 |
|
61 | 90 |
/** |
62 | 91 |
* Herramientas de uso general y que son dependientes de gvSIG, FMap o de |
... | ... | |
67 | 96 |
*/ |
68 | 97 |
public class RasterToolsUtil { |
69 | 98 |
|
99 |
private static final Logger logger = LoggerFactory.getLogger(RasterToolsUtil.class); |
|
100 |
|
|
101 |
|
|
70 | 102 |
/** |
71 | 103 |
* Obtiene la lista de capas del TOC y devuelve las raster. Si hay capas agrupadas lo tiene en cuenta y mira |
72 | 104 |
* dentro de la agrupaci?n. |
73 | 105 |
* @param srcLyrs FLayers de la vista |
74 |
* @param destLyrs Lista de capas
|
|
106 |
* @param destLyrs Lista de capas |
|
75 | 107 |
* @return ArrayList con la lista de capas raster agrupadas o no. El orden en que aparecen |
76 | 108 |
* en la lista es de abajo a arriba las que aparecen en el TOC. |
77 | 109 |
*/ |
... | ... | |
86 | 118 |
} |
87 | 119 |
return destLyrs; |
88 | 120 |
} |
89 |
|
|
121 |
|
|
90 | 122 |
/** |
91 | 123 |
* Obtiene la lista de capas del TOC y devuelve las raster. Si hay capas agrupadas lo tiene en cuenta y mira |
92 | 124 |
* dentro de la agrupaci?n. |
93 | 125 |
* @param srcLyrs FLayers de la vista |
94 |
* @param destLyrs Lista de capas
|
|
126 |
* @param destLyrs Lista de capas |
|
95 | 127 |
* @return ArrayList con la lista de capas raster agrupadas o no. El orden en que aparecen |
96 | 128 |
* en la lista es de abajo a arriba las que aparecen en el TOC. |
97 | 129 |
*/ |
... | ... | |
103 | 135 |
for (int i = 0; i < srcLyrs.getLayersCount(); i++) { |
104 | 136 |
if(srcLyrs.getLayer(i) instanceof FLayers) |
105 | 137 |
destLyrs = getLayerList((FLayers)srcLyrs.getLayer(i), destLyrs); |
106 |
else
|
|
138 |
else |
|
107 | 139 |
destLyrs.add(srcLyrs.getLayer(i)); |
108 | 140 |
} |
109 | 141 |
return destLyrs; |
110 | 142 |
} |
111 |
|
|
143 |
|
|
112 | 144 |
/** |
113 | 145 |
* Obtiene el nombre de la vista donde est? cargada la capa que se pasa por par?metro |
114 | 146 |
* @param layer Capa cargada en una vista |
... | ... | |
117 | 149 |
public static String getView(FLayer layer) { |
118 | 150 |
// Project p = ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject(); |
119 | 151 |
Project p = ProjectManager.getInstance().getCurrentProject(); |
120 |
return p.getViewName(layer);
|
|
152 |
return p.getViewName(layer); |
|
121 | 153 |
} |
122 |
|
|
154 |
|
|
123 | 155 |
/** |
124 | 156 |
* Devuelve la traducci?n de un texto. En caso de no existir la traducci?n al idioma seleccionado |
125 | 157 |
* devolver? la cadena de entrada. |
... | ... | |
130 | 162 |
public static String getText(Object parent, String text) { |
131 | 163 |
return PluginServices.getText(parent, text); |
132 | 164 |
} |
133 |
|
|
165 |
|
|
134 | 166 |
/** |
135 |
* Obtiene un icono definido por la etiqueta que se especifica en el
|
|
167 |
* Obtiene un icono definido por la etiqueta que se especifica en el |
|
136 | 168 |
* par?metro |
137 | 169 |
* @param ico Etiqueta del icono |
138 | 170 |
* @return Icono |
139 | 171 |
*/ |
140 | 172 |
public static ImageIcon getIcon(String ico) { |
141 |
return IconThemeHelper.getImageIcon(ico);
|
|
173 |
return IconThemeHelper.getImageIcon(ico); |
|
142 | 174 |
} |
143 |
|
|
175 |
|
|
144 | 176 |
/** |
145 | 177 |
* A?ade una ventana al gestor de ventanas |
146 | 178 |
* @param window |
... | ... | |
148 | 180 |
public static void addWindow(IWindow window) { |
149 | 181 |
PluginServices.getMDIManager().addWindow(window); |
150 | 182 |
} |
151 |
|
|
183 |
|
|
152 | 184 |
/** |
153 | 185 |
* Elimina una ventana al gestor de ventanas |
154 | 186 |
* @param window |
... | ... | |
156 | 188 |
public static void closeWindow(IWindow window) { |
157 | 189 |
PluginServices.getMDIManager().closeWindow(window); |
158 | 190 |
} |
159 |
|
|
191 |
|
|
160 | 192 |
/** |
161 | 193 |
* Selecciona los controles del panel de propiedades a partir de los par?mtros |
162 | 194 |
* obtenidos del driver. Este m?todo realiza una transformaci?n entre Params |
... | ... | |
274 | 306 |
* por alg?n motivo. |
275 | 307 |
*/ |
276 | 308 |
@SuppressWarnings("deprecation") |
277 |
public static FLayer loadLayer(String viewName, String fileName, String layerName) throws RasterNotLoadException { |
|
278 |
if(fileName == null) |
|
279 |
return null; |
|
309 |
public static void loadLayer(String viewName, String fileName, final String layerName) throws RasterNotLoadException { |
|
310 |
//Este m?todo, antes devolv?a la layer a?adida, pero no hevisto ning?n sitio d?nde se utilizara. |
|
311 |
if(fileName == null){ |
|
312 |
return; |
|
313 |
} |
|
314 |
File file = new File(fileName); |
|
280 | 315 |
|
281 | 316 |
//Seleccionamos la vista de gvSIG |
282 | 317 |
AbstractViewPanel theView = null; |
... | ... | |
309 | 344 |
throw new RasterNotLoadException("No se puede hacer un casting de esa IWindow a View."); |
310 | 345 |
} |
311 | 346 |
|
312 |
theView.getMapControl().getMapContext().beginAtomicEvent(); |
|
347 |
DataManager dm = DALLocator.getDataManager(); |
|
348 |
FilesystemServerExplorerParameters param; |
|
349 |
FilesystemServerExplorer explorer; |
|
350 |
try { |
|
351 |
param = (FilesystemServerExplorerParameters) dm |
|
352 |
.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
353 |
explorer = (FilesystemServerExplorer) dm.openServerExplorer( |
|
354 |
FilesystemServerExplorer.NAME, param); |
|
355 |
} catch (Exception e) { |
|
356 |
throw new RuntimeException(e); |
|
357 |
} |
|
313 | 358 |
|
314 |
DefaultFLyrRaster lyr = null; |
|
315 |
try { |
|
316 |
ProviderServices provServ = RasterLocator.getManager().getProviderServices(); |
|
317 |
RasterDataParameters storeParameters = provServ.createNotTiledParameters(fileName); |
|
318 |
storeParameters.setSRS(theView.getProjection()); |
|
319 |
|
|
320 |
MapContextManager mcm = MapContextLocator.getMapContextManager(); |
|
321 |
DataManager dataManager = DALLocator.getDataManager(); |
|
322 |
DataStore dataStore = null; |
|
323 |
try { |
|
324 |
dataStore = dataManager.createStore(storeParameters); |
|
325 |
} catch (ValidateDataParametersException e) { |
|
326 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
327 |
} catch (InitializeException e) { |
|
328 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
329 |
} catch (ProviderNotRegisteredException e) { |
|
330 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
331 |
} |
|
332 |
|
|
333 |
lyr = new DefaultFLyrRaster(); |
|
334 |
|
|
335 |
if(layerName == null) { |
|
336 |
int endIndex = fileName.lastIndexOf("."); |
|
337 |
if (endIndex < 0) |
|
338 |
endIndex = fileName.length(); |
|
339 |
|
|
340 |
layerName = fileName.substring(fileName.lastIndexOf(File.separator) + 1, endIndex); |
|
341 |
} |
|
342 |
|
|
343 |
lyr = (DefaultFLyrRaster) mcm.createLayer(layerName, dataStore); |
|
359 |
int mode = FilesystemServerExplorer.MODE_RASTER; |
|
344 | 360 |
|
345 |
} catch (LoadLayerException e) { |
|
346 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
347 |
} catch (InitializeException e) { |
|
348 |
throw new RasterNotLoadException("Error creating parameters."); |
|
349 |
} catch (ProviderNotRegisteredException e) { |
|
350 |
throw new RasterNotLoadException("Error creating parameters."); |
|
351 |
} |
|
352 |
theView.getMapControl().getMapContext().getLayers().addLayer(lyr); |
|
353 |
theView.getMapControl().getMapContext().invalidate(); |
|
354 |
theView.getMapControl().getMapContext().endAtomicEvent(); |
|
355 |
return lyr; |
|
356 |
} |
|
357 |
|
|
358 |
/** |
|
359 |
* Carga una capa raster en una vista de gvSIG. |
|
360 |
* @param viewName Nombre de la vista donde ha de cargarse. Si vale null se cargar? en la |
|
361 |
* primera vista que encuentre que est? activa. Si no hay ninguna saltar? una excepci?n. |
|
362 |
* @param fileName Nombre del fichero a cargar. No debe ser nulo nunca. |
|
363 |
* @param layerName Nombre de la capa. Si es null se asignar? el nombre del |
|
364 |
* fichero sin extensi?n. |
|
365 |
* @throws RasterNotLoadException Excepci?n que se lanza cuando no se ha podido cargar la capa |
|
366 |
* por alg?n motivo. |
|
367 |
*/ |
|
368 |
public static FLayer loadLayer(String viewName, FLayer lyr) throws RasterNotLoadException { |
|
369 |
if(lyr == null) |
|
370 |
return null; |
|
361 |
try { |
|
371 | 362 |
|
372 |
//Seleccionamos la vista de gvSIG |
|
373 |
AbstractViewPanel theView = null; |
|
374 |
try { |
|
375 |
IWindow[] allViews = PluginServices.getMDIManager().getAllWindows(); |
|
376 |
if(viewName != null) { |
|
377 |
for (int i = 0; i < allViews.length; i++) { |
|
378 |
if (allViews[i] instanceof AbstractViewPanel |
|
379 |
&& PluginServices.getMDIManager().getWindowInfo((AbstractViewPanel) allViews[i]).getTitle().equals(viewName)) |
|
380 |
theView = (AbstractViewPanel) allViews[i]; |
|
381 |
} |
|
382 |
} else { |
|
383 |
IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
|
384 |
for (int i = 0; i < allViews.length; i++) { |
|
385 |
if (allViews[i] instanceof AbstractViewPanel && ((AbstractViewPanel)allViews[i]) == activeWindow) //En la primera vista activa |
|
386 |
theView = (AbstractViewPanel) allViews[i]; |
|
387 |
} |
|
388 |
if(theView == null) { |
|
389 |
for (int i = 0; i < allViews.length; i++) { |
|
390 |
if (allViews[i] instanceof AbstractViewPanel) //En la primera vista |
|
391 |
theView = (AbstractViewPanel) allViews[i]; |
|
392 |
} |
|
393 |
} |
|
394 |
} |
|
363 |
final DataStoreParameters parameters = explorer.createStoreParameters(file); |
|
395 | 364 |
|
396 |
if (theView == null)
|
|
397 |
throw new RasterNotLoadException("Imposible cargar la capa.");
|
|
398 |
} catch (ClassCastException ex) {
|
|
399 |
throw new RasterNotLoadException("No se puede hacer un casting de esa IWindow a View.");
|
|
400 |
}
|
|
365 |
final MapControl mapControl = theView.getMapControl();
|
|
366 |
final boolean b_isMapControlAvail = (mapControl!=null);
|
|
367 |
final MapContext mapContext = mapControl.getMapContext();
|
|
368 |
final ApplicationManager application = ApplicationLocator.getManager();
|
|
369 |
final MapContextManager manager = MapContextLocator.getMapContextManager();
|
|
401 | 370 |
|
402 |
theView.getMapControl().getMapContext().beginAtomicEvent(); |
|
403 |
theView.getMapControl().getMapContext().getLayers().addLayer(lyr); |
|
404 |
theView.getMapControl().getMapContext().invalidate(); |
|
405 |
theView.getMapControl().getMapContext().endAtomicEvent(); |
|
406 |
return lyr; |
|
371 |
logger.info("addLayer('{}',...)", layerName); |
|
372 |
Thread task = new Thread(new Runnable() { |
|
373 |
|
|
374 |
@Override |
|
375 |
public void run() { |
|
376 |
FLayer layer = null; |
|
377 |
FLayer preparedLayer = null; |
|
378 |
try { |
|
379 |
DataManager dataManager = DALLocator.getDataManager(); |
|
380 |
final DataStore dataStore = dataManager.openStore(parameters.getDataStoreName(), parameters); |
|
381 |
DataStoreProviderFactory factory = dataStore.getProviderFactory(); |
|
382 |
//Descomentarizar si se desea tilear estas capas |
|
383 |
|
|
384 |
// if (factory.isTiledSupported() != DataStoreProviderFactory.NO) { |
|
385 |
// if (isTiled(parameters)) { |
|
386 |
// DynObject tileParameters = dataManager.createStoreParameters("TileCache"); |
|
387 |
// |
|
388 |
// File rootFolder = new File(Launcher.getAppHomeDir() + File.separator + "gvsig_rcache"); |
|
389 |
// |
|
390 |
// if (tileParameters.getDynClass().getDynField("rootFolder") != null) { |
|
391 |
// tileParameters.setDynValue("rootFolder", rootFolder); |
|
392 |
// } |
|
393 |
// |
|
394 |
// try { |
|
395 |
// dataStore.useCache("TileCache", tileParameters); |
|
396 |
// } catch (DataException e) { |
|
397 |
// logger.warn("Can't cache the layer.", e); |
|
398 |
// } |
|
399 |
// |
|
400 |
// } |
|
401 |
// } |
|
402 |
String name; |
|
403 |
if (layerName == null) { |
|
404 |
name = dataStore.getName(); |
|
405 |
} else { |
|
406 |
name = layerName; |
|
407 |
} |
|
408 |
layer = manager.createLayer(name, dataStore); |
|
409 |
|
|
410 |
DisposeUtils.disposeQuietly(dataStore); |
|
411 |
preparedLayer = application.prepareOpenLayer(layer, new PrepareContextView_v1() { |
|
412 |
|
|
413 |
@Override |
|
414 |
public Window getOwnerWindow() { |
|
415 |
return null; |
|
416 |
} |
|
417 |
|
|
418 |
@Override |
|
419 |
public MapControl getMapControl() { |
|
420 |
return mapControl; |
|
421 |
} |
|
422 |
|
|
423 |
@Override |
|
424 |
public IProjection getViewProjection() { |
|
425 |
return mapContext.getProjection(); |
|
426 |
} |
|
427 |
|
|
428 |
@Override |
|
429 |
public MapContext getMapContext() { |
|
430 |
return mapContext; |
|
431 |
} |
|
432 |
|
|
433 |
@Override |
|
434 |
public boolean isMapControlAvailable() { |
|
435 |
return b_isMapControlAvail; |
|
436 |
} |
|
437 |
}); |
|
438 |
if (preparedLayer != null) { |
|
439 |
mapContext.getLayers().addLayer(preparedLayer); |
|
440 |
} |
|
441 |
} catch (UnauthorizedException e) { |
|
442 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
443 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
444 |
String resource = ""; |
|
445 |
if (e.getResource() instanceof FilesystemStoreParameters) { |
|
446 |
resource = ((FilesystemStoreParameters) e.getResource()).getFile().getPath(); |
|
447 |
} |
|
448 |
application.messageDialog( |
|
449 |
i18nManager.getTranslation("_User_0_is_not_authorized_to_1_on_resource_2_3", new String[] { |
|
450 |
e.getIdentity().getID(), e.getActionName(), e.getResourceName(), resource }), |
|
451 |
i18nManager.getTranslation("_Unauthorized_access"), JOptionPane.WARNING_MESSAGE); |
|
452 |
logger.warn("Unauthorized access to layer '" + layerName + "'.", e); |
|
453 |
|
|
454 |
} catch (Exception e) { |
|
455 |
LayerErrorsPanel panel = new LayerErrorsPanel(layerName, e); |
|
456 |
if (preparedLayer != null) { |
|
457 |
panel.setLayer(preparedLayer); |
|
458 |
} else if (layer != null) { |
|
459 |
panel.setLayer(layer); |
|
460 |
} |
|
461 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
462 |
ToolsSwingLocator.getWindowManager().showWindow(panel, |
|
463 |
i18nManager.getTranslation("_Problems_loading_the_layer"), WindowManager.MODE.WINDOW); |
|
464 |
logger.warn("Can't load layer '" + layerName + "'.", e); |
|
465 |
|
|
466 |
} finally { |
|
467 |
if (preparedLayer != layer) { |
|
468 |
DisposeUtils.disposeQuietly(preparedLayer); |
|
469 |
} |
|
470 |
DisposeUtils.disposeQuietly(layer); |
|
471 |
} |
|
472 |
} |
|
473 |
}); |
|
474 |
task.start(); |
|
475 |
return; |
|
476 |
|
|
477 |
} catch (DataException e){ |
|
478 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
479 |
} |
|
407 | 480 |
} |
408 |
|
|
481 |
|
|
409 | 482 |
/** |
410 |
* Calculo de las coordenadas de una ventana IWindow para que quede centrada sobre el
|
|
483 |
* Calculo de las coordenadas de una ventana IWindow para que quede centrada sobre el |
|
411 | 484 |
* MainFrame. Estas coordenadas solo valen para un IWindow ya que andami mete las ventanas |
412 | 485 |
* con coordenadas relativas a su ventanta principal. |
413 | 486 |
* @param widthWindow Ancho de la ventana a a?adir |
414 | 487 |
* @param heightWindow Alto de la ventana a a?adir |
415 |
* @return Array con el ancho y el alto
|
|
488 |
* @return Array con el ancho y el alto |
|
416 | 489 |
*/ |
417 | 490 |
public static Point iwindowPosition(int widthWindow, int heightWindow) { |
418 | 491 |
int posWindowX = 0; |
Also available in: Unified diff