Revision 58

View differences:

1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/build.xml
1
<project name="Generar extension en Andami ext3D" default="generate-without-source" basedir=".">
2
	<description>
3
        Instala el plugin de ejemplo en Andami.
4
    </description>
5
	<!-- set global properties for this build -->
6
	<property name="src" location="src" />
7
	<property name="build" location="bin" />
8
	<property name="dist" location="dist" />
9
	<property name="resources" location="resources" />
10
	<property name="plugin" value="com.iver.ai2.gvsig3d" />
11
	<property name="extension-dir" location="../_fwAndami/gvSIG/extensiones" />
12
	<property name="logos-dir" location="../_fwAndami/theme" />
13
	<property name="gvsig-lib" location="../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib" />
14
	<property name="binaries-dir" location="../binaries/" />
15
	<property name="ext3D" value="../_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d" />
16
	<property name="ext3Dgui-lib" value="../ext3Dgui/lib" />
17
	<property name="ext3D-lib" value="../ext3D/lib" />
18
	<property name="buildman.executable" value="buildman/bin/bmn.py"/>
19
	<import file="../binaries/ant/utilities.xml"/>
20

  
21
	<target name="batch-build" description="Builds all. This is called by appgvSIG script"
22
			depends="compile,create-jar,copy-files,clean-dist">
23
	</target>
24

  
25
	<target name="init">
26
		<mkdir dir="${build}" />
27

  
28
	</target>
29

  
30

  
31
    <target name="compile" description="compile the source" >
32
		<!-- Compile the Java code from ${src} to ${build} -->
33
		<mkdir dir="${build}" />
34
		<loadEclipseClasspath project="${basedir}"/>
35
		<gvSIG-javac
36
			classpath="${eclipseClasspath}"	/>
37
    </target>
38

  
39
    <target name="create-jar"
40
            description="Creates the jar">
41

  
42
		<mkdir dir="${dist}" />
43
		<mkdir dir="${dist}/lib" />
44
		<!-- Put everything in ${build} into the jar file
45
	     Except classes to be instantiated in core gvSIG -->
46
		<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" excludes="com/iver/ai2/gvsig3d/map3d/layers/Layer3DProps.*,com/iver/ai2/gvsig3d/gui/VectorLayerMenu.*,com/iver/ai2/gvsig3d/camera/ProjectCamera.*,com/iver/ai2/gvsig3d/resources/ResourcesFactory.*" />
47

  
48
		<!-- Put in this .jar the classes to be instantiated in gvSIG -->
49
		<jar jarfile="${dist}/lib/${plugin}_share.jar" basedir="${build}" includes="com/iver/ai2/gvsig3d/map3d/layers/Layer3DProps.*,com/iver/ai2/gvsig3d/gui/VectorLayerMenu.*,com/iver/ai2/gvsig3d/camera/ProjectCamera.*,com/iver/ai2/gvsig3d/resources/ResourcesFactory.*" />
50
		<jar jarfile="${gvsig-lib}/${plugin}_share.jar" basedir="${build}" includes="com/iver/ai2/gvsig3d/map3d/layers/Layer3DProps.*,com/iver/ai2/gvsig3d/gui/VectorLayerMenu.*,com/iver/ai2/gvsig3d/camera/ProjectCamera.*,com/iver/ai2/gvsig3d/resources/ResourcesFactory.*" />
51

  
52
	</target>
53

  
54
    <target name="copy-files">
55
		<copy todir="${dist}/lib/">
56
			<fileset dir="lib/" includes="*.jar" />
57
		</copy>
58

  
59
		<copy todir="${ext3Dgui-lib}/">
60
			<fileset dir="${dist}/lib/" includes="*.jar" />
61
		</copy>
62

  
63
		<mkdir dir="../ext3Dgui/resources" />
64
		<copy todir="../ext3Dgui/resources/">
65
			<fileset dir="resources" includes="*.**" />
66
		</copy>
67

  
68
	</target>
69

  
70

  
71
	<target name="generate-without-source" description="generate the distribution without the source file"
72
			depends="create-jar,copy-files,clean-dist">
73
	</target>
74

  
75
	<target name="clean" description="clean up" depends="clean-dist">
76
		<echo message="dentro de clean" />
77
		<delete dir="${build}" />
78
	</target>
79

  
80
	<target name="clean-dist" description="clean up dist">
81
		<delete dir="${dist}" />
82
	</target>
83

  
84
	<!--target name="copy-binaries">
85
		<copy todir="${binaries-dir}">
86
			<fileset dir="binaries/" includes="**/**" />
87
		</copy>
88
	</target-->
89

  
90
	<target name="update-binaries-cache">
91
		<exec executable="python">
92
			<arg value="${buildman.executable}"/>
93
			<arg value="update"/>
94
			<arg value="--cache"/>
95
		</exec>
96
	</target>
97

  
98
	<target name="update-binaries-remote">
99
		<exec executable="python">
100
			<arg value="${buildman.executable}"/>
101
			<arg value="update"/>
102
			<arg value="--remote"/>
103
		</exec>
104
	</target>
105

  
106
	<target name="update-binaries-atifglrx-remote">
107
		<exec executable="python">
108
			<arg value="${buildman.executable}"/>
109
			<arg value="update"/>
110
			<arg value="--file"/>
111
			<arg value="depman-atifglrx.xml"/>
112
			<arg value="--remote"/>
113
		</exec>
114
	</target>
