1 |
1 |
package com.iver.cit.gvsig.animation;
|
2 |
2 |
|
3 |
3 |
import java.util.ArrayList;
|
|
4 |
import java.util.Iterator;
|
4 |
5 |
import java.util.List;
|
5 |
6 |
|
6 |
7 |
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack;
|
... | ... | |
12 |
13 |
public class AnimationContainer implements IPersistence {
|
13 |
14 |
|
14 |
15 |
// IAnimationTrakc List.
|
15 |
|
public List AnimationTrackList;
|
|
16 |
public List<IAnimationTrack> AnimationTrackList;
|
16 |
17 |
|
17 |
18 |
private int trackListSize=0;
|
18 |
19 |
|
... | ... | |
21 |
22 |
private static AnimationPlayer animationPlayer = new AnimationPlayer();
|
22 |
23 |
|
23 |
24 |
public AnimationContainer() {
|
24 |
|
List aniTrackList = this.getAnimationTrackList();
|
25 |
|
aniTrackList = new ArrayList();
|
|
25 |
List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
|
|
26 |
aniTrackList = new ArrayList<IAnimationTrack>();
|
26 |
27 |
this.setAnimationTrackList(aniTrackList);
|
27 |
28 |
}
|
28 |
29 |
|
... | ... | |
30 |
31 |
* @param animationType
|
31 |
32 |
* @return
|
32 |
33 |
*/
|
33 |
|
public List getTackListOfType(IAnimationType animationType) {
|
34 |
|
List typeList = new ArrayList();
|
|
34 |
public List<IAnimationTrack> getTackListOfType(IAnimationType animationType) {
|
|
35 |
List<IAnimationTrack> typeList = new ArrayList<IAnimationTrack>();
|
35 |
36 |
for (int i = 0; i < this.AnimationTrackList.size(); i++) {
|
36 |
37 |
IAnimationTrack trackElement = (IAnimationTrack) this.AnimationTrackList
|
37 |
38 |
.get(i);
|
... | ... | |
50 |
51 |
*/
|
51 |
52 |
public IAnimationTrack CreateDatedTrack(IAnimationType animationType) {
|
52 |
53 |
|
53 |
|
List aniTrackList = this.getAnimationTrackList();
|
|
54 |
List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
|
54 |
55 |
if (aniTrackList == null) {
|
55 |
|
aniTrackList = new ArrayList();
|
|
56 |
aniTrackList = new ArrayList<IAnimationTrack>();
|
56 |
57 |
}
|
57 |
58 |
AnimationDatedTrack ADTrack = new AnimationDatedTrack(animationType);
|
58 |
59 |
aniTrackList.add(ADTrack);
|
... | ... | |
62 |
63 |
|
63 |
64 |
public IAnimationTrack CreateTimeTrack(IAnimationType animationType) {
|
64 |
65 |
|
65 |
|
List aniTrackList = this.getAnimationTrackList();
|
|
66 |
List<IAnimationTrack> aniTrackList = this.getAnimationTrackList();
|
66 |
67 |
if (aniTrackList == null) {
|
67 |
|
aniTrackList = new ArrayList();
|
|
68 |
aniTrackList = new ArrayList<IAnimationTrack>();
|
68 |
69 |
}
|
69 |
70 |
AnimationTimeTrack ADTrack = new AnimationTimeTrack(animationType);
|
70 |
71 |
aniTrackList.add(ADTrack);
|
... | ... | |
112 |
113 |
*
|
113 |
114 |
*/
|
114 |
115 |
public void removeAllTrack() {
|
115 |
|
this.AnimationTrackList.clear();
|
|
116 |
for (Iterator<IAnimationTrack> iterator = AnimationTrackList.iterator(); iterator.hasNext();) {
|
|
117 |
removeTrack(iterator.next());
|
|
118 |
}
|
116 |
119 |
}
|
117 |
120 |
|
118 |
121 |
/**
|
119 |
122 |
* @return
|
120 |
123 |
*/
|
121 |
|
public List getAnimationTrackList() {
|
|
124 |
public List<IAnimationTrack> getAnimationTrackList() {
|
122 |
125 |
return AnimationTrackList;
|
123 |
126 |
}
|
124 |
127 |
|
125 |
128 |
/**
|
126 |
129 |
* @param animationTrackList
|
127 |
130 |
*/
|
128 |
|
public void setAnimationTrackList(List animationTrackList) {
|
|
131 |
public void setAnimationTrackList(List<IAnimationTrack> animationTrackList) {
|
129 |
132 |
AnimationTrackList = animationTrackList;
|
130 |
133 |
}
|
131 |
134 |
|
132 |
135 |
public String toString() {
|
133 |
136 |
String result = "";
|
134 |
|
List ATL = this.AnimationTrackList;
|
|
137 |
List<IAnimationTrack> ATL = this.AnimationTrackList;
|
135 |
138 |
result += "Mostrando lista de tracks:";
|
136 |
139 |
if ((ATL == null) || ATL.isEmpty()) {
|
137 |
140 |
result += "\nLista vacia";
|
... | ... | |
146 |
149 |
}
|
147 |
150 |
|
148 |
151 |
public void apply(double Tini, double Tend) {
|
149 |
|
List ATL = this.AnimationTrackList;
|
|
152 |
List<IAnimationTrack> ATL = this.AnimationTrackList;
|
150 |
153 |
System.out.println("Tiempo de inicio: " + Tini + " tiempo final "
|
151 |
154 |
+ Tend);
|
152 |
155 |
if ((ATL != null) && !ATL.isEmpty()) {
|
... | ... | |
219 |
222 |
// Node IAnimationTrack in the animation tree. Calling setXmlEntity() methods.
|
220 |
223 |
// Reconstruyendo el framework. Paso: nuevo IAnimationTrack, AnimationDateTrack o AnimationTimeTrack.
|
221 |
224 |
|
222 |
|
List trackList = new ArrayList<IAnimationTrack>();
|
|
225 |
List<IAnimationTrack> trackList = new ArrayList<IAnimationTrack>();
|
223 |
226 |
for (int i = 1; i <= this.trackListSize; i++) {//desde el hijo 1 que es el primer track hasta el ?ltimo track.
|
224 |
227 |
XMLEntity xmlTrack = xml.getChild(i);
|
225 |
228 |
class_name = xmlTrack.getStringProperty("className");//Accedemos al tipo de track.
|
226 |
229 |
try {
|
227 |
|
Class classTrack = Class.forName(class_name);
|
|
230 |
Class<?> classTrack = Class.forName(class_name);
|
228 |
231 |
Object obj = classTrack .newInstance();
|
229 |
232 |
IPersistence objPersist = (IPersistence) obj;
|
230 |
233 |
objPersist.setXMLEntity(xmlTrack);
|