Revision 18655

View differences:

trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/test/Animation3D.java
1 1
package com.iver.cit.gvsig.animation.test;
2 2

  
3 3
import com.iver.cit.gvsig.animation.IAnimationType;
4
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
4 5
import com.iver.utiles.XMLEntity;
5 6

  
6 7
public class Animation3D implements IAnimationType {
......
68 69
		
69 70
	}
70 71

  
72
	public void setInterpolator(IInterpolator interpolator) {
73
		// TODO Auto-generated method stub
74
		
75
	}
76

  
71 77
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/IKeyFrame.java
15 15
	public void setPropertiesList(List list);
16 16
	public List getPropertiesList();
17 17
	
18
	public void setAnimatedObject(Object object);
18 19
	public void CapturesProperties();
19 20
	
20 21
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/IInterpolatorFuntion.java
1
package com.iver.cit.gvsig.animation.keyframe.interpolator;
2

  
3

  
4
public interface IInterpolatorFuntion {
5

  
6
	// Identification of the class
7
	public void setName(String name);
8

  
9
	public void setDescription(String name);
10

  
11
	public String getName();
12

  
13
	public String getDescription();
14

  
15
	public String getClassName();
16

  
17
	// Interpolation funcion
18
	public double interpolate(double T);
19

  
20
	public double[] interpolate(double T[]);
21
	
22
	public IInterpolatorFuntion create();
23

  
24
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/FuntionFactory.java
23 23
		FuntionFactory.register(lf);
24 24
	}
25 25

  
26
	public static void register(IInterpolatorFuntion funtion) {
26
	public static void register(IInterpolatorTimeFuntion funtion) {
27 27
		objectsList.put(funtion.getClassName(), funtion);
28 28
	}
29 29

  
30
	public static IInterpolatorFuntion createObject(String type) {
31
		IInterpolatorFuntion funtion = null;
30
	public static IInterpolatorTimeFuntion createObject(String type) {
31
		IInterpolatorTimeFuntion funtion = null;
32 32
		try {
33 33
			System.out.println("existe el tipo " + type + "  "
34 34
					+ objectsList.containsKey(type));
35 35
			if ((objectsList.containsKey(type)) == false)
36 36
				return null;
37 37
//			funtion = objectsList.get(type).getClass().newInstance();
38
			funtion = (IInterpolatorFuntion) objectsList.get(type).getClass().newInstance();
38
			funtion = (IInterpolatorTimeFuntion) objectsList.get(type).getClass().newInstance();
39 39
		} catch (InstantiationException e) {
40 40
			e.printStackTrace();
41 41
		} catch (IllegalAccessException e) {
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/InterpolatorFactory.java
1
package com.iver.cit.gvsig.animation.keyframe.interpolator;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
public class InterpolatorFactory {
7
	private static Map<String, IInterpolator> objectsList;
8

  
9
	static {
10
		objectsList = new HashMap<String, IInterpolator>();
11
	}
12

  
13
	public static void register(String alias, IInterpolator interpolator) {
14
		objectsList.put(alias, interpolator);
15
	}
16

  
17
	public static IInterpolator createObject(String alias) {
18
		IInterpolator interpolator = null;
19
		System.out.println("existe el tipo " + alias + "  "
20
				+ objectsList.containsKey(alias));
21
		if ((objectsList.containsKey(alias)) == false) {
22
			return null;
23
		} else {
24
			interpolator = (IInterpolator) objectsList.get(alias);
25
		}
26
		return interpolator;
27
	}
28

  
29
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/IInterpolator.java
15 15

  
16 16
	public String getClassName();
17 17
	
18
	public void setAnimatedObject(Object ani);
19

  
20
	public Object getAnimatedObject();
18
//	public void setAnimatedObject(Object ani);
19
//
20
//	public Object getAnimatedObject();
21 21
		
22
	public void setFuntion(IInterpolatorFuntion funtion);
22
	public void setFuntion(IInterpolatorTimeFuntion funtion);
23 23
	
24
	public IInterpolatorFuntion getFuntion();
24
	public IInterpolatorTimeFuntion getFuntion();
25 25
	
26 26

  
27 27
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/IInterpolatorTimeFuntion.java
1
package com.iver.cit.gvsig.animation.keyframe.interpolator;
2

  
3

  
4
public interface IInterpolatorTimeFuntion {
5

  
6
	// Identification of the class
7
	public void setName(String name);
8

  
9
	public void setDescription(String name);
10

  
11
	public String getName();
12

  
13
	public String getDescription();
14

  
15
	public String getClassName();
16

  
17
	// Interpolation funcion
18
	public double interpolate(double T);
19

  
20
	public double[] interpolate(double T[]);
21
	
22
	public IInterpolatorTimeFuntion create();
23

  
24
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/keyframe/interpolator/LinearFuntion.java
1 1
package com.iver.cit.gvsig.animation.keyframe.interpolator;
2 2

  
3 3

  
4
public class LinearFuntion implements IInterpolatorFuntion {
4
public class LinearFuntion implements IInterpolatorTimeFuntion {
5 5

  
6 6
	private String name;
7 7
	private String description;
......
34 34
		return T;
35 35
	}
36 36

  
37
	public IInterpolatorFuntion create() {
37
	public IInterpolatorTimeFuntion create() {
38 38
		return this;
39 39
	}
40 40

  
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/animatedObject/IAnimatedObject.java
1
package com.iver.cit.gvsig.animation.animatedObject;
2

  
3
public interface IAnimatedObject {
4

  
5
	public void addAnimatedObject(String name, Object object);
6

  
7
	public Object getAnimatedObject(String name);
8
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/animatedObject/AnimatedObjectBase.java
1
package com.iver.cit.gvsig.animation.animatedObject;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
7

  
8
public class AnimatedObjectBase implements IAnimatedObject {
9

  
10
	private Map<String, Object> objectsList;
11

  
12
	
13
	public AnimatedObjectBase() {
14
		super();
15
	}
16

  
17
	public void addAnimatedObject(String name, Object object) {
18
		if (objectsList == null)
19
			objectsList = new HashMap<String, Object>();			
20
		objectsList.put(name, object);
21
		
22
	}
23

  
24
	public Object getAnimatedObject(String name) {
25
		Object object = null;
26
		System.out.println("existe el tipo " + name + "  "
27
				+ objectsList.containsKey(name));
28
		if ((objectsList.containsKey(name)) == false) {
29
			return null;
30
		} else {
31
			object = (Object) objectsList.get(name);
32
		}
33
		return object;
34

  
35
	}
36

  
37
}
trunk/libraries/libAnimation/src/com/iver/cit/gvsig/animation/IAnimationType.java
1 1
package com.iver.cit.gvsig.animation;
2 2

  
3
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
3 4
import com.iver.utiles.IPersistence;
4 5

  
5 6
public interface IAnimationType extends IPersistence{
......
23 24
	public Object getAnimatedObject();
24 25
	
25 26
	public void setAnimatedObject(Object object);
27
	
28
	public void setInterpolator(IInterpolator interpolator);
26 29

  
27 30
}
trunk/libraries/libAnimation/test/com/iver/cit/gvsig/animation/AnimationTest.java
6 6

  
7 7
import com.iver.cit.gvsig.animation.interval.AnimationDatedInterval;
8 8
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory;
9
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorFuntion;
9
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
10 10
import com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion;
11 11
import com.iver.cit.gvsig.animation.test.Animation3D;
12 12
import com.iver.cit.gvsig.animation.test.AnimationTypeFactory3D;
......
155 155
		
156 156
		FuntionFactory.register(lf2);
157 157
		
158
		IInterpolatorFuntion resutl = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
158
		IInterpolatorTimeFuntion resutl = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
159 159
		
160 160
		System.out.println(resutl);
161 161

  

Also available in: Unified diff