Revision 15439

View differences:

import/ext3D/branches/ext3D_v1.1/extAnimation3D/build.xml
1
<project name="Generar extension en Andami" 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="plugin" value="com.iver.ai2.animation3D" />
10
	<property name="extension-dir" location="../_fwAndami/gvSIG/extensiones" />
11
	<property name="logos-dir" location="../_fwAndami/theme" />
12
	<property name="gvsig-lib" location="../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib" />
13
	<!--property name="binaries-dir" location="../binaries" /-->
14

  
15
	<target name="init">
16
		<!-- Create the time stamp -->
17
		<tstamp />
18
		<!-- Create the build directory structure used by compile -->
19
		<mkdir dir="${build}" />
20
		<!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
21
		<buildnumber />
22

  
23
	</target>
24

  
25
	<target name="generate-without-source" description="generate the distribution without the source file" depends="">
26
		<!-- Create the distribution directory -->
27
		<mkdir dir="${dist}" />
28
		<mkdir dir="${dist}/lib" />
29
		<mkdir dir="${dist}/binaries" />
30
		<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file
31
         Except classes to be instantiated in core gvSIG -->
32
		<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" />
33

  
34
		<copy todir="${dist}/lib/">
35
			<fileset dir="lib/" includes="**/**" />
36
		</copy>
37
		<!-- Put in this .jar the classes to be instantiated in gvSIG -->
38
		<copy file="config/config.xml" todir="${dist}" />
39
		<copy file="config/about.htm" todir="${dist}" />
40

  
41
		<copy todir="${dist}">
42
			<fileset dir="config" includes="text*.properties" />
43
		</copy>
44
		<copy todir="${dist}/images">
45
			<fileset dir="images/" includes="**/**" excludes="**/*.db" />
46
		</copy>
47

  
48
		<move todir="${extension-dir}/${plugin}/">
49
			<fileset dir="${dist}" includes="**/**" />
50
		</move>
51
	</target>
52

  
53
	<target name="copy-binaries">
54
		<copy todir="${binaries-dir}">
55
			<fileset dir="binaries/" includes="**" />
56
		</copy>
57
	</target>
58

  
59
	<target name="debug-yes">
60
		<property name="debug" value="on" />
61
		<property name="debuglevel" value="lines, vars" />
62
	</target>
63

  
64
</project>
65

  
import/ext3D/branches/ext3D_v1.1/extAnimation3D/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/Utiles/src"/>
6
	<classpathentry combineaccessrules="false" kind="src" path="/ext3D"/>
7
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
8
	<classpathentry combineaccessrules="false" kind="src" path="/appgvSIG"/>
9
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/>
10
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/gluegen-rt.jar"/>
11
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/jogl.jar"/>
12
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/libjosg-core-1.0-SNAPSHOT.jar"/>
13
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/libjosg-features-1.0-SNAPSHOT.jar"/>
14
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/libjosg-planets-1.0-SNAPSHOT.jar"/>
15
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.ai2.gvsig3d/lib/libjosg-viewer-1.0-SNAPSHOT.jar"/>
16
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/gvsig-animation.jar"/>
17
	<classpathentry kind="output" path="bin"/>
18
</classpath>
import/ext3D/branches/ext3D_v1.1/extAnimation3D/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extAnimaton3D</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
import/ext3D/branches/ext3D_v1.1/extAnimation3D/config/text.properties
1
#Default language
2
#AnimationGui
3
Check_Text=Visualizaci?n frames
4
Label_Duration =Duraci?n
5
Label_Mode=Modo
6
Window_Title=Controles de animaci?n
7
Text_Secs=segs
8
Capturar_encuadre=Capturar encuadre
9
Capturar_capa=Capturar capa
10
Controles_de_animacion=Controles de animaci?n
11
Exportar_video=Exportar v?deo
12
Borrar_animacion=Borrar animaci?n
13
Animacion=Animaci?n
import/ext3D/branches/ext3D_v1.1/extAnimation3D/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>
import/ext3D/branches/ext3D_v1.1/extAnimation3D/config/text_ca.properties
1
#Translations for language [ca]
2
#AnimationGui
3
Check_Text=Visualizaci?n frames
4
Label_Duration =Duraci?n
5
Label_Mode=Modo
6
Window_Title=Controles de animaci?n
7
Text_Secs=segs
8
Capturar_encuadre=Capturar encuadre
9
Capturar_capa=Capturar capa
10
Controles_de_animacion=Controles de animaci?n
11
Exportar_video=Exportar v?deo
12
Borrar_animacion=Borrar animaci?n
13
Animacion=Animaci?n
import/ext3D/branches/ext3D_v1.1/extAnimation3D/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="com.iver.cit.gvsig" />
4
	<depends plugin-name="com.iver.ai2.gvsig3d" />
5
	
6
	<libraries library-dir="./lib"/>
7
	<resourceBundle name="text"/>
8
	<extensions>
9
		<extension class-name="com.iver.cit.gvsig.animation.ExtensionAnimacion3D"
10
			description="Extensi?n encargada de registrar los tipos de animacion 3D."
11
			active="true"
12
			priority="50">					
13
		</extension>
14
	</extensions>
15
</plugin-config>
import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/Interpolator3DFlat.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.util.List;
4

  
5
import com.iver.ai2.gvsig3d.camera.ProjectCamera;
6
import com.iver.ai2.gvsig3d.gui.View3D;
7
import com.iver.cit.gvsig.animation.keyframe.IInterpolator;
8
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
9

  
10
import es.upv.ai2.libjosg.Vec3;
11
import es.upv.ai2.libjosg.viewer.Camera;
12

  
13
public class Interpolator3DFlat implements IInterpolator {
14

  
15
	public View3D view;
16

  
17
	public IKeyFrame interpolate(List kfList, int index, double time) {
18
		KeyFrame3DFlat KF = new KeyFrame3DFlat();
19

  
20
		if (kfList == null)
21
			return null;
22

  
23
		if (this.view == null)
24
			return null;
25

  
26
		switch (kfList.size()) {
27
		// this case when there are only has 2 keyframes
28
		case 2:
29
			// getting the keyframes
30
			KeyFrame3DFlat kf1 = (KeyFrame3DFlat) kfList.get(0);
31
			KeyFrame3DFlat kf2 = (KeyFrame3DFlat) kfList.get(1);
32

  
33
			if (index == 1) {
34
				KeyFrame3DFlat kaux = kf1;
35
				kf1 = kf2;
36
				kf2 = kaux;
37
			}
38

  
39
			if ((kf1 == null) ||(kf2 == null))
40
				return null;
41
			ProjectCamera vp1 = (ProjectCamera) kf1.getAnimatedObject();
42
			ProjectCamera vp2 = (ProjectCamera) kf2.getAnimatedObject();
43

  
44
			// ViewPort vp = view.getMapControl().getViewPort();
45

  
46
			Camera cam1 = vp1.getCamera();
47
			Camera cam2 = vp2.getCamera();
48
			double time1 = kf1.getTime();
49
			double time2 = kf2.getTime();
50
			
51
			Vec3 eye = linearInterpolate(cam1.getEye(), cam2.getEye(), time1, time2, time);
52
			Vec3 center = linearInterpolate(cam1.getCenter(), cam2.getCenter(), time1, time2, time);
53
//			Vec3 center = new Vec3(eye.x(),eye.y(),0.0);
54
			Vec3 up = linearInterpolate(cam1.getUp(), cam2.getUp(), time1, time2, time);
55
		
56
			Camera newCamera = new Camera();
57
//			newCamera.setViewByLookAt(eye, center, cam1.getUp());
58
			newCamera.setViewByLookAt(eye, center, up);
59

  
60
			ProjectCamera pe = new ProjectCamera();
61
			pe.setCamera(newCamera);
62
			KF.setName("temporal_keyframe");
63
			// vp.setExtent(newExtent);
64
			KF.setAnimatedObject(pe);
65
			break;
66

  
67
		}
68

  
69
		return KF;
70
	}
71

  
72
	private double linearInterpolate(double minX, double minX2, double timePos,
73
			double timePos2, double time) {
74
		// P1 + (P2-P1)*((t-t1)/(t2-t1))
75
		return (minX + (minX2 - minX)
76
				* ((time - timePos) / (timePos2 - timePos)));
77
	}
78

  
79
	private Vec3 linearInterpolate(Vec3 minX, Vec3 minX2, double timePos,
80
			double timePos2, double time) {
81

  
82
		Vec3 result = new Vec3();
83

  
84
		double ele1 = linearInterpolate(minX.x(), minX2.x(), timePos, timePos2,
85
				time);
86
		double ele2 = linearInterpolate(minX.y(), minX2.y(), timePos, timePos2,
87
				time);
88
		double ele3 = linearInterpolate(minX.z(), minX2.z(), timePos, timePos2,
89
				time);
90

  
91
		result.setX(ele1);
92
		result.setY(ele2);
93
		result.setZ(ele3);
94
		return result;
95
	}
96

  
97
	public Object getAnimatedObject() {
98

  
99
		return this.view;
100
	}
101

  
102
	public void setAnimatedObject(Object ani) {
103
		this.view = (View3D) ani;
104

  
105
	}
106
}
import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/KeyFrame3DFlat.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.util.List;
4

  
5
import com.iver.ai2.gvsig3d.camera.ProjectCamera;
6
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
7
import com.iver.utiles.XMLEntity;
8

  
9
public class KeyFrame3DFlat implements IKeyFrame {
10

  
11
	private String name;
12
	private double time;
13

  
14
	ProjectCamera projectCamera = null;
15
	private Object extend;
16

  
17
	public void Apply(double Tini) {
18
		// TODO Auto-generated method stub
19

  
20
	}
21

  
22
	public void CapturesProperties() {
23
		// TODO Auto-generated method stub
24

  
25
	}
26

  
27
	public void CapturesProperties(ProjectCamera projectCamera) {
28
		this.projectCamera = projectCamera;
29

  
30
	}
31

  
32
	public String getName() {
33
		// TODO Auto-generated method stub
34
		return this.name;
35
	}
36

  
37
	public List getPropertiesList() {
38
		// TODO Auto-generated method stub
39
		return null;
40
	}
41

  
42
	public void setName(String name) {
43
		this.name = name;
44

  
45
	}
46

  
47
	public void setPropertiesList(List list) {
48
		// TODO Auto-generated method stub
49

  
50
	}
51

  
52
	public String toString() {
53
		String result;
54
		result = " keyframe3DFlats:\n";
55
		result += " tiempo: " + this.time;
56
		result += " nombre del extent: " + this.projectCamera.getDescription();
57

  
58
		// result= "Name: " + this.getName();
59
		return result;
60
	}
61

  
62
	public void Interpolate(Object p1, Object p2, double time) {
63
		// TODO Auto-generated method stub
64
	}
65

  
66
	public Object getAnimatedObject() {
67
		// TODO Auto-generated method stub
68
		return projectCamera;
69
	}
70
	public void setAnimatedObject(Object object) {
71
		this.projectCamera = (ProjectCamera) object;
72
	}
73

  
74
	public double getTime() {
75
		return time;
76
	}
77

  
78
	public void setTime(double time) {
79
		this.time = time;
80
	}
81

  
82
	public String getClassName() {
83
		// TODO Auto-generated method stub
84
		return null;
85
	}
86

  
87
	public XMLEntity getXMLEntity() {
88
		// TODO Auto-generated method stub
89
		return null;
90
	}
91

  
92
	public void setXMLEntity(XMLEntity xml) {
93
		// TODO Auto-generated method stub
94
		
95
	}
96

  
97
}
import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/ExtensionAnimacion3D.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import com.iver.andami.plugins.Extension;
4
import com.iver.utiles.extensionPoints.ExtensionPoint;
5
import com.iver.utiles.extensionPoints.ExtensionPoints;
6
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
7

  
8
//import com.iver.ai2.gvsig3d.gui.AnimationContol3D;
9

  
10
/**
11
 * @author
12
 * @since 1.1
13
 * 
14
 * Menu of animation toolbar's options.
15
 */
16

  
17
public class ExtensionAnimacion3D extends Extension {
18

  
19
	public void execute(String actionCommand) {
20

  
21
	}
22

  
23
	public void initialize() {
24

  
25
		AnimationTypeFactoryLayer3DFlat.register();
26
		
27

  
28
	}
29

  
30
	public boolean isEnabled() {
31
		// TODO Auto-generated method stub
32
		return true;
33
	}
34

  
35
	public boolean isVisible() {
36

  
37
		return false;
38
	}
39

  
40
}
import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/AnimationTypeFactoryLayer3DFlat.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import com.iver.cit.gvsig.animation.AnimationFactory;
4

  
5
public class AnimationTypeFactoryLayer3DFlat extends AnimationFactory {
6

  
7
	public static String registerName = "AnimationLayer3DFlat";
8
	
9
	
10
	public static AnimationLayer3DFlat animationLayer3DFlat;
11
	
12
	static {
13
		if (animationLayer3DFlat == null) {
14
			animationLayer3DFlat = new AnimationLayer3DFlat();
15
			animationLayer3DFlat.setClassName("AnimationLayer3DFlat");
16
			animationLayer3DFlat.setName("AnimationLayer3DFlat");
17
			animationLayer3DFlat.setDescription("Animacion basada en encuadres para vista 3D plana");
18
		}
19
	}
20
	
21

  
22
	
23
	public Object create() {
24
		
25
       return animationLayer3DFlat;
26
	}
27
	
28
	/**
29
	 * Registers in the points of extension the Factory with alias.
30
	 * 
31
	 */
32
	public static void register() {
33
		register(registerName, new AnimationTypeFactoryLayer3DFlat(), "com.iver.cit.gvsig.animation.AnimationLayer3DFlat");
34
	}
35

  
36
	public String getRegisterName() {
37
		return registerName;
38
	}
39

  
40
}
import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/AnimationLayer3DFlat.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import com.iver.ai2.gvsig3d.camera.ProjectCamera;
4
import com.iver.ai2.gvsig3d.gui.Hud;
5
import com.iver.ai2.gvsig3d.gui.View3D;
6
import com.iver.cit.gvsig.animation.IAnimationType;
7
import com.iver.cit.gvsig.animation.keyframe.IAnimationTypeKeyFrame;
8
import com.iver.cit.gvsig.animation.keyframe.IInterpolator;
9
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
10

  
11
import es.upv.ai2.libjosg.Node;
12
import es.upv.ai2.libjosg.viewer.Camera;
13

  
14
public class AnimationLayer3DFlat implements IAnimationTypeKeyFrame {
15

  
16
	private String className = this.getClass().getName();
17
	private String description = "Animacion basada en encuadres para vista 3D plana";
18
	private String name = "Animacion vista 3D plana";
19
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
20
	private IInterpolator interpolator;
21
	private View3D view;
22

  
23
	public AnimationLayer3DFlat() {
24
		this.interpolator = new Interpolator3DFlat();
25
	}
26

  
27
	public String getClassName() {
28
		return className;
29
	}
30

  
31
	public String getDescription() {
32
		return description;
33
	}
34

  
35
	public String getName() {
36
		return name;
37
	}
38

  
39
	public void setClassName(String className) {
40
		this.className = className;
41
	}
42

  
43
	public void setDescription(String description) {
44
		this.description = description;
45
	}
46

  
47
	public void setName(String name) {
48
		this.name = name;
49
	}
50

  
51
	public void AppliesToObject(Object animated) {
52

  
53
		// TODO implementar esta funcion para vistas 3D esfericas.
54
		
55
		KeyFrame3DFlat keyf = (KeyFrame3DFlat) animated;
56
		ProjectCamera projectCamera = (ProjectCamera) keyf.getAnimatedObject();
57

  
58
		view.setCamera(projectCamera.getCamera());	
59
//		Hud hud = (Hud) view.getCanvas3d().getOSGViewer().getNodeFromHUD(0);
60
//		hud.setAnimationTime(AnimationPlayer.getCurrentTime()/1000);
61
//		hud.updateHud();
62
		
63
		
64
		view.getCanvas3d().repaint();
65
	
66
	}
67

  
68
	public int getTypeTrack() {
69
		return typeTrack;
70
	}
71

  
72
	public void setTypeTrack(int typeTrack) {
73
		this.typeTrack = typeTrack;
74

  
75
	}
76

  
77
	public IInterpolator getInterpolator() {
78
		return this.interpolator;
79
	}
80

  
81
	public void setInterpolator(IInterpolator interpolator) {
82
		this.interpolator = interpolator;
83

  
84
	}
85

  
86
	public Object getAnimatedObject() {
87
		// TODO Auto-generated method stub
88
		return this.view;
89
	}
90

  
91
	public void setAnimatedObject(Object object) {
92
		this.view = (View3D) object;
93

  
94
	}
95

  
96
}

Also available in: Unified diff