115
</project>
116

  
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/test/com/iver/ai2/gvsig3d/TransformacionesTest.java
1
//package com.iver.ai2.gvsig3d;
2
//
3
//import junit.framework.TestCase;
4
//
5
//import com.iver.ai2.gvsig3d.gui.Hud;
6
//import com.iver.ai2.gvsig3d.utils.UtilCoord;
7
//
8
//import es.upv.ai2.osgvp.Vec3;
9
//import es.upv.ai2.osgvp.planets.Planet;
10
//import es.upv.ai2.osgvp.viewer.ViewerFactory;
11
//
12
//public class TransformacionesTest extends TestCase {
13
//	public void testTrasnform() throws Throwable {
14
//
15
//		System.out.println("De grados a radianes " + UtilCoord.radianes(180));
16
//		System.out
17
//				.println("De radianes a grados " + UtilCoord.degrees(Math.PI));
18
//
19
//		Vec3 esferica = new Vec3(6378137, 0.0, 40.0);
20
//		Vec3 cartesianas = new Vec3(4885936.723, 0, 4099786.416);
21
//
22
//		Vec3 e = UtilCoord.GeoToCarte(esferica);
23
//		Vec3 c = UtilCoord.CarteToGeo(cartesianas);
24
//
25
//		System.out.println("De geocentricas a cartesianas " + e.x() + " "
26
//				+ e.y() + " " + e.z());
27
//		System.out.println("De cartesianas a geocentricas " + c.x() + " "
28
//				+ c.y() + " " + c.z());
29
//
30
//	}
31
//
32
//	public void testTraPla() throws Throwable {
33
//
34
////		ViewerFactory m_canvas3d = new ViewerFactory();
35
////
36
////		m_canvas3d.startAnimator();
37
////
38
////		Planet m_planet = new Planet();
39
////
40
////		m_planet.setCoordinateSystemType(Planet.CoordinateSystemType.PROJECTED);
41
////
42
////		Vec3 cartesianas = new Vec3(4886013.328, 0, 4099850.692);
43
////		Vec3 e = m_planet.convertXYZToLatLongHeight(cartesianas);
44
////
45
////		System.out.println("De geocentricas a cartesianas " + e.x() + " "
46
////				+ e.y() + " " + e.z());
47
//
48
//	}
49
//
50
//	public void testHome() throws Throwable {
51
//
52
//		// System.out.println(new File("home").getCanonicalPath());
53
//
54
//		String home = System.getProperty("user.home");
55
//		System.out.println(home);
56
//
57
//		String wd = System.getProperty("user.dir");
58
//		System.out.println(wd);
59
//
60
//	}
61
//
62
//	public void testGrados() throws Throwable {
63
//
64
////		System.out.println(Hud.getSexagesinal(74.90555556, false));
65
//
66
//	}
67
//
68
//	public void testJDialog() throws Throwable {
69
////
70
////		VectorLayerMenu vectorLayerMenu = new VectorLayerMenu(null);
71
////		vectorLayerMenu.setModal(true);
72
////		vectorLayerMenu.pack();
73
////		vectorLayerMenu.setVisible(true);
74
//	}
75
//
76
//}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/test/com/iver/ai2/gvsig3d/OperationTest.java
1
//package com.iver.ai2.gvsig3d;
2
//
3
//import junit.framework.TestCase;
4
//
5
//import org.gvsig.exceptions.BaseException;
6
//
7
//import com.iver.ai2.gvsig3d.geometry.GeometryFactory;
8
//import com.iver.ai2.gvsig3d.geometry.Point3D;
9
//
10
//public class OperationTest extends TestCase {
11
//	
12
//	public void testRegisterOperation() throws BaseException {
13
//
14
//		// Registering operation
15
//		System.out.println("Registering operations.");
16
////		Draw3DDefaultOperation.registerOperations();
17
//			
18
//	}
19
//	
20
//	public void testPoint3DDrawOperation() throws BaseException {
21
//
22
//		//Registering operation 
23
//		System.out.println("Registering operations.");
24
////		Draw3DDefaultOperation.registerOperations();
25
//		
26
//		System.out.println("Drawing point 3D");
27
//		Point3D point = (Point3D) GeometryFactory.createPoint3D("punto3D");
28
////		point.doOperation(GeometryOperation.DRAW3D_OPERATION);
29
//			
30
//	}
31
//}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/config/about.htm
1
<html>
2
  <head>
3
    <title>Extension 3D del programa GvSIG </title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
    <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I and other contributors 2005.</font></td>
16
  </tr>
17
</table>
18
  <h3>Extesi&oacute;n de la Aplicaci&oacute;n para el tratamiento de top&oacute;nimos del Instituto Geogr&aacute;fico Nacional</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/build.number
1
#Build Number for ANT. Do not edit!
2
#Mon Jul 16 14:09:59 CEST 2007
3
build.number=14
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/About3DExtension.java
1
package org.gvsig.gvsig3d;
2

  
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.plugins.Extension;
5
import com.iver.cit.gvsig.About;
6
import com.iver.cit.gvsig.gui.panels.FPanelAbout;
7

  
8
/**
9
 * About extension for the "Aplicación para el 
10
 * tratamiento de topónimos del Instituto Geográfico NAcional" 
11
 *
12
 * Add the about coments to the gvSIG About panel
13
 */
