Revision 1192 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/infobypoint/InfoByRasterPointExtension.java
InfoByRasterPointExtension.java | ||
---|---|---|
22 | 22 |
package org.gvsig.raster.tools.app.basic.tool.infobypoint; |
23 | 23 |
|
24 | 24 |
import java.awt.Component; |
25 |
import java.util.Observable; |
|
26 |
import java.util.Observer; |
|
25 | 27 |
|
26 | 28 |
import javax.swing.JOptionPane; |
27 | 29 |
|
... | ... | |
41 | 43 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
42 | 44 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
43 | 45 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
44 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.gui.InfoByPointDataModel;
|
|
46 |
import org.gvsig.raster.swing.infobypoint.InfoByPointDataModel;
|
|
45 | 47 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.viewtool.InfoByPixelPointViewTool; |
46 | 48 |
import org.gvsig.raster.tools.app.basic.tool.infobypoint.viewtool.PixelInspectorViewTool; |
47 | 49 |
|
48 | 50 |
/** |
51 |
* Plugin for the information by point of a raster layer |
|
49 | 52 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
50 | 53 |
*/ |
51 | 54 |
public class InfoByRasterPointExtension extends Extension { |
... | ... | |
78 | 81 |
} |
79 | 82 |
MainInfoByPointDialog dialog = new MainInfoByPointDialog(false); |
80 | 83 |
InfoByPointDataModel model = dialog.getInfoByPointDataModel(); |
81 |
model.addObserver(dialog.getMainPanel());
|
|
84 |
((Observable)model).addObserver((Observer)dialog.getMainPanel());
|
|
82 | 85 |
|
83 | 86 |
lastTool = new InfoByPixelPointViewTool(mapCtrl, model); |
84 | 87 |
mapCtrl.addBehavior("infoByRasterPoint", |
... | ... | |
102 | 105 |
return ((AbstractViewPanel)theView).getMapControl(); |
103 | 106 |
} |
104 | 107 |
|
105 |
|
|
106 | 108 |
/* |
107 | 109 |
* (non-Javadoc) |
108 | 110 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled() |
... | ... | |
129 | 131 |
|
130 | 132 |
/* |
131 | 133 |
* (non-Javadoc) |
132 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled() |
|
133 |
*/ |
|
134 |
@SuppressWarnings("deprecation") |
|
135 |
public boolean isRasterLayerActive() { |
|
136 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
137 |
if (f == null) |
|
138 |
return false; |
|
139 |
if (f instanceof AbstractViewPanel) { |
|
140 |
AbstractViewPanel vista = (AbstractViewPanel) f; |
|
141 |
ViewDocument model = vista.getModel(); |
|
142 |
MapContext mapa = model.getMapContext(); |
|
143 |
FLayers layers = mapa.getLayers(); |
|
144 |
for (int i = 0; i < layers.getLayersCount(); i++) |
|
145 |
if (layers.getLayer(i) instanceof FLyrRaster) { |
|
146 |
FLyrRaster lyr = (FLyrRaster)layers.getLayer(i); |
|
147 |
if(lyr.isActive()) |
|
148 |
return true; |
|
149 |
} |
|
150 |
} |
|
151 |
return false; |
|
152 |
} |
|
153 |
|
|
154 |
/* |
|
155 |
* (non-Javadoc) |
|
156 | 134 |
* @see org.gvsig.andami.plugins.IExtension#isVisible() |
157 | 135 |
*/ |
158 | 136 |
public boolean isVisible() { |
... | ... | |
171 | 149 |
super.postInitialize(); |
172 | 150 |
ActionInfoManager manager = PluginsLocator.getActionInfoManager(); |
173 | 151 |
manager.redirect("layer-info-by-point", "layer-info-by-raster-point"); |
174 |
//ActionInfo infoByPointRaster = manager.getAction("layer-info-by-raster-point"); |
|
175 |
//oldActionInfo = manager.getAction("layer-info-by-point"); |
|
176 |
//oldActionInfo.getRedirections().add(infoByPointRaster); |
|
177 |
//oldActionInfo = manager.replaceAction(infoRaster, "layer-info-by-point"); |
|
178 | 152 |
} |
179 | 153 |
} |
Also available in: Unified diff