gvsig-3d / 1.10 / trunk / extensions / ext3Dgui / src / org / gvsig / gvsig3dgui / display / WireframeMode.java @ 99
History | View | Annotate | Download (1.32 KB)
1 |
package org.gvsig.gvsig3dgui.display; |
---|---|
2 |
|
3 |
import org.gvsig.gvsig3dgui.view.View3D; |
4 |
import org.gvsig.osgvp.viewer.OSGViewer; |
5 |
|
6 |
import com.iver.andami.PluginServices; |
7 |
import com.iver.andami.plugins.Extension; |
8 |
|
9 |
public class WireframeMode extends Extension { |
10 |
|
11 |
public void execute(String actionCommand) { |
12 |
// Getting view3D
|
13 |
com.iver.andami.ui.mdiManager.IWindow view = PluginServices |
14 |
.getMDIManager().getActiveWindow(); |
15 |
if (!(view instanceof View3D)) |
16 |
return;
|
17 |
|
18 |
OSGViewer viewer = (OSGViewer) ((View3D) view).getCanvas3d() |
19 |
.getOSGViewer(); |
20 |
|
21 |
|
22 |
|
23 |
if (actionCommand.equals("WIREFRAME")) { |
24 |
|
25 |
if(viewer.getPolygonMode() == OSGViewer.PolygonModeType.GL_FILL)
|
26 |
viewer.setPolygonMode(OSGViewer.PolygonModeType.GL_LINE); |
27 |
else
|
28 |
viewer.setPolygonMode(OSGViewer.PolygonModeType.GL_FILL); |
29 |
|
30 |
|
31 |
} |
32 |
|
33 |
} |
34 |
|
35 |
public void initialize() { |
36 |
// Register new icons
|
37 |
// zoom to selection
|
38 |
PluginServices.getIconTheme().registerDefault( |
39 |
"wireframe-icon",
|
40 |
this.getClass().getClassLoader().getResource(
|
41 |
"images/WireFrame.png"));
|
42 |
|
43 |
} |
44 |
|
45 |
public boolean isEnabled() { |
46 |
if (PluginServices.getMDIManager().getActiveWindow() instanceof View3D) |
47 |
return true; |
48 |
else
|
49 |
return false; |
50 |
} |
51 |
|
52 |
public boolean isVisible() { |
53 |
if (PluginServices.getMDIManager().getActiveWindow() instanceof View3D) |
54 |
return true; |
55 |
else
|
56 |
return false; |
57 |
} |
58 |
|
59 |
} |