Revision 32768
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/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_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/animatedObject/AnimationObject2D.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 |
/** |
|
21 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
22 |
* @since 1.1 |
|
23 |
* |
|
24 |
*/ |
|
25 |
|
|
26 |
package com.iver.cit.gvsig.animation.animatedObject; |
|
27 |
|
|
28 |
|
|
29 |
public class AnimationObject2D extends AnimatedObjectBase { |
|
30 |
|
|
31 |
private String nameClassView; |
|
32 |
|
|
33 |
public String getClassName() { |
|
34 |
return this.getClass().getName(); |
|
35 |
} |
|
36 |
|
|
37 |
public void setClassName(String className) { |
|
38 |
} |
|
39 |
|
|
40 |
public String getNameClassView() { |
|
41 |
return nameClassView; |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public void setNameView(String nameView) { |
|
46 |
this.nameClassView = nameView; |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
public Object getAnimatedView() { |
|
51 |
return this.getAnimatedObject("view2D"); |
|
52 |
} |
|
53 |
|
|
54 |
public void setAnimatedView(Object object) { |
|
55 |
this.addAnimatedObject("view2D", object); |
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationTypeFactoryLayer2D.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 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
24 |
* @since 1.1 |
|
25 |
* |
|
26 |
*/ |
|
27 |
package com.iver.cit.gvsig.animation.animationType; |
|
28 |
|
|
29 |
import com.iver.cit.gvsig.animation.AnimationFactory; |
|
30 |
|
|
31 |
public class AnimationTypeFactoryLayer2D extends AnimationFactory { |
|
32 |
|
|
33 |
public static String registerName = "AnimationLayer2D"; |
|
34 |
|
|
35 |
|
|
36 |
public static AnimationLayer2D animationLayer2D; |
|
37 |
|
|
38 |
static { |
|
39 |
if (animationLayer2D == null) { |
|
40 |
animationLayer2D = new AnimationLayer2D(); |
|
41 |
animationLayer2D.setClassName("AnimationLayer2D"); |
|
42 |
animationLayer2D.setName("AnimationLayer2D"); |
|
43 |
animationLayer2D.setDescription("Animacion basada en encuadres para vista 2D."); |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
public Object create() { |
|
50 |
|
|
51 |
return animationLayer2D; |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* Registers in the points of extension the Factory with alias. |
|
56 |
* |
|
57 |
*/ |
|
58 |
public static void register() { |
|
59 |
register(registerName, new AnimationTypeFactoryLayer2D(), "com.iver.cit.gvsig.animation.test.AnimationLayer2D"); |
|
60 |
} |
|
61 |
|
|
62 |
public String getRegisterName() { |
|
63 |
return registerName; |
|
64 |
} |
|
65 |
|
|
66 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationLayer2D.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 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
24 |
import com.iver.cit.gvsig.animation.IAnimationType; |
|
25 |
import com.iver.cit.gvsig.animation.animatedObject.AnimationObject2D; |
|
26 |
import com.iver.cit.gvsig.animation.interpolator.Interpolator2D; |
|
27 |
import com.iver.cit.gvsig.animation.keyFrame.KeyFrame2D; |
|
28 |
import com.iver.cit.gvsig.animation.keyframe.IAnimationTypeKeyFrame; |
|
29 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory; |
|
30 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator; |
|
31 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion; |
|
32 |
import com.iver.cit.gvsig.project.ProjectExtent; |
|
33 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
|
34 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
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 AnimationLayer2D implements IAnimationTypeKeyFrame { |
|
45 |
|
|
46 |
private String className = "AnimationLayer2D"; |
|
47 |
private String description = "Animacion para zoom de capas"; |
|
48 |
private String name = "Animacion de zoom capas"; |
|
49 |
private int typeTrack = IAnimationType.TIME_TYPE_TRACK; |
|
50 |
private IInterpolator interpolator; |
|
51 |
private View view; |
|
52 |
private AnimationObject2D animationObject2D = new AnimationObject2D() ; |
|
53 |
private String titleWindow; |
|
54 |
|
|
55 |
public AnimationLayer2D() { |
|
56 |
this.interpolator = new Interpolator2D(); |
|
57 |
} |
|
58 |
|
|
59 |
public String getClassName() { |
|
60 |
return className; |
|
61 |
} |
|
62 |
|
|
63 |
public String getDescription() { |
|
64 |
return description; |
|
65 |
} |
|
66 |
|
|
67 |
public String getName() { |
|
68 |
return name; |
|
69 |
} |
|
70 |
|
|
71 |
public void setClassName(String className) { |
|
72 |
this.className = className; |
|
73 |
} |
|
74 |
|
|
75 |
public void setDescription(String description) { |
|
76 |
this.description = description; |
|
77 |
} |
|
78 |
|
|
79 |
public void setName(String name) { |
|
80 |
this.name = name; |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
/** |
|
85 |
* Repainting the view |
|
86 |
*/ |
|
87 |
|
|
88 |
public void AppliesToObject(Object animated) { |
|
89 |
|
|
90 |
// Casting the animated object |
|
91 |
KeyFrame2D keyFrame2D = (KeyFrame2D) animated; |
|
92 |
this.view = (View) this.animationObject2D.getAnimatedView(); |
|
93 |
this.view.getMapControl().getViewPort().setExtent( |
|
94 |
((ProjectExtent) keyFrame2D.getAnimatedObject()).getExtent()); |
|
95 |
// Repainting the object |
|
96 |
this.view.getMapControl().drawMap(true); |
|
97 |
} |
|
98 |
|
|
99 |
public int getTypeTrack() { |
|
100 |
return typeTrack; |
|
101 |
} |
|
102 |
|
|
103 |
public void setTypeTrack(int typeTrack) { |
|
104 |
this.typeTrack = typeTrack; |
|
105 |
} |
|
106 |
|
|
107 |
public IInterpolator getInterpolator() { |
|
108 |
return this.interpolator; |
|
109 |
} |
|
110 |
|
|
111 |
public void setInterpolator(IInterpolator interpolator) { |
|
112 |
this.interpolator = interpolator; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Getting the animated object, in movement track animation; the view |
|
117 |
*/ |
|
118 |
public Object getAnimatedObject() { |
|
119 |
if(this.animationObject2D != null) { |
|
120 |
// getting all views. |
|
121 |
try{ |
|
122 |
IWindow[] viewArray = PluginServices.getMDIManager().getAllWindows(); |
|
123 |
for (int i = 0; i < viewArray.length; i++) { |
|
124 |
IWindow window = viewArray[i]; |
|
125 |
if(window.getWindowInfo().getTitle().equals(this.titleWindow)){ |
|
126 |
BaseView newView = (BaseView)window; |
|
127 |
this.animationObject2D.setAnimatedView(newView); |
|
128 |
this.setAnimatedObject(this.animationObject2D); |
|
129 |
IInterpolatorTimeFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion"); |
|
130 |
this.interpolator.setFuntion(funtion); |
|
131 |
} |
|
132 |
} |
|
133 |
}catch(Exception e) { |
|
134 |
e.printStackTrace(); |
|
135 |
} |
|
136 |
} |
|
137 |
return this.animationObject2D; |
|
138 |
} |
|
139 |
|
|
140 |
|
|
141 |
public void setAnimatedObject(Object object) { |
|
142 |
if (object instanceof AnimationObject2D) |
|
143 |
this.animationObject2D = (AnimationObject2D) object; |
|
144 |
|
|
145 |
} |
|
146 |
public XMLEntity getXMLEntity() { |
|
147 |
|
|
148 |
View myActualView = null; |
|
149 |
|
|
150 |
XMLEntity xml = new XMLEntity(); |
|
151 |
xml.putProperty("className", this.getClassName()); |
|
152 |
xml.putProperty("description", description); |
|
153 |
xml.putProperty("animationTrackTipe", typeTrack); |
|
154 |
myActualView = (View) animationObject2D.getAnimatedView(); |
|
155 |
titleWindow = myActualView.getWindowInfo().getTitle(); |
|
156 |
xml.putProperty("titleWindow", titleWindow); |
|
157 |
xml.addChild(((IPersistence)this.interpolator).getXMLEntity()); |
|
158 |
return xml; |
|
159 |
} |
|
160 |
|
|
161 |
public void setXMLEntity(XMLEntity xml) { |
|
162 |
if (xml.contains("className")) |
|
163 |
this.className= xml.getStringProperty("className"); |
|
164 |
if (xml.contains("animationTrackTipe")) |
|
165 |
this.typeTrack = xml.getIntProperty("animationTrackTipe"); |
|
166 |
if (xml.contains("titleWindow")) |
|
167 |
this.titleWindow = xml.getStringProperty("titleWindow"); |
|
168 |
|
|
169 |
XMLEntity xmlInterpolator = xml.getChild(0); |
|
170 |
|
|
171 |
try { |
|
172 |
String class_name = xmlInterpolator.getStringProperty("className"); |
|
173 |
Class<?> classInterpolator = Class.forName(class_name); |
|
174 |
Object obj = classInterpolator .newInstance(); |
|
175 |
IPersistence objPersist = (IPersistence) obj; |
|
176 |
objPersist.setXMLEntity(xmlInterpolator); |
|
177 |
this.interpolator = (IInterpolator) obj; |
|
178 |
this.setInterpolator(interpolator); |
|
179 |
|
|
180 |
} catch (Exception e) { |
|
181 |
e.printStackTrace(); |
|
182 |
} |
|
183 |
} |
|
184 |
|
|
185 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/interpolator/Interpolator2D.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.awt.geom.Rectangle2D; |
|
23 |
import java.util.List; |
|
24 |
|
|
25 |
import com.iver.cit.gvsig.animation.keyFrame.KeyFrame2D; |
|
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.project.ProjectExtent; |
|
30 |
import com.iver.utiles.XMLEntity; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
34 |
* @since 1.1 |
|
35 |
* |
|
36 |
*/ |
|
37 |
|
|
38 |
public class Interpolator2D implements IInterpolator { |
|
39 |
|
|
40 |
private String description = "Interpolaci?n basada en encuadres"; |
|
41 |
private String name = "Interpolator2D"; |
|
42 |
|
|
43 |
private IInterpolatorTimeFuntion funtion; |
|
44 |
|
|
45 |
/** |
|
46 |
* Calculating the new positions in the movement animation |
|
47 |
*/ |
|
48 |
public IKeyFrame interpolate(List<IKeyFrame> kfList, int index, double time) { |
|
49 |
KeyFrame2D KF = new KeyFrame2D(); |
|
50 |
|
|
51 |
if (kfList == null) |
|
52 |
return null; |
|
53 |
|
|
54 |
|
|
55 |
switch (kfList.size()) { |
|
56 |
// this case when there are only has 2 keyframes |
|
57 |
case 2: |
|
58 |
// getting the keyframes |
|
59 |
KeyFrame2D kf1 = (KeyFrame2D) kfList.get(0); |
|
60 |
KeyFrame2D kf2 = (KeyFrame2D) kfList.get(1); |
|
61 |
|
|
62 |
if (index == 1) { |
|
63 |
KeyFrame2D kaux = kf1; |
|
64 |
kf1 = kf2; |
|
65 |
kf2 = kaux; |
|
66 |
} |
|
67 |
|
|
68 |
ProjectExtent vp1 = (ProjectExtent) kf1.getAnimatedObject(); |
|
69 |
ProjectExtent vp2 = (ProjectExtent) kf2.getAnimatedObject(); |
|
70 |
|
|
71 |
|
|
72 |
double min1 = vp1.getExtent().getMinX(); |
|
73 |
double time1 = kf1.getTime(); |
|
74 |
double min2 = vp2.getExtent().getMinX(); |
|
75 |
double time2 = kf2.getTime(); |
|
76 |
double left = linearInterpolate(min1, min2, time1, time2, time); |
|
77 |
min1 = vp1.getExtent().getMinY(); |
|
78 |
min2 = vp2.getExtent().getMinY(); |
|
79 |
double top = linearInterpolate(min1, min2, time1, time2, time); |
|
80 |
min1 = vp1.getExtent().getWidth(); |
|
81 |
min2 = vp2.getExtent().getWidth(); |
|
82 |
double right = linearInterpolate(min1, min2, time1, time2, time); |
|
83 |
min1 = vp1.getExtent().getHeight(); |
|
84 |
min2 = vp2.getExtent().getHeight(); |
|
85 |
double bottom = linearInterpolate(min1, min2, time1, time2, time); |
|
86 |
|
|
87 |
Rectangle2D newExtent = new Rectangle2D.Double(left, top, right, |
|
88 |
bottom); |
|
89 |
ProjectExtent pe = new ProjectExtent(); |
|
90 |
pe.setExtent(newExtent); |
|
91 |
KF.setAnimatedObject(pe); |
|
92 |
break; |
|
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 |
public IInterpolatorTimeFuntion getFuntion() { |
|
116 |
return this.funtion; |
|
117 |
} |
|
118 |
|
|
119 |
public void setFuntion(IInterpolatorTimeFuntion funtion) { |
|
120 |
this.funtion = funtion; |
|
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 |
public XMLEntity getXMLEntity() { |
|
136 |
XMLEntity xml = new XMLEntity(); |
|
137 |
xml.putProperty("className", this.getClassName()); |
|
138 |
xml.putProperty("description", this.description); |
|
139 |
return xml; |
|
140 |
} |
|
141 |
|
|
142 |
public void setXMLEntity(XMLEntity xml) { |
|
143 |
if (xml.contains("description")) |
|
144 |
this.description = xml.getStringProperty("description"); |
|
145 |
|
|
146 |
} |
|
147 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/keyFrame/AnimationKeyFrame2DFactory.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 |
/** |
|
26 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
27 |
* @since 1.1 |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class AnimationKeyFrame2DFactory extends AnimationFactory { |
|
31 |
|
|
32 |
public static String registerName = "KeyFrame2D"; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* Creating a new keyFrmame 2D in the factory. |
|
37 |
*/ |
|
38 |
public Object create() { |
|
39 |
KeyFrame2D keyFrameFlat = new KeyFrame2D(); |
|
40 |
return keyFrameFlat; |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Registers in the points of extension the Factory with alias. |
|
45 |
*/ |
|
46 |
public static void register() { |
|
47 |
register(registerName, new AnimationKeyFrame2DFactory(), "com.iver.cit.gvsig.animation.KeyFrame2D"); |
|
48 |
} |
|
49 |
|
|
50 |
public String getRegisterName() { |
|
51 |
return registerName; |
|
52 |
} |
|
53 |
|
|
54 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/keyFrame/KeyFrame2D.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.awt.geom.Rectangle2D; |
|
23 |
import java.util.List; |
|
24 |
|
|
25 |
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame; |
|
26 |
import com.iver.cit.gvsig.project.ProjectExtent; |
|
27 |
import com.iver.utiles.XMLEntity; |
|
28 |
|
|
29 |
/** |
|
30 |
* @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es |
|
31 |
* @since 1.1 |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class KeyFrame2D implements IKeyFrame { |
|
35 |
|
|
36 |
private String name; |
|
37 |
private double time; |
|
38 |
private String aliasKeyFrame = "KeyFrame2D"; |
|
39 |
|
|
40 |
ProjectExtent projectExtent = null; |
|
41 |
private double valueX; |
|
42 |
private double valueY; |
|
43 |
private double valueW; |
|
44 |
private double valueH; |
|
45 |
|
|
46 |
|
|
47 |
public void CapturesProperties() { |
|
48 |
// TODO Auto-generated method stub |
|
49 |
} |
|
50 |
|
|
51 |
public void CapturesProperties(ProjectExtent projectExtent) { |
|
52 |
this.projectExtent = projectExtent; |
|
53 |
} |
|
54 |
|
|
55 |
public String getName() { |
|
56 |
return this.name; |
|
57 |
} |
|
58 |
|
|
59 |
public List<IKeyFrame> getPropertiesList() { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
return null; |
|
62 |
} |
|
63 |
|
|
64 |
public void setName(String name) { |
|
65 |
this.name = name; |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
public void setPropertiesList(List<IKeyFrame> list) { |
|
70 |
// TODO Auto-generated method stub |
|
71 |
} |
|
72 |
|
|
73 |
public String toString() { |
|
74 |
String result; |
|
75 |
result = " keyframe2D:\n"; |
|
76 |
result += " tiempo: " + this.time; |
|
77 |
result += " nombre del extent: " + this.projectExtent.getDescription(); |
|
78 |
|
|
79 |
return result; |
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
public Object getAnimatedObject() { |
|
84 |
return projectExtent; |
|
85 |
} |
|
86 |
public void setAnimatedObject(Object object) { |
|
87 |
this.projectExtent = (ProjectExtent) object; |
|
88 |
} |
|
89 |
|
|
90 |
public double getTime() { |
|
91 |
return time; |
|
92 |
} |
|
93 |
|
|
94 |
public void setTime(double time) { |
|
95 |
this.time = time; |
|
96 |
} |
|
97 |
|
|
98 |
public String getClassName() { |
|
99 |
return this.getClass().getName(); |
|
100 |
} |
|
101 |
|
|
102 |
public XMLEntity getXMLEntity() { |
|
103 |
XMLEntity xml = new XMLEntity(); |
|
104 |
|
|
105 |
xml.putProperty("className", this.getClassName()); |
|
106 |
xml.putProperty("keyFrameAlias", aliasKeyFrame); |
|
107 |
xml.putProperty("time", time); |
|
108 |
|
|
109 |
xml.addChild((this.projectExtent).getXMLEntity()); |
|
110 |
|
|
111 |
return xml; |
|
112 |
} |
|
113 |
|
|
114 |
public void setXMLEntity(XMLEntity xml) { |
|
115 |
|
|
116 |
if (xml.contains("time")) |
|
117 |
this.time = xml.getDoubleProperty("time"); |
|
118 |
if (xml.contains("keyFrameAlias")) |
|
119 |
this.aliasKeyFrame = xml.getStringProperty("keyFrameAlias"); |
|
120 |
|
|
121 |
XMLEntity xmlProp = xml.getChild(0); |
|
122 |
if (xmlProp.contains("extentX")) { |
|
123 |
valueX = xmlProp.getDoubleProperty("extentX"); |
|
124 |
} |
|
125 |
if (xmlProp.contains("extentY")) { |
|
126 |
valueY = xmlProp.getDoubleProperty("extentY"); |
|
127 |
} |
|
128 |
if (xmlProp.contains("extentW")) { |
|
129 |
valueW = xmlProp.getDoubleProperty("extentW"); |
|
130 |
} |
|
131 |
if (xmlProp.contains("extentH")) { |
|
132 |
valueH = xmlProp.getDoubleProperty("extentH"); |
|
133 |
} |
|
134 |
|
|
135 |
Rectangle2D rectangle2D = new Rectangle2D.Double(valueX, valueY, valueW, valueH); |
|
136 |
this.projectExtent = new ProjectExtent(); |
|
137 |
this.projectExtent.setExtent(rectangle2D); |
|
138 |
|
|
139 |
} |
|
140 |
} |
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_14/libraries/libAnimation2D/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>libAnimation2D</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<version>1.9-SNAPSHOT</version> |
|
9 |
<name>libAnimation2D</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>libAnimation</artifactId> |
|
23 |
<version>1.9-SNAPSHOT</version> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>_fwAndami</artifactId> |
|
28 |
<version>1.9-SNAPSHOT</version> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>appgvSIG</artifactId> |
|
33 |
<version>1.9-SNAPSHOT</version> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>libFMap</artifactId> |
|
38 |
<version>1.9-SNAPSHOT</version> |
|
39 |
</dependency> |
|
40 |
</dependencies> |
|
41 |
</project> |
|
0 | 42 |
Also available in: Unified diff