Revision 1313
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.reproject/src/main/java/org/gvsig/raster/tools/app/reproject/ReprojectExtension.java | ||
---|---|---|
22 | 22 |
package org.gvsig.raster.tools.app.reproject; |
23 | 23 |
|
24 | 24 |
import org.gvsig.andami.IconThemeHelper; |
25 |
import org.gvsig.andami.PluginServices; |
|
25 | 26 |
import org.gvsig.andami.plugins.Extension; |
27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
28 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
29 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
32 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
33 |
import org.gvsig.raster.fmap.layers.ILayerState; |
|
34 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
|
26 | 35 |
import org.gvsig.tools.ToolsLocator; |
36 |
import org.gvsig.tools.extensionpoint.ExtensionBuilder; |
|
27 | 37 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
28 | 38 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
29 | 39 |
|
... | ... | |
32 | 42 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
33 | 43 |
*/ |
34 | 44 |
public class ReprojectExtension extends Extension { |
45 |
private ExtensionPoint genericToolBarMenuExtensionPoint = null; |
|
46 |
private static String action = "Reproject"; |
|
35 | 47 |
|
36 | 48 |
public void initialize() { |
37 | 49 |
IconThemeHelper.registerIcon("action", "tools-raster-reproject", this); |
38 | 50 |
|
39 | 51 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
40 | 52 |
ExtensionPoint point = extensionPoints.add("GenericToolBarMenu"); |
41 |
point.append("Reproject", "", ReprojectTocMenuEntry.getSingleton());
|
|
53 |
point.append(action, "", ReprojectTocMenuEntry.getSingleton());
|
|
42 | 54 |
} |
43 | 55 |
|
44 | 56 |
public void execute(String actionCommand) { |
57 |
//Las entradas en GenericToolBarModule est?n registradas con la misma etiqueta que la del actionCommand |
|
58 |
//De esta forma pueden recuperarse los TocMenuEntry del punto de extensi?n y ejecutar la acci?n a |
|
59 |
//trav?s de este. |
|
60 |
ExtensionBuilder ext = getGenericToolBarMenuExtensionPoint().get(actionCommand).getBuilder(); |
|
61 |
if(ext != null && ext instanceof AbstractTocContextMenuAction) { |
|
62 |
IWindow w = PluginServices.getMDIManager().getActiveWindow(); |
|
63 |
if(w instanceof AbstractViewPanel) { |
|
64 |
FLayers lyrs = ((AbstractViewPanel)w).getMapControl().getMapContext().getLayers(); |
|
65 |
FLayer[] actives = lyrs.getActives(); |
|
66 |
((AbstractTocContextMenuAction)ext).execute(null, actives); |
|
67 |
} |
|
68 |
} |
|
45 | 69 |
} |
46 | 70 |
|
47 | 71 |
public boolean isEnabled() { |
48 |
return true; |
|
72 |
IWindow w = PluginServices.getMDIManager().getActiveWindow(); |
|
73 |
if(w instanceof AbstractViewPanel) { |
|
74 |
FLayers lyrs = ((AbstractViewPanel)w).getMapControl().getMapContext().getLayers(); |
|
75 |
FLayer[] actives = lyrs.getActives(); |
|
76 |
if(actives != null && actives.length > 0) { |
|
77 |
for (int i = 0; i < actives.length; i++) { |
|
78 |
if(actives[i] instanceof FLyrRaster && ((ILayerState)actives[i]).isOpen()) { |
|
79 |
return true; |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
return false; |
|
49 | 85 |
} |
50 | 86 |
|
51 | 87 |
public boolean isVisible() { |
88 |
IWindow w = PluginServices.getMDIManager().getActiveWindow(); |
|
89 |
if(w instanceof AbstractViewPanel) { |
|
90 |
FLayers lyrs = ((AbstractViewPanel)w).getMapControl().getMapContext().getLayers(); |
|
91 |
FLayer[] actives = lyrs.getActives(); |
|
92 |
if(actives != null && actives.length > 0) { |
|
93 |
for (int i = 0; i < actives.length; i++) { |
|
94 |
if(actives[i] instanceof FLyrRaster && |
|
95 |
((IRasterLayerActions)actives[i]).isActionEnabled(IRasterLayerActions.REPROJECT)) { |
|
96 |
return true; |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
52 | 101 |
return false; |
53 | 102 |
} |
103 |
|
|
104 |
public ExtensionPoint getGenericToolBarMenuExtensionPoint() { |
|
105 |
if(genericToolBarMenuExtensionPoint == null) { |
|
106 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
107 |
genericToolBarMenuExtensionPoint = extensionPoints.get("GenericToolBarMenu"); |
|
108 |
} |
|
109 |
return genericToolBarMenuExtensionPoint; |
|
110 |
} |
|
54 | 111 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.reproject/src/main/resources/text.properties | ||
---|---|---|
1 |
toc_reproject=Reproyectar capa
|
|
1 |
reproject_layer=Reproyectar
|
|
2 | 2 |
reprojection=Reproyecci?n |
3 | 3 |
wrong_size=Tama?o incorrecto en la imagen de salida |
4 | 4 |
wrong_projection=Proyecci?n incorrecta |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.reproject/src/main/resources/text_en.properties | ||
---|---|---|
1 |
toc_reproject=Reproject layer
|
|
1 |
reproject_layer=Reproject
|
|
2 | 2 |
reprojection=Reprojection |
3 | 3 |
wrong_size=Wrong size in output image |
4 | 4 |
wrong_projection=Wrong projection |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.reproject/src/main/resources/config.xml | ||
---|---|---|
8 | 8 |
description="Reproject plugin" |
9 | 9 |
active="true" |
10 | 10 |
priority="1"> |
11 |
|
|
12 |
<menu text="Layer/reproject_layer" |
|
13 |
position="0" |
|
14 |
action-command="Reproject" |
|
15 |
icon="tools-raster-reproject"/> |
|
16 |
|
|
11 | 17 |
</extension> |
12 | 18 |
</extensions> |
13 | 19 |
</plugin-config> |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterExtension.java | ||
---|---|---|
285 | 285 |
* (non-Javadoc) |
286 | 286 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
287 | 287 |
*/ |
288 |
@SuppressWarnings("deprecation") |
|
289 | 288 |
public boolean isEnabled() { |
290 | 289 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
291 | 290 |
if (f == null) |
292 | 291 |
return false; |
293 | 292 |
if (f instanceof AbstractViewPanel) { |
294 |
AbstractViewPanel vista = (AbstractViewPanel) f; |
|
295 |
ViewDocument model = vista.getModel(); |
|
296 |
MapContext mapa = model.getMapContext(); |
|
297 |
FLayers layers = mapa.getLayers(); |
|
298 |
for (int i = 0; i < layers.getLayersCount(); i++) |
|
299 |
if (layers.getLayer(i) instanceof FLyrRaster) |
|
293 |
FLayers lyrs = ((AbstractViewPanel)f).getMapControl().getMapContext().getLayers(); |
|
294 |
for (int i = 0; i < lyrs.getLayersCount(); i++) |
|
295 |
if (lyrs.getLayer(i) instanceof FLyrRaster) |
|
300 | 296 |
return true; |
301 | 297 |
} |
302 | 298 |
return false; |
... | ... | |
305 | 301 |
/** |
306 | 302 |
* Mostramos el control si hay alguna capa cargada. |
307 | 303 |
*/ |
308 |
@SuppressWarnings("deprecation") |
|
309 | 304 |
public boolean isVisible() { |
310 | 305 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
311 | 306 |
if (f == null) |
312 | 307 |
return false; |
313 | 308 |
|
314 | 309 |
if (f instanceof AbstractViewPanel) { |
315 |
AbstractViewPanel vista = (AbstractViewPanel) f; |
|
316 |
ViewDocument model = vista.getModel(); |
|
317 |
MapContext mapa = model.getMapContext(); |
|
318 |
if (mapa.getLayers().getLayersCount() > 0) |
|
310 |
FLayers lyrs = ((AbstractViewPanel)f).getMapControl().getMapContext().getLayers(); |
|
311 |
if (lyrs.getLayersCount() > 0) |
|
319 | 312 |
return true; |
320 | 313 |
} |
321 | 314 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/geolocation/GeoLocationTocMenuEntry.java | ||
---|---|---|
40 | 40 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
41 | 41 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
42 | 42 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
43 |
import org.gvsig.raster.fmap.layers.ILayerState; |
|
43 | 44 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
44 | 45 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
45 | 46 |
import org.gvsig.raster.tools.app.basic.raster.gui.IGenericToolBarMenuItem; |
... | ... | |
112 | 113 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[]) |
113 | 114 |
*/ |
114 | 115 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
116 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
|
117 |
return false; |
|
118 |
|
|
119 |
if (!(selectedItems[0] instanceof ILayerState)) |
|
120 |
return false; |
|
121 |
|
|
122 |
if (!((ILayerState) selectedItems[0]).isOpen()) |
|
123 |
return false; |
|
115 | 124 |
return true; |
116 | 125 |
} |
117 | 126 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/config.xml | ||
---|---|---|
30 | 30 |
action-command="HistogramPanel" |
31 | 31 |
icon="layer-histogram"/> |
32 | 32 |
|
33 |
<menu text="Layer/Raster/tablas_color"
|
|
33 |
<menu text="Layer/tablas_color" |
|
34 | 34 |
position="0" |
35 | 35 |
action-command="ViewColorTable" |
36 | 36 |
icon="layer-color-table"/> |
... | ... | |
60 | 60 |
action-command="GeoLocation" |
61 | 61 |
icon="layer-geolocalization"/> |
62 | 62 |
|
63 |
<menu text="Layer/toc_reproject" |
|
64 |
position="0" |
|
65 |
action-command="Reproject" |
|
66 |
icon="tools-raster-reproject"/> |
|
67 |
|
|
68 | 63 |
<!-- ************* --> |
69 | 64 |
|
70 | 65 |
<menu text="Layer/export_to/saveas" |
Also available in: Unified diff