Revision 16992

View differences:

tags/tmp_build/prototypes/3D/build/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0"
2
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
4
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
	<modelVersion>4.0.0</modelVersion>
6
   	<groupId>ai2.libjosg</groupId>
7
   	<artifactId>libjosg</artifactId>
8
   	<packaging>pom</packaging>
9
   	<version>1.0-SNAPSHOT</version>
10
   	<name>libjosg</name>
11
   	<url>http://www.ai2.upv.es</url>
12
   	<description>libjosg library</description>
13

  
14
	<inceptionYear>2006</inceptionYear>
15

  
16
   	<developers>
17
     		<developer>
18
      			<name>Rafael Gaitán</name>
19
      			<id>rgaitan</id>
20
      			<email>rgaitan@dsic.upv.es</email>
21
      			<roles>
22
          			<role>Project Lead</role>
23
      			</roles>
24
      			<organization>AI2</organization>
25
     		</developer>
26
     		<developer>
27
			<name>Maria Ten</name>
28
      			<id>mten</id>
29
      			<email>mten@dsic.upv.es</email>
30
      			<roles>
31
          			<role>Developer</role>
32
      			</roles>
33
      			<organization>AI2</organization>
34
     		</developer>
35
		<developer>
36
			<name>Jordi Torres</name>
37
      			<id>jtorres</id>
38
      			<email>jtorres@dsic.upv.es</email>
39
      			<roles>
40
          			<role>Developer</role>
41
      			</roles>
42
      			<organization>AI2</organization>
43
     		</developer>
44
		<developer>
45
			<name>Javier Lluch</name>
46
      			<id>jlluch</id>
47
      			<email>jlluch@dsic.upv.es</email>
48
      			<roles>
49
          			<role>Manager</role>
50
      			</roles>
51
      			<organization>AI2</organization>
52
     		</developer>
53
	</developers>
54

  
55
	<scm>
56
     		<connection>
57
      			scm:svn:https://www.sig.upv.es/svn/gvSIG3D/trunk
58
     		</connection>
59
     		<developerConnection>
60
      			scm:svn:https://www.sig.upv.es/svn/gvSIG3D/trunk
61
     		</developerConnection>
62
     		<url>https://www.sig.upv.es/svn/gvSIG3D/trunk</url>
63
   	</scm>
64

  
65
   	<organization>
66
     		<name>AI2</name>
67
     		<url>http://www.ai2.upv.es/</url>
68
   	</organization>
69

  
70
	<repositories>
71
     		<repository>
72
      		<id>jboss</id>
73
      		<url>http://repository.jboss.com/maven2/</url>
74
     		</repository>
75
     		<repository>
76
      		<id>local</id>
77
      		<url>file://${basedir}/../build/repository</url>
78
     		</repository>
79
   	</repositories>
80

  
81
   	<dependencies>
82
     		<dependency>
83
      			<groupId>junit</groupId>
84
      			<artifactId>junit</artifactId>
85
     			<version>3.8.1</version>
86
      			<scope>test</scope>
87
     		</dependency>
88
   	</dependencies>
89

  
90
	<reporting>
91
     		<plugins>
92
      			<plugin>
93
          			<groupId>org.apache.maven.plugins</groupId>
94
          			<artifactId>maven-javadoc-plugin</artifactId>
95
          			<configuration>
96
             				<minmemory>128m</minmemory>
97
             				<maxmemory>512</maxmemory>
98
             				<aggregate>true</aggregate>
99
             				<outputDirectory>${stagingDirectory}/libjosg/apidocs</outputDirectory>
100
          			</configuration>
101
      			</plugin>
102
			<plugin>
103
				<artifactId>maven-surefire-plugin</artifactId>
104
			</plugin>
105
			<plugin>
106
				<artifactId>maven-clover-plugin</artifactId>
107
			</plugin>
108
			<plugin>
109
				<groupId>org.codehaus.mojo</groupId>
110
				<artifactId>changelog-maven-plugin</artifactId>
111
			</plugin>
112
			<plugin>
113
				<groupId>org.codehaus.mojo</groupId>
114
				<artifactId>taglist-maven-plugin</artifactId>
115
			</plugin>
116
		</plugins>
117
	</reporting>
118

  
119
   <build>
120
     <plugins>
121
      <plugin>
122
          <groupId>org.apache.maven.plugins</groupId>
123
          <artifactId>maven-compiler-plugin</artifactId>
124
          <configuration>
125
             <source>1.4</source>
126
             <target>1.4</target>
127
          </configuration>
128
      </plugin>
129
      <plugin>
130
          <groupId>org.codehaus.mojo</groupId>
131
          <artifactId>dependency-maven-plugin</artifactId>
132
          <executions>
133
             <execution>
134
               <id>copy-dependencies</id>
