Statistics
| Revision:

svn-gvsig-desktop / import / ext3D / branches / ext3D_v1.1 / libAnimation / test / com / iver / cit / gvsig / animation / AnimationTest.java @ 15475

History | View | Annotate | Download (4.51 KB)

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.IInterpolatorFuntion;
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.extensionPoints.ExtensionPoint;
15
import com.iver.utiles.extensionPoints.ExtensionPoints;
16
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
17

    
18
public class AnimationTest extends TestCase {
19

    
20
        private Animation3D a3D;
21

    
22
        private AnimationContainer AC;
23

    
24
        public void testRegisterType() throws Throwable {
25

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

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

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

    
56
        }
57

    
58
        public void testCreateAnimationContainer() throws Throwable {
59

    
60
                // Inicialicing
61
                a3D = null; // Animation type
62
                AC = null; // Animation Container
63

    
64
                // Creando contenerdor de tracks
65
                AC = new AnimationContainer();
66
                testRegisterType();
67
                System.out.println(AC);
68
        }
69

    
70
        public void testCreateDateTrack() {
71
                
72
                // Inicialicing
73
                a3D = null; // Animation type
74
                AC = null; // Animation Container
75

    
76
                // Creando track del tipo de animacion
77
                AnimationDatedTrack ADTrack = (AnimationDatedTrack) AC
78
                                .CreateDatedTrack(a3D);
79
                // Inicializando el track
80
                ADTrack.setName("Track 1");
81
                ADTrack.setDescription("track de prueba para series temporales");
82
                ADTrack.setBeginDate(new Date(0));
83
                ADTrack.setEndDate(new Date(0));
84
                // Creando intervalo
85
                AnimationDatedInterval ADInterval = (AnimationDatedInterval) ADTrack
86
                                .createInterval();
87

    
88
                // Inicializando intervalo
89
                Date beginDateInterval = new Date(0);
90
                ADInterval.setBeginDateInterval(beginDateInterval);
91
                Date endDateInterval = new Date(0);
92
                ADInterval.setEndDateInterval(endDateInterval);
93

    
94
                AC.removeAllTrack();
95
                AC.removeTrack(ADTrack);
96
                ADTrack.removeAllIntervals();
97
                ADTrack.removeInterval(ADInterval);
98
                //                
99
                //                
100
                // // IAnimationTrack T = AC.findTrack("Track 2");
101
                // // if (T != null) {
102
                // // T.toString();
103
                // // }else {
104
                // // System.out.println("no encontrada");
105
                // // }
106
                //                
107
                // // List l = AC.getTackListOfType(a3D);
108
                // // System.out.println(l);
109

    
110
        }
111

    
112
        public void testAnimationTimer() throws Throwable {
113

    
114
                AnimationPlayer AP = new AnimationPlayer();
115
                AP.play();
116

    
117
        }
118
        public void testCreateTrack() throws Throwable {
119

    
120
                // AnimationTimer modelo = new AnimationTimer();
121
                // modelo.addObserver (new Observer()
122
                // {
123
                // public void update (Observable unObservable, Object dato)
124
                // {
125
                // System.out.println (dato);
126
                // }
127
                // });
128
                // System.out.println("estoy fuera");
129

    
130
        }
131
        
132
        
133
        public void testFuntionFactory() throws Throwable {
134
                LinearFuntion lf = new LinearFuntion();
135
                System.out.println("registrando " + lf.getClassName());
136
                
137
                FuntionFactory.register(lf);
138
                
139
                LinearFuntion lf2 = new LinearFuntion();
140
                System.out.println("registrando " + lf.getClassName());
141
                
142
                FuntionFactory.register(lf2);
143
                
144
                IInterpolatorFuntion resutl = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
145
                
146
                System.out.println(resutl);
147

    
148
        }
149

    
150

    
151
        
152
}