Revision 27175

View differences:

tags/tmp_build/libraries/libAnimation/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 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<groupId>org.gvsig</groupId>
6
	<artifactId>libAnimation</artifactId>
7
	<packaging>jar</packaging>
8
	<version>1.0-SNAPSHOT</version>
9
	<name>libAnimation</name>
10
	<url>http://maven.apache.org</url>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>gvsig-library-base-pom</artifactId>
14
		<version>1.0-SNAPSHOT</version>
15
	</parent>
16
	<dependencies>
17
		<dependency>
18
			<groupId>org.gvsig</groupId>
19
			<artifactId>libIverUtiles</artifactId>
20
			<version>1.9-SNAPSHOT</version>
21
		</dependency>
22
	</dependencies>
23
	<build>
24
		<sourceDirectory>src</sourceDirectory>
25
		<testSourceDirectory>test</testSourceDirectory>
26
	</build>
27
</project>
tags/tmp_build/libraries/libAnimation/build.xml
1
<project name="MyProject" default="create-jar" basedir=".">
2
	<!-- set global properties for this build -->
3
	<property name="src" location="src" />
4
	<property name="build" location="bin" />
5
	<property name="dist" location="dist" />
6
	<!-- <property name="targetDir" location="../_fwAndami/lib"/> -->
7
	<!-- <property name="targetDir" location="../ExtAnimationGUI/lib"/> -->
8
	<!--property name="gvsig-lib" location="../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib" / -->
9
	<property name="gvsig-lib" location="../appgvSIG/lib" />
10
	<property name="jarName" value="gvsig-animation" />
11
	<property name="andamiLibs" location="../_fwAndami/lib" />
12
	<property name="fmapLibs" location="../libFMap" />
13

  
14
	<target name="init">
15
		<!-- Create the time stamp -->
16
		<tstamp />
17
	</target>
18

  
19
	<target name="batch-build" description="compile the sources, create the jar file" depends="compile,create-jar">
20
	</target>
21

  
22
	<target name="compile" description="compile the source">
23
		<!-- Compile the Java code from ${src} to ${build} -->
24
		<mkdir dir="${build}" />
25
		<javac srcdir="${src}" destdir="${build}" source="1.4" target="1.4" debug="${debug}" debuglevel="${debuglevel}" classpath="${compile-classpath}" />
26
		<!-- copy any images or resources present in the src dir -->
27
		<copy todir="${build}">
28
			<fileset dir="${src}" excludes="**/*.java" casesensitive="false" />
29
		</copy>
30
	</target>
31

  
32
	<target name="create-jar" description="Crea el jar de la aplicacion">
33
		<!--<mkdir dir="${dist}" />-->
34
		<jar jarfile="${gvsig-lib}/${jarName}.jar" basedir="${build}" />
35
		<ant dir="../appgvSIG" inheritAll="false">
36
			<property name="encoding" value="ISO_8859_1" />
37
		</ant>
38
	</target>
39

  
40
	<target name="clean" description="clean up">
41
		<!-- Delete the ${build} and ${dist} directory trees -->
42
		<delete dir="${build}" />
43
		<delete dir="${dist}" />
44
	</target>
45

  
46
</project>
47

  
tags/tmp_build/libraries/libAnimation/test/com/iver/cit/gvsig/animation/AnimationTest.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.sql.Date;
4

  
5
import junit.framework.TestCase;
6

  
7
import com.iver.cit.gvsig.animation.interval.AnimationDatedInterval;
8
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory;
9
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
10
import com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion;
11
import com.iver.cit.gvsig.animation.test.Animation3D;
12
import com.iver.cit.gvsig.animation.test.AnimationTypeFactory3D;
13
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack;
14
import com.iver.utiles.XMLEntity;
15
import com.iver.utiles.extensionPoints.ExtensionPoint;
16
import com.iver.utiles.extensionPoints.ExtensionPoints;
17
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
18

  
19
public class AnimationTest extends TestCase {
20

  
21
	private Animation3D a3D;
22

  
23
	private AnimationContainer AC;
24

  
25
	public void testRegisterType() throws Throwable {
26

  
27
		AnimationTypeFactory3D.register();
28
		ExtensionPoints extensionPoints = ExtensionPointsSingleton
29
				.getInstance();
30
		System.out.println("Getting extension point...");
31
		ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
32
				.get("Animation"));
33
		System.out.println("Creating animation type ...");
34
		a3D = (Animation3D) extPoint.create("Animation3D");
35
		System.out.println("Done " + a3D);
36
		// System.out.println("Resultados:\n " + a3D.getName() + "\n "
37
		// + a3D.getClassName() + "\n " + a3D.getDescription());
38

  
39
	}
40
	
41
	public void testRegisterType2D() throws Throwable {
42

  
43
//		AnimationLayer2D a3D;
44
//		
45
//		AnimationTypeFactoryLayer2D.register();
46
//		ExtensionPoints extensionPoints = ExtensionPointsSingleton
47
//				.getInstance();
48
//		System.out.println("Getting extension point...");
49
//		ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
50
//				.get("Animation"));
51
//		System.out.println("Creating animation type ...");
52
//		a3D = (AnimationLayer2D) extPoint.create("AnimationLayer2D");
53
//		System.out.println("Done " + a3D);
54
//		// System.out.println("Resultados:\n " + a3D.getName() + "\n "
55
//		// + a3D.getClassName() + "\n " + a3D.getDescription());
56

  
57
	}
58

  
59
	public void testCreateAnimationContainer() throws Throwable {
60

  
61
		// Inicialicing
62
		a3D = null; // Animation type
63
		AC = null; // Animation Container
64
		XMLEntity xml = new XMLEntity();
65

  
66
		// Creando contenerdor de tracks
67
		AC = new AnimationContainer();
68
		testRegisterType();
69
	
70
		String antesName = AC.getClassName();
71
		System.out.println("antes: " + antesName);
72
		xml = AC.getXMLEntity();
73
		//saveWindowProperties(xml);
74
		AC.setXMLEntity(xml);
75
		
76
		String despuesName = xml.getStringProperty("class_name");
77
		System.out.println("\ndespues: " + despuesName);
78
		assertEquals(antesName,despuesName);
79
		
80
		
81
		System.out.println(AC);
82
	}
83

  
84
	public void testCreateDateTrack() {
85
		
86
		// Inicialicing
87
		a3D = null; // Animation type
88
		AC = null; // Animation Container
89

  
90
		// Creando track del tipo de animacion
91
		AnimationDatedTrack ADTrack = (AnimationDatedTrack) AC
92
				.CreateDatedTrack(a3D);
93
		// Inicializando el track
94
		ADTrack.setName("Track 1");
95
		ADTrack.setDescription("track de prueba para series temporales");
96
		ADTrack.setBeginDate(new Date(0));
97
		ADTrack.setEndDate(new Date(0));
98
		// Creando intervalo
99
		AnimationDatedInterval ADInterval = (AnimationDatedInterval) ADTrack
100
				.createInterval();
101

  
102
		// Inicializando intervalo
103
		Date beginDateInterval = new Date(0);
104
		ADInterval.setBeginDateInterval(beginDateInterval);
105
		Date endDateInterval = new Date(0);
106
		ADInterval.setEndDateInterval(endDateInterval);
107

  
108
		AC.removeAllTrack();
109
		AC.removeTrack(ADTrack);
110
		ADTrack.removeAllIntervals();
111
		ADTrack.removeInterval(ADInterval);
112
		//		
113
		//		
114
		// // IAnimationTrack T = AC.findTrack("Track 2");
115
		// // if (T != null) {
116
		// // T.toString();
117
		// // }else {
118
		// // System.out.println("no encontrada");
119
		// // }
120
		//		
121
		// // List l = AC.getTackListOfType(a3D);
122
		// // System.out.println(l);
123

  
124
	}
125

  
126
	public void testAnimationTimer() throws Throwable {
127

  
128
		AnimationPlayer AP = new AnimationPlayer();
129
		AP.play();
130

  
131
	}
132
	public void testCreateTrack() throws Throwable {
133

  
134
		// AnimationTimer modelo = new AnimationTimer();
135
		// modelo.addObserver (new Observer()
136
		// {
137
		// public void update (Observable unObservable, Object dato)
138
		// {
139
		// System.out.println (dato);
140
		// }
141
		// });
142
		// System.out.println("estoy fuera");
143

  
144
	}
145
	
146
	
147
	public void testFuntionFactory() throws Throwable {
148
		LinearFuntion lf = new LinearFuntion();
149
		System.out.println("registrando " + lf.getClassName());
150
		
151
		FuntionFactory.register(lf);
152
		
153
		LinearFuntion lf2 = new LinearFuntion();
154
		System.out.println("registrando " + lf.getClassName());
155
		
156
		FuntionFactory.register(lf2);
157
		
158
		IInterpolatorTimeFuntion resutl = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
159
		
160
		System.out.println(resutl);
161

  
162
	}
163

  
164

  
165
	
166
}
tags/tmp_build/libraries/libAnimation/test/com/iver/cit/gvsig/animation/AnimationPlayerIPersistanceTest.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.sql.Date;
4
import junit.framework.TestCase;
5
import com.iver.cit.gvsig.animation.interval.AnimationDatedInterval;
6
import com.iver.cit.gvsig.animation.interval.AnimationFunctionInterval;
7
import com.iver.cit.gvsig.animation.interval.AnimationKeyFrameInterval;
8
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack;
9
import com.iver.cit.gvsig.animation.traks.AnimationTimeTrack;
10
import com.iver.utiles.DateTime;
11
import com.iver.utiles.XMLEntity;
12

  
13

  
14
/**
15
 * @author
16
 * 
17
 * Testing IPersistance methods.
18
 */
19

  
20

  
21
public class AnimationPlayerIPersistanceTest extends TestCase {
22
	
23
	/*
24
	 * Testing getXMLEntity, setXMLEntity in AnimationPlayer.
25
	 */
26
	
27
	public void testAnimationPlayer()
28
	{
29
		AnimationPlayer animationPlayer = new AnimationPlayer();
30
		int antesFrameRate = 1;
31
		double antesGlobalTime = 60;
32
		int antesMode = 0;
33
		XMLEntity xml = new XMLEntity();
34
		
35
		
36
		animationPlayer.setFrameRate(antesFrameRate);
37
		animationPlayer.setGlobalTime(antesGlobalTime);
38
		animationPlayer.setAnimationMode(antesMode);
39
						
40
		xml = animationPlayer.getXMLEntity();
41
		animationPlayer.setXMLEntity(xml);
42
		
43

  
44
		int despuesMode = xml.getIntProperty("mode");
45
		double despuesGlobalTime = xml.getDoubleProperty("length");
46
		int despuesFrameRate = xml.getIntProperty("framerate");
47
		assertEquals(antesMode,despuesMode);
48
		assertEquals(antesGlobalTime,despuesGlobalTime,0);
49
		assertEquals(antesFrameRate,despuesFrameRate);
50
		
51
//		System.out.println("Escribiendo depuesMode: " + despuesMode);
52
//		System.out.println("Escribiendo despuesGlobalTime: " + despuesGlobalTime);
53
//		System.out.println("Escribiendo despuesFrameRate: " + despuesFrameRate);
54
//		
55
	}
56

  
57
	/*
58
	 * Testing getXMLEntity, setXMLEntity in AnimationTimeTrack.
59
	 */
60
	
61
	public void testAnimationTimeTrack()
62
	{
63
		AnimationTimeTrack animationTimeTrack = new AnimationTimeTrack(null);		
64
		XMLEntity xml = new XMLEntity();
65
		
66
		String antesName = "nombreCualkiera";
67
		String antesDescription = "DescripcionCualkiera";
68
		double antesBeginTime = 0;
69
		double antesEndTime = 1;
70
		
71
		animationTimeTrack.setName(antesName);
72
		animationTimeTrack.setDescription(antesDescription);
73
		animationTimeTrack.setBeginTime(antesBeginTime);
74
		animationTimeTrack.setendTime(antesEndTime);
75
						
76
		xml = animationTimeTrack.getXMLEntity();
77
		animationTimeTrack.setXMLEntity(xml);
78
		
79
		String despuesName = xml.getStringProperty("name");
80
		String despuesDescription = xml.getStringProperty("description");
81
		double despuesBeginTime = xml.getDoubleProperty("begin_time");
82
		double despuesEndTime = xml.getDoubleProperty("end_time");
83
		
84
		assertEquals(antesName,despuesName);
85
		assertEquals(antesDescription,despuesDescription);
86
		assertEquals(antesBeginTime,despuesBeginTime,0);
87
		assertEquals(antesEndTime,despuesEndTime,0);
88

  
89
	}
90
	
91
	/*
92
	 * Testing getXMLEntity, setXMLEntity in AnimationFunctionInterval.
93
	 */
94
	
95
	public void testAnimationFunctionInterval()
96
	{
97
		AnimationFunctionInterval interval = new AnimationFunctionInterval();
98
		XMLEntity xml = new XMLEntity();
99
		double antesInitialTime = 0;
100
		double antesEndTime = 1;
101
		double antesIntervalTime = antesEndTime - antesInitialTime;
102
		
103
		interval.setInitialTime(antesInitialTime);
104
		interval.setEndTime(antesEndTime);
105
		interval.setIntervalTime(antesIntervalTime);
106
						
107
		xml = interval.getXMLEntity();
108
		interval.setXMLEntity(xml);
109
		
110
		double despuesInitialInterval = xml.getDoubleProperty("begin_time");
111
		double despuesEndTime = xml.getDoubleProperty("end_time");
112
		double despuesIntervalTime = xml.getDoubleProperty("interval_time");
113
		assertEquals(antesInitialTime,despuesInitialInterval,0);
114
		assertEquals(antesEndTime,despuesEndTime,0);
115
		assertEquals(antesIntervalTime,despuesIntervalTime,0);
116
		
117
	}
118
	
119
	/*
120
	 * Testing getXMLEntity, setXMLEntity in AnimationKeyFrameInterval.
121
	 */
122
	
123
	public void testAnimationKeyFrameInterval()
124
	{
125
		AnimationKeyFrameInterval interval = new AnimationKeyFrameInterval();
126
		XMLEntity xml = new XMLEntity();
127
		
128
		double antesInitialTime = 0;
129
		double antesEndTime = 1;
130
		double antesIntervalTime = antesEndTime - antesInitialTime;
131
		
132
		interval.setInitialTime(antesInitialTime);
133
		interval.setEndTime(antesEndTime);
134
		interval.setIntervalTime(antesIntervalTime);
135
						
136
		xml = interval.getXMLEntity();
137
		interval.setXMLEntity(xml);
138
		
139

  
140
		double despuesInitialInterval = xml.getDoubleProperty("begin_time");
141
		double despuesEndTime = xml.getDoubleProperty("end_time");
142
		double despuesIntervalTime = xml.getDoubleProperty("interval_time");
143
		assertEquals(antesInitialTime,despuesInitialInterval,0);
144
		assertEquals(antesEndTime,despuesEndTime,0);
145
		assertEquals(antesIntervalTime,despuesIntervalTime,0);
146
		
147
	}
148
	
149
	/*
150
	 * Testing getXMLEntity, setXMLEntity in AnimationDatedTrack.
151
	 */
152
	
153
	public void testAnimationDatedTrack()
154
	{
155
		AnimationDatedTrack animationDatedTrack = new AnimationDatedTrack(null);
156
		
157
		XMLEntity xml = new XMLEntity();
158
		
159
		String antesName = "nombreCualkiera";
160
		String antesDescription = "DescripcionCualkiera";
161
		Date antesBeginDate = new Date(107,3,21);
162
		Date antesEndDate = new Date(107,6,21);
163
		String sFormat = new String( "Y-m-d" );
164
		String prueba = "nada";
165
		
166
		animationDatedTrack.setName(antesName);
167
		animationDatedTrack.setDescription(antesDescription);
168
		animationDatedTrack.setBeginDate(antesBeginDate);
169
		animationDatedTrack.setEndDate(antesEndDate);
170
						
171
		xml = animationDatedTrack.getXMLEntity();
172
		animationDatedTrack.setXMLEntity(xml);
173
		
174
		String despuesName = xml.getStringProperty("name");
175
		String despuesDescription = xml.getStringProperty("description");
176
		String despuesBeginDate = xml.getStringProperty("begin_date");
177
		String despuesEndDate = xml.getStringProperty("end_date");
178
		
179
		String antesBeginDateString = DateTime.dateToString(antesBeginDate, sFormat);
180
		String antesEndDateString = DateTime.dateToString(antesEndDate, sFormat);
181
		
182
		
183
		assertEquals(antesName,despuesName);
184
		assertEquals(antesDescription,despuesDescription);
185
		assertEquals(prueba,antesBeginDateString,despuesBeginDate);
186
		assertEquals(prueba,antesEndDateString,despuesEndDate);
187

  
188
	}
189
	
190
	/*
191
	 * Testing getXMLEntity, setXMLEntity in AnimationDatedInterval.
192
	 */
193
	
194
	public void testAnimationDatedInterval()
195
	{
196
		AnimationDatedInterval animationDatedInterval = new AnimationDatedInterval();
197
		
198
		XMLEntity xml = new XMLEntity();
199
		
200
		Date antesBeginDate = new Date(107,3,21);
201
		Date antesEndDate = new Date(107,6,21);
202
		String sFormat = new String( "Y-m-d" );
203
		String prueba = "nada";
204
		
205
		animationDatedInterval.setBeginDateInterval(antesBeginDate);
206
		animationDatedInterval.setEndDateInterval(antesEndDate);
207
						
208
		xml = animationDatedInterval.getXMLEntity();
209
		animationDatedInterval.setXMLEntity(xml);
210
		
211
		String despuesBeginDate = xml.getStringProperty("begin_date");
212
		String despuesEndDate = xml.getStringProperty("end_date");
213
		String antesBeginDateString = DateTime.dateToString(antesBeginDate, sFormat);
214
		String antesEndDateString = DateTime.dateToString(antesEndDate, sFormat);
215
		
216
		assertEquals(prueba,antesBeginDateString,despuesBeginDate);
217
		assertEquals(prueba,antesEndDateString,despuesEndDate);
218

  
219
	}
220
	
221
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/AnimationPlayer.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*/
20

  
21
package com.iver.cit.gvsig.animation;
22

  
23
import com.iver.cit.gvsig.animation.timer.AnimationTimer;
24
import com.iver.cit.gvsig.animation.timer.IUpdateCallBack;
25
import com.iver.utiles.IPersistence;
26
import com.iver.utiles.XMLEntity;
27

  
28
/**
29
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
30
 * @since 1.1
31
 * 
32
 */
33

  
34
public class AnimationPlayer implements IUpdateCallBack,
35
		IPersistence {
36

  
37
	public static final int ANIMATION_PLAY = 0;
38

  
39
	public static final int ANIMATION_STOP = 1;
40

  
41
	public static final int ANIMATION_PAUSE = 2;
42

  
43
	public static final int ANIMATION_RECORD = 3;
44
	
45
	public static final int ANIMATION_INITIAL = 4;//Default initial state.
46
							   //our animation modes.
47
	public static final int LOOP = 0;//begin..end - begin..end - begin..end...
48

  
49
	public static final int PING_PONG_LOOP = 1;//begin..end - end..begin - begin..end...
50

  
51
	public static final int PLAY_ONCE = 2;//begin..end
52

  
53
	public static final int PLAY_ONCE_BACKWARDS = 3;//end..begin
54
	
55
	private AnimationContainer animationContainer;
56

  
57
	private int frameRate = 30;
58

  
59
	private int animationPlayerState; //initial, play, pause, stop.
60
	
61
	private int animationMode = 0;//loop, ping pong, play once, play once backwards.
62

  
63
	private double animationFrequency = 1.0 / frameRate * 1000;// ms.
64

  
65
	private double preTime = 0.0;
66

  
67
	private double globalTime = 10.0;
68

  
69
	private double time = 0.0;
70

  
71
	private AnimationTimer AT;
72

  
73
	private boolean pauseFlag = false;
74
	
75
	private boolean playFlag = false;
76
	
77
	private boolean occupied = false;
78

  
79
	private int direcction = 1;//1: 255-0, 0: 0-255.
80

  
81
	public AnimationPlayer() {
82
		AT = new AnimationTimer();
83
	}
84

  
85
	/**
86
	 * Logic actions when the play button is pressed.
87
	 */
88
	public void play() {
89
		if (animationPlayerState != AnimationPlayer.ANIMATION_PLAY){
90
				animationPlayerState = AnimationPlayer.ANIMATION_PLAY;
91
				
92
				if (AT.isAlive() == false){
93
					AT = new AnimationTimer();
94
					AT.addCallBackObject(this);
95
					AT.start(animationFrequency);
96
				}
97

  
98
			//Initial time control, backward animation: initial time = end time, forward animation: initial time = 0.
99
			if ((this.getAnimationMode() == PLAY_ONCE_BACKWARDS)&& (!pauseFlag)) {
100
				time = this.getGlobalTime(); 
101
			}
102
		//	System.err.println("time dentro del play: "+ time);
103
			playFlag = true;// flag of play running.
104
	  //}IF DEL playFlag.
105
		}
106
	}
107

  
108
	
109
	/**
110
	 * Logic actions when the stop button is pressed.
111
	 */
112
	public void stop() {
113
		if ((animationPlayerState != AnimationPlayer.ANIMATION_STOP) && (playFlag == true || pauseFlag == true)) {//If the state is not stop.
114
			animationPlayerState = AnimationPlayer.ANIMATION_STOP;
115
			if(playFlag == true)//flag to control that the actual state is play. 
116
				playFlag = false;
117
			if(pauseFlag == true)//flag to control that the actual state is pause.
118
				pauseFlag = false;
119
			occupied = false;
120
			time = 0.0;
121
			AT.end();
122
		}
123
	}
124

  
125
	
126
	/**
127
	 * Logic actions when the pause button is pressed.
128
	 */
129
	public void pause() {
130
		if (animationPlayerState != AnimationPlayer.ANIMATION_PAUSE && playFlag == true) {//If the state is not pause.
131
			animationPlayerState = AnimationPlayer.ANIMATION_PAUSE;
132
			pauseFlag = true;//flag to control that is not first play pressing. 
133
			playFlag = false;
134
			occupied = false;
135
			AT.end();
136
		}
137
	}
138

  
139
	
140
	/**
141
	 * Logic actions when the record button is pressed.
142
	 */
143
	public void record() {
144
		if (animationPlayerState != AnimationPlayer.ANIMATION_RECORD) {
145
			animationPlayerState = AnimationPlayer.ANIMATION_RECORD;
146
			this.stop();//Provisional operation of record.
147
		}
148
	}
149

  
150
	/**
151
	 * Set of our player frequency.
152
	 * 
153
	 * @param animationFrequency
154
	 */
155
	
156
	public void setFrameRate(int frameRate) {
157
		this.frameRate = frameRate;
158
	}
159

  
160
	public void setTime() {
161
		// TODO generate method to set time
162
	}
163

  
164
	public AnimationContainer getAnimationContainer() {
165
		return animationContainer;
166
	}
167

  
168
	public void setAnimationContainer(AnimationContainer animationContainer) {
169
		this.animationContainer = animationContainer;
170
	}
171

  
172
	public AnimationPlayer(AnimationContainer animationContainer) {
173
		this.animationContainer = animationContainer;
174
	}
175

  
176
	private void apply(double Tini, double Tend) {
177
		getAnimationContainer().apply(Tini, Tend);
178
	}
179
	
180
	/**
181
	 * Getting the total duration of the animation. 
182
	 * @return total time in seconds
183
	 */
184
	public double getGlobalTime() {
185
		return (globalTime * 1000);
186
	}
187

  
188
	
189
	/**
190
	 * Setting the total time of the animation.
191
	 * @param globalTime
192
	 */
193
	public void setGlobalTime(double globalTime) {
194
		this.globalTime = globalTime;
195
	}
196

  
197
	/**
198
	 * Getting the actual state running.
199
	 * @return animationPlayerState: INITIAL, PLAY, STOP, PAUSE, RECORD.
200
	 */
201
	public int getAnimationPlayerState() {
202
		return animationPlayerState;
203
	}
204

  
205
	
206
	/**
207
	 * Setting the state selected in the interface.
208
	 * @param animationPlayerState
209
	 */
210
	public void setAnimationPlayerState(int animationPlayerState) {
211
		this.animationPlayerState = animationPlayerState;
212
	}
213
	
214
	
215
	/**
216
	 * Updating the timer according to our state and mode.
217
	 */
218
	public void update() {
219
		double currentTime=0, delay=0;
220
		if (!occupied) {
221
			occupied = true;
222
			//System.err.println("time dentro del update: "+ time);
223
			//System.err.println("MODO: " + this.getAnimationMode());			
224
			if (this.animationPlayerState == AnimationPlayer.ANIMATION_PLAY) {
225
					if (pauseFlag == true) {//pause->play.
226
						currentTime = System.currentTimeMillis();
227
						preTime = currentTime;
228
						//System.err.println("RETARDO PAUSE TRUE: " + delay);
229
						pauseFlag = false;
230
					}else{//normal play.
231
						 //Calculate the delay
232
						currentTime = System.currentTimeMillis();
233
						delay = currentTime - preTime;
234
						preTime = currentTime;
235
						//System.err.println("RETARDO PAUSE FALSE: " + delay);
236
				}
237
				//System.err.println("RETARDO: " + delay);
238

  
239
				// if the delay could be hightest than the frequency, we have
240
				// had increased the time with this delay
241
				
242
				//Play once or loop animation selected.
243
				if ((this.getAnimationMode() == PLAY_ONCE)||(this.getAnimationMode() == LOOP)) {
244
					if ((delay > animationFrequency) && (!pauseFlag))
245
					{
246
						if(time != 0)
247
							time += delay;
248
						else 
249
							time += animationFrequency;
250
					}
251
					else{
252
						time += animationFrequency;
253
						//Play once animation.
254
					}
255
					if (this.getAnimationMode() == PLAY_ONCE) {
256
						if (time >= this.getGlobalTime()){
257
							occupied = false;
258
							this.stop();
259
						}
260
					} else
261
						time = (time > this.getGlobalTime()) ? 0 : time;
262
				}//if loop.
263
				//Backward animation.
264
				if (this.getAnimationMode() == PLAY_ONCE_BACKWARDS) {
265
					if ((delay > animationFrequency) && (!pauseFlag)){
266
						if((time < this.getGlobalTime()))
267
							time -= delay;
268
						else
269
							time -= animationFrequency;
270
					}
271
					else
272
						time -= animationFrequency;
273
					if(time <= 0){
274
						occupied = false;
275
						pauseFlag = false;
276
						this.stop();
277
					}
278
				}//if backwards.
279
				//Ping pong animation.
280
				if(this.getAnimationMode() == PING_PONG_LOOP){
281
						if(direcction == 1){// 0..globalTime
282
							if ((delay > animationFrequency) && (!pauseFlag)){
283
								if((time < this.getGlobalTime())){
284
									time += delay;
285
								}
286
								else
287
									time += animationFrequency;
288
							}
289
							else
290
								time += animationFrequency;
291
						}
292
						else{
293
							if ((delay > animationFrequency) && (!pauseFlag)){
294
								if((time < this.getGlobalTime())){
295
									time -= delay;
296
								}
297
								else
298
									time -= animationFrequency;
299
							}
300
							else
301
								time -= animationFrequency;
302
						}
303
						if(time > this.getGlobalTime()){
304
							time = this.getGlobalTime();
305
							direcction = 0;
306
						}
307
						else if(time < 0.0){
308
							time = 0.0;
309
							direcction = 1;
310
						}
311
				}//if ping pong.
312
				// Apply and repaint all tracks.
313
				apply(time / this.getGlobalTime(), 0);
314

  
315
			} else if (this.animationPlayerState == AnimationPlayer.ANIMATION_STOP) {
316
				
317
			} else if (this.animationPlayerState == AnimationPlayer.ANIMATION_PAUSE) {
318
						
319
			} else if (this.animationPlayerState == AnimationPlayer.ANIMATION_RECORD) {
320

  
321
			}
322
			occupied = false;
323
		}//ocupied.
324
		//System.out.println("ocupado : " + occupied);
325
	}
326
	
327
	/**
328
	 * Return the actual time running in the player.
329
	 * @return time.
330
	 */
331
	public double getCurrentTime() {
332
		return this.time;
333
	}
334

  
335
	
336
	/**
337
	 * Return the name of this class.
338
	 * @return name.
339
	 */
340
	public String getClassName() {
341
		return this.getClass().getName();
342
	}
343
	
344
	
345
	/**
346
	 * This function returns the actual state of the player.
347
	 * 
348
	 * @return animationMode. loop, ping pong, play once, play once backwards.
349
	 */
350
	public int getAnimationMode() {
351
		return animationMode;
352
	}
353

  
354
	
355
	/**
356
	 * It Depends the selected option the mode change.
357
	 * 
358
	 * @param animationMode
359
	 */
360
	
361
	public void setAnimationMode(int animationMode) {
362
		this.animationMode = animationMode;
363
	}
364

  
365
	
366
	/*
367
	 * IPersistence get method.
368
	 * @see com.iver.utiles.IPersistence#getXMLEntity()
369
	 */
370
	public XMLEntity getXMLEntity() {
371
		XMLEntity xml = new XMLEntity();
372
		//xml.putProperty("animationContainer", "true");
373
		xml.putProperty("className", this.getClassName());
374
		xml.putProperty("animationMode", this.animationMode);
375
		//xml.putProperty("animationPlayerState", animationPlayerState);
376
		xml.putProperty("length",this.globalTime);
377
	//	xml.putProperty("animationFrequency",this.animationFrequency);
378

  
379
		return xml;
380
	}
381
	
382
	
383
	/*
384
	 * IPersistence set method.
385
	 * @see com.iver.utiles.IPersistence#setXMLEntity(com.iver.utiles.XMLEntity)
386
	 */
387
	public void setXMLEntity(XMLEntity xml) {
388
		
389
		if (xml.contains("animationMode"))
390
			this.animationMode = xml.getIntProperty("animationMode");
391
		if (xml.contains("length")){
392
			this.globalTime = xml.getDoubleProperty("length");
393
		}
394
	}
395
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/test/AnimationTypeFactory3D.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.test;
21

  
22
import com.iver.cit.gvsig.animation.AnimationFactory;
23

  
24

  
25
public class AnimationTypeFactory3D extends AnimationFactory {
26

  
27
	public static String registerName = "Animation3D";
28
	
29
	
30
	public static Animation3D animation3D;
31
	
32
	static {
33
		if (animation3D == null) {
34
			animation3D = new Animation3D();
35
			animation3D.setClassName("Animation3D");
36
			animation3D.setName("Animation3D");
37
			animation3D.setDescription("Hola caracola");
38
		}
39
	}
40

  
41
	
42
	public Object create() {
43
		
44
       return animation3D;
45
	}
46
	
47
	/**
48
	 * Registers in the points of extension the Factory with alias.
49
	 * 
50
	 */
51
	public static void register() {
52
		register(registerName, new AnimationTypeFactory3D(), "com.iver.cit.gvsig.animation.test.Animation3D");
53
	}
54

  
55
	public String getRegisterName() {
56
		return registerName;
57
	}
58
	
59
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/test/Animation3D.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.test;
21

  
22
import com.iver.cit.gvsig.animation.IAnimationType;
23
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
24
import com.iver.utiles.XMLEntity;
25

  
26
public class Animation3D implements IAnimationType {
27

  
28
	private String className;
29
	private String Description;
30
	private String Name;
31
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
32

  
33
	public String getClassName() {
34
		return className;
35
	}
36

  
37
	public String getDescription() {
38
		return Description;
39
	}
40

  
41
	public String getName() {
42
		return Name;
43
	}
44

  
45
	public void setClassName(String className) {
46
		this.className = className;
47
	}
48

  
49
	public void setDescription(String description) {
50
		Description = description;
51
	}
52

  
53
	public void setName(String name) {
54
		Name = name;
55
	}
56

  
57
	public void AppliesToObject(Object animated) {
58
		// TODO Auto-generated method stub
59
		
60
	}
61

  
62
	public int getTypeTrack() {
63
		return typeTrack;
64
	}
65

  
66
	public void setTypeTrack(int typeTrack) {
67
		this.typeTrack = typeTrack;
68
		
69
	}
70

  
71
	public Object getAnimatedObject() {
72
		return null;
73
	}
74

  
75
	public void setAnimatedObject(Object object) {
76
		// TODO Auto-generated method stub
77
		
78
	}
79

  
80
	public XMLEntity getXMLEntity() {
81
		return null;
82
	}
83

  
84
	public void setXMLEntity(XMLEntity arg0) {
85
		// TODO Auto-generated method stub
86
		
87
	}
88

  
89
	public void setInterpolator(IInterpolator interpolator) {
90
		// TODO Auto-generated method stub
91
	}
92
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/timer/AnimationTimer.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.timer;
21

  
22
import java.util.ArrayList;
23
import java.util.List;
24

  
25

  
26

  
27
// this class is only an example. it isn?t used in librarys
28
public class AnimationTimer  implements Runnable {
29
	double milis;
30
	private boolean finish;
31
	private List<IUpdateCallBack> callBackList;
32
	private Thread thread;
33
	
34
	
35
    /**
36
     * Lanza un timer cada segundo.
37
     */
38
    public AnimationTimer()
39
    {
40
    	
41
    }
42

  
43
	public void run() {
44
		if (isAlive()) {
45
			while (true) {
46
				try {
47
					Thread.sleep((long) milis);
48
					synchronized (this) {
49
						if (finish) {
50
							break;
51
						}
52
					}
53
				} catch (InterruptedException e) {
54

  
55
					e.printStackTrace();
56
				}
57
				// Updating
58
				Update();
59
			}
60
		}		
61
	}
62
	
63
	public synchronized void end() {
64
		finish = true;
65
		//thread.stop();
66
		thread.interrupt();
67
	}
68
	
69
	
70
	private void Update() {
71
		// TODO Auto-generated method stub
72
		for (int i = 0; i < callBackList.size(); i++) {
73
			IUpdateCallBack element = (IUpdateCallBack) callBackList.get(i);
74
			element.update();		
75
		}
76
		
77
	}
78

  
79
	public void start(double milis) {
80
		this.milis = milis;
81

  
82
		// Create the thread supplying it with the runnable object
83
		thread = new Thread(this);
84

  
85
		// Start the thread
86
		thread.start();
87
	}
88
	
89
	public void addCallBackObject(IUpdateCallBack object) {
90
		if (callBackList == null)
91
			callBackList = new ArrayList<IUpdateCallBack>();
92
		if (!callBackList.contains(object)) {
93
			callBackList.add(object);
94
		}
95
	}
96

  
97
	public boolean isAlive() {
98
		if (thread != null)
99
			return thread.isAlive();
100
		else
101
			return false;
102
	}
103
	
104
  
105
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/timer/IUpdateCallBack.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.timer;
21

  
22
public interface IUpdateCallBack {
23

  
24
	public void update();
25
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/AnimationContainer.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation;
21

  
22
import java.util.ArrayList;
23
import java.util.List;
24

  
25
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack;
26
import com.iver.cit.gvsig.animation.traks.AnimationTimeTrack;
27
import com.iver.cit.gvsig.animation.traks.IAnimationTrack;
28
import com.iver.utiles.IPersistence;
29
import com.iver.utiles.XMLEntity;
30

  
31
public class AnimationContainer implements IPersistence {
32

  
33
	// IAnimationTrakc List.
34
	public List<IAnimationTrack>  AnimationTrackList;
35

  
36
	private int trackListSize=0;
37

  
38
	private  AnimationPlayer animationPlayer = new AnimationPlayer();
39

  
40
	public AnimationContainer() {
41
		List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
42
		aniTrackList = new ArrayList<IAnimationTrack>();
43
		this.setAnimationTrackList(aniTrackList);
44
	}
45

  
46
	/**
47
	 * @param animationType
48
	 * @return
49
	 */
50
	public List<IAnimationTrack> getTackListOfType(IAnimationType animationType) {
51
		List<IAnimationTrack> typeList = new ArrayList<IAnimationTrack>();
52
		for (int i = 0; i < this.AnimationTrackList.size(); i++) {
53
			IAnimationTrack trackElement = (IAnimationTrack) this.AnimationTrackList
54
					.get(i);
55
			if (animationType.getClassName().equals(
56
					trackElement.getAnimationType().getClassName())) {
57
				typeList.add(trackElement);
58
			}
59

  
60
		}
61
		return typeList;
62
	}
63

  
64
	/**
65
	 * @param animationType
66
	 * @return
67
	 */
68
	public IAnimationTrack CreateDatedTrack(IAnimationType animationType) {
69

  
70
		List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
71
		if (aniTrackList == null) {
72
			aniTrackList = new ArrayList<IAnimationTrack>();
73
		}
74
		AnimationDatedTrack ADTrack = new AnimationDatedTrack(animationType);
75
		aniTrackList.add(ADTrack);
76
		this.setAnimationTrackList(aniTrackList);
77
		return ADTrack;
78
	}
79

  
80
	public IAnimationTrack CreateTimeTrack(IAnimationType animationType) {
81

  
82
		List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
83
		if (aniTrackList == null) {
84
			aniTrackList = new ArrayList<IAnimationTrack>();
85
		}
86
		AnimationTimeTrack ADTrack = new AnimationTimeTrack(animationType);
87
		aniTrackList.add(ADTrack);
88
		this.setAnimationTrackList(aniTrackList);
89
		return ADTrack;
90
	}
91

  
92
	/**
93
	 * @param animationTrack
94
	 */
95
	public void addTrack(IAnimationTrack animationTrack) {
96
		IAnimationTrack track = findTrack(animationTrack.getName());
97
		if (track == null) {
98
			this.AnimationTrackList.add(animationTrack);
99
		}
100
	}
101

  
102
	/**
103
	 * @param name
104
	 * @return
105
	 */
106
	public IAnimationTrack findTrack(String name) {
107

  
108
		IAnimationTrack IAT = null;
109
		for (int i = 0; i < this.AnimationTrackList.size(); i++) {
110
			IAnimationTrack trackElement = (IAnimationTrack) this.AnimationTrackList
111
					.get(i);
112
			if (trackElement.getName().equals(name)) {
113
				IAT = trackElement;
114
			}
115

  
116
		}
117
		return IAT;
118
	}
119

  
120
	/**
121
	 * @param animationTrack
122
	 */
123
	public void removeTrack(IAnimationTrack animationTrack) {
124
		animationTrack.removeAllIntervals();
125
		this.AnimationTrackList.remove(animationTrack);
126
	}
127

  
128
	/**
129
	 * 
130
	 */
131
	public void removeAllTrack() {
132
		for (int i=AnimationTrackList.size() - 1; i>=0; i--) {
133
			removeTrack(AnimationTrackList.get(i));
134
		}
135
		
136
//		for (Iterator<IAnimationTrack> iterator = AnimationTrackList.iterator(); iterator.hasNext();) {
137
//			((IAnimationTrack) iterator.next()).removeAllIntervals();
138
////			removeTrack(iterator.next());
139
//		}
140
//		AnimationTrackList.clear();
141
	}
142

  
143
	/**
144
	 * @return
145
	 */
146
	public List<IAnimationTrack> getAnimationTrackList() {
147
		return AnimationTrackList;
148
	}
149

  
150
	
151
	public boolean isEmpty() {
152
		
153
		if(this.AnimationTrackList.size() == 0)
154
			return true;
155
		else
156
			return false;
157
		
158
	}
159
	
160
	/**
161
	 * @param animationTrackList
162
	 */
163
	public void setAnimationTrackList(List<IAnimationTrack> animationTrackList) {
164
		AnimationTrackList = animationTrackList;
165
	}
166
	
167
	public String toString() {
168
		String result = "";
169
		List<IAnimationTrack> ATL = this.AnimationTrackList;
170
		result += "Mostrando lista de tracks:";
171
		if ((ATL == null) || ATL.isEmpty()) {
172
			result += "\nLista vacia";
173
		} else {
174
			for (int i = 0; i < ATL.size(); i++) {
175
				Object element = ATL.get(i);
176
				result += "\n" + element;
177
			}
178
		}
179
		return result;
180

  
181
	}
182

  
183
	public void apply(double Tini, double Tend) {
184
		List<IAnimationTrack> ATL = this.AnimationTrackList;
185
//		System.out.println("Tiempo de inicio: " + Tini + " tiempo final "
186
//				+ Tend);
187
		if ((ATL != null) && !ATL.isEmpty()) {
188
			for (int i = 0; i < ATL.size(); i++) {
189
				IAnimationTrack element = (IAnimationTrack) ATL.get(i);
190
//				System.out.println("track: " + element.getName() + "OBJETO" + element.getAnimatedObject());
191
				element.apply(Tini, Tend);
192
				if (element.isEnable()){}
193
			}
194
		}
195
	}
196
	
197
	
198
	/**
199
	 * Return the name of this class.
200
	 * @return name.
201
	 */
202
	
203
	public String getClassName() {
204
		return this.getClass().getName();
205
	}
206
	
207
	/**
208
	 * Return the player associated with the container.
209
	 * @return animationPlayer.
210
	 */
211
	
212
	public AnimationPlayer getAnimationPlayer(){
213
		return this.animationPlayer;
214
	}
215
	
216
	/*
217
	 * IPersistence methods.
218
	 */
219
	
220
	public XMLEntity getXMLEntity() {
221
		XMLEntity xml = new XMLEntity();
222
		
223
		xml.putProperty("className", this.getClassName());
224
		xml.putProperty("animationContainer", "true");
225
		xml.putProperty("trackListSize", this.AnimationTrackList.size());
226
		
227
		xml.addChild(((IPersistence)animationPlayer).getXMLEntity());
228
		
229
		for (int i = 0; i < this.AnimationTrackList.size(); i++) {			
230
			IAnimationTrack trackElement = (IAnimationTrack) this.AnimationTrackList.get(i);			
231
			xml.addChild(((IPersistence)trackElement).getXMLEntity());
232
		}
233
		return xml;
234
	}
235

  
236
	
237
	
238

  
239
	/**
240
	 * @param xml
241
	 */
242
	public void setXMLEntity(XMLEntity xml) {
243
		
244
		String class_name;
245
		
246
		if (xml.contains("trackListSize"))
247
			this.trackListSize = xml.getIntProperty("trackListSize");
248
		 
249
		// Node AnimationPlayer in the animation tree. Calling setXmlEntity() methods.
250
		// Reconstruyendo el framework. Paso: accediendo a la configuracion del player.
251
		
252
		this.animationPlayer.setXMLEntity(xml.getChild(0));
253
		
254
		
255
		// Node IAnimationTrack in the animation tree. Calling setXmlEntity() methods.
256
		// Reconstruyendo el framework. Paso: nuevo IAnimationTrack, AnimationDateTrack o AnimationTimeTrack.
257
		
258
		List<IAnimationTrack> trackList = new ArrayList<IAnimationTrack>();
259
		for (int i = 1; i <= this.trackListSize; i++) {//desde el hijo 1 que es el primer track hasta el ?ltimo track.
260
			XMLEntity xmlTrack = xml.getChild(i);
261
			class_name = xmlTrack.getStringProperty("className");//Accedemos al tipo de track.
262
				try {
263
					Class<?> classTrack = Class.forName(class_name);
264
					Object obj = classTrack .newInstance();
265
					IPersistence objPersist = (IPersistence) obj;
266
					objPersist.setXMLEntity(xmlTrack);
267
					IAnimationTrack trackElement = (IAnimationTrack) obj;
268
					trackElement.setEnable(true);
269
					trackList.add(trackElement);
270
				} catch (Exception e) {
271
					e.printStackTrace();
272
			}
273
		}
274
		this.setAnimationTrackList(trackList);
275

  
276
	}
277

  
278
}
tags/tmp_build/libraries/libAnimation/src/com/iver/cit/gvsig/animation/dateFilter/IDateFilter.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.dateFilter;
21

  
22
public interface IDateFilter {
23

  
24
	public void setFieldIndex(int field);
25

  
26
	public void setFiieldType(int Type);
27

  
28
	public void setMinDate(String date);
29

  
30
	public void setMaxDate(String Date);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff