Revision 15487 import/ext3D/trunk/ext3D/src/com/iver/ai2/gvsig3d/gui/NavigationMenu3D.java
NavigationMenu3D.java | ||
---|---|---|
9 | 9 |
import javax.swing.JMenu; |
10 | 10 |
import javax.swing.JMenuBar; |
11 | 11 |
import javax.swing.JOptionPane; |
12 |
import javax.swing.JPopupMenu; |
|
13 |
import javax.swing.MenuElement; |
|
14 | 12 |
|
15 | 13 |
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D; |
16 | 14 |
import com.iver.ai2.gvsig3d.navigation.NavigationMode; |
17 |
import com.iver.ai2.gvsig3d.utils.UtilCoord; |
|
18 | 15 |
import com.iver.andami.PluginServices; |
19 | 16 |
import com.iver.andami.plugins.Extension; |
20 |
import com.iver.andami.plugins.ExtensionDecorator; |
|
21 | 17 |
import com.iver.andami.ui.mdiFrame.JMenuItem; |
22 | 18 |
import com.iver.andami.ui.mdiFrame.JToolBarButton; |
23 | 19 |
import com.iver.cit.gvsig.fmap.DriverException; |
24 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
|
25 | 20 |
import com.iver.cit.gvsig.project.documents.gui.FOpenDialog; |
26 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
|
27 | 21 |
|
28 | 22 |
import es.upv.ai2.libjosg.planets.Planet.PlanetType; |
29 |
import es.upv.ai2.libjosg.viewer.Camera; |
|
30 | 23 |
import es.upv.ai2.libjosg.viewer.CustomTerrainManipulator; |
31 | 24 |
import es.upv.ai2.libjosg.viewer.OSGViewer; |
32 | 25 |
|
... | ... | |
60 | 53 |
return; |
61 | 54 |
// Casting to View3D |
62 | 55 |
View3D vista3D = (View3D) view; |
63 |
|
|
56 |
|
|
64 | 57 |
navMode = vista3D.getNavMode(); |
65 | 58 |
|
66 | 59 |
// Action for ZOOM_SELECT |
... | ... | |
85 | 78 |
vista3D.getCanvas3d().getOSGViewer().setPolygonMode( |
86 | 79 |
OSGViewer.PolygonModeType.GL_FILL); |
87 | 80 |
vista3D.getCanvas3d().repaint(); |
88 |
} else if (actionCommand.equals("RESET_VIEW")) { |
|
89 |
FLayers3D layers = (FLayers3D)vista3D.getMapControl().getMapContext().getLayers(); |
|
81 |
} else if (actionCommand.equals("RESET_VIEW")) { // this conditional is to reset view |
|
82 |
// getting the layers |
|
83 |
FLayers3D layers = (FLayers3D) vista3D.getMapControl() |
|
84 |
.getMapContext().getLayers(); |
|
90 | 85 |
try { |
86 |
// getting the full extent of all layers added |
|
91 | 87 |
Rectangle2D ext = layers.getFullExtent(); |
92 |
layers.zoomToExtent(ext, 0.0); |
|
88 |
// if there were not layers i would have to insert by code the extent |
|
89 |
if (ext != null) |
|
90 |
layers.zoomToExtent(ext, 0.0); |
|
91 |
else { |
|
92 |
// Spherical extent |
|
93 |
if (vista3D.getPlanet().getType() == PlanetType.SPHERICAL_MODE) { |
|
94 |
ext = new Rectangle2D.Double(-180.0, -90.0, 360.0, |
|
95 |
180.0); |
|
96 |
} else { // Plane extent |
|
97 |
ext = new Rectangle2D.Double(-20000000.0, -10000000.0, |
|
98 |
40000000.0, 20000000.0); |
|
99 |
} |
|
100 |
layers.zoomToExtent(ext, 0.0); |
|
101 |
} |
|
93 | 102 |
} catch (DriverException e) { |
94 | 103 |
// TODO Auto-generated catch block |
95 | 104 |
e.printStackTrace(); |
96 | 105 |
} |
97 | 106 |
vista3D.repaint(); |
98 |
|
|
99 |
|
|
100 |
// Camera cam; |
|
101 |
// cam = vista3D.getCamera(); |
|
102 |
// |
|
103 |
// if (vista3D.getPlanet().getType() != PlanetType.PLANE_MODE) { |
|
104 |
// cam.setViewByLookAt( |
|
105 |
// vista3D.getPlanet().getRadiusEquatorial() * 3.0, 0, 0, |
|
106 |
// 0, 0, 0, 0, 0, 1); |
|
107 |
// |
|
108 |
// } else { |
|
109 |
//// cam.setViewByLookAt(0, 0, 5000000 * 4.6, 0, 0, 0, 0, 1, 0); |
|
110 |
// } |
|
111 |
// UtilCoord.imprimeCamara(cam); |
|
112 |
// vista3D.getCanvas3d().getOSGViewer().setCamera(cam); |
|
113 | 107 |
|
114 |
// UtilCoord.imprimeCamara(vista3D.getCamera()); |
|
115 |
// System.out.println("CAMBIANDO CAMARAAAAAAAAA!!!!!!!!!");s |
|
116 | 108 |
} else if (actionCommand.equals("ACTIVE")) { |
117 | 109 |
if (vista3D.getPlanet().getType() != PlanetType.PLANE_MODE) { |
118 | 110 |
|
119 | 111 |
CustomTerrainManipulator ctm = vista3D.getCanvas3d() |
120 | 112 |
.getOSGViewer().getCustomTerrainManipulator(); |
121 |
|
|
113 |
|
|
122 | 114 |
JToolBarButton b = (JToolBarButton) PluginServices |
123 |
.getMainFrame().getComponentByName("NORTH"); |
|
115 |
.getMainFrame().getComponentByName("NORTH");
|
|
124 | 116 |
if ((!ctm.getNorthOrientation()) && (myMenu != null)) { |
125 | 117 |
myMenu.setIcon(iconVis); |
126 | 118 |
|
Also available in: Unified diff