Revision 15462
import/ext3D/branches/ext3D_v1.1/extAnimationGUI/src/com/iver/ai2/animationgui/gui/MenuAnimation3D.java | ||
---|---|---|
4 | 4 |
import java.util.ArrayList; |
5 | 5 |
import java.util.List; |
6 | 6 |
|
7 |
import com.iver.ai2.animationgui.gui.toc.TocAnimationDate; |
|
7 | 8 |
import com.iver.ai2.gvsig3d.camera.ProjectCamera; |
8 | 9 |
import com.iver.ai2.gvsig3d.gui.View3D; |
9 | 10 |
import com.iver.andami.PluginServices; |
... | ... | |
15 | 16 |
import com.iver.cit.gvsig.animation.AnimationLayer2D; |
16 | 17 |
import com.iver.cit.gvsig.animation.AnimationLayer3DFlat; |
17 | 18 |
import com.iver.cit.gvsig.animation.AnimationPlayer; |
18 |
import com.iver.cit.gvsig.animation.AnimationTypeFactoryLayer2D; |
|
19 | 19 |
import com.iver.cit.gvsig.animation.Interpolator2D; |
20 | 20 |
import com.iver.cit.gvsig.animation.Interpolator3DFlat; |
21 | 21 |
import com.iver.cit.gvsig.animation.KeyFrame2D; |
22 | 22 |
import com.iver.cit.gvsig.animation.KeyFrame3DFlat; |
23 | 23 |
import com.iver.cit.gvsig.animation.interval.AnimationKeyFrameInterval; |
24 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory; |
|
25 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorFuntion; |
|
24 | 26 |
import com.iver.cit.gvsig.animation.traks.AnimationTimeTrack; |
25 | 27 |
import com.iver.cit.gvsig.animation.traks.IAnimationTrack; |
26 | 28 |
import com.iver.cit.gvsig.fmap.MapControl; |
... | ... | |
81 | 83 |
|
82 | 84 |
// crear track sino existe |
83 | 85 |
ac = this.getAnimationContainer(); |
84 |
animationTimeTrack = this.getAnimationTimeTrack( |
|
85 |
"encuadrator_track", ac); |
|
86 |
// generar el intervalo |
|
87 |
if (AKFinterval == null) { |
|
88 |
AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack |
|
89 |
.createKeyFrameInterval(); |
|
90 |
AKFinterval.setInitialTime(0.0); |
|
91 |
AKFinterval.setEndTime(1.0); |
|
92 |
} |
|
93 | 86 |
|
94 | 87 |
// If the w is instance of View |
95 | 88 |
if (w instanceof View) { |
89 |
|
|
90 |
animationTimeTrack = this.getAnimationTimeTrack( |
|
91 |
"encuadrator_track_2D", ac); |
|
92 |
// generar el intervalo |
|
93 |
if (AKFinterval == null) { |
|
94 |
AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack |
|
95 |
.createKeyFrameInterval(); |
|
96 |
AKFinterval.setInitialTime(0.0); |
|
97 |
AKFinterval.setEndTime(1.0); |
|
98 |
} |
|
96 | 99 |
|
97 | 100 |
BaseView view = (BaseView) w; |
98 | 101 |
MapControl mapa = view.getMapControl(); |
... | ... | |
115 | 118 |
double tiempo = 0.0; |
116 | 119 |
if (i != 0) |
117 | 120 |
tiempo = i * ((fin - ini) / (size - 1.0)); |
118 |
// (AKFinterval.getEndTime() - AKFinterval |
|
119 |
// .getInitialTime()) / extentsList.length); |
|
120 | 121 |
kf2D.setTime(tiempo); |
121 | 122 |
// hacer funcion de insercion o adapter |
122 | 123 |
// kf2D.CapturesProperties(projectExtent); |
... | ... | |
128 | 129 |
|
129 | 130 |
if (w instanceof View3D) { |
130 | 131 |
|
132 |
animationTimeTrack = this.getAnimationTimeTrack( |
|
133 |
"encuadrator_track_3D", ac); |
|
134 |
// generar el intervalo |
|
135 |
if (AKFinterval == null) { |
|
136 |
AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack |
|
137 |
.createKeyFrameInterval(); |
|
138 |
AKFinterval.setInitialTime(0.0); |
|
139 |
AKFinterval.setEndTime(1.0); |
|
140 |
} |
|
141 |
|
|
131 | 142 |
View3D view = (View3D) w; |
132 | 143 |
Camera ca = view.getCamera(); |
133 | 144 |
|
... | ... | |
135 | 146 |
camera.setDescription(name); |
136 | 147 |
camera.setCamera(ca); |
137 | 148 |
|
138 |
Object[] l = project.getCameras(); |
|
139 |
|
|
140 |
|
|
141 | 149 |
project.addCamera(camera); |
142 |
|
|
143 |
|
|
144 | 150 |
// generar lista de keyframes |
145 |
|
|
146 | 151 |
Object[] extentsList = project.getCameras(); |
147 | 152 |
keyFrameList = new ArrayList(); |
148 | 153 |
for (int i = 0; i < extentsList.length; i++) { |
... | ... | |
165 | 170 |
|
166 | 171 |
} |
167 | 172 |
} |
168 |
|
|
169 |
|
|
170 | 173 |
AKFinterval.setKeyFrameList(keyFrameList); |
171 |
|
|
172 | 174 |
System.out.println(ac); |
173 |
|
|
174 | 175 |
} else if (actionCommand.equals("CAPACAP")) {// button capture layer |
175 | 176 |
// pressed. |
176 | 177 |
System.out.println("pulsado boton de capturar capa!!!"); |
178 |
} else if (actionCommand.equals("BORRAR")){ |
|
179 |
ac = this.getAnimationContainer(); |
|
180 |
ac.removeAllTrack(); |
|
177 | 181 |
} |
182 |
|
|
178 | 183 |
|
179 | 184 |
} |
180 | 185 |
|
181 | 186 |
private AnimationTimeTrack getAnimationTimeTrack(String name, |
182 | 187 |
AnimationContainer ac) { |
188 |
|
|
189 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices |
|
190 |
.getMDIManager().getActiveWindow(); |
|
191 |
|
|
183 | 192 |
AnimationTimeTrack at = this.animationTimeTrack; |
184 | 193 |
IAnimationTrack aa = ac.findTrack(name); |
185 | 194 |
if (aa == null) { |
... | ... | |
188 | 197 |
.getInstance(); |
189 | 198 |
ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints |
190 | 199 |
.get("Animation")); |
191 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices |
|
192 |
.getMDIManager().getActiveWindow(); |
|
200 |
|
|
193 | 201 |
if (f instanceof View) { |
194 |
AnimationLayer2D animationLayer2D = null; |
|
195 |
try { |
|
196 |
animationLayer2D = (AnimationLayer2D) extPoint |
|
197 |
.create("AnimationLayer2D"); |
|
198 |
} catch (InstantiationException e) { |
|
199 |
// TODO Auto-generated catch block |
|
200 |
e.printStackTrace(); |
|
201 |
} catch (IllegalAccessException e) { |
|
202 |
// TODO Auto-generated catch block |
|
203 |
e.printStackTrace(); |
|
204 |
} |
|
205 |
at = (AnimationTimeTrack) ac.CreateTimeTrack(animationLayer2D); |
|
206 |
at.setName(name); |
|
202 |
IAnimationTrack trackAux = ac.findTrack("encuadrator_track_3D"); |
|
203 |
if (trackAux != null) { |
|
204 |
trackAux.setEnabale(false); |
|
205 |
} |
|
206 |
AnimationLayer2D animationLayer2D = null; |
|
207 |
try { |
|
208 |
animationLayer2D = (AnimationLayer2D) extPoint |
|
209 |
.create("AnimationLayer2D"); |
|
210 |
} catch (InstantiationException e) { |
|
211 |
// TODO Auto-generated catch block |
|
212 |
e.printStackTrace(); |
|
213 |
} catch (IllegalAccessException e) { |
|
214 |
// TODO Auto-generated catch block |
|
215 |
e.printStackTrace(); |
|
216 |
} |
|
217 |
at = (AnimationTimeTrack) ac.CreateTimeTrack(animationLayer2D); |
|
218 |
at.setName(name); |
|
219 |
at.setEnabale(true); |
|
207 | 220 |
View view = (View) f; |
208 | 221 |
at.setAnimatedObject(view); |
222 |
// Create the interpolator |
|
209 | 223 |
Interpolator2D inter2D = new Interpolator2D(); |
210 | 224 |
inter2D.setAnimatedObject(view); |
225 |
IInterpolatorFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion"); |
|
226 |
inter2D.setFuntion(funtion); |
|
227 |
|
|
211 | 228 |
animationLayer2D.setInterpolator(inter2D); |
212 | 229 |
at.setAnimationType(animationLayer2D); |
213 | 230 |
animationLayer2D.setAnimatedObject(view); |
214 | 231 |
} |
215 | 232 |
if (f instanceof View3D) { |
233 |
IAnimationTrack trackAux = ac.findTrack("encuadrator_track_2D"); |
|
234 |
if (trackAux != null) { |
|
235 |
trackAux.setEnabale(false); |
|
236 |
} |
|
216 | 237 |
AnimationLayer3DFlat animationLayer3DFlat = null; |
217 | 238 |
try { |
218 | 239 |
animationLayer3DFlat = (AnimationLayer3DFlat) extPoint |
... | ... | |
223 | 244 |
} catch (IllegalAccessException e) { |
224 | 245 |
e.printStackTrace(); |
225 | 246 |
} |
226 |
at = (AnimationTimeTrack) ac.CreateTimeTrack(animationLayer3DFlat); |
|
247 |
at = (AnimationTimeTrack) ac |
|
248 |
.CreateTimeTrack(animationLayer3DFlat); |
|
227 | 249 |
at.setName(name); |
250 |
at.setEnabale(true); |
|
228 | 251 |
BaseView view = (BaseView) f; |
229 | 252 |
at.setAnimatedObject(view); |
230 | 253 |
Interpolator3DFlat inter3DFlat = new Interpolator3DFlat(); |
231 | 254 |
inter3DFlat.setAnimatedObject(view); |
255 |
IInterpolatorFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion"); |
|
256 |
inter3DFlat.setFuntion(funtion); |
|
232 | 257 |
animationLayer3DFlat.setInterpolator(inter3DFlat); |
233 | 258 |
at.setAnimationType(animationLayer3DFlat); |
234 | 259 |
animationLayer3DFlat.setAnimatedObject(view); |
235 | 260 |
} |
236 | 261 |
} |
262 |
|
|
263 |
if (f instanceof View3D) { |
|
264 |
IAnimationTrack trackAux = ac.findTrack("encuadrator_track_2D"); |
|
265 |
if (trackAux != null) { |
|
266 |
trackAux.setEnabale(false); |
|
267 |
} |
|
268 |
} |
|
269 |
|
|
270 |
if (f instanceof View) { |
|
271 |
IAnimationTrack trackAux = ac.findTrack("encuadrator_track_3D"); |
|
272 |
if (trackAux != null) { |
|
273 |
trackAux.setEnabale(false); |
|
274 |
} |
|
275 |
} |
|
237 | 276 |
return at; |
238 | 277 |
|
239 | 278 |
} |
... | ... | |
252 | 291 |
project = pe.getProject(); |
253 | 292 |
|
254 | 293 |
// Register types |
255 |
AnimationTypeFactoryLayer2D.register(); |
|
294 |
// AnimationTypeFactoryLayer2D.register();
|
|
256 | 295 |
// AnimationTypeFactoryLayer3DFlat.register(); |
296 |
|
|
297 |
// Registering TOC actions |
|
298 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
|
299 |
extensionPoints.add("View_TocActions","Generar animacion temporal",new TocAnimationDate()); |
|
257 | 300 |
} |
258 | 301 |
|
259 | 302 |
public boolean isEnabled() { |
Also available in: Unified diff