Revision 671 org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/DefaultAnimation3DSwingManager.java
DefaultAnimation3DSwingManager.java | ||
---|---|---|
1 | 1 |
package org.gvsig.animation3d.swing.impl; |
2 | 2 |
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
import org.gvsig.animation3d.swing.api.Animation3D; |
|
3 | 8 |
import org.gvsig.animation3d.swing.api.Animation3DSwingManager; |
9 |
import org.gvsig.animation3d.swing.api.Frame3D; |
|
10 |
import org.gvsig.fmap.geom.primitive.Point; |
|
11 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
|
12 |
import org.gvsig.tools.persistence.impl.DelegatedList; |
|
4 | 13 |
|
5 |
|
|
6 | 14 |
/** |
7 | 15 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
8 | 16 |
* |
9 | 17 |
*/ |
10 |
public class DefaultAnimation3DSwingManager implements Animation3DSwingManager{ |
|
18 |
public class DefaultAnimation3DSwingManager implements Animation3DSwingManager {
|
|
11 | 19 |
|
20 |
@SuppressWarnings("unchecked") |
|
21 |
@Override |
|
22 |
public List<Animation3D> getAnimations(ExtendedPropertiesSupport properties) { |
|
23 |
Object animationsList = properties.getProperty("animations"); |
|
24 |
if (animationsList == null) { |
|
25 |
List<Animation3D> animations = new ArrayList<Animation3D>(); |
|
26 |
setAnimations(properties, animations); |
|
27 |
return animations; |
|
28 |
} else { |
|
29 |
if (animationsList instanceof DelegatedList) { |
|
30 |
List<Animation3D> animations = new ArrayList<Animation3D>(); |
|
31 |
animations.addAll((Collection<? extends Animation3D>) animationsList); |
|
32 |
setAnimations(properties, animations); |
|
33 |
return animations; |
|
34 |
} else { |
|
35 |
return (List<Animation3D>) animationsList; |
|
36 |
} |
|
37 |
} |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public void setAnimations(ExtendedPropertiesSupport properties, List<Animation3D> animations) { |
|
42 |
properties.setProperty("animations", animations); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public Frame3D createFrame3D(String name, double heading, double pitch, double elevation, |
|
47 |
Point position, double zoom) { |
|
48 |
return new DefaultFrame3D(name, heading, pitch, elevation, position, zoom); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public Animation3D createAnimation3D(String name, List<Frame3D> sphericalFrames, |
|
53 |
List<Frame3D> flatFrames) { |
|
54 |
return new DefaultAnimation3D(name, sphericalFrames, flatFrames); |
|
55 |
} |
|
56 |
|
|
12 | 57 |
} |
Also available in: Unified diff