Revision 20900
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/Extension3D.java | ||
---|---|---|
50 | 50 |
public void terminate() { |
51 | 51 |
super.terminate(); |
52 | 52 |
} |
53 |
|
|
53 | 54 |
} |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/listener/PointSelectListerner3D.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.geom.Point2D; |
4 | 4 |
|
5 |
import org.gvsig.osgvp.Vec3; |
|
6 |
import org.gvsig.osgvp.viewer.Intersections; |
|
7 |
|
|
5 | 8 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
6 | 9 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
7 | 10 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
8 |
import com.iver.andami.PluginServices; |
|
9 | 11 |
import com.iver.andami.messages.NotificationManager; |
10 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
11 | 12 |
import com.iver.cit.gvsig.exceptions.visitors.VisitorException; |
12 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
13 | 13 |
import com.iver.cit.gvsig.fmap.MapControl; |
14 | 14 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
15 | 15 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
16 | 16 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
17 |
import com.iver.cit.gvsig.fmap.layers.SelectionEvent; |
|
18 | 17 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
19 | 18 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
20 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
|
21 | 19 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.PointSelectListener; |
22 | 20 |
|
23 |
import es.upv.ai2.osgvp.Vec3; |
|
24 |
import es.upv.ai2.osgvp.viewer.Intersections; |
|
25 |
|
|
26 | 21 |
public class PointSelectListerner3D extends PointSelectListener { |
27 | 22 |
|
28 | 23 |
public PointSelectListerner3D(MapControl mapCtrl) { |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/listener/RectangleSelectListener3D.java | ||
---|---|---|
3 | 3 |
import java.awt.geom.Point2D; |
4 | 4 |
import java.awt.geom.Rectangle2D; |
5 | 5 |
|
6 |
import org.gvsig.osgvp.Vec3; |
|
7 |
import org.gvsig.osgvp.viewer.Intersections; |
|
8 |
|
|
6 | 9 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
7 | 10 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
8 | 11 |
import com.iver.andami.messages.NotificationManager; |
... | ... | |
15 | 18 |
import com.iver.cit.gvsig.fmap.tools.RectangleSelectionListener; |
16 | 19 |
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent; |
17 | 20 |
|
18 |
import es.upv.ai2.osgvp.Vec3; |
|
19 |
import es.upv.ai2.osgvp.viewer.Intersections; |
|
20 |
|
|
21 | 21 |
public class RectangleSelectListener3D extends RectangleSelectionListener { |
22 | 22 |
|
23 | 23 |
private MapControl mapControl; |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/camera/Encuadrator3D.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.ai2.gvsig3dgui.camera; |
42 | 42 |
|
43 |
import org.gvsig.osgvp.viewer.Camera; |
|
44 |
|
|
43 | 45 |
import com.iver.ai2.gvsig3d.camera.ProjectCamera; |
44 | 46 |
import com.iver.ai2.gvsig3dgui.view.View3D; |
45 | 47 |
import com.iver.cit.gvsig.fmap.MapContext; |
... | ... | |
47 | 49 |
import com.iver.cit.gvsig.project.documents.view.ListSelectorListener; |
48 | 50 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
49 | 51 |
|
50 |
import es.upv.ai2.osgvp.viewer.Camera; |
|
51 |
|
|
52 | 52 |
public class Encuadrator3D implements ListSelectorListener { |
53 | 53 |
|
54 | 54 |
private Project project; |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/behavior/RectangleBehavior3D.java | ||
---|---|---|
7 | 7 |
import java.awt.geom.Point2D; |
8 | 8 |
import java.awt.geom.Rectangle2D; |
9 | 9 |
|
10 |
import org.apache.log4j.Logger; |
|
11 |
import org.gvsig.osgvp.Vec3; |
|
12 |
import org.gvsig.osgvp.exceptions.OSGVPException; |
|
13 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
|
14 |
import org.gvsig.osgvp.features.SelectionRectangle; |
|
15 |
import org.gvsig.osgvp.features.Polygon.PolygonType; |
|
16 |
import org.gvsig.osgvp.planets.PlanetViewer; |
|
17 |
import org.gvsig.osgvp.viewer.Intersections; |
|
18 |
|
|
19 |
import com.iver.ai2.gvsig3d.map3d.GraphicLayer3D; |
|
10 | 20 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
11 | 21 |
import com.iver.andami.messages.NotificationManager; |
12 | 22 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
... | ... | |
14 | 24 |
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent; |
15 | 25 |
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener; |
16 | 26 |
|
17 |
import es.upv.ai2.osgvp.Vec3; |
|
18 |
import es.upv.ai2.osgvp.features.SelectionRectangle; |
|
19 |
import es.upv.ai2.osgvp.features.Polygon.PolygonType; |
|
20 |
import es.upv.ai2.osgvp.planets.PlanetViewer; |
|
21 |
import es.upv.ai2.osgvp.viewer.Intersections; |
|
27 |
public class RectangleBehavior3D extends RectangleBehavior { |
|
22 | 28 |
|
23 |
public class RectangleBehavior3D extends RectangleBehavior { |
|
24 |
|
|
25 | 29 |
private Point2D m_FirstPoint; |
26 | 30 |
private Point2D m_LastPoint; |
27 | 31 |
private RectangleListener listener; |
... | ... | |
29 | 33 |
private int height; |
30 | 34 |
private int width; |
31 | 35 |
|
36 |
private static Logger logger = Logger.getLogger(GraphicLayer3D.class |
|
37 |
.getName()); |
|
32 | 38 |
|
33 | 39 |
public RectangleBehavior3D(RectangleListener zili) { |
34 | 40 |
super(zili); |
35 | 41 |
// TODO Auto-generated constructor stub |
36 | 42 |
listener = zili; |
37 |
rectangle = new SelectionRectangle(); |
|
38 |
|
|
43 |
try { |
|
44 |
rectangle = new SelectionRectangle(); |
|
45 |
} catch (OSGVPException e) { |
|
46 |
logger.error("Command: " |
|
47 |
+ "Error creating new selection rectangle.", e); |
|
48 |
} |
|
49 |
|
|
39 | 50 |
} |
40 | 51 |
|
41 | 52 |
@Override |
42 | 53 |
public void mouseDragged(MouseEvent e) { |
43 | 54 |
// TODO Auto-generated method stub |
44 |
// super.mouseDragged(e);
|
|
55 |
// super.mouseDragged(e);
|
|
45 | 56 |
// Painting |
46 |
rectangle.setMouseCoords((int)e.getPoint().getX(),height -(int) e.getPoint().getY()); |
|
47 |
rectangle.update(); |
|
48 |
|
|
57 |
rectangle.setMouseCoords((int) e.getPoint().getX(), height |
|
58 |
- (int) e.getPoint().getY()); |
|
59 |
try { |
|
60 |
rectangle.update(); |
|
61 |
} catch (OSGVPException e1) { |
|
62 |
logger.error("Command: " + "Error updating rectangle selection.", |
|
63 |
e1); |
|
64 |
} |
|
65 |
|
|
49 | 66 |
rectangle.setType(PolygonType.FILLED_POLYGON); |
50 | 67 |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 | 68 |
} |
55 | 69 |
|
56 | 70 |
@Override |
57 | 71 |
public void mousePressed(MouseEvent e) { |
58 | 72 |
// TODO Auto-generated method stub |
59 | 73 |
MapContext3D mcontext = (MapContext3D) getMapControl().getMapContext(); |
60 |
((PlanetViewer)mcontext.getCanvas3d().getOSGViewer()).addNodeToHUD(rectangle); |
|
74 |
try { |
|
75 |
((PlanetViewer) mcontext.getCanvas3d().getOSGViewer()) |
|
76 |
.addNodeToHUD(rectangle); |
|
77 |
} catch (NodeException e1) { |
|
78 |
logger.error("Command: " |
|
79 |
+ "Error adding the rectangle selecton to the hud node.", |
|
80 |
e1); |
|
81 |
} |
|
61 | 82 |
height = mcontext.getCanvas3d().getHeight(); |
62 |
width =mcontext.getCanvas3d().getWidth(); |
|
63 |
|
|
83 |
width = mcontext.getCanvas3d().getWidth();
|
|
84 |
|
|
64 | 85 |
if (e.getButton() == MouseEvent.BUTTON1) { |
65 | 86 |
m_FirstPoint = e.getPoint(); |
66 | 87 |
// Put here the code to star drawing the rectangle |
67 |
rectangle.setFirstPoint((int)m_FirstPoint.getX(),height - (int)m_FirstPoint.getY()); |
|
68 |
rectangle.setMouseCoords((int)m_FirstPoint.getX(),height -(int)m_FirstPoint.getY()); |
|
88 |
rectangle.setFirstPoint((int) m_FirstPoint.getX(), height |
|
89 |
- (int) m_FirstPoint.getY()); |
|
90 |
rectangle.setMouseCoords((int) m_FirstPoint.getX(), height |
|
91 |
- (int) m_FirstPoint.getY()); |
|
69 | 92 |
|
70 |
rectangle.update(); |
|
93 |
try { |
|
94 |
rectangle.update(); |
|
95 |
} catch (OSGVPException e1) { |
|
96 |
logger.error("Command: " |
|
97 |
+ "Error updating rectangle selection.", e1); |
|
98 |
} |
|
71 | 99 |
rectangle.setType(PolygonType.EMPTY_POLYGON); |
72 | 100 |
} |
73 | 101 |
} |
74 | 102 |
|
75 | 103 |
@Override |
76 | 104 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
77 |
|
|
78 |
if (m_FirstPoint == null) return; |
|
79 |
Point2D p1 = new Point2D.Double(); |
|
105 |
|
|
106 |
if (m_FirstPoint == null) |
|
107 |
return; |
|
108 |
Point2D p1 = new Point2D.Double(); |
|
80 | 109 |
Point2D p2 = new Point2D.Double(); |
81 | 110 |
Point pScreen = e.getPoint(); |
82 |
|
|
83 |
// ViewPort vp = getMapControl().getMapContext().getViewPort();
|
|
84 |
|
|
85 |
// p1 = vp.toMapPoint(m_FirstPoint);
|
|
86 |
// p2 = vp.toMapPoint(pScreen);
|
|
111 |
|
|
112 |
// ViewPort vp = getMapControl().getMapContext().getViewPort();
|
|
113 |
|
|
114 |
// p1 = vp.toMapPoint(m_FirstPoint);
|
|
115 |
// p2 = vp.toMapPoint(pScreen);
|
|
87 | 116 |
Vec3 p1Vec = coordinatesIntersection(m_FirstPoint); |
88 |
p1.setLocation(p1Vec.x(),p1Vec.y()); |
|
117 |
p1.setLocation(p1Vec.x(), p1Vec.y());
|
|
89 | 118 |
Vec3 p2Vec = coordinatesIntersection(pScreen); |
90 |
p2.setLocation(p2Vec.x(),p2Vec.y()); |
|
91 |
|
|
119 |
p2.setLocation(p2Vec.x(), p2Vec.y());
|
|
120 |
|
|
92 | 121 |
if (e.getButton() == MouseEvent.BUTTON1) { |
93 |
// Fijamos el nuevo extent
|
|
122 |
// Fijamos el nuevo extent
|
|
94 | 123 |
Rectangle2D.Double r = new Rectangle2D.Double(); |
95 | 124 |
r.setFrameFromDiagonal(p1, p2); |
96 |
|
|
125 |
|
|
97 | 126 |
Rectangle2D rectPixel = new Rectangle(); |
98 | 127 |
rectPixel.setFrameFromDiagonal(m_FirstPoint, pScreen); |
99 |
|
|
128 |
|
|
100 | 129 |
RectangleEvent event = new RectangleEvent(r, e, rectPixel); |
101 | 130 |
listener.rectangle(event); |
102 |
|
|
131 |
|
|
103 | 132 |
} |
104 |
|
|
133 |
|
|
105 | 134 |
// Deleted rectangle |
106 |
rectangle.setMouseCoords((int)m_FirstPoint.getX(),height -(int)m_FirstPoint.getY()); |
|
107 |
rectangle.update(); |
|
135 |
rectangle.setMouseCoords((int) m_FirstPoint.getX(), height |
|
136 |
- (int) m_FirstPoint.getY()); |
|
137 |
try { |
|
138 |
rectangle.update(); |
|
139 |
} catch (OSGVPException e1) { |
|
140 |
logger.error("Command: " + "Error updating rectangle selection.", |
|
141 |
e1); |
|
142 |
} |
|
108 | 143 |
rectangle.setType(PolygonType.EMPTY_POLYGON); |
109 |
|
|
144 |
|
|
110 | 145 |
m_FirstPoint = null; |
111 | 146 |
m_LastPoint = null; |
112 | 147 |
} |
... | ... | |
114 | 149 |
@Override |
115 | 150 |
public void paintComponent(Graphics g) { |
116 | 151 |
// TODO Auto-generated method stub |
117 |
// super.paintComponent(g);
|
|
152 |
// super.paintComponent(g);
|
|
118 | 153 |
MapContext3D mcontext = (MapContext3D) getMapControl().getMapContext(); |
119 | 154 |
mcontext.getCanvas3d().repaint(); |
120 | 155 |
} |
121 | 156 |
|
122 | 157 |
public Vec3 coordinatesIntersection(Point2D pScreen) { |
123 | 158 |
Vec3 intersection; |
124 |
|
|
159 |
|
|
125 | 160 |
// System.err.println("Coordenadas de pantalla " + pScreen.getX() + ","+ |
126 | 161 |
// pScreen.getY()); |
127 | 162 |
MapContext3D mcontext = (MapContext3D) getMapControl().getMapContext(); |
... | ... | |
135 | 170 |
|
136 | 171 |
// System.err.println("Interseccion de osg " + hit.x() + ","+ |
137 | 172 |
// hit.y()); |
138 |
if (mcontext.getProjection().getAbrev().compareToIgnoreCase("EPSG:4326") == 0) { |
|
139 |
Vec3 geoPt = mcontext.getPlanet().convertXYZToLatLongHeight(hit); |
|
173 |
if (mcontext.getProjection().getAbrev().compareToIgnoreCase( |
|
174 |
"EPSG:4326") == 0) { |
|
175 |
Vec3 geoPt = mcontext.getPlanet() |
|
176 |
.convertXYZToLatLongHeight(hit); |
|
140 | 177 |
// Swap the coordinates X and Y, because they are invert. |
141 |
intersection = new Vec3(geoPt.y(),geoPt.x(),geoPt.z());
|
|
178 |
intersection = new Vec3(geoPt.y(), geoPt.x(), geoPt.z());
|
|
142 | 179 |
} else { |
143 | 180 |
intersection = hit; |
144 | 181 |
} |
145 | 182 |
} else { |
146 |
if (mcontext.getProjection().getAbrev().compareToIgnoreCase("EPSG:4326") == 0) { |
|
183 |
if (mcontext.getProjection().getAbrev().compareToIgnoreCase( |
|
184 |
"EPSG:4326") == 0) { |
|
147 | 185 |
pWorld.setLocation(360, 120); |
148 |
intersection = new Vec3(360,120,0);
|
|
149 |
} else{ |
|
150 |
intersection = new Vec3(1e100,1e100,0);
|
|
151 |
// pWorld.setLocation(1e100, 1e100);
|
|
186 |
intersection = new Vec3(360, 120, 0);
|
|
187 |
} else {
|
|
188 |
intersection = new Vec3(1e100, 1e100, 0);
|
|
189 |
// pWorld.setLocation(1e100, 1e100);
|
|
152 | 190 |
} |
153 | 191 |
} |
154 |
NotificationManager.addInfo("Obteniendo punto de informacion "+ intersection.x() + " , " + intersection.y() +" , "+ intersection.z()); |
|
192 |
NotificationManager.addInfo("Obteniendo punto de informacion " |
|
193 |
+ intersection.x() + " , " + intersection.y() + " , " |
|
194 |
+ intersection.z()); |
|
155 | 195 |
return intersection; |
156 | 196 |
} |
157 |
|
|
158 | 197 |
|
159 | 198 |
} |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/navigation/NavigationMenu3D.java | ||
---|---|---|
13 | 13 |
import javax.swing.ImageIcon; |
14 | 14 |
import javax.swing.JOptionPane; |
15 | 15 |
|
16 |
import org.gvsig.osgvp.planets.CustomTerrainManipulator; |
|
17 |
import org.gvsig.osgvp.planets.Planet; |
|
18 |
import org.gvsig.osgvp.planets.PlanetViewer; |
|
19 |
import org.gvsig.osgvp.viewer.Camera; |
|
20 |
import org.gvsig.osgvp.viewer.OSGViewer; |
|
21 |
|
|
16 | 22 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
17 | 23 |
import com.iver.ai2.gvsig3d.navigation.NavigationMode; |
18 | 24 |
import com.iver.ai2.gvsig3d.resources.ResourcesFactory; |
... | ... | |
24 | 30 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
25 | 31 |
import com.iver.cit.gvsig.project.documents.view.gui.FPanelLocConfig; |
26 | 32 |
|
27 |
import es.upv.ai2.osgvp.planets.CustomTerrainManipulator; |
|
28 |
import es.upv.ai2.osgvp.planets.Planet; |
|
29 |
import es.upv.ai2.osgvp.planets.PlanetViewer; |
|
30 |
import es.upv.ai2.osgvp.viewer.Camera; |
|
31 |
import es.upv.ai2.osgvp.viewer.OSGViewer; |
|
32 |
|
|
33 | 33 |
public class NavigationMenu3D extends Extension { |
34 | 34 |
|
35 | 35 |
private boolean activa = true; |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/ProjectView3D.java | ||
---|---|---|
9 | 9 |
import java.util.Map.Entry; |
10 | 10 |
import java.util.prefs.Preferences; |
11 | 11 |
|
12 |
import org.apache.log4j.Logger; |
|
12 | 13 |
import org.gvsig.cacheservice.CacheService; |
14 |
import org.gvsig.osgvp.Vec3; |
|
15 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
|
16 |
import org.gvsig.osgvp.planets.Planet; |
|
17 |
import org.gvsig.osgvp.planets.PlanetViewer; |
|
18 |
import org.gvsig.osgvp.viewer.Camera; |
|
19 |
import org.gvsig.osgvp.viewer.CanvasViewer; |
|
20 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
|
21 |
import org.gvsig.osgvp.viewer.ViewerFactory; |
|
22 |
import org.gvsig.osgvp.viewer.ViewerStateListener; |
|
13 | 23 |
|
14 | 24 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
15 | 25 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
16 | 26 |
import com.iver.ai2.gvsig3d.camera.ProjectCamera; |
17 | 27 |
import com.iver.ai2.gvsig3d.gui.FeatureFactory; |
18 | 28 |
import com.iver.ai2.gvsig3d.gui.Hud; |
29 |
import com.iver.ai2.gvsig3d.map3d.GraphicLayer3D; |
|
19 | 30 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
20 | 31 |
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D; |
21 | 32 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
... | ... | |
43 | 54 |
import com.iver.utiles.StringUtilities; |
44 | 55 |
import com.iver.utiles.XMLEntity; |
45 | 56 |
|
46 |
import es.upv.ai2.osgvp.Vec3; |
|
47 |
import es.upv.ai2.osgvp.planets.Planet; |
|
48 |
import es.upv.ai2.osgvp.planets.PlanetViewer; |
|
49 |
import es.upv.ai2.osgvp.viewer.Camera; |
|
50 |
import es.upv.ai2.osgvp.viewer.CanvasViewer; |
|
51 |
import es.upv.ai2.osgvp.viewer.IViewerContainer; |
|
52 |
import es.upv.ai2.osgvp.viewer.ViewerFactory; |
|
53 |
import es.upv.ai2.osgvp.viewer.ViewerStateListener; |
|
54 |
|
|
55 | 57 |
/** |
56 | 58 |
* Clase que representa una vista del proyecto |
57 | 59 |
* |
... | ... | |
68 | 70 |
|
69 | 71 |
private ProjectCamera projectCamera = null; |
70 | 72 |
|
71 |
private int m_planetType = Planet.CoordinateSystemType.GEOCENTRIC; // spheric or plane |
|
73 |
private int m_planetType = Planet.CoordinateSystemType.GEOCENTRIC; // spheric |
|
74 |
// or |
|
75 |
// plane |
|
72 | 76 |
|
73 | 77 |
private Color backgroundColor; |
74 | 78 |
|
... | ... | |
77 | 81 |
private FeatureFactory g; |
78 | 82 |
|
79 | 83 |
private View3D m_view = null; |
80 |
|
|
81 |
private static Preferences prefs = Preferences.userRoot().node( "gvsig.configuration.3D" ); |
|
82 |
|
|
84 |
|
|
85 |
private static Preferences prefs = Preferences.userRoot().node( |
|
86 |
"gvsig.configuration.3D"); |
|
87 |
|
|
83 | 88 |
private boolean prespectiveMode = true; |
84 | 89 |
|
90 |
private static Logger logger = Logger.getLogger(ProjectView3D.class |
|
91 |
.getName()); |
|
92 |
|
|
85 | 93 |
// private Satelite runnable; |
86 | 94 |
|
87 | 95 |
public ProjectView3D() { |
... | ... | |
263 | 271 |
// create libJOSG objects |
264 | 272 |
if (m_canvas3d == null) { |
265 | 273 |
// AI2 objects |
266 |
m_planetViewer = new PlanetViewer(); |
|
267 |
|
|
274 |
try { |
|
275 |
m_planetViewer = new PlanetViewer(); |
|
276 |
} catch (NodeException e1) { |
|
277 |
logger.error("Command: " + "Error creating planer viewer.", e1); |
|
278 |
} |
|
279 |
|
|
268 | 280 |
// Getting 3D preferences |
269 | 281 |
boolean compatibilitySwing = false; |
270 |
compatibilitySwing = prefs.getBoolean("compatibilitySwing", compatibilitySwing); |
|
271 |
|
|
272 |
if (compatibilitySwing){ |
|
273 |
m_canvas3d = ViewerFactory.getInstance().createViewer( |
|
274 |
ViewerFactory.VIEWER_TYPE.JPANEL_VIEWER, m_planetViewer); |
|
275 |
}else{ |
|
276 |
m_canvas3d = ViewerFactory.getInstance().createViewer( |
|
277 |
ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, m_planetViewer); |
|
282 |
compatibilitySwing = prefs.getBoolean("compatibilitySwing", |
|
283 |
compatibilitySwing); |
|
284 |
|
|
285 |
if (compatibilitySwing) { |
|
286 |
m_canvas3d = ViewerFactory.getInstance() |
|
287 |
.createViewer(ViewerFactory.VIEWER_TYPE.JPANEL_VIEWER, |
|
288 |
m_planetViewer); |
|
289 |
} else { |
|
290 |
m_canvas3d = ViewerFactory.getInstance() |
|
291 |
.createViewer(ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, |
|
292 |
m_planetViewer); |
|
278 | 293 |
} |
279 |
|
|
294 |
|
|
280 | 295 |
this.configureProjectionViewMode(); |
281 |
// m_canvas3d = ViewerFactory.getInstance().createViewer( |
|
282 |
// ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, m_planetViewer); |
|
283 |
m_canvas3d.addKeyListener(new ViewerStateListener(m_canvas3d.getOSGViewer())); |
|
296 |
// m_canvas3d = ViewerFactory.getInstance().createViewer( |
|
297 |
// ViewerFactory.VIEWER_TYPE.CANVAS_VIEWER, m_planetViewer); |
|
298 |
m_canvas3d.addKeyListener(new ViewerStateListener(m_canvas3d |
|
299 |
.getOSGViewer())); |
|
284 | 300 |
|
285 | 301 |
// ViewerFactory.getInstance().startAnimator(); |
286 | 302 |
|
... | ... | |
308 | 324 |
m_planet.setExtent(extent); |
309 | 325 |
} |
310 | 326 |
|
311 |
// canvasListener lis = new canvasListener();
|
|
312 |
// lis.setCanvas(m_canvas3d);
|
|
313 |
// m_canvas3d.addKeyListener(lis);
|
|
327 |
// canvasListener lis = new canvasListener();
|
|
328 |
// lis.setCanvas(m_canvas3d);
|
|
329 |
// m_canvas3d.addKeyListener(lis);
|
|
314 | 330 |
/* |
315 | 331 |
* CODIGO DE PRUEBA PARA LA INCLUSION DE TEXTOS, POLIGONOS, LINEAS, |
316 | 332 |
* ETC... |
... | ... | |
359 | 375 |
// root.addChild(rot2); |
360 | 376 |
/* ************************************************************************* */ |
361 | 377 |
|
362 |
// m_planetViewer.addSpecialNode(g); |
|
363 |
// List posi = new ArrayList(); |
|
364 |
// for (int i = 0; i < 10; i++) { |
|
365 |
// Vec3 pos1 = m_planet.convertLatLongHeightToXYZ(new Vec3(0, Math |
|
366 |
// .toRadians(i * 10), 0)); |
|
367 |
// |
|
368 |
// // Vec3 pos1 = new Vec3(0, i * 10, 0); |
|
369 |
// posi.add(pos1); |
|
370 |
// } |
|
371 |
// Vec4 rgba = new Vec4(1.0, 1.0, 1.0, 1.0); |
|
372 |
// float lineWidth = 8; |
|
373 |
// g.addChild(FeatureFactory.insertLine(posi, rgba, lineWidth)); |
|
374 |
|
|
378 |
// m_planetViewer.addSpecialNode(g); |
|
379 |
// List posi = new ArrayList(); |
|
380 |
// for (int i = 0; i < 10; i++) { |
|
381 |
// Vec3 pos1 = m_planet.convertLatLongHeightToXYZ(new Vec3(0, Math |
|
382 |
// .toRadians(i * 10), 0)); |
|
383 |
// |
|
384 |
// // Vec3 pos1 = new Vec3(0, i * 10, 0); |
|
385 |
// posi.add(pos1); |
|
386 |
// } |
|
387 |
// Vec4 rgba = new Vec4(1.0, 1.0, 1.0, 1.0); |
|
388 |
// float lineWidth = 8; |
|
389 |
// g.addChild(FeatureFactory.insertLine(posi, rgba, lineWidth)); |
|
375 | 390 |
// m_planetViewer.addSpecialNode(FeatureFactory.insertLine(posi, |
376 | 391 |
// rgba, |
377 | 392 |
// lineWidth)); |
378 |
|
|
379 | 393 |
// m_planetViewer.addSpecialNode(osgDB.readNodeFile(ResourcesFactory |
380 | 394 |
// .getResourcesPath() |
381 | 395 |
// + "../images/flag.ive")); |
382 | 396 |
// m_canvas3d.getOSGViewer().addSpecialNode(root); |
383 | 397 |
// Cargando el satelite |
384 | 398 |
// m_canvas3d.addSpecialNode(sat); |
385 |
|
|
386 |
m_planetViewer.addPlanet(m_planet); |
|
399 |
try { |
|
400 |
m_planetViewer.addPlanet(m_planet); |
|
401 |
} catch (NodeException e1) { |
|
402 |
logger.error("Command: " + "Error adding new child node.", e1); |
|
403 |
} |
|
387 | 404 |
|
388 | 405 |
Camera cam; |
389 | 406 |
cam = new Camera(); |
... | ... | |
408 | 425 |
.setMinCameraDistance(10); |
409 | 426 |
m_planetViewer.getCustomTerrainManipulator() |
410 | 427 |
.setMaxCameraDistance(5000000 * 10); |
411 |
// m_planet.setSubdivisionFactor((float) 0.45);
|
|
428 |
// m_planet.setSubdivisionFactor((float) 0.45);
|
|
412 | 429 |
} else { |
413 |
// cam.setViewByLookAt(m_planet.getRadiusEquatorial() * 3.0,
|
|
414 |
// 0, 0, 0, 0, 0, 0, 0, 1);
|
|
430 |
// cam.setViewByLookAt(m_planet.getRadiusEquatorial() * 3.0,
|
|
431 |
// 0, 0, 0, 0, 0, 0, 0, 1);
|
|
415 | 432 |
cam.setViewByLookAt(m_planet.getRadiusEquatorial() * 8.0, |
416 | 433 |
0, 0, 0, 0, 0, 0, 0, 1); |
417 | 434 |
m_planetViewer.getCustomTerrainManipulator() |
418 | 435 |
.setMinCameraDistance(100); |
419 |
// m_planetViewer.getCustomTerrainManipulator()
|
|
420 |
// .setMaxCameraDistance(
|
|
421 |
// m_planet.getRadiusEquatorial() * 3.0);
|
|
436 |
// m_planetViewer.getCustomTerrainManipulator()
|
|
437 |
// .setMaxCameraDistance(
|
|
438 |
// m_planet.getRadiusEquatorial() * 3.0);
|
|
422 | 439 |
m_planetViewer.getCustomTerrainManipulator() |
423 |
.setMaxCameraDistance( |
|
424 |
m_planet.getRadiusEquatorial() * 10.0); |
|
440 |
.setMaxCameraDistance(
|
|
441 |
m_planet.getRadiusEquatorial() * 10.0);
|
|
425 | 442 |
// cam.setViewByLookAt(100 * 2.0, |
426 | 443 |
// 0, 0, 0, 0, 0, 0, 0, 1); |
427 | 444 |
// m_planet.setSubdivisionFactor((float) 0.65); |
... | ... | |
434 | 451 |
// m_canvas3d.getOSGViewer().setCameraManipulator(new |
435 | 452 |
// TrackballManipulator()); |
436 | 453 |
|
437 |
m_planetViewer.setCamera(cam);
|
|
454 |
m_planetViewer.setCamera(cam); |
|
438 | 455 |
|
439 | 456 |
Hud hud = new Hud(m_canvas3d, m_planet); |
440 |
m_planetViewer.addNodeToHUD(hud); |
|
457 |
try { |
|
458 |
m_planetViewer.addNodeToHUD(hud); |
|
459 |
} catch (NodeException e) { |
|
460 |
logger.error("Command: " + "Error adding node to hud.", e); |
|
461 |
} |
|
441 | 462 |
|
442 | 463 |
m_planetViewer.setEnabledLighting(true); |
443 | 464 |
} |
... | ... | |
689 | 710 |
return prespectiveMode; |
690 | 711 |
} |
691 | 712 |
|
692 |
|
|
693 | 713 |
/** |
694 |
* Active the prespective mode. If we disable the prespective mode, the ortho mode will be active |
|
714 |
* Active the prespective mode. If we disable the prespective mode, the |
|
715 |
* ortho mode will be active |
|
695 | 716 |
* |
696 |
* @param prespectiveMode enable/disable |
|
717 |
* @param prespectiveMode |
|
718 |
* enable/disable |
|
697 | 719 |
*/ |
698 | 720 |
public void setActivePrespectiveMode(boolean prespectiveMode) { |
699 | 721 |
this.prespectiveMode = prespectiveMode; |
700 | 722 |
} |
701 |
|
|
702 |
private void configureProjectionViewMode(){ |
|
703 |
if (prespectiveMode){ |
|
723 |
|
|
724 |
private void configureProjectionViewMode() {
|
|
725 |
if (prespectiveMode) {
|
|
704 | 726 |
System.out.println("Setting up prespective projection"); |
705 |
// this.m_canvas3d.getOSGViewer().setProjectionMatrixAsPerspective( |
|
706 |
// arg0, arg1, arg2, arg3); |
|
707 |
} |
|
708 |
else { |
|
727 |
// this.m_canvas3d.getOSGViewer().setProjectionMatrixAsPerspective( |
|
728 |
// arg0, arg1, arg2, arg3); |
|
729 |
} else { |
|
709 | 730 |
System.out.println("Setting up prespective projection"); |
710 |
this.m_canvas3d.getOSGViewer().setProjectionMatrixAsOrtho(-10, 10, -10, 10, 1, 1000); |
|
731 |
this.m_canvas3d.getOSGViewer().setProjectionMatrixAsOrtho(-10, 10, |
|
732 |
-10, 10, 1, 1000); |
|
711 | 733 |
} |
712 | 734 |
} |
713 |
|
|
714 | 735 |
|
715 | 736 |
} |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/view/ViewProperties3D.java | ||
---|---|---|
64 | 64 |
import org.cresques.cts.IProjection; |
65 | 65 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
66 | 66 |
import org.gvsig.gui.beans.swing.JButton; |
67 |
import org.gvsig.osgvp.planets.Planet; |
|
67 | 68 |
|
68 | 69 |
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D; |
69 | 70 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
... | ... | |
77 | 78 |
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel; |
78 | 79 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
79 | 80 |
|
80 |
import es.upv.ai2.osgvp.planets.Planet; |
|
81 |
|
|
82 | 81 |
/** |
83 | 82 |
* Dialogo donde se muestran las propiedades de una vista |
84 | 83 |
* |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/view/Export.java | ||
---|---|---|
47 | 47 |
package com.iver.ai2.gvsig3dgui.view; |
48 | 48 |
|
49 | 49 |
import java.awt.Component; |
50 |
import java.awt.geom.AffineTransform; |
|
51 |
import java.awt.image.BufferedImage; |
|
52 | 50 |
import java.io.File; |
53 |
import java.io.IOException; |
|
54 | 51 |
import java.util.Hashtable; |
55 | 52 |
import java.util.Iterator; |
56 | 53 |
|
... | ... | |
58 | 55 |
import javax.swing.JOptionPane; |
59 | 56 |
import javax.swing.filechooser.FileFilter; |
60 | 57 |
|
61 |
import org.gvsig.raster.dataset.GeoRasterWriter; |
|
62 |
import org.gvsig.raster.dataset.IBuffer; |
|
63 |
import org.gvsig.raster.dataset.IDataWriter; |
|
64 |
import org.gvsig.raster.dataset.NotSupportedExtensionException; |
|
65 |
import org.gvsig.raster.dataset.io.RasterDriverException; |
|
66 |
import org.gvsig.raster.datastruct.Extent; |
|
58 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
|
67 | 59 |
|
68 | 60 |
import com.iver.andami.PluginServices; |
69 |
import com.iver.andami.messages.NotificationManager; |
|
70 | 61 |
import com.iver.andami.plugins.Extension; |
71 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
72 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
73 | 62 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
74 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
|
75 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
|
76 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
77 |
import com.sun.jimi.core.Jimi; |
|
78 |
import com.sun.jimi.core.JimiException; |
|
79 | 63 |
|
80 |
import es.upv.ai2.osgvp.viewer.IViewerContainer; |
|
81 | 64 |
|
82 | 65 |
|
83 |
|
|
84 | 66 |
/** |
85 | 67 |
* Extensi?n para exportar en algunos formatos raster la vista3D actual. |
86 | 68 |
* |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/view/View3D.java | ||
---|---|---|
20 | 20 |
import javax.swing.JSplitPane; |
21 | 21 |
|
22 | 22 |
import org.cresques.cts.IProjection; |
23 |
import org.gvsig.osgvp.planets.Planet; |
|
24 |
import org.gvsig.osgvp.planets.RequestLayerListener; |
|
25 |
import org.gvsig.osgvp.viewer.Camera; |
|
26 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
|
23 | 27 |
|
24 | 28 |
import com.iver.ai2.gvsig3d.listener.canvasListener; |
25 | 29 |
import com.iver.ai2.gvsig3d.map3d.MapContext3D; |
... | ... | |
48 | 52 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.TOC; |
49 | 53 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener; |
50 | 54 |
|
51 |
import es.upv.ai2.osgvp.planets.Planet; |
|
52 |
import es.upv.ai2.osgvp.planets.RequestLayerListener; |
|
53 |
import es.upv.ai2.osgvp.planets.TileCreatedListener; |
|
54 |
import es.upv.ai2.osgvp.planets.TileManagerListener; |
|
55 |
import es.upv.ai2.osgvp.viewer.Camera; |
|
56 |
import es.upv.ai2.osgvp.viewer.IViewerContainer; |
|
57 |
|
|
58 | 55 |
public class View3D extends BaseView { |
59 | 56 |
|
60 | 57 |
private static final long serialVersionUID = 1L; |
... | ... | |
91 | 88 |
*/ |
92 | 89 |
|
93 | 90 |
// Make layers listen to tile requests |
94 |
TileManagerListener tileManager = (TileManagerListener) m_planet
|
|
95 |
.getTileListener(); |
|
96 |
tileManager.setTileCreatedListener((TileCreatedListener) fmap); |
|
97 |
tileManager.setRequestLayerListener((RequestLayerListener) fmap); |
|
91 |
m_planet.setRequestLayerListener((RequestLayerListener) fmap);
|
|
92 |
// .getTileListener();
|
|
93 |
// tileManager.setTileCreatedListener((TileCreatedListener) fmap);
|
|
94 |
// tileManager.setRequestLayerListener((RequestLayerListener) fmap);
|
|
98 | 95 |
|
99 | 96 |
// set projection for 3D view |
100 | 97 |
IProjection projection = null; |
trunk/extensions/ext3Dgui/src/com/iver/ai2/gvsig3dgui/view/InsertPosition.java | ||
---|---|---|
56 | 56 |
|
57 | 57 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
58 | 58 |
import org.gvsig.gui.beans.swing.JButton; |
59 |
import org.gvsig.osgvp.Vec3; |
|
60 |
import org.gvsig.osgvp.planets.Planet; |
|
59 | 61 |
|
60 | 62 |
import com.iver.ai2.gvsig3dgui.ProjectView3D; |
61 | 63 |
import com.iver.andami.PluginServices; |
... | ... | |
63 | 65 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
64 | 66 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
65 | 67 |
|
66 |
import es.upv.ai2.osgvp.Vec3; |
|
67 |
import es.upv.ai2.osgvp.planets.Planet; |
|
68 |
|
|
69 | 68 |
/** |
70 | 69 |
* Dialogo donde se muestran las propiedades de una vista |
71 | 70 |
* |
Also available in: Unified diff