135
               <phase>package</phase>
136
               <goals>
137
                <goal>copy-dependencies</goal>
138
               </goals>
139
               <configuration>
140
                <outputDirectory>
141
                    ../build-jni/product/lib
142
                </outputDirectory>
143
               </configuration>
144
             </execution>
145
          </executions>
146
      </plugin>
147
         <plugin>
148
           <artifactId>maven-clean-plugin</artifactId>
149
           <configuration>
150
             <filesets>
151
               <fileset>
152
                 <directory>product/lib</directory>
153
                 <includes>
154
                   <include>**/**</include>
155
                 </includes>
156
            </fileset>
157
            </filesets>
158
           </configuration>
159
         </plugin>
160
         <plugin>
161
          <groupId>org.apache.maven.plugins</groupId>
162
          <artifactId>maven-site-plugin</artifactId>
163
          <configuration>
164
             <locales>en,es</locales>
165
          </configuration>
166
         </plugin>
167
     </plugins>
168
   </build>
169

  
170

  
171
  <modules>
172
    <module>../libjosg-core</module>
173
    <module>../libjosg-viewer</module>
174
    <module>../libjosg-planets</module>
175
    <module>../libjosg-features</module>
176
    <module>../appGeoViewer</module>
177
  </modules>
178
</project>
179

  
tags/tmp_build/prototypes/3D/build/build.xml
1
<project name="Complete build system" default="all" basedir=".">
2
	<description>
3
		Builds java libraries using maven.
4
	</description>
5
	<!-- set global properties for this build -->
6
	<condition property="mvn.executable" value="mvn.bat" else="mvn">
7
		<os family="windows" />
8
	</condition>
9

  
10
	<condition property="isLinux">
11
		<and>
12
			<os family="unix" />
13
			<not>
14
				<os family="mac" />
15
			</not>
16
		</and>
17
	</condition>
18
	<condition property="isWindows">
19
		<or>
20
			<os family="windows" />
21
			<os family="win9x" />
22
			<os name="Windows Vista" />
23
		</or>
24
	</condition>
25
	<condition property="isMac">
26
		<os family="mac" />
27
	</condition>
28

  
29
	<condition property="ai2.os" value="win32">
30
		<os family="windows" />
31
	</condition>
32
	<condition property="ai2.os" value="linux32">
33
		<and>
34
			<os family="unix" />
35
			<not>
36
				<os family="mac" />
37
			</not>
38
		</and>
39
	</condition>
40
	<condition property="ai2.os" value="mac">
41
		<os family="mac" />
42
	</condition>
43
	<condition property="gvsig.os" value="w32">
44
		<os family="windows" />
45
	</condition>
46
	<condition property="gvsig.os" value="linux">
47
		<and>
48
			<os family="unix" />
49
			<not>
50
				<os family="mac" />
51
			</not>
52
		</and>
53
	</condition>
54
	<condition property="gvsig.os" value="mac">
55
		<os family="mac" />
56
	</condition>
57

  
58

  
59
	<property name="native-project-libjosg" value="../libjni-libjosg" />
60
	<property name="native-binaries-dir" value="../binaries" />
61

  
62
	<target name="all" depends="compile-native-win,compile-native-linux,
63
    	compile-native-mac,copy-binaries-linux,mvn-install">
64
		<!-- tstamp of the release build -->
65
		<buildnumber />
66
	</target>
67

  
68
	<target name="compile-native-linux" if="isLinux">
69
		<exec dir="${native-project-libjosg}" executable="make">
70
			<arg value="-j2" />
71
		</exec>
72
	</target>
73

  
74
	<target name="copy-binaries-linux" if="isLinux">
75
		<copy todir="../binaries/linux/3D" overwrite="true">
76
			<fileset dir="${native-project-libjosg}/lib/Linux32" includes="libjosg*" />
77
		</copy>
78
	</target>
79

  
80

  
81
	<target name="compile-native-mac" if="isMac">
82
		<echo message="not implemented please launch XCode to compile" />
83
	</target>
84
	<!--target name="copy-binaries-mac" if="isMac">
85
					<copy todir="../binaries/mac" overwrite="true">
86
						<fileset dir="${native-project-libjosg}/lib/mac" includes="libjosg*" />
87
					</copy>
88
	</target-->
89
	<target name="compile-native-win" if="isWindows">
90
		<exec dir="${native-project-libjosg}" executable="cmd.exe">
91
			<arg value="/C" />
92
			<arg value="build.bat" />
93
		</exec>
94
	</target>
95
	<target name="mvn-install">
96
		<exec executable="${mvn.executable}">
97
			<arg value="install" />
98
			<arg value="-Dmaven.test.skip=true" />
99
		</exec>
100
	</target>
101
</project>
102

  
tags/tmp_build/prototypes/3D/build/repository/cqRemoteClients/cqRemoteClients/1.0.0/cqRemoteClients-1.0.0.pom
1
<project>
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>cqRemoteClients</groupId>
4
  <artifactId>cqRemoteClients</artifactId>
5
  <version>1.0.0</version>
6
</project>
tags/tmp_build/prototypes/3D/build/repository/cms/cms/1.0.0/cms-1.0.0.pom
1
<project>
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>cms</groupId>
4
  <artifactId>cms</artifactId>
5
  <version>1.0.0</version>
6
</project>
tags/tmp_build/prototypes/3D/build/repository/cqRasterCache/cqRasterCache/1.0.0/cqRasterCache-1.0.0.pom
1
<project>
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>cqRasterCache</groupId>
4
  <artifactId>cqRasterCache</artifactId>
5
  <version>1.0.0</version>
6
</project>
tags/tmp_build/prototypes/3D/build/repository/jogl/jogl/1.0.0/jogl-1.0.0.pom
1
<project>
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>jogl</groupId>
4
  <artifactId>jogl</artifactId>
5
  <version>1.0.0</version>
6
</project>
tags/tmp_build/prototypes/3D/build/product/GeoViewer3D.bat
1
set PATH=%PATH%;..\..\binaries\w32;
2
java -cp "appGeoViewer3D-1.0-SNAPSHOT.jar:lib/cms-1.0.0.jar:lib/jogl-1.0.0.jar:lib/libjosg-core-1.0-SNAPSHOT.jar:lib/libjosg-viewer-1.0-SNAPSHOT.jar:lib/cqRasterCache-1.0.0.jar:lib/junit-3.8.1.jar:lib/libjosg-features-1.0-SNAPSHOT.jar:lib/cqRemoteClients-1.0.0.jar:lib/kxml2-2.1.8.jar:lib/libjosg-planets-1.0-SNAPSHOT.jar" es.upv.ai2.appGeoViewer3D.GeoViewer3D $1
3

  
0 4

  
tags/tmp_build/prototypes/3D/build/product/GeoViewer3D.sh
1
export LD_LIBRARY_PATH=../../binaries/linux;
2
export DYLD_LIBRARY_PATH=../../binaries/mac;
3
java -cp "appGeoViewer3D-1.0-SNAPSHOT.jar:lib/cms-1.0.0.jar:lib/jogl-1.0.0.jar:lib/libjosg-core-1.0-SNAPSHOT.jar:lib/libjosg-viewer-1.0-SNAPSHOT.jar:lib/cqRasterCache-1.0.0.jar:lib/junit-3.8.1.jar:lib/libjosg-features-1.0-SNAPSHOT.jar:lib/cqRemoteClients-1.0.0.jar:lib/kxml2-2.1.8.jar:lib/libjosg-planets-1.0-SNAPSHOT.jar" es.upv.ai2.appGeoViewer3D.GeoViewer3D $1
4

  
0 5

  
tags/tmp_build/prototypes/3D/build/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>build-jni</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
	</buildSpec>
9
	<natures>
10
	</natures>
11
</projectDescription>
tags/tmp_build/prototypes/3D/build/LEEME.txt
1
Requerimientos para compilación automática:
2
* OpenSceneGraph versi�n 1.2 (http://www.openscenegraph.org)
3
* GDAL Version 1.2.
4
* Maven 2 (2.0.7) (http://maven.apache.org)
5
* ANT (http://ant.apache.org)
6

  
7

  
8
Sistema de Construcción:
9
* El sistema de construcción de las librerías de Java está basado en Maven 2,
10
por lo que es necesaria su instalación tal y como se recomienda en la página.
11
* Aunque Eclipse soporta ANT, también es conveniente su instalación fuera
12
de eclipse, ya que algunas rutas del Sistema Operativo no las encuentra
13
correctamente desde dentro de eclipse.
14

  
15
Compilaci�n Nativa:
16
Para compilar es necesario tener compilados los requerimientos siguiendo
17
las siguientes recomendaciones:
18

  
19
* Windows:
20
	* Compilar OpenSceneGraph 1.2 siguiendo las instrucciones de la p�gina.
21
	* Crearse un directorio (por ejemplo en C:) c:\usr
22
	* En c:\usr, crear los subdirectorios c:\usr\include,c:\usr\lib y c:\usr\bin
23
	* Copiar los ficheros *.dll de OpenSceneGraph a c:\usr\bin
24
	* Copiar los ficheros *.lib de OpenSceneGraph a c:\usr\lib
25
	* Copiar los directorios de inclusi�n de OpensCeneGraph 
26
	  (OpenSceneGraph\include\*) dentro de c:\usr\include
27
	* Descargarse la librer�a GDAL version 1.2.
28
	* Abrir el proyecto de VisualStudio7 y seleccionar Release en la 
29
	  configuraci�n de la soluci�n.
30
	* A�adir a las rutas de b�squeda los directorios:
31
	  - c:\usr\include para la busqueda de cabeceras.
32
	  - c:\usr\lib para la busqueda de librer�as.
33
	* Ejecutar ANT en el directorio build.
34
	
35
* Linux:
36
	* Compilar OpenSceneGraph 1.2 siguiendo las instrucciones de la p�gina:
37
	* Descargarse GDAL (apt-get install libgdal1-dev) o descargarselo de la p�gina.
38
	* Instalar en las rutas por defecto OpenSceneGraph y GDAL (/usr/local o /usr).
39
	* Ejecutar ANT en el directorio build.
40
* Mac
41
	* Descargarse el paquete (.dmg) para OpenSceneGraph 1.2 e instalar los
42
	  frameworks en el sitio apropiado por ejemplo ${HOME}/Library/Frameworks)
43
	* Abrir el proyecto de XCode de la carpeta XCode y generar la solución.
44
	
45
Notas:
46
* La extensi�n3D (ext3D), que se provee con el workspace de gvSIG del piloto 3D
47
ya lleva las librer�as compiladas y preparadas para su instalaci�n en las rutas
48
anteriormente mencionadas.
49

  
50
* Si existe alguna duda o problema a la hora de compilar, usar la lista
51
de desarrolladores de gvSIG para las consultas.
52

  
53

  
54

  
55

  
56
	  
tags/tmp_build/prototypes/3D/extensions/ext3D/build.number
1
#Build Number for ANT. Do not edit!
2
#Wed Oct 17 17:12:00 CEST 2007
3
build.number=6
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/resources/ResourcesFactory.java
1
package com.iver.ai2.gvsig3d.resources;
2

  
3
import java.io.File;
4

  
5
/**
6
 * @author julio
7
 * 
8
 * This class is a factory to find resources in 3D extensions
9
 * 
10
 */
11
public class ResourcesFactory {
12

  
13
	private static String textPath;
14

  
15
	private static String extPath;
16

  
17
	static {
18
		extPath = "/gvSIG/extensiones/com.iver.ai2.gvsig3d/resources/";
19

  
20
		textPath = System.getProperty("user.dir") + extPath;
21
	}
22

  
23
	/**
24
	 * Method to get Path resources directory
25
	 * 
26
	 * @return
27
	 */
28
	public static String getResourcesPath() {
29
		return textPath;
30
	}
31

  
32
	/**
33
	 * Method to get path to specific resource
34
	 * 
35
	 * @param name
36
	 *            Name of resource
37
	 * @return All path resource
38
	 */
39
	public static String getResourcePath(String name) {
40
		return textPath + name;
41
	}
42

  
43
	/**
44
	 * Method to get a list of all resources
45
	 * 
46
	 * @return String array with all resources
47
	 */
48
	public static String[] getResources() {
49
		String[] resourcesList;
50

  
51
		File dir = new File(ResourcesFactory.getResourcesPath());
52

  
53
		resourcesList = dir.list();
54
		if (resourcesList == null) {
55
			// Either dir does not exist or is not a directory
56
		} else {
57
			for (int i = 0; i < resourcesList.length; i++) {
58
				// Get filename of file or directory
59
				String filename = resourcesList[i];
60
			}
61
		}
62

  
63
		return resourcesList;
64
	}
65

  
66
	/**
67
	 * Method to verify if this resource exits
68
	 * 
69
	 * @param name
70
	 *            Name of resource
71
	 * @return True or false
72
	 */
73
	public static boolean exitsResouce(String name) {
74
		boolean exit = false;
75
		String[] resourcesList = ResourcesFactory.getResources();
76

  
77
		for (int i = 0; i < resourcesList.length; i++) {
78
			// Get filename of file or directory
79
			String filename = resourcesList[i];
80
			if (filename.equals(name))
81
				return true;
82
		}
83

  
84
		return exit;
85
	}
86

  
87
	/**
88
	 * Method to set the extension path
89
	 * 
90
	 * @param extPath
91
	 */
92
	public static void setExtPath(String extPath) {
93
		ResourcesFactory.extPath = extPath;
94
		textPath = System.getProperty("user.dir") + extPath;
95
	}
96

  
97
	/**
98
	 * Method to get the extension path
99
	 * 
100
	 * @param extPath
101
	 */
102
	public static String getExtPath() {
103
		return ResourcesFactory.extPath;
104
	}
105
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/About3DExtension.java
1
package com.iver.ai2.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
		super.postInitialize();
24
		About about=(About)PluginServices.getExtension(About.class);
25
		FPanelAbout panelAbout=about.getAboutPanel();
26
		java.net.URL aboutURL = this.getClass().getResource(
27
	        "/about.htm");
28
	        panelAbout.addAboutUrl("3D",aboutURL);
29
	}
30

  
31
	public void execute(String actionCommand) {
32

  
33
	}
34

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

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

  
43
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/navigation/NavigationMask.java
1
package com.iver.ai2.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

  
13
	private int keyMask;
14

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

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

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

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

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

  
54
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/navigation/NavigationMode.java
1
package com.iver.ai2.gvsig3d.navigation;
2

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

  
7
import com.iver.ai2.gvsig3d.gui.View3D;
8

  
9
import es.upv.ai2.libjosg.viewer.CustomTerrainManipulator;
10

  
11
public class NavigationMode {
12

  
13
	/**
14
	 * Custom terrain manipulator
15
	 */
16
	private CustomTerrainManipulator CTM;
17

  
18
	/**
19
	 * List of roll manipulators
20
	 */
21
	private List manRollList;
22

  
23
	/**
24
	 * List of zoom manipulator
25
	 */
26
	private List manZoomList;
27

  
28
	/**
29
	 * List of azimut manipulator
30
	 */
31
	private List manAzimutList;
32

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

  
43
		// Getting the custom terrain manipulator
44
		CTM = view3D.getCanvas3d().getOSGViewer().getCustomTerrainManipulator();
45

  
46
		// Gettin list of roll manipulator
47
		manRollList = new ArrayList();
48
		for (int i = 0; i < CTM.getRollButtonMaskSize(); i++) {
49
			// Save button and key mask
50
			NavigationMask navMask = new NavigationMask(
51
					CTM.getRollMouseMask(i), CTM.getRollKeyMask(i));
52
			// Adding to list
53
			manRollList.add(navMask);
54
		}
55

  
56
		// Gettin list of zoom manipulator
57
		manZoomList = new ArrayList();
58
		for (int i = 0; i < CTM.getZoomButtonMaskSize(); i++) {
59
			// Save button and key mask
60
			NavigationMask navMask = new NavigationMask(
61
					CTM.getZoomMouseMask(i), CTM.getZoomKeyMask(i));
62
			// Adding to list
63
			manZoomList.add(navMask);
64
		}
65

  
66
		// Gettin list of roll manipulator
67
		manAzimutList = new ArrayList();
68
		for (int i = 0; i < CTM.getAzimButtonMaskSize(); i++) {
69
			// Save button and key mask
70
			NavigationMask navMask = new NavigationMask(
71
					CTM.getAzimMouseMask(i), CTM.getAzimKeyMask(i));
72
			// Adding to list
73
			manAzimutList.add(navMask);
74
		}
75
	}
