Revision 32251

View differences:

tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/test/java/com/iver/cit/gvsig/animation/AppTest.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import junit.framework.Test;
4
import junit.framework.TestCase;
5
import junit.framework.TestSuite;
6

  
7
/**
8
 * Unit test for simple App.
9
 */
10
public class AppTest 
11
    extends TestCase
12
{
13
    /**
14
     * Create the test case
15
     *
16
     * @param testName name of the test case
17
     */
18
    public AppTest( String testName )
19
    {
20
        super( testName );
21
    }
22

  
23
    /**
24
     * @return the suite of tests being tested
25
     */
26
    public static Test suite()
27
    {
28
        return new TestSuite( AppTest.class );
29
    }
30

  
31
    /**
32
     * Rigourous Test :-)
33
     */
34
    public void testApp()
35
    {
36
        assertTrue( true );
37
    }
38
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/animatedObject/AnimationObjectTransparency.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.animatedObject;
21

  
22
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
23

  
24
/**
25
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
26
 * @since 1.1
27
 * 
28
 */
29
public class AnimationObjectTransparency extends AnimatedObjectBase{
30
	
31
	private String nameLayer;
32
	private FLyrDefault layerDefault;
33
	
34
	
35
	public String getClassName() {
36
		return this.getClass().getName();
37
	}
38
	
39
	public void setClassName(String className) {
40
	}
41
	
42
	public String getNameLayer() {
43
		return nameLayer;
44
	}
45
	
46
	public void setNameLayer(String nameLayer) {
47
		this.nameLayer = nameLayer;
48
	}
49
	
50
	public Object getAnimatedView() {
51
		return this.getAnimatedObject("view");
52
	}
53
	
54
	public void setAnimatedView(Object object) {
55
		this.addAnimatedObject("view", object);
56
	}
57
	
58
	
59
	public Object getAnimatedLayer() {
60
		return layerDefault;
61
	}
62

  
63
	public void setAnimatedLayer(Object object) {
64
		this.layerDefault = (FLyrDefault) object;
65
		this.nameLayer = this.layerDefault.getName();
66
	}
67
	
68
	
69
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationTypeFactoryTransparency.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.animationType;
21

  
22
import com.iver.cit.gvsig.animation.AnimationFactory;
23

  
24
/**
25
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
26
 * @since 1.1
27
 * 
28
 */
29
public class AnimationTypeFactoryTransparency extends AnimationFactory {
30

  
31
	public static String registerName = "AnimationTransparency";
32
	
33
	
34
	public static AnimationTransparency animationTransparency;
35
	
36
	static {
37
		if (animationTransparency == null) {
38
			animationTransparency = new AnimationTransparency();
39
			animationTransparency.setClassName("AnimationTransparency");
40
			animationTransparency.setName("AnimationTransparency");
41
			animationTransparency.setDescription("Animacion basada en transparencias.");
42
		}
43
	}
44
	
45
	/**
46
	 * Creating a new animation in the factory.
47
	 */
48
	public Object create() {
49
		
50
       return animationTransparency;
51
	}
52
	
53
	/**
54
	 * Registers in the points of extension the Factory with alias.
55
	 */
56
	public static void register() {
57
		register(registerName, new AnimationTypeFactoryTransparency(), "com.iver.cit.gvsig.animation.AnimationTransparency");
58
	}
59

  
60
	public String getRegisterName() {
61
		return registerName;
62
	}
63

  
64
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationKeyFrameTransparencyFactory.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.animationType;
21

  
22
import com.iver.cit.gvsig.animation.AnimationFactory;
23
import com.iver.cit.gvsig.animation.keyFrame.KeyFrameTransparency;
24

  
25
/**
26
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
27
 * @since 1.1
28
 * 
29
 */
30
public class AnimationKeyFrameTransparencyFactory extends AnimationFactory {
31

  
32
	public static String registerName = "KeyFrameTransparency";
33
	
34
	
35
	/**
36
	 * Creating a new animation in the factory.
37
	 */
38
	public Object create() {
39
		KeyFrameTransparency keyFrameTransparency = new KeyFrameTransparency();
40
        return keyFrameTransparency;
41
	}
42
	
43
	/**
44
	 * Registers in the points of extension the Factory with alias.
45
	 */
46
	public static void register() {
47
		register(registerName, new AnimationKeyFrameTransparencyFactory(), "com.iver.cit.gvsig.animation.KeyFrameTransparency");
48
	}
49

  
50
	public String getRegisterName() {
51
		return registerName;
52
	}
53

  
54
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationTransparency.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.animationType;
21

  
22
import com.iver.andami.PluginServices;
23

  
24
import com.iver.andami.ui.mdiManager.IWindow;
25
import com.iver.cit.gvsig.animation.IAnimationType;
26
import com.iver.cit.gvsig.animation.animatedObject.AnimationObjectTransparency;
27
import com.iver.cit.gvsig.animation.animatedObject.IAnimatedObject;
28
import com.iver.cit.gvsig.animation.keyFrame.KeyFrameTransparency;
29
import com.iver.cit.gvsig.animation.keyframe.IAnimationTypeKeyFrame;
30
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory;
31
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
32
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
33
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
34
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
35
import com.iver.utiles.IPersistence;
36
import com.iver.utiles.XMLEntity;
37

  
38

  
39
/**
40
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
41
 * @since 1.1
42
 * 
43
 */
44
public class AnimationTransparency implements IAnimationTypeKeyFrame {
45

  
46
	private String description = "Animacion basada en Transparencias";
47
	private String name = "AnimationTransparency";
48
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
49
	private IInterpolator interpolator;
50
	private String nameView;
51
	private IAnimatedObject animationObjectTransparency = new AnimationObjectTransparency() ;
52
	private String titleWindow;
53

  
54
	public AnimationTransparency() {
55
	}
56

  
57
	public String getClassName() {
58
		return this.getClass().getName();
59
	}
60

  
61
	public String getDescription() {
62
		return description;
63
	}
64

  
65
	public String getName() {
66
		return name;
67
	}
68

  
69
	public void setClassName(String className) {
70
	}
71

  
72
	public void setDescription(String description) {
73
		this.description = description;
74
	}
75

  
76
	public void setName(String name) {
77
		this.name = name;
78
	}
79

  
80
	/**
81
	 * 
82
	 * @param animate : Object to animate.
83
	 *  Application of attributes to our object animated.
84
	 *  In this animation the object is a layer(FLyerDefault).
85
	 *  Attributes: layer transparency.
86
	 *  invalidate(): repaint the view. 
87
	 */
88
	
89
	public void AppliesToObject(Object animated) {
90

  
91
		KeyFrameTransparency kf = (KeyFrameTransparency) animated;
92
		FLyrDefault layer = (FLyrDefault)kf.getAnimatedObject();
93
		int trans = (int)kf.getLevelTransparency();
94
		
95
	//	System.err.println("antes: " + System.currentTimeMillis());
96
	//	long antes = System.currentTimeMillis();
97
		
98
		layer.setTransparency(trans);	
99
		layer.getMapContext().invalidate();
100
		
101
	//	System.err.println("despues: " + System.currentTimeMillis());
102
	//	long despues = System.currentTimeMillis();
103
	//	System.err.println("intervalo de tiempo: " + (despues-antes));
104
		
105
	}
106

  
107
	public int getTypeTrack() {
108
		return typeTrack;
109
	}
110

  
111
	public void setTypeTrack(int typeTrack) {
112
		this.typeTrack = typeTrack;
113
	}
114

  
115
	public IInterpolator getInterpolator() {
116
		return this.interpolator;
117
	}
118

  
119
	public void setInterpolator(IInterpolator interpolator) {
120
		this.interpolator = interpolator;
121
	}
122

  
123
	/**
124
	 * Getting the animated object, in movement track animation; the view
125
	 */
126
	public Object getAnimatedObject() {
127
		if(this.animationObjectTransparency != null){
128
			// getting all views.
129
			try{
130
				IWindow[] viewArray = PluginServices.getMDIManager().getAllWindows();
131
				for (int i = 0; i < viewArray.length; i++) {
132
					IWindow window = viewArray[i];
133
					if (window.getClass().getName().equals(this.nameView)){
134
						// get the actual name of the view, and compare it with the view saved in xml.
135
						if(window.getWindowInfo().getTitle().equals(this.titleWindow)){
136
							BaseView newView = (BaseView)window;
137
							this.animationObjectTransparency.addAnimatedObject("view", newView);
138
							this.setAnimatedObject(this.animationObjectTransparency);
139
							IInterpolatorTimeFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
140
							this.interpolator.setFuntion(funtion);
141
						}
142
					}
143
				}
144
			}catch(Exception e) {
145
				e.printStackTrace();
146
			}
147
		}
148
		return this.animationObjectTransparency;
149
	}
150

  
151
	public void setAnimatedObject(Object object) {
152
		this.animationObjectTransparency = (IAnimatedObject) object;
153
	}
154

  
155
	/*
156
	 * IPersistence methods.
157
	 */
158
	
159
	public XMLEntity getXMLEntity() {
160
		
161
		
162
		XMLEntity xml = new XMLEntity();
163
		xml.putProperty("className", this.getClassName());
164
		xml.putProperty("description", description);
165
		xml.putProperty("animationTrackTipe", typeTrack);
166
		
167
		BaseView myActualView =  (BaseView) animationObjectTransparency.getAnimatedObject("view");
168
		xml.putProperty("nameClassView", myActualView.getClass().getName());
169
		
170
		titleWindow = myActualView.getWindowInfo().getTitle();
171
		xml.putProperty("titleWindow", titleWindow);
172
		xml.addChild(((IPersistence)this.interpolator).getXMLEntity());
173
		return xml;
174
	}
175

  
176
	public void setXMLEntity(XMLEntity xml) {
177
		
178
		
179
		if (xml.contains("animationTrackTipe"))
180
			this.typeTrack = xml.getIntProperty("animationTrackTipe");
181
		if (xml.contains("nameView"))
182
			this.nameView =	xml.getStringProperty("nameView");
183
		
184
		//Acceding to the InterpolatorX of the AnimationTypeX
185
		XMLEntity xmlInterpolator = xml.getChild(0);
186
		try {
187
			String class_name = xmlInterpolator.getStringProperty("className");
188
			Class<?> classInterpolator = Class.forName(class_name);
189
			Object obj = classInterpolator .newInstance();
190
			IPersistence objPersist = (IPersistence) obj;
191
			objPersist.setXMLEntity(xmlInterpolator);
192
			this.interpolator = (IInterpolator) obj;
193
			this.setInterpolator(interpolator);
194
			
195
		} catch (Exception e) {
196
			e.printStackTrace();
197
		}
198
		
199
	}
200
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/interpolator/InterpolatorTransparency.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.interpolator;
21

  
22
import java.util.List;
23

  
24
import com.iver.cit.gvsig.animation.animatedObject.AnimationObjectTransparency;
25
import com.iver.cit.gvsig.animation.keyFrame.KeyFrameTransparency;
26
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
27
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
28
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
29
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
30
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
31
import com.iver.utiles.XMLEntity;
32

  
33

  
34
/**
35
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
36
 * @since 1.1
37
 * 
38
 */
39
public class InterpolatorTransparency implements IInterpolator {
40

  
41
	public BaseView view;
42
	private String description = "Interpolaci?n basada en Transparencias";
43
	private String name = "InterpolatorTransparency";
44
	
45
	private AnimationObjectTransparency animationObjectTransparency = new AnimationObjectTransparency() ;
46
	
47
	/**
48
	 *  Class to interpolate the transparency of a activated layer.
49
	 */
50
	public IKeyFrame interpolate(List<IKeyFrame> kfList, int index, double time) {
51
		KeyFrameTransparency KF = new KeyFrameTransparency();
52

  
53
		// if the list of keyframes is empty.
54
		if (kfList == null)
55
			return null;
56
		
57
 
58
		switch (kfList.size()) {
59
		// this case when there are only has 2 keyframes
60
		case 2:
61
		
62
			KeyFrameTransparency kf1 = (KeyFrameTransparency) kfList.get(0);
63
			KeyFrameTransparency kf2 = (KeyFrameTransparency) kfList.get(1);
64
			
65
			if (index == 1) {
66
				KeyFrameTransparency kaux = kf1;
67
				kf1 = kf2;
68
				kf2 = kaux;
69
			}
70

  
71
			if ((kf1 == null) ||(kf2 == null))
72
				return null;
73
			//initial transparency level.
74
			double transparencia1 = kf1.getLevelTransparency();
75
			//final transparency level.
76
			double transparencia2 = kf2.getLevelTransparency();
77
			
78
			// Object to animate getting the keyframe.
79
			FLyrDefault fd1 = (FLyrDefault) kf1.getAnimatedObject();
80
			//FLyrDefault fd2 = (FLyrDefault) kf2.getAnimatedObject();
81
			
82
			double time1 = kf1.getTime();//initial time.
83
			double time2 = kf2.getTime();//final time.
84
			double valorTrans = linearInterpolate(transparencia1, transparencia2, time1, time2, time);
85
			
86
			//Creating the keyframe KF to return.
87
				try {
88
					KF.setLevelTransparency((int)valorTrans);
89
					KF.setAnimatedObject(fd1);// keyframe with the layer and the new transparecy to apply.
90
				} catch (Exception e) {
91
					// TODO Auto-generated catch block
92
					e.printStackTrace();
93
				}
94
		}
95
		return KF;
96
	}
97

  
98
	/**
99
	 * Return a value interpolate 
100
	 * 
101
	 * @param minX: initial x value in the 2D extent
102
	 * @param minX2: final x value in the 2D extent
103
	 * @param timePos: initial time value
104
	 * @param timePos2: final time value
105
	 * @param time: total time
106
	 * @return
107
	 */
108
	private double linearInterpolate(double minX, double minX2, double timePos,
109
			double timePos2, double time) {
110
		// P1 + (P2-P1)*((t-t1)/(t2-t1))
111
		return (minX + (minX2 - minX)
112
				* ((time - timePos) / (timePos2 - timePos)));
113
	}
114

  
115
	
116
	public Object getAnimatedObject() {
117
		return this.animationObjectTransparency;
118
	}
119

  
120

  
121
	public void setAnimatedObject(Object object) {
122
		this.animationObjectTransparency = (AnimationObjectTransparency) object;
123
		this.view = (BaseView) animationObjectTransparency.getAnimatedView();
124
	}
125

  
126
	public IInterpolatorTimeFuntion getFuntion() {
127
		return null;
128
	}
129

  
130

  
131
	public void setFuntion(IInterpolatorTimeFuntion arg0) {
132
		// TODO Auto-generated method stub
133
	}
134
	
135
	public String getClassName() {
136
		return this.getClass().getName();
137
	}
138

  
139
	public String getDescription() {
140
		return this.description;
141
	}
142

  
143
	public String getName() {
144
		return this.name;
145
	}
146

  
147
	/*
148
	 * IPersistence methods.
149
	 */
150
	
151
	public XMLEntity getXMLEntity() {
152
		XMLEntity xml = new XMLEntity();	
153
		xml.putProperty("className", this.getClassName());
154
		xml.putProperty("description", this.description);
155
		return xml;
156
	}
157
	
158
	public void setXMLEntity(XMLEntity xml) {
159
		if (xml.contains("description"))
160
			this.description = xml.getStringProperty("description");
161
	}
162

  
163
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/keyFrame/KeyFrameTransparency.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.keyFrame;
21

  
22
import java.util.List;
23

  
24
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
25
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
26
import com.iver.utiles.XMLEntity;
27

  
28

  
29
/**
30
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
31
 * @since 1.1
32
 * * Class to create a keyframe used in animation with transparency.
33
 */
34

  
35
public class KeyFrameTransparency implements IKeyFrame {
36

  
37
	private String name;
38
	private double time;
39
	private int levelTransparency;
40
	private boolean visibility;
41
	private FLyrDefault layerDefault;
42
	private String layerName;
43
	
44

  
45

  
46
	/**
47
	 * 
48
	 * @see com.iver.cit.gvsig.animation.keyframe.IKeyFrame#CapturesProperties()
49
	 * Capturing the property transparency of the layer and the property is selected?. 
50
	 */
51
	
52
	public void CapturesProperties() {
53
		if (layerDefault != null){
54
			levelTransparency = this.layerDefault.getTransparency();
55
			visibility = this.layerDefault.isVisible();//Check box is selected?.
56
		}
57
	}
58

  
59
	/**
60
	 * Getting the keyframe name.
61
	 */
62
	
63
	public String getName() {
64
		return this.name;
65
	}
66

  
67
	public List<IKeyFrame> getPropertiesList() {
68
		return null;
69
	}
70

  
71
	/**
72
	 * @param name: name of the keyframe.
73
	 * Setting the keyframe name.
74
	 */
75
	
76
	public void setName(String name) {
77
		this.name = name;
78

  
79
	}
80

  
81
	public void setPropertiesList(List<IKeyFrame> list) {
82
		// TODO Auto-generated method stub
83
	}
84

  
85
	/**
86
	 * Information of the keyframe in a String.
87
	 */
88
	
89
	public String toString() {
90
		String result;
91
		result = " keyframeTransparency:\n";
92
		result += " tiempo: " + this.time;
93
		// result= "Name: " + this.getName();
94
		return result;
95
	}
96

  
97
	/**
98
	 * 
99
	 * @return the Object to animate.(FLyrDefault)
100
	 */
101
	
102
	public Object getAnimatedObject() {
103
		return layerDefault;
104
	}
105

  
106
	/**
107
	 * 
108
	 * @param object : Object to animate.
109
	 * Setting the object to animate.(FLyrDefault).
110
	 * 
111
	 */
112
	public void setAnimatedObject(Object object) {
113
		this.layerDefault = (FLyrDefault) object;
114
	}
115

  
116
	/**
117
	 * Getting the time of the keyframe.
118
	 */
119
	
120
	public double getTime() {
121
		return time;
122
	}
123
	
124
	public double getLevelTransparency() {
125
		return levelTransparency;
126
	}
127

  
128
	public void setLevelTransparency(int levelTransparency) {
129
		this.levelTransparency = levelTransparency;
130
	}
131

  
132
	/**
133
	 * Setting the time of the keyframe.
134
	 */
135
	
136
	public void setTime(double time) {
137
		this.time = time;
138
	}
139

  
140
	/**
141
	 * @return the name of the class.
142
	 */
143
	public String getClassName() {
144
		// TODO Auto-generated method stub
145
		return this.getClass().getName();
146
	}
147

  
148
	/*	 
149
	 * IPersistence methods.
150
	 */
151

  
152
	public XMLEntity getXMLEntity() {
153
		
154
		XMLEntity xml = new XMLEntity();
155
		
156
		xml.putProperty("className", this.getClassName());
157
		xml.putProperty("keyFrameName", name);
158
		xml.putProperty("levelTransparency", levelTransparency);
159
		xml.putProperty("visibility", visibility);
160
		xml.putProperty("time", time);
161
		xml.putProperty("layerName", layerDefault.getClass().getName());
162
		
163
		return xml;
164
	}
165

  
166
	public void setXMLEntity(XMLEntity xml) {
167
		
168
	//	if (xml.contains("className"))
169
	//		this.className = xml.getStringProperty("className");
170
		if (xml.contains("keyFrameName"))
171
			this.name = xml.getStringProperty("keyFrameName");
172
		if (xml.contains("levelTransparency"))
173
			this.levelTransparency = xml.getIntProperty("levelTransparency");
174
		if (xml.contains("visibility"))
175
			this.visibility = xml.getBooleanProperty("visibility");
176
		if (xml.contains("time"))
177
			this.time = xml.getDoubleProperty("time");
178
		
179

  
180
		try {
181
			this.layerName = xml.getStringProperty("layerName");
182
			Class<?> classProp = Class.forName(this.layerName);
183
			Object obj = classProp.newInstance();
184
			this.layerDefault = (FLyrDefault) obj;
185
		} catch (Exception e) {
186
			
187
		}
188
	}
189
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/keyFrame/AnimationKeyFrameTransparencyFactory.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19

  
20
package com.iver.cit.gvsig.animation.keyFrame;
21

  
22
import com.iver.cit.gvsig.animation.AnimationFactory;
23

  
24
/**
25
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
26
 * @since 1.1
27
 * 
28
 */
29
public class AnimationKeyFrameTransparencyFactory extends AnimationFactory {
30

  
31
	public static String registerName = "KeyFrameTransparency";
32
	
33
	
34
	/**
35
	 * Creating a new animation in the factory.
36
	 */
37
	public Object create() {
38
		KeyFrameTransparency keyFrameTransparency = new KeyFrameTransparency();
39
        return keyFrameTransparency;
40
	}
41
	
42
	/**
43
	 * Registers in the points of extension the Factory with an alias.
44
	 */
45
	public static void register() {
46
		register(registerName, new AnimationKeyFrameTransparencyFactory(), "com.iver.cit.gvsig.animation.KeyFrameTransparency");
47
	}
48

  
49
	public String getRegisterName() {
50
		return registerName;
51
	}
52

  
53
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/libraries/libAnimationCommon/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0"
2
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<groupId>org.gvsig</groupId>
6
	<artifactId>libAnimationCommon</artifactId>
7
	<packaging>jar</packaging>
8
	<version>1.9-SNAPSHOT</version>
9
	<name>libAnimationCommon</name>
10
	<url>http://maven.apache.org</url>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>gvsig-library-base-pom</artifactId>
14
		<version>1.9-SNAPSHOT</version>
15
	</parent>
16
    <properties>
17
        <build-dir>${basedir}/../build</build-dir>
18
    </properties>
19
	<dependencies>
20
		<dependency>
21
			<groupId>org.gvsig</groupId>
22
			<artifactId>lib3DMap</artifactId>
23
			<version>1.9-SNAPSHOT</version>
24
		</dependency>
25
		<dependency>
26
			<groupId>org.gvsig</groupId>
27
			<artifactId>lib3DMap-share</artifactId>
28
			<version>1.9-SNAPSHOT</version>
29
		</dependency>
30
		<dependency>
31
			<groupId>org.gvsig</groupId>
32
			<artifactId>libAnimation</artifactId>
33
			<version>1.9-SNAPSHOT</version>
34
		</dependency>
35
		<dependency>
36
			<groupId>org.gvsig</groupId>
37
			<artifactId>appgvSIG</artifactId>
38
			<version>1.9-SNAPSHOT</version>
39
		</dependency>
40
	</dependencies>
41
</project>
0 42

  

Also available in: Unified diff