Revision 32540 branches/gvSIG_19_ext3D_osgVP_2_2_0/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/manipulator/EnableManipulation3DExtension.java
EnableManipulation3DExtension.java | ||
---|---|---|
1 | 1 |
package org.gvsig.gvsig3dgui.manipulator; |
2 | 2 |
|
3 |
import java.awt.event.ComponentEvent; |
|
4 |
import java.awt.event.ComponentListener; |
|
3 | 5 |
import java.io.File; |
4 | 6 |
|
5 | 7 |
import javax.swing.Icon; |
6 | 8 |
import javax.swing.ImageIcon; |
7 | 9 |
|
8 | 10 |
import org.gvsig.gvsig3d.cacheservices.OSGCacheService; |
9 |
import org.gvsig.gvsig3d.map3d.MapContext3D; |
|
10 | 11 |
import org.gvsig.gvsig3dgui.view.View3D; |
11 |
|
|
12 | 12 |
import org.gvsig.osgvp.core.osg.Vec4; |
13 | 13 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
14 | 14 |
import org.gvsig.osgvp.features.Text; |
15 |
import org.gvsig.osgvp.manipulator.Manipulator.DraggerType; |
|
16 | 15 |
import org.gvsig.osgvp.terrain.TerrainViewer; |
17 | 16 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
18 | 17 |
|
... | ... | |
21 | 20 |
import com.iver.andami.PluginServices; |
22 | 21 |
import com.iver.andami.plugins.Extension; |
23 | 22 |
import com.iver.andami.ui.mdiFrame.JToolBarButton; |
24 |
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException; |
|
25 | 23 |
import com.iver.cit.gvsig.fmap.MapContext; |
26 | 24 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
27 | 25 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
... | ... | |
34 | 32 |
private TerrainViewer _terrainViewer; |
35 | 33 |
private Text _editionHud; |
36 | 34 |
private FLayer _lastActiveLayer = null; |
35 |
private HudResizeListener _resizeListener; |
|
37 | 36 |
|
38 | 37 |
public void execute(String actionCommand) { |
39 | 38 |
|
... | ... | |
75 | 74 |
"enable_manipulator", |
76 | 75 |
this.getClass().getClassLoader() |
77 | 76 |
.getResource("images/pick2.png")); |
77 |
_resizeListener = new HudResizeListener(); |
|
78 | 78 |
|
79 | 79 |
} |
80 | 80 |
|
... | ... | |
87 | 87 |
if ((view instanceof View3D)) { |
88 | 88 |
// Casting to View3D |
89 | 89 |
View3D vista3D = (View3D) view; |
90 |
|
|
90 |
|
|
91 | 91 |
_canvas3d = vista3D.getCanvas3d(); |
92 | 92 |
|
93 | 93 |
IProjectView model = vista3D.getModel(); |
... | ... | |
130 | 130 |
OSGCacheService lastCache = ((OSGCacheService) lastProps3D |
131 | 131 |
.getCacheService()); |
132 | 132 |
lastCache.endEditing(); |
133 |
//lastCache.disableEditionListener(); |
|
133 |
// lastCache.disableEditionListener();
|
|
134 | 134 |
|
135 | 135 |
} |
136 |
|
|
136 |
|
|
137 | 137 |
if (!cache.getManipulatorsActive()) { |
138 | 138 |
|
139 | 139 |
b.setIcon(iconActivar); |
... | ... | |
197 | 197 |
_editionHud.setFont("arial.ttf"); |
198 | 198 |
} |
199 | 199 |
|
200 |
_editionHud.setPosition(10, 10, 0);
|
|
200 |
_editionHud.setPosition(0, 0, 0);
|
|
201 | 201 |
_editionHud.setBackdropType(Text.BackdropType.OUTLINE); |
202 | 202 |
_editionHud.setAlignment(Text.AlignmentType.LEFT_CENTER); |
203 | 203 |
_editionHud |
... | ... | |
209 | 209 |
|
210 | 210 |
_terrainViewer = (TerrainViewer) _canvas3d.getOSGViewer(); |
211 | 211 |
if (_terrainViewer != null) { |
212 |
_editionHud.setPosition(10, _canvas3d.getHeight() - 10, 0); |
|
213 | 212 |
|
214 | 213 |
try { |
215 | 214 |
if (_terrainViewer.getCameraHUD().getChildIndex(_editionHud) >= _terrainViewer |
216 | 215 |
.getCameraHUD().getNumChildren()) { |
217 | 216 |
_terrainViewer.addNodeToCameraHUD(_editionHud); |
217 |
_editionHud.setPosition(10, _canvas3d.getHeight()-10, 0); |
|
218 |
_canvas3d.addComponentListener(_resizeListener); |
|
219 |
|
|
218 | 220 |
} |
219 | 221 |
|
220 | 222 |
} catch (NodeException e) { |
... | ... | |
232 | 234 |
if (_terrainViewer.getCameraHUD().getChildIndex(_editionHud) < _terrainViewer |
233 | 235 |
.getCameraHUD().getNumChildren()) { |
234 | 236 |
_terrainViewer.removeNodeFromCameraHUD(_editionHud); |
237 |
_canvas3d.removeComponentListener(_resizeListener); |
|
235 | 238 |
} |
236 | 239 |
|
237 | 240 |
} catch (NodeException e) { |
... | ... | |
242 | 245 |
|
243 | 246 |
} |
244 | 247 |
|
248 |
public class HudResizeListener implements ComponentListener { |
|
249 |
|
|
250 |
public void componentResized(java.awt.event.ComponentEvent evt) { |
|
251 |
_editionHud.setPosition(10, _canvas3d.getHeight() - 10, 0); |
|
252 |
} |
|
253 |
|
|
254 |
public void componentHidden(ComponentEvent arg0) { |
|
255 |
_editionHud.setPosition(10, _canvas3d.getHeight() - 10, 0); |
|
256 |
|
|
257 |
} |
|
258 |
|
|
259 |
public void componentMoved(ComponentEvent arg0) { |
|
260 |
_editionHud.setPosition(10, _canvas3d.getHeight() - 10, 0); |
|
261 |
|
|
262 |
} |
|
263 |
|
|
264 |
public void componentShown(ComponentEvent arg0) { |
|
265 |
_editionHud.setPosition(10, _canvas3d.getHeight() - 10, 0); |
|
266 |
|
|
267 |
} |
|
268 |
|
|
269 |
} |
|
270 |
|
|
245 | 271 |
} |
Also available in: Unified diff