Revision 30995
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/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/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/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/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/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/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/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/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/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); |
|
31 |
|
|
32 |
public int getFieldIndex(); |
|
33 |
|
|
34 |
public int getFiieldType(); |
|
35 |
|
|
36 |
public String getMinDate(); |
|
37 |
|
|
38 |
public String getMaxDate(); |
|
39 |
|
|
40 |
public boolean accepts(Object feature); |
|
41 |
|
|
42 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/dateFilter/IndexFilter.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 |
//import com.hardcode.gdbms.engine.values.NullValue; |
|
23 |
//import com.hardcode.gdbms.engine.values.NumericValue; |
|
24 |
//import com.hardcode.gdbms.engine.values.Value; |
|
25 |
//import com.iver.cit.gvsig.fmap.core.IFeature; |
|
26 |
//import com.iver.utiles.IPersistence; |
|
27 |
//import com.iver.utiles.XMLEntity; |
|
28 |
|
|
29 |
//public class IndexFilter implements ICustomVectorialFilter, IPersistence { |
|
30 |
public class IndexFilter { |
|
31 |
|
|
32 |
// private int filterFieldIndex=-1; |
|
33 |
// private int minIndex = -1; |
|
34 |
// private int maxIndex = -1; |
|
35 |
// |
|
36 |
// public void setFieldIndex(int index) { |
|
37 |
// filterFieldIndex = index; |
|
38 |
// } |
|
39 |
// |
|
40 |
// // if type is INTEGER, use these instead of setMinDate/setMaxDate |
|
41 |
// // internally, the int value is used as year |
|
42 |
// public void setMinIndex(int miniIndex) { |
|
43 |
// minIndex = miniIndex; |
|
44 |
// } |
|
45 |
// |
|
46 |
// public void setMaxIndex(int maxiIndex) { |
|
47 |
// maxIndex = maxiIndex; |
|
48 |
// } |
|
49 |
// |
|
50 |
// public boolean accepts(IFeature feature) { |
|
51 |
// |
|
52 |
// Value val = feature.getAttribute(filterFieldIndex); |
|
53 |
// if (val instanceof NullValue) |
|
54 |
// return false; |
|
55 |
// |
|
56 |
// if (!(val instanceof NumericValue)) |
|
57 |
// return false; |
|
58 |
// |
|
59 |
// int intVal = ((NumericValue)val).intValue(); |
|
60 |
// |
|
61 |
// if (intVal < minIndex) |
|
62 |
// return false; |
|
63 |
// |
|
64 |
// if (intVal > maxIndex) |
|
65 |
// return false; |
|
66 |
// |
|
67 |
// return true; |
|
68 |
// } |
|
69 |
// |
|
70 |
// public String getClassName() { |
|
71 |
// return this.getClass().getName(); |
|
72 |
// } |
|
73 |
// |
|
74 |
// public XMLEntity getXMLEntity() { |
|
75 |
// XMLEntity xml = new XMLEntity(); |
|
76 |
// |
|
77 |
// xml.putProperty("fieldIndex", filterFieldIndex); |
|
78 |
// xml.putProperty("minIndex", minIndex); |
|
79 |
// xml.putProperty("maxIndex", maxIndex); |
|
80 |
// |
|
81 |
// return xml; |
|
82 |
// } |
|
83 |
// |
|
84 |
// public void setXMLEntity(XMLEntity xml) { |
|
85 |
// |
|
86 |
// if (xml.contains("fieldIndex")) |
|
87 |
// filterFieldIndex = xml.getIntProperty("fieldIndex"); |
|
88 |
// |
|
89 |
// if (xml.contains("minIndex")) |
|
90 |
// minIndex = xml.getIntProperty("minIndex"); |
|
91 |
// |
|
92 |
// if (xml.contains("maxIndex")) |
|
93 |
// maxIndex = xml.getIntProperty("maxIndex"); |
|
94 |
// } |
|
95 |
// |
|
96 |
// public boolean compareTo(ICustomVectorialFilter filter) { |
|
97 |
// IndexFilter filterAux = (IndexFilter) filter; |
|
98 |
// |
|
99 |
// return ((this.minIndex == filterAux.minIndex) && (this.maxIndex == filterAux.maxIndex)); |
|
100 |
// } |
|
101 |
|
|
102 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/dateFilter/ICustomVectorialFilter.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 |
//import com.iver.cit.gvsig.fmap.core.IFeature; |
|
23 |
|
|
24 |
public interface ICustomVectorialFilter { |
|
25 |
// public boolean accepts(IFeature feature); |
|
26 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/dateFilter/DateFilter.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.animation.dateFilter; |
|
2 |
|
|
3 |
|
|
4 |
//public class DateFilter implements ICustomVectorialFilter, IPersistence { |
|
5 |
public class DateFilter { |
|
6 |
// |
|
7 |
// public static int FIELDTYPE_DATE = 0; |
|
8 |
// public static int FIELDTYPE_DATESTRING = 1; |
|
9 |
// |
|
10 |
// public static int BOTH = 2 | 4; |
|
11 |
// public static int BEFORE_BEGIN = 2; |
|
12 |
// public static int AFTER_END = 4; |
|
13 |
// |
|
14 |
// private int fieldType = -1; |
|
15 |
// |
|
16 |
// private int filterFieldIndex = -1; |
|
17 |
// private Date minDate = null; |
|
18 |
// private Date maxDate = null; |
|
19 |
// // derived |
|
20 |
// private SimpleDateFormat localeDF = null; |
|
21 |
// private SimpleDateFormat javaDF = null; |
|
22 |
// private Calendar cl = null; |
|
23 |
// |
|
24 |
// private int filterMode = BEFORE_BEGIN; |
|
25 |
// |
|
26 |
// public void setFieldIndex(int index) { |
|
27 |
// filterFieldIndex = index; |
|
28 |
// } |
|
29 |
// |
|
30 |
// public void setFieldType(int type) { |
|
31 |
// fieldType = type; |
|
32 |
// } |
|
33 |
// |
|
34 |
// public void setMinDate(Date miniDate) { |
|
35 |
// minDate = miniDate; |
|
36 |
// } |
|
37 |
// |
|
38 |
// public void setMaxDate(Date maxiDate) { |
|
39 |
// maxDate = maxiDate; |
|
40 |
// } |
|
41 |
// |
|
42 |
// public int getFieldType() { |
|
43 |
// return fieldType; |
|
44 |
// } |
|
45 |
// |
|
46 |
// public Date getMinDate() { |
|
47 |
// return minDate; |
|
48 |
// } |
|
49 |
// |
|
50 |
// public Date getMaxDate() { |
|
51 |
// return maxDate; |
|
52 |
// } |
|
53 |
// |
|
54 |
// public boolean accepts(IFeature feature) { |
|
55 |
// |
|
56 |
// if (filterFieldIndex == -1 || minDate == null || maxDate == null) |
|
57 |
// return false; |
|
58 |
// |
|
59 |
// Value val = feature.getAttribute(filterFieldIndex); |
|
60 |
// if (val instanceof NullValue) |
|
61 |
// return false; |
|
62 |
// |
|
63 |
// Date dateVal = null; |
|
64 |
// if (fieldType == FIELDTYPE_DATE) { |
|
65 |
// try { |
|
66 |
// dateVal = ((DateValue) val).getValue(); |
|
67 |
// } catch (RuntimeException e) { |
|
68 |
// return false; |
|
69 |
// } |
|
70 |
// } else if (fieldType == FIELDTYPE_DATESTRING) { |
|
71 |
// if (localeDF == null) |
|
72 |
// localeDF = new SimpleDateFormat("dd/MM/yyyy"); |
|
73 |
// if (javaDF == null) |
|
74 |
// javaDF = new SimpleDateFormat("yyyy-MM-dd"); |
|
75 |
// |
|
76 |
// String valStr = val.toString(); |
|
77 |
// |
|
78 |
// try { |
|
79 |
// java.util.Date utDate = localeDF.parse(valStr); // reads locale |
|
80 |
// // dd/MM/yyyy |
|
81 |
// // strings |
|
82 |
// String utDateStr = javaDF.format(utDate); // outputs |
|
83 |
// // yyyy-MM-dd |
|
84 |
// dateVal = Date.valueOf(utDateStr); // creates Date for |
|
85 |
// // comparison |
|
86 |
// } catch (ParseException e) { |
|
87 |
// return false; |
|
88 |
// } |
|
89 |
// } |
|
90 |
// |
|
91 |
// try { |
|
92 |
// String dateValStr = dateVal.toString(); |
|
93 |
// String minDateStr = minDate.toString(); |
|
94 |
// String maxDateStr = maxDate.toString(); |
|
95 |
// |
|
96 |
// if (((this.filterMode & BEFORE_BEGIN) != BEFORE_BEGIN)) |
|
97 |
// if (dateVal.compareTo(minDate) < 0) |
|
98 |
// return false; |
|
99 |
// |
|
100 |
// if (((this.filterMode & AFTER_END) != AFTER_END)) |
|
101 |
// if (dateVal.compareTo(maxDate) > 0) |
|
102 |
// return false; |
|
103 |
// |
|
104 |
// } catch (Exception e) { |
|
105 |
// return false; |
|
106 |
// } |
|
107 |
// return true; |
|
108 |
// } |
|
109 |
// |
|
110 |
// public String getClassName() { |
|
111 |
// return this.getClass().getName(); |
|
112 |
// } |
|
113 |
// |
|
114 |
// public XMLEntity getXMLEntity() { |
|
115 |
// XMLEntity xml = new XMLEntity(); |
|
116 |
// |
|
117 |
// xml.putProperty("fieldType", fieldType); |
|
118 |
// xml.putProperty("fieldIndex", filterFieldIndex); |
|
119 |
// xml.putProperty("minDate", minDate.toString()); |
|
120 |
// xml.putProperty("maxDate", maxDate.toString()); |
|
121 |
// |
|
122 |
// return xml; |
|
123 |
// } |
|
124 |
// |
|
125 |
// public void setXMLEntity(XMLEntity xml) { |
|
126 |
// if (xml.contains("fieldType")) |
|
127 |
// fieldType = xml.getIntProperty("fieldType"); |
|
128 |
// |
|
129 |
// if (xml.contains("fieldIndex")) |
|
130 |
// filterFieldIndex = xml.getIntProperty("fieldIndex"); |
|
131 |
// |
|
132 |
// if (xml.contains("minDate")) |
|
133 |
// minDate = Date.valueOf(xml.getStringProperty("minDate")); |
|
134 |
// |
|
135 |
// if (xml.contains("maxDate")) |
|
136 |
// maxDate = Date.valueOf(xml.getStringProperty("maxDate")); |
|
137 |
// } |
|
138 |
// |
|
139 |
// public String toString() { |
|
140 |
// String result = ""; |
|
141 |
// |
|
142 |
// result += minDate.toString() + "\n" + maxDate.toString(); |
|
143 |
// |
|
144 |
// return result; |
|
145 |
// } |
|
146 |
// |
|
147 |
// public boolean compareTo(ICustomVectorialFilter filter) { |
|
148 |
// DateFilter filterAux = (DateFilter) filter; |
|
149 |
// boolean type = this.getFieldType() == filterAux.getFieldType(); |
|
150 |
// boolean min = this.getMinDate().toString().equals( |
|
151 |
// filterAux.getMinDate().toString()); |
|
152 |
// boolean max = this.getMaxDate().toString().equals( |
|
153 |
// filterAux.getMaxDate().toString()); |
|
154 |
// |
|
155 |
// return (type && min && max); |
|
156 |
// } |
|
157 |
// |
|
158 |
// public int getFilterMode() { |
|
159 |
// return filterMode; |
|
160 |
// } |
|
161 |
// |
|
162 |
// public void setFilterMode(int filterMode) { |
|
163 |
// this.filterMode = filterMode; |
|
164 |
// } |
|
165 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/IAnimationTypeKeyFrame.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.keyframe; |
|
21 |
|
|
22 |
import com.iver.cit.gvsig.animation.IAnimationType; |
|
23 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator; |
|
24 |
|
|
25 |
public interface IAnimationTypeKeyFrame extends IAnimationType{ |
|
26 |
|
|
27 |
public IInterpolator getInterpolator(); |
|
28 |
|
|
29 |
public void setInterpolator(IInterpolator interpolator); |
|
30 |
|
|
31 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/FuntionFactory.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.keyframe.interpolator; |
|
21 |
|
|
22 |
import java.util.HashMap; |
|
23 |
import java.util.Map; |
|
24 |
|
|
25 |
|
|
26 |
/* |
|
27 |
* factoria para el registro y la creacion de funciones de animacion de tiempo |
|
28 |
* |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class FuntionFactory { |
|
32 |
|
|
33 |
// private static Map<String, IInterpolatorFuntion> objectsList; |
|
34 |
private static Map objectsList; |
|
35 |
|
|
36 |
static { |
|
37 |
// objectsList = new HashMap<String, IInterpolatorFuntion>(); |
|
38 |
objectsList = new HashMap(); |
|
39 |
LinearFuntion lf = new LinearFuntion(); |
|
40 |
lf.setName("LinearFuntion"); |
|
41 |
lf.setDescription("Funcion para el tiempo lineal"); |
|
42 |
FuntionFactory.register(lf); |
|
43 |
} |
|
44 |
|
|
45 |
public static void register(IInterpolatorTimeFuntion funtion) { |
|
46 |
objectsList.put(funtion.getClassName(), funtion); |
|
47 |
} |
|
48 |
|
|
49 |
public static IInterpolatorTimeFuntion createObject(String type) { |
|
50 |
IInterpolatorTimeFuntion funtion = null; |
|
51 |
try { |
|
52 |
if ((objectsList.containsKey(type)) == false) |
|
53 |
return null; |
|
54 |
funtion = (IInterpolatorTimeFuntion) objectsList.get(type).getClass().newInstance(); |
|
55 |
} catch (InstantiationException e) { |
|
56 |
e.printStackTrace(); |
|
57 |
} catch (IllegalAccessException e) { |
|
58 |
e.printStackTrace(); |
|
59 |
} |
|
60 |
return funtion; |
|
61 |
} |
|
62 |
|
|
63 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/InterpolatorFactory.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.keyframe.interpolator; |
|
21 |
|
|
22 |
import java.util.HashMap; |
|
23 |
import java.util.Map; |
|
24 |
|
|
25 |
public class InterpolatorFactory { |
|
26 |
private static Map<String, IInterpolator> objectsList; |
|
27 |
|
|
28 |
static { |
|
29 |
objectsList = new HashMap<String, IInterpolator>(); |
|
30 |
} |
|
31 |
|
|
32 |
public static void register(String alias, IInterpolator interpolator) { |
|
33 |
objectsList.put(alias, interpolator); |
|
34 |
} |
|
35 |
|
|
36 |
public static IInterpolator createObject(String alias) { |
|
37 |
IInterpolator interpolator = null; |
|
38 |
System.out.println("existe el tipo " + alias + " " |
|
39 |
+ objectsList.containsKey(alias)); |
|
40 |
if ((objectsList.containsKey(alias)) == false) { |
|
41 |
return null; |
|
42 |
} else { |
|
43 |
interpolator = (IInterpolator) objectsList.get(alias); |
|
44 |
} |
|
45 |
return interpolator; |
|
46 |
} |
|
47 |
|
|
48 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/IInterpolator.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.keyframe.interpolator; |
|
21 |
|
|
22 |
import java.util.List; |
|
23 |
|
|
24 |
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame; |
|
25 |
import com.iver.utiles.IPersistence; |
|
26 |
|
|
27 |
public interface IInterpolator extends IPersistence{ |
|
28 |
|
|
29 |
public IKeyFrame interpolate(List<IKeyFrame> kfList, int index, double time); |
|
30 |
|
|
31 |
public String getName(); |
|
32 |
|
|
33 |
public String getDescription(); |
|
34 |
|
|
35 |
public String getClassName(); |
|
36 |
|
|
37 |
public void setFuntion(IInterpolatorTimeFuntion funtion); |
|
38 |
|
|
39 |
public IInterpolatorTimeFuntion getFuntion(); |
|
40 |
|
|
41 |
|
|
42 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/IInterpolatorTimeFuntion.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.keyframe.interpolator; |
|
21 |
|
|
22 |
|
|
23 |
public interface IInterpolatorTimeFuntion { |
|
24 |
|
|
25 |
// Identification of the class |
|
26 |
public void setName(String name); |
|
27 |
|
|
28 |
public void setDescription(String name); |
|
29 |
|
|
30 |
public String getName(); |
|
31 |
|
|
32 |
public String getDescription(); |
|
33 |
|
|
34 |
public String getClassName(); |
|
35 |
|
|
36 |
// Interpolation function |
|
37 |
public double interpolate(double T); |
|
38 |
|
|
39 |
public double[] interpolate(double T[]); |
|
40 |
|
|
41 |
public IInterpolatorTimeFuntion create(); |
|
42 |
|
|
43 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/LinearFuntion.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.keyframe.interpolator; |
|
21 |
|
|
22 |
|
|
23 |
public class LinearFuntion implements IInterpolatorTimeFuntion { |
|
24 |
|
|
25 |
private String name; |
|
26 |
private String description; |
|
27 |
|
|
28 |
public String getName() { |
|
29 |
return name; |
|
30 |
} |
|
31 |
|
|
32 |
public void setName(String name) { |
|
33 |
this.name = name; |
|
34 |
} |
|
35 |
|
|
36 |
public String getClassName() { |
|
37 |
return this.getClass().getName(); |
|
38 |
} |
|
39 |
|
|
40 |
public String getDescription() { |
|
41 |
return this.description; |
|
42 |
} |
|
43 |
|
|
44 |
public void setDescription(String name) { |
|
45 |
this.description = name; |
|
46 |
} |
|
47 |
|
|
48 |
public double interpolate(double T) { |
|
49 |
return T; |
|
50 |
} |
|
51 |
|
|
52 |
public double[] interpolate(double[] T) { |
|
53 |
return T; |
|
54 |
} |
|
55 |
|
|
56 |
public IInterpolatorTimeFuntion create() { |
|
57 |
return this; |
|
58 |
} |
|
59 |
|
|
60 |
} |
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/AnimationFunction.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.keyframe; |
|
21 |
|
|
22 |
import java.util.List; |
|
23 |
|
|
24 |
import com.iver.utiles.IPersistence; |
|
25 |
import com.iver.utiles.XMLEntity; |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
30 |
* @since 1.1 |
|
31 |
* |
|
32 |
*/ |
|
33 |
|
|
34 |
public class AnimationFunction implements IPersistence{ |
|
35 |
|
|
36 |
private List AnimationFunctionList; |
|
37 |
//private String className; |
|
38 |
|
|
39 |
//private AnimationFunction animationFunctionItem; |
|
40 |
|
|
41 |
public List getAnimationFuntionList() { |
|
42 |
return AnimationFunctionList; |
|
43 |
} |
|
44 |
|
|
45 |
public void setAnimationFuntionList(List animationFuntionList) { |
|
46 |
AnimationFunctionList = animationFuntionList; |
|
47 |
} |
|
48 |
|
|
49 |
public String toString() { |
|
50 |
|
|
51 |
String result = ""; |
|
52 |
|
|
53 |
return result; |
|
54 |
} |
|
55 |
|
|
56 |
|
|
57 |
public String getClassName() { |
|
58 |
return this.getClass().getName(); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
public XMLEntity getXMLEntity() { |
|
63 |
XMLEntity xml = new XMLEntity(); |
|
64 |
|
|
65 |
xml.putProperty("class_name", this.getClassName()); |
|
66 |
for (int i = 0; i < this.AnimationFunctionList.size(); i++) { |
|
67 |
AnimationFunction animationFunctionItem = (AnimationFunction) this.AnimationFunctionList.get(i); |
|
68 |
xml.addChild(((IPersistence)animationFunctionItem).getXMLEntity()); |
|
69 |
return xml;//provisional |
|
70 |
} |
|
71 |
return xml; |
|
72 |
} |
|
73 |
|
|
74 |
|
|
75 |
public void setXMLEntity(XMLEntity xml) { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
// |
|
78 |
// if (xml.contains("class_name")) |
|
79 |
// className = xml.getStringProperty("class_name"); |
|
80 |
// for (int i = 0; i < this.AnimationFunctionList.size(); i++) { |
|
81 |
// AnimationFunction animationFunctionItem = (AnimationFunction) this.AnimationFunctionList.get(i); |
|
82 |
// return; //provisional |
|
83 |
// } |
|
84 |
// |
|
85 |
} |
|
86 |
} |
Also available in: Unified diff