14

  
15
public class About3DExtension extends Extension {
16

  
17
	public void initialize() {
18
		// TODO Auto-generated method stub
19

  
20
	}
21
	
22
	public void postInitialize() {
23
		About about=(About)PluginServices.getExtension(About.class);
24
		FPanelAbout panelAbout=about.getAboutPanel();
25
		java.net.URL aboutURL = this.getClass().getResource(
26
	        "/about.htm");
27
	        panelAbout.addAboutUrl("Toponimos",aboutURL);
28
	}
29

  
30
	public void execute(String actionCommand) {
31

  
32
	}
33

  
34
	public boolean isEnabled() {
35
		return false;
36
	}
37

  
38
	public boolean isVisible() {
39
		return false;
40
	}
41

  
42
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/drivers/GvsigDriverOSG.java
1
package org.gvsig.gvsig3d.drivers;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.driver.OSGDriver;
6
import org.gvsig.fmap.geom.operation.GeometryOperationException;
7
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
8
import org.gvsig.fmap.geom.primitive.AbstractPrimitive;
9
import org.gvsig.geometries3D.MultiGeometry;
10
import org.gvsig.geometries3D.MultiSolid;
11
import org.gvsig.gpe.osg.OSGParser;
12
import org.gvsig.operations3D.Draw3DMultiSolid;
13
import org.gvsig.operations3D.context.Draw3DContext;
14
import org.gvsig.osgvp.core.osg.Group;
15
import org.gvsig.osgvp.exceptions.node.NodeException;
16

  
17
import com.hardcode.gdbms.driver.exceptions.CloseDriverException;
18
import com.hardcode.gdbms.driver.exceptions.OpenDriverException;
19
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
20
import com.hardcode.gdbms.driver.exceptions.WriteDriverException;
21
import com.hardcode.gdbms.engine.data.edition.DataWare;
22
import com.iver.cit.gvsig.fmap.core.FShape;
23
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
24
import com.iver.cit.gvsig.fmap.drivers.MemoryDriver;
25
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
26
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend;
27
import com.iver.cit.gvsig.fmap.rendering.ILegend;
28
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
29
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
30
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.AttrInTableLabelingStrategy;
31
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingStrategy;
32

  
33
public class GvsigDriverOSG extends MemoryDriver implements VectorialFileDriver, WithDefaultLegend {
34

  
35
	private File 				_file;
36
	private DriverAttributes 	_attr = new DriverAttributes();
37
	private OSGDriver 			_osgDriver;
38
	private Group 				_osgGroupRoot;
39
	private VectorialUniqueValueLegend defaultLegend;
40
	private ILabelingStrategy labeler;
41
	// tipo grupo set mas get, en el load hago un set de lo q devuelve el parser
42

  
43
	public String getName() {
44
		return "gvSIG OSG Driver";
45
	}
46

  
47
	public int getShapeType() {
48
		return FShape.MULTI;
49
	}
50

  
51
	public boolean accept(File f) {
52
		if ((f.getName().toUpperCase().endsWith("OSG"))
53
				|| (f.getName().toUpperCase().endsWith("IVE"))) {
54
			return true;
55
		}
56
		return false;
57
	}
58

  
59
	public void close() throws CloseDriverException {
60
		// TODO Auto-generated method stub
61

  
62
	}
63

  
64
	public File getFile() {
65
		return _file;
66
	}
67

  
68
	public void initialize() throws ReadDriverException {
69
	//	this.parseStream();
70
		defaultLegend = LegendFactory.createVectorialUniqueValueLegend(getShapeType());
71
		defaultLegend.setClassifyingFieldNames(new String[] {"3DMODEL"} );
72
		labeler =  new AttrInTableLabelingStrategy();
73
	}
74

  
75
	public void parseStream() {
76

  
77
		_osgDriver = new OSGDriver();
78
		OSGParser parser = new OSGParser("OSG", "OSG File Formats Parser");
79

  
80
		parser.parse(_osgDriver, null, _file.toURI());
81

  
82
		// Getting the geometry from the driver.
83
	}
84

  
85
	public void buildGeometry(AbstractPrimitive geom, Group group)
86
			throws NodeException {
87

  
88
		int i;
89

  
90
		if (geom instanceof MultiGeometry) {
91
			MultiGeometry multiGeometry = (MultiGeometry) geom;
92
			for (i = 0; i < multiGeometry.getGeometries().size(); i++) {
93

  
94
				Group child = new Group();
95
				group.addChild(child);
96
				buildGeometry(multiGeometry.getGeometries().get(i), child);
97
			}
98
		} else if (geom instanceof MultiSolid) {
99
			// Getting the geometry
100
			MultiSolid multiSolid = (MultiSolid) geom;
101
			// Creating the context and adding parameters
102
			Draw3DContext ctx3D = new Draw3DContext();
103
			ctx3D.setGroup(group);
104
			// Creating the drawing operation
105
			Draw3DMultiSolid d3DMultiSolid = new Draw3DMultiSolid();
106

  
107
			try {
108
				// Invoking the operation for the multisolid
109
				multiSolid.invokeOperation(d3DMultiSolid.getOperationIndex(),
110
						ctx3D);
111
			} catch (GeometryOperationNotSupportedException e) {
112
				// TODO Auto-generated catch block
113
				e.printStackTrace();
114
			} catch (GeometryOperationException e) {
115
				// TODO Auto-generated catch block
116
				e.printStackTrace();
117
			}
118
		}
119

  
120
	}
121

  
122
	public void open(File f) throws OpenDriverException {
123
		_file = f;
124

  
125
	}
126

  
127
	public DriverAttributes getDriverAttributes() {
128
		return _attr;
129
	}
130

  
131
	public boolean isWritable() {
132
		return _file.canWrite();
133
	}
134

  
135
	public int[] getPrimaryKeys() throws ReadDriverException {
136
		return null;
137
	}
138

  
139
	public void write(DataWare arg0) throws WriteDriverException,
140
			ReadDriverException {
141
		// TODO Auto-generated method stub
142

  
143
	}
144

  
145
	public Group getOsgGroupRoot() {
146
		return _osgGroupRoot;
147
	}
148

  
149
	public void setOsgGroupRoot(Group osgGroupRoot) {
150
		_osgGroupRoot = osgGroupRoot;
151
	}
152

  
153
	public MultiGeometry getOsgRootMultigometry() {
154
		return _osgDriver.getRootFeature();
155
	}
156

  
157
	public OSGDriver getOSGDriver() {
158
		return _osgDriver;
159
	}
160

  
161
	public void setOSGDriver(OSGDriver driver) {
162
		_osgDriver = driver;
163
	}
164

  
165
	public ILabelingStrategy getDefaultLabelingStrategy() {
166
		return labeler; 
167
	}
168

  
169
	public ILegend getDefaultLegend() {
170
		
171
		return defaultLegend;
172
	}
173

  
174
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/navigation/NavigationMode.java
1
package org.gvsig.gvsig3d.navigation;
2

  
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.List;
6

  
7
import org.gvsig.osgvp.terrain.TerrainCameraManipulator;
8

  
9
public class NavigationMode {
10

  
11
	/**
12
	 * Custom terrain manipulator
13
	 */
14
	private TerrainCameraManipulator _tcm;
15

  
16
	/**
17
	 * List of roll manipulators
18
	 */
19
	private static List _manRollList;
20

  
21
	/**
22
	 * List of zoom manipulator
23
	 */
24
	private static List _manZoomList;
25

  
26
	/**
27
	 * List of azimut manipulator
28
	 */
29
	private static List _manAzimutList;
30

  
31
	/**
32
	 * Contrustor method
33
	 * 
34
	 * They save the custom terrain manipulator for use in the future.
35
	 * 
36
	 * @param view3D
37
	 *            View3D object
38
	 */
39
	public NavigationMode(TerrainCameraManipulator tcm) {
40

  
41
		// Getting the custom terrain manipulator
42
		_tcm = tcm;
43

  
44
		if (_manRollList == null){
45
			// Gettin list of roll manipulator
46
			_manRollList = new ArrayList();
47
			for (int i = 0; i < _tcm.countActionMask("ROLL"); i++) {
48
				// Save button and key mask
49
				NavigationMask navMask = new NavigationMask(
50
						_tcm.getActionMouseMask("ROLL", i), _tcm.getActionKeyMask("ROLL", i));
51
				// Adding to list
52
				_manRollList.add(navMask);
53
			}
54
		}
55

  
56
		if (_manZoomList == null){
57
			// Gettin list of zoom manipulator
58
			_manZoomList = new ArrayList();
59
			for (int i = 0; i < _tcm.countActionMask("ZOOM"); i++) {
60
				// Save button and key mask
61
				NavigationMask navMask = new NavigationMask(
62
						_tcm.getActionMouseMask("ZOOM", i), _tcm.getActionKeyMask("ZOOM", i));
63
				// Adding to list
64
				_manZoomList.add(navMask);
65
			}
66
		}
67

  
68
		if (_manAzimutList == null){
69
			// Gettin list of roll manipulator
70
			_manAzimutList = new ArrayList();
71
			for (int i = 0; i < _tcm.countActionMask("AZIMUT"); i++) {
72
				// Save button and key mask
73
				NavigationMask navMask = new NavigationMask(
74
						_tcm.getActionMouseMask("AZIMUT", i), _tcm.getActionKeyMask("AZIMUT", i));
75
				// Adding to list
76
				_manAzimutList.add(navMask);
77
			}
78
		}
79
	}
80

  
81
	/**
82
	 * Method to restore defaul roll mode manipulator
83
	 */
84
	public void RestoreRollMode() {
85

  
86
		// Setting left button for roll mode
87
		for (Iterator iter = _manRollList.iterator(); iter.hasNext();) {
88
			// Get the mask element
89
			NavigationMask mask = (NavigationMask) iter.next();
90
			// Settin mode
91
			_tcm.registryActionMask("ROLL", mask.getBtnMask(), mask.getKeyMask());
92

  
93
		}
94

  
95
	}
96

  
97
	/**
98
	 * Method to restore default zoom mode manipulator
99
	 */
100
	public void RestoreZoomMode() {
101

  
102
		// Setting left button for roll mode
103
		for (Iterator iter = _manZoomList.iterator(); iter.hasNext();) {
104
			// Get the mask element
105
			NavigationMask mask = (NavigationMask) iter.next();
106
			// Settin mode
107
			_tcm.registryActionMask("ZOOM", mask.getBtnMask(), mask.getKeyMask());
108

  
109
		}
110
	}
111

  
112
	/**
113
	 * Method to restore default azimut mode manipulator
114
	 */
115
	public void RestoreAzimutMode() {
116

  
117
		// Setting left button for roll mode
118
		for (Iterator iter = _manAzimutList.iterator(); iter.hasNext();) {
119
			// Get the mask element
120
			NavigationMask mask = (NavigationMask) iter.next();
121
			// Settin mode
122
			_tcm.registryActionMask("AZIMUT", mask.getBtnMask(), mask.getKeyMask());
123

  
124
		}
125

  
126
	}
127

  
128
	/**
129
	 * Method to remove navigation altogether
130
	 */
131
	public void SetStopMode() {
132
		// Removing all controls
133
		removeAllModes();
134
	}
135

  
136
	/**
137
	 * Method to set up roll mode in left mouse button
138
	 */
139
	public void SetRollMode() {
140
		// Relmoving all controls
141
		removeAllModes();
142

  
143
		_tcm.registryActionMask("ROLL", 
144
				TerrainCameraManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
145
				0);
146
	}
147

  
148
	/**
149
	 * Method to set up zoom mode in left mouse button
150
	 */
151
	public void SetZoomMode() {
152
		// Relmoving all controls
153
		removeAllModes();
154
		
155
		// Settin mode
156
		_tcm.registryActionMask("ZOOM", 
157
				TerrainCameraManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
158
				0);
159
	}
160

  
161
	/**
162
	 * Method to set up azimut mode in left mouse button
163
	 */
164
	public void SetAzimutMode() {
165
		// Relmoving all controls
166
		removeAllModes();
167
		
168
		_tcm.registryActionMask("AZIMUT",
169
				TerrainCameraManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
170
				0);
171
	}
172

  
173
	/**
174
	 * Method to set up default mode in left mouse button
175
	 */
176
	public void SetDefaultMode() {
177
		// Removing all controls
178
		removeAllModes();
179

  
180
		RestoreRollMode();
181
		RestoreZoomMode();
182
		RestoreAzimutMode();
183

  
184
	}
185
	
186
	/**
187
	 * Method to set up azimut and roll mode in left mouse button
188
	 */
189
	public void SetAzimutRollMode() {
190
		// Relmoving all controls
191
		removeAllModes();
192
		_tcm.registryActionMask("AZIMUT",
193
				TerrainCameraManipulator.MouseButtonMaskType.RIGHT_MOUSE_BUTTON,
194
				0);
195
		_tcm.registryActionMask("ROLL",
196
				TerrainCameraManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
197
				0);
198
	}
199

  
200
	/**
201
	 * Method to remove all mask button manipulator
202
	 */
203
	public void removeAllModes() {
204
		// Removing roll modes
205
		_tcm.unRegistryActionMask("ROLL");
206
		_tcm.unRegistryActionMask("AZIMUT");
207
		_tcm.unRegistryActionMask("ZOOM");
208
	}
209

  
210
	public static void removeAllNavigationModes(TerrainCameraManipulator tcm) {
211
		if (tcm != null){
212
			tcm.unRegistryActionMask("ROLL");
213
			tcm.unRegistryActionMask("AZIMUT");
214
			tcm.unRegistryActionMask("ZOOM");
215
		}
216
	}
217
	
218
	public static void restoreAllNavigationModes(TerrainCameraManipulator tcm) {
219
		if (tcm !=null){
220
			
221
			for (int i = 0; i < _manRollList.size(); i++) {
222
				// Get the mask element
223
				NavigationMask mask = (NavigationMask) _manRollList.get(i);
224
				// Settin mode
225
				tcm.registryActionMask("ROLL", mask.getBtnMask(), mask.getKeyMask());
226
			}
227
			for (int i = 0; i < _manZoomList.size(); i++) {
228
				// Get the mask element
229
				NavigationMask mask = (NavigationMask) _manZoomList.get(i);
230
				// Settin mode
231
				tcm.registryActionMask("ZOOM", mask.getBtnMask(), mask.getKeyMask());
232
			}
233
			for (int i = 0; i < _manAzimutList.size(); i++) {
234
				// Get the mask element
235
				NavigationMask mask = (NavigationMask) _manAzimutList.get(i);
236
				// Settin mode
237
				tcm.registryActionMask("AZIMUT", mask.getBtnMask(), mask.getKeyMask());
238
			}
239
			
240
		}
241
	}
242

  
243
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/navigation/NavigationMask.java
1
package org.gvsig.gvsig3d.navigation;
2

  
3
/**
4
 * Use this class for save the estate of the Navigations mask butons and keys
5
 * 
6
 * @author julio
7
 *
8
 */
9
public class NavigationMask {
10

  
11
	private int _btnMask;
12
	private int _keyMask;
13

  
14
	/**
15
	 * Constructor 
16
	 * 
17
	 * @param btn button mask
18
	 * @param key key mask
19
	 */
20
	public NavigationMask(int btn, int key) {
21
		setBtnMask(btn);
22
		setKeyMask(key);
23
	}
24

  
25
	/**
26
	 * @return
27
	 */
28
	public int getBtnMask() {
29
		return _btnMask;
30
	}
31

  
32
	/**
33
	 * @param btnMask
34
	 */
35
	public void setBtnMask(int btnMask) {
36
		_btnMask = btnMask;
37
	}
38

  
39
	/**
40
	 * @return
41
	 */
42
	public int getKeyMask() {
43
		return _keyMask;
44
	}
45

  
46
	/**
47
	 * @param keyMask
48
	 */
49
	public void setKeyMask(int keyMask) {
50
		_keyMask = keyMask;
51
	}
52

  
53
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/utils/Punto3D.java
1
package org.gvsig.gvsig3d.utils;
2

  
3
import org.gvsig.osgvp.core.osg.Vec3;
4
import org.gvsig.osgvp.core.osg.Vec4;
5

  
6
public class Punto3D {
7

  
8
	private Vec3 position;
9

  
10
	private Vec4 color;
11

  
12
	private int zize;
13

  
14
	public Punto3D(Vec3 position, Vec4 color, int zize) {
15
		super();
16
		this.position = position;
17
		this.color = color;
18
		this.zize = zize;
19
	}
20

  
21
	public Vec4 getColor() {
22
		return color;
23
	}
24

  
25
	public void setColor(Vec4 color) {
26
		this.color = color;
27
	}
28

  
29
	public Vec3 getPosition() {
30
		return position;
31
	}
32

  
33
	public void setPosition(Vec3 position) {
34
		this.position = position;
35
	}
36

  
37
	public int getZize() {
38
		return zize;
39
	}
40

  
41
	public void setZize(int zize) {
42
		this.zize = zize;
43
	}
44

  
45
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/utils/UtilCoord.java
1
package org.gvsig.gvsig3d.utils;
2

  
3
import java.awt.geom.Rectangle2D;
4

  
5
import org.gvsig.osgvp.core.osg.Vec3;
6
import org.gvsig.osgvp.viewer.Camera;
7

  
8
public class UtilCoord {
9
	static String mensaje;
10

  
11
	private static double radio;
12

  
13
	static {
14
		radio = 6378137.0;
15
	}
16

  
17
	/**
18
	 * Method to transform geodesic coordinates to geometrical coordinates
19
	 * 
20
	 * @param r
21
	 *            radio
22
	 * @param alpha
23
	 *            angle in degrees
24
	 * @param beta
25
	 *            angle in degrees
26
	 * @return a vector with X,Y and Z values
27
	 */
28
	public static Vec3 GeoToCarte(double r, double alpha, double beta) {
29
		return GeoToCarte(new Vec3(r, alpha, beta));
30
	}
31

  
32
	/**
33
	 * Method to transform geodesic coordinates to geometrical coordinates
34
	 * 
35
	 * @param coord
36
	 *            vertor with radio, alpha and beta values in this order
37
	 * @return a vector with X,Y and Z values in this order
38
	 */
39
	public static Vec3 GeoToCarte(Vec3 coord) {
40
		Vec3 result = new Vec3();
41

  
42
		double h = coord.x();
43
		double alphaRad = radianes(coord.y());
44
		double betaRad = radianes(coord.z());
45

  
46
		double sinA = Math.sin(alphaRad);
47
		double cosA = Math.cos(alphaRad);
48
		double sinB = Math.sin(betaRad);
49
		double cosB = Math.cos(betaRad);
50

  
51
		// Calculate the X value
52
		result.setX(h * cosA * cosB);
53

  
54
		// Calculate the Y value
55
		result.setY(h * sinA * cosB);
56

  
57
		// Calculate the Z value
58
		result.setZ(h * sinB);
59

  
60
		return result;
61
	}
62

  
63
	/**
64
	 * Method to transform geometrical coordinates to geodesic coordinates
65
	 * 
66
	 * @param x
67
	 *            value
68
	 * @param y
69
	 *            value
70
	 * @param z
71
	 *            value
72
	 * @return a vector with radio, alpha and beta values in this order
73
	 */
74
	public static Vec3 CarteToGeo(double x, double y, double z) {
75
		return CarteToGeo(new Vec3(x, y, z));
76
	}
77

  
78
	/**
79
	 * Method to transform geometrical coordinates to geodesic coordinates
80
	 * 
81
	 * @param coord
82
	 *            vector with X,Y and Z values in this order
83
	 * @return vertor with radio, alpha and beta values in this order
84
	 */
85
	public static Vec3 CarteToGeo(Vec3 coord) {
86
		Vec3 result = new Vec3();
87

  
88
		// Caculate the radio value
89
		double modx = coord.x() * coord.x();
90
		double mody = coord.y() * coord.y();
91
		double modz = coord.z() * coord.z();
92

  
93
		result.setX(Math.sqrt(modx + mody + modz));
94

  
95
		// Calculate the alpha angle
96
		double sqrt = Math.sqrt(modx + mody);
97
		double alpha = Math.atan(coord.z() / sqrt);
98
		result.setY(degrees(alpha));
99

  
100
		// Calculate the beta angle
101
		double beta = degrees(Math.atan2(coord.y(), coord.x()));
102
		result.setZ(beta);
103

  
104
		return result;
105
	}
106

  
107
	/**
108
	 * Method to transform degrees to radianes
109
	 * 
110
	 * @param degrees
111
	 *            value
112
	 * @return radianes value
113
	 */
114
	public static double radianes(double degrees) {
115
		return ((degrees * Math.PI) / 180);
116
	}
117

  
118
	public static double degrees(double rad) {
119
		return ((rad * 180) / Math.PI);
120
	}
121

  
122
	public static void imprimeCamara(Camera camera) {
123
		Vec3 c, e, u;
124
		c = camera.getCenter();
125
		e = camera.getEye();
126
		u = camera.getUp();
127

  
128
		System.out.println("********* POSICION DE LA CAMARA *****************");
129
		System.out.println("CENTER : X " + c.x() + " Y " + c.y() + "Z " + c.z());
130
		System.out.println("EYE    : X " + e.x() + " Y " + e.y() + "Z " + e.z());
131
		System.out.println("UP     : X " + u.x() + " Y " + u.y() + "Z " + u.z());
132
		System.out.println("*************************************************");
133
	}
134
	
135
	public static Rectangle2D getExtendGeo(double longi, double lati, double size,double radius){
136

  
137
		double with = size / radius;
138
		double heigth = size / ( radius * Math.cos(lati));
139
		Rectangle2D extend = new Rectangle2D.Double(longi,lati,with,heigth);
140
		
141
		return extend;
142
	}
143

  
144
	public static Vec3 getDegreesHMS(double num) {
145
		// transform degrees in sexagesinal format
146
		int grados = (int) num;
147
		double resG = num - grados;
148
		int minutos = (int) (resG * 60);
149
		double minutosD = (resG * 60);
150
		double resM = minutosD - minutos;
151
		int segundos = (int) (resM * 60);
152
		String cadG = "";
153
		if (grados < 10)
154
			cadG = cadG + "0";
155
		cadG = cadG + grados;
156

  
157
		String cadM = "";
158
		if (minutos < 10)
159
			cadM = cadM + "0";
160
		cadM = cadM + minutos;
161

  
162
		String cadS = "";
163
		if (segundos < 10)
164
			cadS = cadS + "0";
165
		cadS = cadS + segundos;
166

  
167

  
168
		return (new Vec3(grados,minutos,segundos));
169
	}
170

  
171
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/gui/Hud.java
1
package org.gvsig.gvsig3d.gui;
2

  
3
import java.awt.Component;
4
import java.awt.event.MouseEvent;
5
import java.awt.event.MouseMotionListener;
6
import java.util.EventListener;
7

  
8
import org.apache.log4j.Logger;
9
import org.gvsig.gui.beans.Messages;
10
import org.gvsig.osgvp.core.osg.Group;
11
import org.gvsig.osgvp.core.osg.Node;
12
import org.gvsig.osgvp.core.osg.Vec3;
13
import org.gvsig.osgvp.core.osg.Vec4;
14
import org.gvsig.osgvp.exceptions.InvalidValueException;
15
import org.gvsig.osgvp.exceptions.node.NodeException;
16
import org.gvsig.osgvp.features.Text;
17
import org.gvsig.osgvp.terrain.Terrain;
18
import org.gvsig.osgvp.util.EventHandler;
19
import org.gvsig.osgvp.util.UpdateNodeListener;
20
import org.gvsig.osgvp.viewer.IViewerContainer;
21

  
22
import com.iver.ai2.gvsig3d.resources.ResourcesFactory;
23
import com.iver.andami.PluginServices;
24

  
25
/**
26
 * Use this class for draw items in HUD
27
 * 
28
 * @author julio
29
 * 
30
 */
31
public class Hud extends Group implements MouseMotionListener, EventHandler {
32

  
33
	private IViewerContainer _canvas3d = null;
34
	private Terrain _terrain = null;
35
	private String _lonText;
36
	private String _latText;
37
	private String _lon;
38
	private String _lat;
39
	private Text _textoHud;
40
	private Compass _compass;
41
	private static String _north;
42
	private static String _south;
43
	private static String _east;
44
	private static String _west;
45
	private static Logger _logger = Logger.getLogger(Hud.class.getName());
46

  
47
	static {
48
		_north = Messages.getText("North");
49
		_south = Messages.getText("South");
50
		_east = Messages.getText("East");
51
		_west = Messages.getText("West");
52

  
53
	}
54

  
55
	private int _projectionType;
56
	
57

  
58
	/**
59
	 * Constructor
60
	 * 
61
	 * @param m_canvas3d
62
	 *            Viewer instance
63
	 * @param m_terrain
64
	 *            Planet instance
65
	 */
66
	public Hud(IViewerContainer canvas3d, Terrain terrain) {
67
		super();
68
		_canvas3d = canvas3d;
69
		_terrain = terrain;
70
		_projectionType = terrain.getCoordinateSystemType();
71
		// Inicialize object
72
		init();
73
	}
74

  
75
	/**
76
	 * Inicilize the object params
77
	 */
78
	private void init() {
79

  
80
		try {
81
			_textoHud = new Text();
82
			_compass = new Compass(_terrain);
83
			if (_projectionType == Terrain.CoordinateSystemType.GEOCENTRIC) {
84
				_compass.setPanetType(Compass.Mode.SPHERIC);
85
			} else
86
				_compass.setPanetType(Compass.Mode.FLAT);
87
		} catch (NodeException e1) {
88
			// TODO Auto-generated catch block
89
			e1.printStackTrace();
90
		}
91
		if (getProjectionType() == Terrain.CoordinateSystemType.GEOCENTRIC) {
92
			// Setting up longitud and latitud string
93
			_lonText = PluginServices.getText(this, "Ext3D.longitude");
94
			_latText = PluginServices.getText(this, "Ext3D.latitude");
95
		} else {
96
			_lonText = PluginServices.getText(this, "X") + " ";
97
			_latText = PluginServices.getText(this, "Y") + " ";
98
		}
99

  
100
		// Adding text to group
101
		try {
102
			this.addChild(_textoHud);
103
			this.addChild(_compass);
104
		} catch (NodeException e) {
105
			_logger.error("Comand:" + "Error al a�adir nodo al hud.", e);
106
		}
107

  
108
		// Setting up the lighting mode to disable (rgaitan)
109
		try {
110
			getOrCreateStateSet().setLightingMode(
111
					Node.Mode.OFF | Node.Mode.PROTECTED);
112
		} catch (InvalidValueException e) {
113
			_logger.error("Comand:" + "Error al inicializar las luces.", e);
114
		}
115
		;
116

  
117
		// Seting up text
118
		_textoHud.setCharacterSize(14);
119
		_textoHud.setColor(new Vec4(1.0f, 1.0f, 1.0f, 1.0f));
120
		_textoHud.setBackdropColor(0.0f, 0.0f, 1.0f, 1.0f);
121

  
122
		if (ResourcesFactory.exitsResouce("arial.ttf"))
123
			_textoHud.setFont(ResourcesFactory.getResourcePath("arial.ttf"));
124
		else {
125
			// TODO: This freeze the execution.. disable when working.
126
			_textoHud.setFont("arial.ttf");
127
		}
128

  
129
		_textoHud.setPosition(10, 10, 0);
130
		_textoHud.setBackdropType(Text.BackdropType.OUTLINE);
131
		_textoHud.setAlignment(Text.AlignmentType.LEFT_CENTER);
132
		
133

  
134
		_compass.setUpdateListener(new UpdateNodeListener() {
135

  
136
			public void update(Node arg0) {
137
				_compass.update(_canvas3d.getOSGViewer().getCamera());
138
				//updateHud();				
139

  
140
			}
141
		});
142

  
143
		// disabling compass.
144
		_compass.setEnabledNode(true);
145
		_compass.setScale(new Vec3(75, 75, 75));
146
		// _compass.setPosition(new
147
		// Vec3(_canvas3d.getWidth()-70,_canvas3d.getHeight()-70,0));
148

  
149
		// Add mouse listener to viewer
150
		((Component) _canvas3d).addMouseMotionListener(this);
151
		// _canvas3d.getOSGViewer().addEventHandler(this);
152

  
153
		_canvas3d.addComponentListener(new java.awt.event.ComponentAdapter() {
154
			public void componentResized(java.awt.event.ComponentEvent evt) {
155
				updateHud();
156
			}
157
		});
158
		
159
		System.out.println("Compass creada = " + _compass.getCPtr());
160

  
161
		// Update Hud
162
		updateHud();
163
	}
164

  
165
	public void setCompassPosition(Vec3 pos) {
166

  
167
		_compass.setPosition(pos);
168

  
169
	}
170
	
171

  
172

  
173
	/**
174
	 * This method updates information of the HUD
175
	 */
176
	public void updateHud() {
177

  
178
		if (_terrain.getCoordinateSystemType() == Terrain.CoordinateSystemType.GEOCENTRIC) {
179
			// Getting longitud and latitud informacion from planet
180
			_lon = Hud.getSexagesinal(_terrain.getLongitude(), true);
181
			_lat = Hud.getSexagesinal(_terrain.getLatitude(), false);
182

  
183
			// Updating text information
184
			_textoHud.setText(_lonText + " " + _lon + " " + _latText + " "
185
					+ _lat);
186
		} else {
187
			// Getting longitud and latitud informacion from planet
188
			_lon = Double.toString(_terrain.getLongitude());
189
			_lat = Double.toString(_terrain.getLatitude());
190

  
191
			// Updating text information
192
			_textoHud.setText(_lonText + " " + _lon + " " + _latText + " "
193
					+ _lat);
194
		}
195

  
196
		_compass.setPosition(new Vec3(_canvas3d.getWidth() - 50, _canvas3d
197
				.getHeight() - 50, 0));
198
		
199
				
200
		
201
		// Repainting view
202
		/*
203
		 * if (_canvas3d != null) _canvas3d.repaint();
204
		 */
205
	}
206

  
207
	public String getLat() {
208
		return _lat;
209
	}
210

  
211
	public void setLat(String lat) {
212
		_lat = lat;
213
	}
214

  
215
	public String getLatText() {
216
		return _latText;
217
	}
218

  
219
	public void setLatText(String latText) {
220
		_latText = latText;
221
	}
222

  
223
	public String getLon() {
224
		return _lon;
225
	}
226

  
227
	public void setLon(String lon) {
228
		_lon = lon;
229
	}
230

  
231
	public String getLonText() {
232
		return _lonText;
233
	}
234

  
235
	public void setLonText(String lonText) {
236
		_lonText = lonText;
237
	}
238

  
239
	/**
240
	 * To transform longitud and latitud to sexagesinal format degress minuts
241
	 * seconds
242
	 * 
243
	 * @param num
244
	 *            number to transform
245
	 * @param lat
246
	 *            is tatitud or not
247
	 * @return sexagesinal format
248
	 */
249
	public static String getSexagesinal(double num, boolean lat) {
250

  
251
		String result = "";
252
		String ori = "";
253

  
254
		// Setting up North or South and East or West
255
		if (num < 0) {
256
			num = num * (-1);
257
			if (lat) {
258
				ori = _east;// south;// Messages.getText("South");
259
			} else {
260
				ori = _north;// north;// Messages.getText("North");
261
			}
262
		} else {
263
			if (lat) {
264
				ori = _west;// west;// Messages.getText("West");
265
			} else {
266
				ori = _south;// east;// Messages.getText("East");
267
			}
268
		}
269

  
270
		// transform degrees in sexagesinal format
271
		int grados = (int) num;
272
		double resG = num - grados;
273
		int minutos = (int) (resG * 60);
274
		double minutosD = (resG * 60);
275
		double resM = minutosD - minutos;
276
		int segundos = (int) (resM * 60);
277
		String cadG = "";
278
		if (grados < 10)
279
			cadG = cadG + "0";
280
		cadG = cadG + grados;
281

  
282
		String cadM = "";
283
		if (minutos < 10)
284
			cadM = cadM + "0";
285
		cadM = cadM + minutos;
286

  
287
		String cadS = "";
288
		if (segundos < 10)
289
			cadS = cadS + "0";
290
		cadS = cadS + segundos;
291

  
292
		// Building result string
293
		result = cadG + " " + cadM + " " + cadS + " " + ori;
294

  
295
		return result;
296
	}
297

  
298
	// MOUSE MOTION EVENTS
299

  
300
	public void mouseDragged(MouseEvent e) {
301
		// Updating Hud information+
302
		// If not update the hud information when mouses dragged the hud don�t
303
		// change
304
		updateHud();
305

  
306
		// System.out.println("***************************************");
307
		// System.out.println("Longitud : " + m_planet.getLongitude());
308
		// System.out.println("Latitud : " + m_planet.getLatitude());
309
		// System.out.println("***************************************");
310

  
311
	}
312

  
313
	public void mouseMoved(MouseEvent e) {
314
		// TODO Auto-generated method stub
315
		// updateHud();
316
	}
317

  
318
	public int getProjectionType() {
319
		return _projectionType;
320
	}
321

  
322
	public void setProjectionType(int projectionType) {
323
		_projectionType = projectionType;
324
	}
325

  
326
	public void handle() {
327

  
328
		updateHud();
329

  
330
	}
331

  
332
}
1.10/tags/gvSIG_3D_Animation_1_10_build_15/libraries/lib3DMap/src/org/gvsig/gvsig3d/gui/FeatureFactory.java
1
package org.gvsig.gvsig3d.gui;
2

  
3
import java.awt.Color;
4
import java.util.ArrayList;
5
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.List;
8

  
9
import org.apache.log4j.Logger;
10
import org.gvsig.gvsig3d.labels3D.ILabel3D;
11
import org.gvsig.gvsig3d.labels3D.SimpleLabel3D;
12
import org.gvsig.gvsig3d.utils.Punto3D;
13
import org.gvsig.osgvp.core.osg.AutoTransform;
14
import org.gvsig.osgvp.core.osg.Geode;
15
import org.gvsig.osgvp.core.osg.Group;
16
import org.gvsig.osgvp.core.osg.Node;
17
import org.gvsig.osgvp.core.osg.Vec3;
18
import org.gvsig.osgvp.core.osg.Vec4;
19
import org.gvsig.osgvp.core.osgtext.TextBase;
20
import org.gvsig.osgvp.core.osgutil.Optimizer;
21
import org.gvsig.osgvp.core.osgutil.Optimizer.OptimizationOptions;
22
import org.gvsig.osgvp.exceptions.InvalidValueException;
23
import org.gvsig.osgvp.exceptions.node.NodeException;
24
import org.gvsig.osgvp.features.PixelPoint;
25
import org.gvsig.osgvp.features.PointExtruder;
26
import org.gvsig.osgvp.features.Polygon;
27
import org.gvsig.osgvp.features.PolygonExtruder;
28
import org.gvsig.osgvp.features.Polyline;
29
import org.gvsig.osgvp.features.PolylineExtruder;
30
import org.gvsig.osgvp.features.QuadPoint;
31
import org.gvsig.osgvp.features.TessellablePolygon;
32
import org.gvsig.osgvp.features.Text;
33
import org.gvsig.osgvp.geometries.Point3D;
34
import org.gvsig.osgvp.terrain.Terrain;
35
import org.gvsig.osgvp.symbology.FadeTextSymbol;
36
import org.gvsig.osgvp.symbology.TextSymbol;
37
import org.gvsig.osgvp.symbology.visitor.Symbol3DVisitor;
38

  
39
import com.iver.ai2.gvsig3d.resources.ResourcesFactory;
40
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
41
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.AttrInTableLabelingStrategy;
42

  
43
public class FeatureFactory extends Group {
44

  
45
	private static double 	_radius;
46
	static Terrain 			_terrain;
47
	private static Logger 	_logger = Logger.getLogger(Hud.class.getName());
48

  
49
	public FeatureFactory(double radius, Terrain terrain) {
50
		super();
51
		_radius = radius;
52
		_terrain = terrain;
53
		init();
54
	}
55

  
56
	private void init() {
57

  
58

  
59
	}
60

  
61
	/**
62
	 * Method to create a new 3D text. With a value and position. Text aligment
63
	 * is LEFT CENTER, and his font is "Arial.ttf"
64
	 * 
65
	 * @param texto
66
	 *            Text that is visible in 3D
67
	 * @param position
68
	 *            Position of 3D text in cartesian coordinates
69
	 * @return New node
70
	 */
71
	public static Node insertTextoS(String texto, Vec3 position, Vec4 color,
72
			int tam, boolean inPixels) {
73

  
74
		// Creating text node
75
		Text text = null;
76
		try {
77
			text = new Text();
78
		} catch (NodeException e1) {
79
			// TODO Auto-generated catch block
80
			e1.printStackTrace();
81
		}
82
		// Set up text properties
83
		text.setText(texto);
84
		text.setCharacterSize(tam);
85
		// Select that the text will be in pixels or screen coordinates
86
		if (inPixels) {
87
			text.setCharacterSizeMode(Text.CharacterSizeMode.SCREEN_COORDS);
88
		} else {
89
			text.setCharacterSizeMode(Text.CharacterSizeMode.OBJECT_COORDS);
90
		}
91
		text.setColor(color);
92
		text.setAxisAlignment(Text.AxisAlignment.SCREEN);
93
		text.setAlignment(Text.AlignmentType.LEFT_BOTTOM);
94
		text.setPosition((float) position.x(), (float) position.y(),
95
				(float) position.z());
96

  
97
		// Search font in resources directori
98
		if (ResourcesFactory.exitsResouce("arial.ttf"))
99
			text.setFont(ResourcesFactory.getResourcePath("arial.ttf"));
100
		else
101
			text.setFont("arial.ttf");
102
		text.setAutoRotateToScreen(true);
103

  
104
		// Optimizer generated nodes
105
		Optimizer opt = new Optimizer();
106
		try {
107
			opt.optimize(text, OptimizationOptions.SPATIALIZE_GROUPS);
108
		} catch (InvalidValueException e) {
109
			// TODO Auto-generated catch block
110
			e.printStackTrace();
111
		} catch (NodeException e) {
112
			// TODO Auto-generated catch block
113
			e.printStackTrace();
114
		}
115

  
116
		// Return node
117
		return text;
118

  
119
	}
120

  
121
	/**
122
	 *  Method to create a new 3D point. With a color, heigth and position.
123
	 * 
124
	 * @param hash
125
	 *            Hash Table that contains "Puntos3D" elements
126
	 * @return
127
	 */
128
	public static Node insertPointS(HashMap hash) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff