root / import / ext3D / branches / ext3D_v1.1 / libAnimation / test / com / iver / cit / gvsig / animation / AnimationTest.java @ 15398
History | View | Annotate | Download (4.04 KB)
1 |
package com.iver.cit.gvsig.animation; |
---|---|
2 |
|
3 |
import java.awt.event.ActionEvent; |
4 |
import java.awt.event.ActionListener; |
5 |
import java.sql.Date; |
6 |
import java.util.List; |
7 |
import java.util.Properties; |
8 |
|
9 |
import javax.swing.Timer; |
10 |
|
11 |
import junit.framework.TestCase; |
12 |
|
13 |
import com.iver.cit.gvsig.animation.interval.AnimationDatedInterval; |
14 |
import com.iver.cit.gvsig.animation.test.Animation3D; |
15 |
import com.iver.cit.gvsig.animation.test.AnimationLayer2D; |
16 |
import com.iver.cit.gvsig.animation.test.AnimationTypeFactory3D; |
17 |
import com.iver.cit.gvsig.animation.test.AnimationTypeFactoryLayer2D; |
18 |
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack; |
19 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
20 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
21 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
22 |
|
23 |
public class AnimationTest extends TestCase { |
24 |
|
25 |
private Animation3D a3D;
|
26 |
|
27 |
private AnimationContainer AC;
|
28 |
|
29 |
public void testRegisterType() throws Throwable { |
30 |
|
31 |
AnimationTypeFactory3D.register(); |
32 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton |
33 |
.getInstance(); |
34 |
System.out.println("Getting extension point..."); |
35 |
ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints |
36 |
.get("Animation"));
|
37 |
System.out.println("Creating animation type ..."); |
38 |
a3D = (Animation3D) extPoint.create("Animation3D");
|
39 |
System.out.println("Done " + a3D); |
40 |
// System.out.println("Resultados:\n " + a3D.getName() + "\n "
|
41 |
// + a3D.getClassName() + "\n " + a3D.getDescription());
|
42 |
|
43 |
} |
44 |
|
45 |
public void testRegisterType2D() throws Throwable { |
46 |
|
47 |
AnimationLayer2D a3D; |
48 |
|
49 |
AnimationTypeFactoryLayer2D.register(); |
50 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton |
51 |
.getInstance(); |
52 |
System.out.println("Getting extension point..."); |
53 |
ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints |
54 |
.get("Animation"));
|
55 |
System.out.println("Creating animation type ..."); |
56 |
a3D = (AnimationLayer2D) extPoint.create("AnimationLayer2D");
|
57 |
System.out.println("Done " + a3D); |
58 |
// System.out.println("Resultados:\n " + a3D.getName() + "\n "
|
59 |
// + a3D.getClassName() + "\n " + a3D.getDescription());
|
60 |
|
61 |
} |
62 |
|
63 |
public void testCreateAnimationContainer() throws Throwable { |
64 |
|
65 |
// Inicialicing
|
66 |
a3D = null; // Animation type |
67 |
AC = null; // Animation Container |
68 |
|
69 |
// Creando contenerdor de tracks
|
70 |
AC = new AnimationContainer();
|
71 |
testRegisterType(); |
72 |
System.out.println(AC);
|
73 |
} |
74 |
|
75 |
public void testCreateDateTrack() { |
76 |
|
77 |
// Inicialicing
|
78 |
a3D = null; // Animation type |
79 |
AC = null; // Animation Container |
80 |
|
81 |
// Creando track del tipo de animacion
|
82 |
AnimationDatedTrack ADTrack = (AnimationDatedTrack) AC |
83 |
.CreateDatedTrack(a3D); |
84 |
// Inicializando el track
|
85 |
ADTrack.setName("Track 1");
|
86 |
ADTrack.setDescription("track de prueba para series temporales");
|
87 |
ADTrack.setBeginDate(new Date(0)); |
88 |
ADTrack.setEndDate(new Date(0)); |
89 |
// Creando intervalo
|
90 |
AnimationDatedInterval ADInterval = (AnimationDatedInterval) ADTrack |
91 |
.createInterval(); |
92 |
|
93 |
// Inicializando intervalo
|
94 |
Date beginDateInterval = new Date(0); |
95 |
ADInterval.setBeginDateInterval(beginDateInterval); |
96 |
Date endDateInterval = new Date(0); |
97 |
ADInterval.setEndDateInterval(endDateInterval); |
98 |
|
99 |
AC.removeAllTrack(); |
100 |
AC.removeTrack(ADTrack); |
101 |
ADTrack.removeAllIntervals(); |
102 |
ADTrack.removeInterval(ADInterval); |
103 |
//
|
104 |
//
|
105 |
// // IAnimationTrack T = AC.findTrack("Track 2");
|
106 |
// // if (T != null) {
|
107 |
// // T.toString();
|
108 |
// // }else {
|
109 |
// // System.out.println("no encontrada");
|
110 |
// // }
|
111 |
//
|
112 |
// // List l = AC.getTackListOfType(a3D);
|
113 |
// // System.out.println(l);
|
114 |
|
115 |
} |
116 |
|
117 |
public void testAnimationTimer() throws Throwable { |
118 |
|
119 |
AnimationPlayer AP = new AnimationPlayer();
|
120 |
AP.play(); |
121 |
|
122 |
} |
123 |
public void testCreateTrack() throws Throwable { |
124 |
|
125 |
// AnimationTimer modelo = new AnimationTimer();
|
126 |
// modelo.addObserver (new Observer()
|
127 |
// {
|
128 |
// public void update (Observable unObservable, Object dato)
|
129 |
// {
|
130 |
// System.out.println (dato);
|
131 |
// }
|
132 |
// });
|
133 |
// System.out.println("estoy fuera");
|
134 |
|
135 |
} |
136 |
|
137 |
|
138 |
} |