76

  
77
	/**
78
	 * Method to restore defaul roll mode manipulator
79
	 */
80
	public void RestoreRollMode() {
81

  
82
		// Setting left button for roll mode
83
		for (Iterator iter = manRollList.iterator(); iter.hasNext();) {
84
			// Get the mask element
85
			NavigationMask mask = (NavigationMask) iter.next();
86
			// Settin mode
87
			CTM.addRollButtonMask(mask.getBtnMask(), mask.getKeyMask());
88

  
89
		}
90

  
91
	}
92

  
93
	/**
94
	 * Method to restore default zoom mode manipulator
95
	 */
96
	public void RestoreZoomMode() {
97

  
98
		// Setting left button for roll mode
99
		for (Iterator iter = manZoomList.iterator(); iter.hasNext();) {
100
			// Get the mask element
101
			NavigationMask mask = (NavigationMask) iter.next();
102
			// Settin mode
103
			CTM.addZoomButtonMask(mask.getBtnMask(), mask.getKeyMask());
104

  
105
		}
106
	}
107

  
108
	/**
109
	 * Method to restore default azimut mode manipulator
110
	 */
111
	public void RestoreAzimutMode() {
112

  
113
		// Setting left button for roll mode
114
		for (Iterator iter = manAzimutList.iterator(); iter.hasNext();) {
115
			// Get the mask element
116
			NavigationMask mask = (NavigationMask) iter.next();
117
			// Settin mode
118
			CTM.addAzimButtonMask(mask.getBtnMask(), mask.getKeyMask());
119

  
120
		}
121

  
122
	}
123

  
124
	/**
125
	 * Method to set up roll mode in left mouse button
126
	 */
127
	public void SetRollMode() {
128
		// Relmoving all controls
129
		removeAllModes();
130

  
131
		CTM.addRollButtonMask(
132
				CustomTerrainManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
133
				0);
134
	}
135

  
136
	/**
137
	 * Method to set up zoom mode in left mouse button
138
	 */
139
	public void SetZoomMode() {
140
		// Relmoving all controls
141
		removeAllModes();
142
		// Settin mode
143
		CTM.addZoomButtonMask(
144
				CustomTerrainManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
145
				0);
146
	}
147

  
148
	/**
149
	 * Method to set up azimut mode in left mouse button
150
	 */
151
	public void SetAzimutMode() {
152
		// Relmoving all controls
153
		removeAllModes();
154
		CTM.addAzimButtonMask(
155
				CustomTerrainManipulator.MouseButtonMaskType.LEFT_MOUSE_BUTTON,
156
				0);
157
	}
158

  
159
	/**
160
	 * Method to set up default mode in left mouse button
161
	 */
162
	public void SetDefaultMode() {
163
		// Relmoving all controls
164
		removeAllModes();
165

  
166
		RestoreRollMode();
167
		RestoreZoomMode();
168
		RestoreAzimutMode();
169

  
170
	}
171

  
172
	/**
173
	 * Method to remove all mask button manipulator
174
	 */
175
	public void removeAllModes() {
176
		// For remove a button mask always remove 0 index. Why the list of
177
		// button mask auto-reorder her elements.
178

  
179
		// Removing roll modes
180
		for (int i = 0; i < manRollList.size(); i++) {
181
			CTM.removeRollButtonMask(0);
182
		}
183

  
184
		// Removing zoom modes
185
		for (int i = 0; i < manZoomList.size(); i++) {
186
			CTM.removeZoomButtonMask(0);
187
		}
188

  
189
		// Removing azimut modes
190
		for (int i = 0; i < manAzimutList.size(); i++) {
191
			CTM.removeAzimButtonMask(0);
192
		}
193
	}
194

  
195
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/ProjectView3DFactory.java
1
package com.iver.ai2.gvsig3d;
2

  
3
import com.iver.andami.PluginServices;
4

  
5
import com.iver.cit.gvsig.fmap.MapContext;
6
import com.iver.cit.gvsig.fmap.ViewPort;
7
import com.iver.cit.gvsig.fmap.layers.FLayers;
8
import com.iver.cit.gvsig.project.Project;
9
import com.iver.cit.gvsig.project.documents.ProjectDocument;
10
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory;
11
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory;
12
import com.iver.cit.gvsig.project.documents.view.ProjectView;
13
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory;
14
import com.iver.utiles.XMLEntity;
15

  
16
import java.awt.Component;
17
import java.text.DateFormat;
18

  
19
import java.util.ArrayList;
20
import java.util.Date;
21
import java.util.Enumeration;
22
import java.util.Hashtable;
23

  
24
import javax.swing.ImageIcon;
25
import javax.swing.JOptionPane;
26

  
27
import org.gvsig.cacheservice.CacheService;
28

  
29
import com.iver.ai2.gvsig3d.gui.ViewProperties3D;
30
import com.iver.ai2.gvsig3d.map3d.layers.FLayers3D;
31

  
32
import es.upv.ai2.libjosg.planets.Planet.PlanetType;
33

  
34
/**
35
 * Factory of View3D.
36
 * 
37
 * @author Vicente Caballero Navarro
38
 */
39
public class ProjectView3DFactory extends ProjectDocumentFactory {
40
	public static String registerName = "ProjectView3D";
41

  
42
	private boolean createFromGUI = false;
43

  
44
	/**
45
	 * Returns image of button.
46
	 * 
47
	 * @return Image button.
48
	 */
49
	public ImageIcon getButtonIcon() {
50
		return new ImageIcon(this.getClass().getClassLoader().getResource(
51
				"images/ProjectView3D.png"));
52
	}
53

  
54
	/**
55
	 * Returns image of selected button.
56
	 * 
57
	 * @return Image button.
58
	 */
59
	public ImageIcon getSelectedButtonIcon() {
60
		return new ImageIcon(this.getClass().getClassLoader().getResource(
61
				"images/ProjectView3DSel.png"));
62
	}
63

  
64
	public ProjectDocument createFromGUI(Project project) {
65
		createFromGUI = true;
66
		ProjectDocument doc = create(project);
67
		createFromGUI = false;
68
		return doc;
69
	}
70

  
71
	/**
72
	 * Create a new ProjectDocument.
73
	 * 
74
	 * @param project
75
	 *            Opened project.
76
	 * 
77
	 * @return ProjectDocument.
78
	 */
79
	public ProjectDocument create(Project project) {
80
		String viewName = "";
81
        String aux = PluginServices.getText(this, "untitled");
82
        int numViews=((Integer)ProjectDocument.NUMS.get(registerName)).intValue();
83

  
84
        viewName = aux + " - " + numViews++;
85

  
86
        if (project != null) {
87
            // Buscamos si alguna vista ya ten?a este nombre:
88
            while (existName(project, viewName)) {
89
                viewName = aux + " - " + numViews++;
90
            }
91
        }
92

  
93
        ProjectDocument.NUMS.put(registerName,new Integer(numViews));
94
		ProjectView3D vista = createView(viewName);
95
		
96
		if (vista != null)
97
			vista.setProject(project, 0);
98

  
99
		return vista;
100
	}
101

  
102
	/**
103
	 * Create a new ProjectView.
104
	 * 
105
	 * @param baseName
106
	 *            name
107
	 * 
108
	 * @return ProjectView.
109
	 */
110
	private ProjectView3D createView(String viewName) {
111
		ProjectView3D v = new ProjectView3D();
112

  
113
		// in the case of 3D layers, the map context is created by the FLayers'
114
		// constructor
115
		ViewPort vp = new ViewPort(Project.getDefaultProjection());
116
		FLayers layers = new FLayers3D(null, null, vp);
117
		v.setMapContext(layers.getMapContext());
118
		v.setMapOverViewContext(new MapContext(null));
119
		v.getMapOverViewContext().setProjection(
120
				v.getMapContext().getProjection());
121
		v.setName(viewName);
122
		v.setCreationDate(DateFormat.getInstance().format(new Date()));
123

  
124
		if (createFromGUI)
125
			setView3DProperties(v);
126

  
127
		return v;
128
	}
129

  
130
	private void setView3DProperties(ProjectView3D prView) {
131

  
132
		ViewProperties3D viewProperties = new ViewProperties3D(prView, true);
133
		PluginServices.getMDIManager().addWindow(viewProperties);
134

  
135
		// // choose spherical or flat view
136
		// int option = JOptionPane.showConfirmDialog(
137
		// (Component)PluginServices.getMainFrame(),
138
		// /*"<html>"+
139
		// PluginServices.getText(this,"desea_una_vista_esf?rica_(Si)") + "<br>"
140
		// +
141
		// PluginServices.getText(this,"o_plana_(No)") + "<br>" +
142
		// "</html>",
143
		// PluginServices.getText(this,"tipo_de_vista"),*/
144
		// "?Desea una vista esf?rica (Si) o plana (No)?",
145
		// "Tipo de vista 3D",
146
		// JOptionPane.YES_NO_OPTION
147
		// );
148
		// int planetType;
149
		// if (option == JOptionPane.YES_OPTION)
150
		// planetType = PlanetType.SPHERICAL_MODE;
151
		// else
152
		// planetType = PlanetType.PLANE_MODE;
153
		// prView.setPlanetType(planetType);
154
	}
155

  
156
	/**
157
	 * Returns the name of registration in the point of extension.
158
	 * 
159
	 * @return Name of registration
160
	 */
161
	public String getRegisterName() {
162
		return registerName;
163
	}
164

  
165
	/**
166
	 * Returns the name of ProjectDocument.
167
	 * 
168
	 * @return Name of ProjectDocument.
169
	 */
170
	public String getNameType() {
171
		return PluginServices.getText(this, "Vista3D");
172
	}
173

  
174
	/**
175
	 * Registers in the points of extension the Factory with alias.
176
	 * 
177
	 */
178
	public static void register() {
179
		register(registerName, new ProjectView3DFactory());
180
	}
181

  
182
	/**
183
	 * Returns the priority of de ProjectDocument.
184
	 * 
185
	 * @return Priority.
186
	 */
187
	public int getPriority() {
188
		return 2;
189
	}
190

  
191
	/**
192
	 * Returns the priority of the Document in the ProjectWindow list.
193
	 * 
194
	 * @return Priority.
195
	 */
196
	public int getListPriority() {
197
		return 1; // so the 3D View appears before other document types
198
	}
199

  
200
	public boolean resolveImportXMLConflicts(XMLEntity root, Project project,
201
			Hashtable conflicts) {
202
		Hashtable viewsConflits = (Hashtable) conflicts.get(this
203
				.getRegisterName());
204
		Hashtable tablesConflits = (Hashtable) conflicts
205
				.get(ProjectTableFactory.registerName);
206
		XMLEntity xmlTables = root.firstChild("type",
207
				ProjectTableFactory.registerName);
208

  
209
		if (viewsConflits != null && viewsConflits.size() > 0) {
210
			int option = JOptionPane
211
					.showConfirmDialog(
212
							(Component) PluginServices.getMainFrame(),
213
							"<html>"
214
									+ PluginServices
215
											.getText(this,
216
													"conflicto_de_nombres_de_vistas_al_pegar")
217
									+ "<br>"
218
									+ PluginServices
219
											.getText(this,
220
													"debera_introducir_nombres_para_las_vistas_a_pegar")
221
									+ "<br>"
222
									+ PluginServices.getText(this,
223
											"no_se_pegaran_las_tablas")
224
									+ "<br>"
225
									+ PluginServices.getText(this,
226
											"desea_continuar") + "</html>",
227
							PluginServices.getText(this, "pegar_vistas"),
228
							JOptionPane.YES_NO_OPTION);
229
			if (option != JOptionPane.YES_OPTION) {
230
				return false;
231
			}
232
			Enumeration en = viewsConflits.elements();
233
			while (en.hasMoreElements()) {
234
				XMLEntity view = (XMLEntity) en.nextElement();
235
				String newName = JOptionPane
236
						.showInputDialog(
237
								(Component) PluginServices.getMainFrame(),
238
								"<html>"
239
										+ PluginServices
240
												.getText(this,
241
														"introduzca_nuevo_nombre_para_la_vista")
242
										+ " " + view.getStringProperty("name")
243
										+ ":" + "</html>", // Mensaje
244
								view.getStringProperty("name") // Valor por
245
																// defecto
246
						);
247
				if (newName == null) {
248
					JOptionPane.showMessageDialog((Component) PluginServices
249
							.getMainFrame(), "<html>"
250
							+ PluginServices.getText(this,
251
									"operacion_cancelada") + "</html>",// Mensaje
252
							PluginServices.getText(this, "pegar_vistas"),// titulo
253
							JOptionPane.ERROR_MESSAGE);
254
				} else if (newName.equalsIgnoreCase(view
255
						.getStringProperty("name"))) {
256
					JOptionPane.showMessageDialog((Component) PluginServices
257
							.getMainFrame(), "<html>"
258
							+ PluginServices.getText(this,
259
									"operacion_cancelada") + ":<br>"
260
							+ PluginServices.getText(this, "nombre_no_valido")
261
							+ "</html>",// Mensaje
262
							PluginServices.getText(this, "pegar_vistas"),// FIXME:
263
																			// getText
264
							JOptionPane.ERROR_MESSAGE);
265
					return false;
266
				}
267
				view.setName(newName);
268
			}
269
			if (xmlTables != null)
270
				xmlTables.removeAllChildren();
271
			tablesConflits = null;
272
		}
273

  
274
		if (tablesConflits != null && tablesConflits.size() > 0) {
275
			int option = JOptionPane.showConfirmDialog(
276
					(Component) PluginServices.getMainFrame(), "<html>"
277
							+ PluginServices.getText(this,
278
									"conflicto_de_nombres_de_tablas_al_pegar")
279
							+ "<br>"
280
							+ PluginServices.getText(this,
281
									"no_se_pegaran_las_tablas") + "<br>"
282
							+ PluginServices.getText(this, "desea_continuar")
283
							+ "</html>", // Mensaje
284
					PluginServices.getText(this, "pegar_vistas"),// FIXME:
285
																	// getText
286
					JOptionPane.YES_NO_OPTION);
287
			if (option != JOptionPane.YES_OPTION) {
288
				return false;
289
			}
290
			xmlTables.removeAllChildren();
291
		}
292

  
293
		return true;
294
	}
295
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/utils/UtilCoord.java
1
package com.iver.ai2.gvsig3d.utils;
2

  
3
import java.awt.geom.Rectangle2D;
4

  
5
import es.upv.ai2.libjosg.Vec3;
6
import es.upv.ai2.libjosg.planets.Planet;
7
import es.upv.ai2.libjosg.viewer.Camera;
8

  
9
public class UtilCoord {
10
	static String mensaje;
11

  
12
	private static double radio;
13

  
14
	static {
15
		radio = 6378137.0;
16
	}
17

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

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

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

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

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

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

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

  
61
		return result;
62
	}
63

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

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

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

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

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

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

  
105
		return result;
106
	}
107

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

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

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

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

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

  
145
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/utils/Punto3D.java
1
package com.iver.ai2.gvsig3d.utils;
2

  
3
import es.upv.ai2.libjosg.Vec3;
4
import es.upv.ai2.libjosg.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
}
tags/tmp_build/prototypes/3D/extensions/ext3D/src/com/iver/ai2/gvsig3d/Extension3D.java
1
package com.iver.ai2.gvsig3d;
2

  
3
import javax.swing.JPopupMenu;
4

  
5
import com.iver.ai2.gvsig3d.gui.TocRefreshLayer;
6
import com.iver.ai2.gvsig3d.gui.TocTransparencyPanel;
7
import com.iver.andami.PluginServices;
8
import com.iver.andami.plugins.Extension;
9
import com.iver.utiles.extensionPoints.ExtensionPoints;
10
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
11

  
12

  
13
public class Extension3D extends Extension {
14

  
15
	public void execute(String actionCommand) {
16
	}
17

  
18
	public void initialize() {
19
    	JPopupMenu.setDefaultLightWeightPopupEnabled(false);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff