Revision 25506

View differences:

tags/3D_Animation_v1_0alpha_Build_5/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
public class AnimationTypeFactoryTransparency extends AnimationFactory {
26

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

  
56
	public String getRegisterName() {
57
		return registerName;
58
	}
59

  
60
}
tags/3D_Animation_v1_0alpha_Build_5/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
public class AnimationKeyFrameTransparencyFactory extends AnimationFactory {
27

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

  
46
	public String getRegisterName() {
47
		return registerName;
48
	}
49

  
50
}
tags/3D_Animation_v1_0alpha_Build_5/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
public class AnimationTransparency implements IAnimationTypeKeyFrame {
40

  
41
	private String description = "Animacion basada en Transparencias";
42
	private String name = "AnimationTransparency";
43
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
44
	private IInterpolator interpolator;
45
	private String nameView;
46
	private IAnimatedObject animationObjectTransparency = new AnimationObjectTransparency() ;
47
	private String titleWindow;
48

  
49
	public AnimationTransparency() {
50
	}
51

  
52
	public String getClassName() {
53
		return this.getClass().getName();
54
	}
55

  
56
	public String getDescription() {
57
		return description;
58
	}
59

  
60
	public String getName() {
61
		return name;
62
	}
63

  
64
	public void setClassName(String className) {
65
	}
66

  
67
	public void setDescription(String description) {
68
		this.description = description;
69
	}
70

  
71
	public void setName(String name) {
72
		this.name = name;
73
	}
74

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

  
86
		KeyFrameTransparency kf = (KeyFrameTransparency) animated;
87
		FLyrDefault layer = (FLyrDefault)kf.getAnimatedObject();
88
		int trans = (int)kf.getLevelTransparency();
89
		
90
	//	System.err.println("antes: " + System.currentTimeMillis());
91
	//	long antes = System.currentTimeMillis();
92
		
93
		layer.setTransparency(trans);	
94
		layer.getMapContext().invalidate();
95
		
96
	//	System.err.println("despues: " + System.currentTimeMillis());
97
	//	long despues = System.currentTimeMillis();
98
	//	System.err.println("intervalo de tiempo: " + (despues-antes));
99
		
100
		System.err.println("aplicando transparencia " + trans + " al objeto " + layer.getName());
101
	}
102

  
103
	public int getTypeTrack() {
104
		return typeTrack;
105
	}
106

  
107
	public void setTypeTrack(int typeTrack) {
108
		this.typeTrack = typeTrack;
109
	}
110

  
111
	public IInterpolator getInterpolator() {
112
		return this.interpolator;
113
	}
114

  
115
	public void setInterpolator(IInterpolator interpolator) {
116
		this.interpolator = interpolator;
117
	}
118

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

  
144
	public void setAnimatedObject(Object object) {
145
		this.animationObjectTransparency = (IAnimatedObject) object;
146
	}
147

  
148
	/*
149
	 * IPersistence methods.
150
	 */
151
	
152
	public XMLEntity getXMLEntity() {
153
		
154
		
155
		XMLEntity xml = new XMLEntity();
156
		xml.putProperty("className", this.getClassName());
157
		xml.putProperty("description", description);
158
		xml.putProperty("animationTrackTipe", typeTrack);
159
		
160
		BaseView myActualView =  (BaseView) animationObjectTransparency.getAnimatedObject("view");
161
		xml.putProperty("nameClassView", myActualView.getClass().getName());
162
		
163
		titleWindow = myActualView.getWindowInfo().getTitle();
164
		xml.putProperty("titleWindow", titleWindow);
165
		xml.addChild(((IPersistence)this.interpolator).getXMLEntity());
166
		return xml;
167
	}
168

  
169
	public void setXMLEntity(XMLEntity xml) {
170
		
171
		
172
		if (xml.contains("animationTrackTipe"))
173
			this.typeTrack = xml.getIntProperty("animationTrackTipe");
174
		if (xml.contains("nameView"))
175
			this.nameView =	xml.getStringProperty("nameView");
176
		
177
		//Acceding to the InterpolatorX of the AnimationTypeX
178
		XMLEntity xmlInterpolator = xml.getChild(0);
179
		try {
180
			String class_name = xmlInterpolator.getStringProperty("className");
181
			Class<?> classInterpolator = Class.forName(class_name);
182
			Object obj = classInterpolator .newInstance();
183
			IPersistence objPersist = (IPersistence) obj;
184
			objPersist.setXMLEntity(xmlInterpolator);
185
			this.interpolator = (IInterpolator) obj;
186
			this.setInterpolator(interpolator);
187
			
188
		} catch (Exception e) {
189
			e.printStackTrace();
190
		}
191
		
192
	}
193
}
tags/3D_Animation_v1_0alpha_Build_5/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
 *  Class to interpolate the transparency of a activated layer.
36
 */
37

  
38
public class InterpolatorTransparency implements IInterpolator {
39

  
40
	public BaseView view;
41
	private String description = "Interpolaci?n basada en Transparencias";
42
	private String name = "InterpolatorTransparency";
43
	
44
	private AnimationObjectTransparency animationObjectTransparency = new AnimationObjectTransparency() ;
45
	
46
	public IKeyFrame interpolate(List<IKeyFrame> kfList, int index, double time) {
47
		KeyFrameTransparency KF = new KeyFrameTransparency();
48

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

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

  
95
	
96
	private double linearInterpolate(double minX, double minX2, double timePos,
97
			double timePos2, double time) {
98
		// P1 + (P2-P1)*((t-t1)/(t2-t1))
99
		return (minX + (minX2 - minX)
100
				* ((time - timePos) / (timePos2 - timePos)));
101
	}
102

  
103
	
104
	public Object getAnimatedObject() {
105
		return this.animationObjectTransparency;
106
	}
107

  
108

  
109
	public void setAnimatedObject(Object object) {
110
		this.animationObjectTransparency = (AnimationObjectTransparency) object;
111
		this.view = (BaseView) animationObjectTransparency.getAnimatedView();
112
	}
113

  
114
	public IInterpolatorTimeFuntion getFuntion() {
115
		return null;
116
	}
117

  
118

  
119
	public void setFuntion(IInterpolatorTimeFuntion arg0) {
120
		// TODO Auto-generated method stub
121
	}
122
	
123
	public String getClassName() {
124
		return this.getClass().getName();
125
	}
126

  
127
	public String getDescription() {
128
		return this.description;
129
	}
130

  
131
	public String getName() {
132
		return this.name;
133
	}
134

  
135
	/*
136
	 * IPersistence methods.
137
	 */
138
	
139
	public XMLEntity getXMLEntity() {
140
		XMLEntity xml = new XMLEntity();	
141
		xml.putProperty("className", this.getClassName());
142
		xml.putProperty("description", this.description);
143
		return xml;
144
	}
145
	
146
	public void setXMLEntity(XMLEntity xml) {
147
		if (xml.contains("description"))
148
			this.description = xml.getStringProperty("description");
149
	}
150

  
151
}
tags/3D_Animation_v1_0alpha_Build_5/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
public class AnimationKeyFrameTransparencyFactory extends AnimationFactory {
26

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

  
45
	public String getRegisterName() {
46
		return registerName;
47
	}
48

  
49
}
tags/3D_Animation_v1_0alpha_Build_5/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
 * 
31
 * @author ?ngel.
32
 * 
33
 * Class to create a keyframe used in animation with transparency.
34
 *
35
 */
36

  
37
public class KeyFrameTransparency implements IKeyFrame {
38

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

  
47

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

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

  
69
	public List<IKeyFrame> getPropertiesList() {
70
		return null;
71
	}
72

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

  
81
	}
82

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

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

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

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

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

  
130
	public void setLevelTransparency(int levelTransparency) {
131
		this.levelTransparency = levelTransparency;
132
	}
133

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

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

  
150
	/*	 
151
	 * IPersistence methods.
152
	 */
153

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

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

  
182
		try {
183
			this.layerName = xml.getStringProperty("layerName");
184
			Class<?> classProp = Class.forName(this.layerName);
185
			Object obj = classProp.newInstance();
186
			this.layerDefault = (FLyrDefault) obj;
187
		} catch (Exception e) {
188
			
189
		}
190
	}
191
}
tags/3D_Animation_v1_0alpha_Build_5/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
public class AnimationObjectTransparency extends AnimatedObjectBase{
25
	
26
	private String nameLayer;
27
	private FLyrDefault layerDefault;
28
	
29
	
30
	public String getClassName() {
31
		return this.getClass().getName();
32
	}
33
	
34
	public void setClassName(String className) {
35
	}
36
	
37
	public String getNameLayer() {
38
		return nameLayer;
39
	}
40
	
41
	public void setNameLayer(String nameLayer) {
42
		this.nameLayer = nameLayer;
43
	}
44
	
45
	public Object getAnimatedView() {
46
		return this.getAnimatedObject("view");
47
	}
48
	
49
	public void setAnimatedView(Object object) {
50
		this.addAnimatedObject("view", object);
51
	}
52
	
53
	
54
	public Object getAnimatedLayer() {
55
		return layerDefault;
56
	}
57

  
58
	public void setAnimatedLayer(Object object) {
59
		this.layerDefault = (FLyrDefault) object;
60
		this.nameLayer = this.layerDefault.getName();
61
	}
62
	
63
	
64
}
tags/3D_Animation_v1_0alpha_Build_5/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/3D_Animation_v1_0alpha_Build_5/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.0-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.0-SNAPSHOT</version>
15
	</parent>
16
	<dependencies>
17
		<dependency>
18
			<groupId>org.gvsig</groupId>
19
			<artifactId>lib3DMap</artifactId>
20
			<version>1.0-SNAPSHOT</version>
21
		</dependency>
22
		<dependency>
23
			<groupId>org.gvsig</groupId>
24
			<artifactId>lib3DMap-share</artifactId>
25
			<version>1.0-SNAPSHOT</version>
26
		</dependency>
27
		<dependency>
28
			<groupId>org.gvsig</groupId>
29
			<artifactId>libAnimation</artifactId>
30
			<version>1.0-SNAPSHOT</version>
31
		</dependency>
32
		<dependency>
33
			<groupId>org.gvsig</groupId>
34
			<artifactId>appgvSIG</artifactId>
35
			<version>2.1-SNAPSHOT</version>
36
		</dependency>
37
	</dependencies>
38
</project>
0 39

  

Also available in: Unified diff