Revision 15441 import/ext3D/branches/ext3D_v1.1/ext3D/src/com/iver/ai2/gvsig3d/listener/canvasListener.java
canvasListener.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import es.upv.ai2.libjosg.Vec3; |
7 | 7 |
import es.upv.ai2.libjosg.planets.Planet; |
8 |
import es.upv.ai2.libjosg.planets.PlanetViewer; |
|
8 | 9 |
import es.upv.ai2.libjosg.viewer.Camera; |
9 | 10 |
import es.upv.ai2.libjosg.viewer.IViewerContainer; |
10 | 11 |
import es.upv.ai2.libjosg.viewer.OSGViewer; |
... | ... | |
20 | 21 |
|
21 | 22 |
private int frameRate = 24; |
22 | 23 |
|
24 |
private PlanetViewer m_planetViewer; |
|
25 |
|
|
23 | 26 |
private static boolean activeRot; |
24 | 27 |
|
25 | 28 |
public void setCanvas(IViewerContainer m_canvas3d) { |
26 | 29 |
this.m_canvas3d = m_canvas3d; |
30 |
this.m_planetViewer = (PlanetViewer) m_canvas3d.getOSGViewer(); |
|
27 | 31 |
} |
28 | 32 |
|
29 | 33 |
public void keyPressed(KeyEvent kev) { |
... | ... | |
34 | 38 |
case 'W': |
35 | 39 |
active = !active; |
36 | 40 |
if (active) { |
37 |
m_canvas3d.getOSGViewer().setPolygonMode(
|
|
41 |
m_planetViewer.setPolygonMode(
|
|
38 | 42 |
OSGViewer.PolygonModeType.GL_LINE); |
39 | 43 |
} else { |
40 |
m_canvas3d.getOSGViewer().setPolygonMode(
|
|
44 |
m_planetViewer.setPolygonMode(
|
|
41 | 45 |
OSGViewer.PolygonModeType.GL_FILL); |
42 | 46 |
} |
43 | 47 |
break; |
... | ... | |
119 | 123 |
// Rotate planet |
120 | 124 |
longi += 1.0; |
121 | 125 |
longi = longi > 360 ? 0 : longi; |
122 |
Camera cam = m_canvas3d.getOSGViewer().getCamera();
|
|
126 |
Camera cam = m_planetViewer.getCamera();
|
|
123 | 127 |
Vec3 camPos = planet.convertLatLongHeightToXYZ(new Vec3(lat, |
124 | 128 |
longi, cam.getEye().z())); |
125 | 129 |
|
126 | 130 |
cam.setViewByLookAt(camPos.x(), camPos.y(), 500000 * 16.6, |
127 | 131 |
0, 0, 0, 0, 0, 1); |
128 |
m_canvas3d.getOSGViewer().setCamera(cam);
|
|
132 |
m_planetViewer.setCamera(cam);
|
|
129 | 133 |
|
130 | 134 |
// Repainting canvas |
131 | 135 |
m_canvas3d.repaint(); |
Also available in: Unified diff