Revision 38564 branches/v2_0_0_prep/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomToSelectExtension.java
ZoomToSelectExtension.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.app.extension; |
23 | 23 |
|
24 |
import org.gvsig.andami.IconThemeHelper; |
|
24 | 25 |
import org.gvsig.andami.PluginServices; |
25 | 26 |
import org.gvsig.andami.messages.NotificationManager; |
26 | 27 |
import org.gvsig.andami.plugins.Extension; |
... | ... | |
40 | 41 |
public class ZoomToSelectExtension extends Extension { |
41 | 42 |
|
42 | 43 |
public void execute(String s) { |
43 |
org.gvsig.andami.ui.mdiManager.IWindow f = |
|
44 |
PluginServices.getMDIManager().getActiveWindow(); |
|
45 |
MapContext mapa = null; |
|
46 |
Envelope selectedExtent = null; |
|
47 |
if (f instanceof FeatureTableDocumentPanel) { |
|
48 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
|
49 |
mapa = (table.getModel().getAssociatedLayer()).getMapContext(); |
|
50 |
} |
|
51 |
|
|
52 |
try { |
|
53 |
selectedExtent = mapa.getSelectionBounds(); |
|
54 |
mapa.getViewPort().setEnvelope(selectedExtent); |
|
55 |
} catch (BaseException e) { |
|
56 |
NotificationManager.addError(e); |
|
57 |
} |
|
58 |
|
|
44 |
if( "view-navigation-zoom-to-selection-table".equalsIgnoreCase(s) ) { |
|
45 |
org.gvsig.andami.ui.mdiManager.IWindow f = |
|
46 |
PluginServices.getMDIManager().getActiveWindow(); |
|
47 |
MapContext mapa = null; |
|
48 |
Envelope selectedExtent = null; |
|
49 |
if (f instanceof FeatureTableDocumentPanel) { |
|
50 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
|
51 |
mapa = (table.getModel().getAssociatedLayer()).getMapContext(); |
|
52 |
} |
|
53 |
|
|
54 |
try { |
|
55 |
selectedExtent = mapa.getSelectionBounds(); |
|
56 |
mapa.getViewPort().setEnvelope(selectedExtent); |
|
57 |
} catch (BaseException e) { |
|
58 |
NotificationManager.addError(e); |
|
59 |
} |
|
60 |
} |
|
59 | 61 |
} |
60 | 62 |
|
61 | 63 |
public boolean isVisible() { |
... | ... | |
122 | 124 |
} |
123 | 125 |
|
124 | 126 |
private void registerIcons() { |
125 |
PluginServices.getIconTheme().registerDefault( |
|
126 |
"table-zoom-to-seleccion", |
|
127 |
this.getClass().getClassLoader() |
|
128 |
.getResource("images/ZoomSeleccion.png")); |
|
127 |
IconThemeHelper.registerIcon("action", "view-navigation-zoom-to-selection", this); |
|
129 | 128 |
} |
130 | 129 |
} |
Also available in: Unified diff