Revision 31002

View differences:

tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/config/text.properties
1
#Default language
2
#AnimationGui
3
Check_Text=Visualizaci\u00f3n frames
4
Label_Duration =Duraci\u00f3n
5
Label_Mode=Modo
6
Window_Title=Controles de animaci\u00f3n
7
Text_Secs=segs
8
Capturar_encuadre=Capturar encuadre
9
Capturar_capa=Capturar capa
10
Controles_de_animacion=Controles de animaci\u00f3n
11
Exportar_video=Exportar v?deo
12
Borrar_animacion=Borrar animaci\u00f3n
13
Animacion=Animaci\u00f3n
14
Crear_animacion_trans=Crear animaci\u00f3n con transparencias
15
no_views=Ninguna vista abierta
16
no_layers=Ninguna capa en la vista
17
Animacion_vacia2=Animaci\u00f3n sin vistas asignadas
18
Animacion_de_transparencias=Animaci\u00f3n de transparencias
19
Animacion_sin_vistas_incluidas=Animaci\u00f3n sin vistas incluidas
20
Capturar_fotograma=Capturar fotograma
21
Player=Player
22
Borrar_animacion=Borrar animaci\u00f3n
23
Vista_a_animar=Vista a animar
24
Modo_de_reproduccion=Modo de reproducci\u00f3n
25
Duracion_de_la_animacion=Duraci\u00f3n de la animaci\u00f3n
26
Grabar_animacion=Grabar animaci\u00f3n
27
Stop=Stop
28
Play=Play
29
Pause=Pause
30
Vista_animada_info=Vista animada, no se puede relacionar con otro documento de animaci\u00f3n
31
Vista_animada_titulo=animada
32
Animacion_en_curso_info=Animaci\u00f3n en curso. Para a\u00f1adir keyframes, parar antes la animaci\u00f3n
33
Animacion_en_curso_info2=Animaci\u00f3n
34
Animacion_en_curso_titulo=en curso
35
Animacion_borrar_info=Animaci?n en curso, para borrar parar antes la animaci\u00f3n
36
Animacion_borrar_titulo=Animaci\u00f3n en curso
37
No_vistas_info=Animaci\u00f3n
38
No_vistas_info2=sin ninguna vista asociada
39
No_vistas_titulo=Animaci\u00f3n vac?a
40
Closed_views_info=Ninguna vista abierta para aplicarle animaci?n por transparencias
41
Closed_views_titulo=Vistas cerradas
42
Closed_views_titulo2=Ninguna vista abierta para la captura de fotogramas en
43
Mensaje_capas_info=Selecciona las capas en el TOC para aplicarles transparencia
44
Mensaje_capas_titulo=Capas no seleccionadas
45
Loop_mode=Modo salto
46
Ping_pong_loop=Ping pong
47
Play_once=Reproducir una vez
48
Loop_once_backwards=Hacia atr?s una vez
49
Project_animation_document=Animaci\u00f3n
50
seconds=(segundos)
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/config/about.htm
1
<html>
2
  <head>
3
    <title>Extension 3D del programa GvSIG </title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
    <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I and other contributors 2005.</font></td>
16
  </tr>
17
</table>
18
  <h3>Extesi&oacute;n de la Aplicaci&oacute;n para el tratamiento de top&oacute;nimos del Instituto Geogr&aacute;fico Nacional</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/config/text_ca.properties
1
#Translations for language [ca]
2
#AnimationGui
3
Check_Text=Visualizaci?n frames
4
Label_Duration =Duraci?n
5
Label_Mode=Modo
6
Window_Title=Controles de animaci?n
7
Text_Secs=segs
8
Capturar_encuadre=Capturar encuadre
9
Capturar_capa=Capturar capa
10
Controles_de_animacion=Controles de animaci?n
11
Exportar_video=Exportar v?deo
12
Borrar_animacion=Borrar animaci?n
13
Animacion=Animaci?n
14
Crear_animacion_trans=Crear animaci?n con transparencias
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="com.iver.cit.gvsig" />
4
	<depends plugin-name="org.gvsig.ext3Dgui" />
5
	<depends plugin-name="org.gvsig.extAnimation3D" />
6
	<depends plugin-name="org.gvsig.extAnimation2D" />
7
	<depends plugin-name="org.gvsig.extAnimationCommon" />
8
	<libraries library-dir="./lib" />
9
	<resourceBundle name="text" />
10
	<extensions>
11
		<extension class-name="com.iver.ai2.animationgui.gui.AnimationDocumentRegister"
12
			description="Shows a Animation" active="true" priority="50">
13
			<tool-bar name="Tools3D">
14
				<selectable-tool icon="images/reproductoranim/pause.png"
15
					action-command="SHOW3D" tooltip="show_animation_document" />
16
			</tool-bar>
17
		</extension>
18
		<extension
19
			class-name="com.iver.ai2.animationgui.gui.MenuAnimation3D"
20
			description="Extensi?n encargada de abrir el menu de animaci?n 3D."
21
			active="true" priority="40">
22
		</extension>
23
		<extension
24
			class-name="com.iver.ai2.animationgui.gui.MenuAnimationTransparency"
25
			description="Extensi?n encargada de abrir el menu de animaci?n 3D."
26
			active="true" priority="40">
27
		</extension>
28
	</extensions>
29
</plugin-config>
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/build.number
1
#Build Number for ANT. Do not edit!
2
#Wed Jan 16 11:54:01 CET 2008
3
build.number=1209
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/MenuAnimation3D.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.ai2.animationgui.gui;
21

  
22
import javax.swing.JOptionPane;
23

  
24
import com.iver.ai2.animationgui.gui.document.ProjectAnimationDocument;
25
import com.iver.ai2.animationgui.gui.toc.TocAnimationDate;
26
import com.iver.ai2.animationgui.gui.util.AnimationUtils;
27
import com.iver.ai2.gvsig3d.camera.ProjectCamera;
28
import com.iver.andami.PluginServices;
29
import com.iver.andami.plugins.Extension;
30
import com.iver.andami.plugins.IExtension;
31
import com.iver.andami.ui.mdiManager.IWindow;
32
import com.iver.cit.gvsig.ProjectExtension;
33
import com.iver.cit.gvsig.animation.AnimationContainer;
34
import com.iver.cit.gvsig.animation.AnimationPlayer;
35
import com.iver.cit.gvsig.project.Project;
36
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
37
import com.iver.utiles.extensionPoints.ExtensionPoints;
38
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
39

  
40
/**
41
 * @author
42
 * @since 1.1
43
 * 
44
 * Menu of animation toolbar's options.
45
 */
46

  
47
public class MenuAnimation3D extends Extension {
48

  
49
	// private variable that contains the project
50
	private Project project;
51
	// It is the project Document create to create a fast animation.
52
	private ProjectAnimationDocument pad;
53

  
54
	public void execute(String actionCommand) {
55

  
56
		AnimationContainer ac;
57
		String prefix = "Default-animation-document";
58
		// if the button pressed is animation control the animation panel is
59
		// created.
60
		if (actionCommand.equals("CONTROLES")) {
61
			// Getting the animation container.
62
			if (pad != null) {
63
				ac = pad.getAnimationContainer();
64
				AnimationPlayer ap = ac.getAnimationPlayer();
65
				ap.setAnimationContainer(ac);
66
				AnimationContol3D fp = new AnimationContol3D(ap);
67
				PluginServices.getMDIManager().addWindow((IWindow) fp);
68
			} else {
69
				if (AnimationUtils.exitsProject(prefix, project)){
70
					ac = AnimationUtils.getProjectDocument(prefix, project).getAnimationContainer();
71
					AnimationPlayer ap = ac.getAnimationPlayer();
72
					ap.setAnimationContainer(ac);
73
					AnimationContol3D fp = new AnimationContol3D(ap);
74
					PluginServices.getMDIManager().addWindow((IWindow) fp);
75
				}else{
76
					// Show a message that indicates why it is impossible to open
77
					// the player
78
					JOptionPane
79
					.showMessageDialog(null,
80
					"There is not any animation document. Please create one");
81
				}
82
			}
83

  
84
		} else if (actionCommand.equals("ENCUADRECAP")) {// button capture
85
			// if there is not create the default animation. we will create it.
86
			pad = AnimationUtils.createAnimationDocument(prefix, project);
87
			if (!AnimationUtils.exitsProject(prefix, project)){
88
				project.addDocument(pad);
89
			}
90

  
91
			// Getting the active windows
92
			IWindow w = PluginServices.getMDIManager().getActiveWindow();
93

  
94
			// Getting the animation container.
95
			ac = pad.getAnimationContainer();
96

  
97
			// Capture the new encuadrator
98
			AnimationUtils.captureEncuadrator((BaseView) w, ac, prefix);
99

  
100
		} else if (actionCommand.equals("CAPACAP")) {// button capture layer
101
			// pressed.
102
			System.out.println("pulsado boton de capturar capa!!!");
103
		} else if (actionCommand.equals("CLEAR_TRACK")) {
104
			//removeCameras(AnimationPrefix);
105
			// // AKFinterval = null;
106
			// cont = 0;
107
			// ac = this.getAnimationContainer();
108
			// ac.removeAllTrack();
109
		}
110

  
111
	}
112

  
113
	/**
114
	 * This method removes all the captures that there are in the encuadrator
115
	 * with the substring "substring"
116
	 * 
117
	 * @param substring
118
	 *            the method removes all the captures that contain this
119
	 *            substring.
120
	 * 
121
	 */
122
	void removeCameras(String substring) {
123
		// Remove all animation keyframe from the encuadrator.
124
		Object[] pcList = project.getCameras();
125
		int i = 0;
126
		while (i < pcList.length) {
127
			ProjectCamera projectCamera = (ProjectCamera) pcList[i];
128
			if (projectCamera.getDescription().contains(substring)) {
129
				project.removeCamera(i);
130
				pcList = project.getCameras();
131
			} else {
132
				i++;
133
			}
134
		}
135
	}
136

  
137
	public void postInitialize() {
138

  
139
		IExtension extension = PluginServices
140
				.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
141
		ProjectExtension pe = (ProjectExtension) extension;
142
		project = pe.getProject();
143

  
144
		PluginServices.getIconTheme().registerDefault(
145
				"camera-link-icon",
146
				this.getClass().getClassLoader().getResource(
147
						"images/camera_link.png"));
148
		PluginServices.getIconTheme().registerDefault(
149
				"camera-add-icon",
150
				this.getClass().getClassLoader().getResource(
151
						"images/camera_add.png"));
152
		PluginServices.getIconTheme().registerDefault(
153
				"camera-edit-icon",
154
				this.getClass().getClassLoader().getResource(
155
						"images/camera_edit.png"));
156

  
157
	}
158

  
159
	public void initialize() {
160

  
161
		// Registering TOC actions
162
		ExtensionPoints extensionPoints = ExtensionPointsSingleton
163
				.getInstance();
164
		extensionPoints.add("View_TocActions", "Generar animacion temporal",
165
				new TocAnimationDate());
166
	}
167

  
168
	public boolean isEnabled() {
169
		return true;
170
	}
171

  
172
	public boolean isVisible() {
173

  
174
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
175
				.getMDIManager().getActiveWindow();
176

  
177
		if (f == null) {
178
			return false;
179
		}
180

  
181
		// Only isVisible = true, where the view3D have layers
182
		if (f instanceof BaseView) {
183
			return true;
184
		}
185
		return false;
186
	}
187

  
188
}
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/util/AnimationUtils.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
 * @author ?ngel Fraile Gri??n  e-mail: angel.fraile@iver.es
23
 * @since 1.1
24
 * 
25
 */
26

  
27
package com.iver.ai2.animationgui.gui.util;
28

  
29
import java.util.ArrayList;
30
import java.util.Iterator;
31
import java.util.List;
32

  
33
import org.gvsig.gvsig3dgui.view.View3D;
34
import org.gvsig.osgvp.planets.Planet;
35
import org.gvsig.osgvp.viewer.Camera;
36

  
37
import com.iver.ai2.animationgui.gui.document.ProjectAnimationDocument;
38
import com.iver.ai2.animationgui.gui.document.ProjectAnimationDocumentFactory;
39
import com.iver.ai2.gvsig3d.camera.ProjectCamera;
40
import com.iver.andami.PluginServices;
41
import com.iver.andami.plugins.IExtension;
42
import com.iver.cit.gvsig.ProjectExtension;
43
import com.iver.cit.gvsig.animation.AnimationContainer;
44
import com.iver.cit.gvsig.animation.IAnimationType;
45
import com.iver.cit.gvsig.animation.animatedObject.AnimatedObjectBase;
46
import com.iver.cit.gvsig.animation.animatedObject.AnimationObject2D;
47
import com.iver.cit.gvsig.animation.animatedObject.AnimationObject3DFlat;
48
import com.iver.cit.gvsig.animation.animatedObject.IAnimatedObject;
49
import com.iver.cit.gvsig.animation.interval.AnimationKeyFrameInterval;
50
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
51
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory;
52
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
53
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
54
import com.iver.cit.gvsig.animation.keyframe.interpolator.InterpolatorFactory;
55
import com.iver.cit.gvsig.animation.traks.AnimationTimeTrack;
56
import com.iver.cit.gvsig.animation.traks.IAnimationTrack;
57
import com.iver.cit.gvsig.fmap.MapContext;
58
import com.iver.cit.gvsig.fmap.MapControl;
59
import com.iver.cit.gvsig.fmap.layers.FLayer;
60
import com.iver.cit.gvsig.fmap.layers.FLayers;
61
import com.iver.cit.gvsig.project.Project;
62
import com.iver.cit.gvsig.project.ProjectExtent;
63
import com.iver.cit.gvsig.project.ProjectFactory;
64
import com.iver.cit.gvsig.project.documents.ProjectDocument;
65
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory;
66
import com.iver.cit.gvsig.project.documents.view.IProjectView;
67
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
68
import com.iver.cit.gvsig.project.documents.view.gui.View;
69
import com.iver.utiles.extensionPoints.ExtensionPoint;
70
import com.iver.utiles.extensionPoints.ExtensionPoints;
71
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
72

  
73
public class AnimationUtils {
74

  
75
	private static String AnimationPrefix = "Animation-";
76
	private static int cont2D = 0;
77
	private static int cont3D = 0;
78
	private static Project project;
79

  
80
	static {
81
		IExtension extension = PluginServices
82
				.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
83
		ProjectExtension pe = (ProjectExtension) extension;
84
		project = pe.getProject();
85
	}
86

  
87
	
88
	/**
89
	 * Default function in movement animations 2D and 3D
90
	 * 
91
	 * @param view: Actual view selected
92
	 * @param ac: Animation container
93
	 * @param prefix: Part of the tracks animation names 
94
	 */
95
	public static void captureEncuadrator(BaseView view, AnimationContainer ac,
96
			String prefix) {
97
		// snapshot pressed.
98
		System.out.println("pulsado boton de capturar encuadres!!!");
99

  
100
		// If the window instance is View, it will manage extends 2D
101
		if (view instanceof View) {
102
			AnimationUtils.captureEncuadrator2D((View) view, ac, prefix);
103
		}
104
		else
105
			if (view instanceof BaseView) {
106
				AnimationUtils.captureEncuadrator3D((View3D) view, ac, prefix);
107
			}
108
		
109

  
110
		System.out.println(ac);
111

  
112
	}
113
	
114
	/**
115
	 * Creating a animation 2D track based in time.
116
	 * 
117
	 * @param view: Actual view selected
118
	 * @param ac: Animation container
119
	 * @param prefix: Part of the tracks animation names 
120
	 */
121

  
122
	public static void captureEncuadrator2D(View view, AnimationContainer ac,
123
			String prefix) {
124

  
125
		AnimationTimeTrack animationTimeTrack = null;
126
		AnimationKeyFrameInterval AKFinterval = null;
127
		List<IKeyFrame> keyFrameList = null;
128

  
129
		String baseName = prefix + "-" + view.getWindowInfo().getTitle() + "-"
130
				+ AnimationPrefix;
131
		String name = baseName + cont2D++;
132

  
133
		// Getting the animation extension point.
134
		ExtensionPoints extensionPoints = ExtensionPointsSingleton
135
				.getInstance();
136
		ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
137
				.get("Animation"));
138

  
139
		// Creating new track
140
		animationTimeTrack = AnimationUtils.getAnimationTimeTrack(baseName
141
				+ "-encuadrator_track_2D", ac, view);
142
		// Creating the interval
143
		List intervalList = animationTimeTrack.getIntervalList();
144
		
145
		if (intervalList != null) {
146
			for (Iterator<AnimationKeyFrameInterval> iterator = intervalList.iterator(); iterator
147
					.hasNext();) {
148
				AnimationKeyFrameInterval animationKeyFrameInterval = iterator.next();
149
				if (animationKeyFrameInterval != null) {
150
					AKFinterval = animationKeyFrameInterval;
151
				}
152
			}
153
			if (intervalList.size() == 0) {
154
				AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack
155
						.createKeyFrameInterval();
156
				// Setting up interval properties.
157
				AKFinterval.setInitialTime(0.0);
158
				AKFinterval.setEndTime(1.0);
159
			}
160
		}
161
		
162
		
163

  
164
		// Getting the current extend and adding to project extends.
165
		MapControl mapa = view.getMapControl();
166
		ProjectExtent extent = ProjectFactory.createExtent();
167
		extent.setDescription(name);
168
		extent.setExtent(mapa.getViewPort().getExtent());
169
		project.addExtent(extent);
170

  
171
		// Creating the keyframe list.
172
		ProjectExtent[] extentsList = project.getExtents();
173
		keyFrameList = new ArrayList<IKeyFrame>();
174
		for (int i = 0; i < extentsList.length; i++) {
175
			ProjectExtent projectExtent = extentsList[i];
176
			if (projectExtent.getDescription().contains(baseName)) {
177
				IKeyFrame kf2D = null;
178
				try {
179
					kf2D = (IKeyFrame) extPoint.create("KeyFrame2D");
180
				} catch (InstantiationException e) {
181
					e.printStackTrace();
182
				} catch (IllegalAccessException e) {
183
					e.printStackTrace();
184
				}
185

  
186
				// Setting up the initial and end time interval.
187
				double fin = AKFinterval.getEndTime();
188
				double ini = AKFinterval.getInitialTime();
189
				double size = extentsList.length;
190
				// Calculating the insertion time.
191
				double tiempo = 0.0;
192
				if (i != 0)
193
					tiempo = i * ((fin - ini) / (size - 1.0));
194
				kf2D.setTime(tiempo);
195
				// hacer funcion de insercion o adapter
196
				kf2D.setAnimatedObject(projectExtent);
197
				kf2D.CapturesProperties();
198
				keyFrameList.add(kf2D);
199
			}
200
		}
201
		AKFinterval.setKeyFrameList(keyFrameList);
202
	}
203

  
204
	public static Project getProject() {
205
		return project;
206
	}
207
	
208
	
209
	public static String getAnimationPrefix() {
210
		return AnimationPrefix;
211
	}
212

  
213
	
214
	/**
215
	 * Creating a animation 3D track based in time.
216
	 * 
217
	 * @param view: Actual view selected
218
	 * @param ac: Animation container
219
	 * @param prefix: Part of the tracks animation names 
220
	 */
221
	public static void captureEncuadrator3D(View3D view, AnimationContainer ac,
222
			String prefix) {
223
		AnimationTimeTrack animationTimeTrack = null;
224
		AnimationKeyFrameInterval AKFinterval = null;
225
		List<IKeyFrame> keyFrameList = null;
226

  
227
		String baseName = prefix + "-" + view.getWindowInfo().getTitle() + "-"
228
				+ AnimationPrefix;
229
		String name = baseName + cont3D++;
230

  
231
		// Getting the animation extension point.
232
		ExtensionPoints extensionPoints = ExtensionPointsSingleton
233
				.getInstance();
234
		ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
235
				.get("Animation"));
236

  
237
		// Creating new track
238
		animationTimeTrack = AnimationUtils.getAnimationTimeTrack(baseName
239
				+ "-encuadrator_track_3D", ac, view);
240

  
241
		// Creating the interval
242
		List intervalList = animationTimeTrack
243
				.getIntervalList();
244
		if (intervalList != null) {
245
			for (Iterator iterator = intervalList.iterator(); iterator
246
					.hasNext();) {
247
				AnimationKeyFrameInterval animationKeyFrameInterval = (AnimationKeyFrameInterval) iterator
248
						.next();
249
				if (animationKeyFrameInterval != null) {
250
					AKFinterval = animationKeyFrameInterval;
251
				}
252
			}
253
			if (intervalList.size() == 0) {
254
				AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack
255
						.createKeyFrameInterval();
256
				// Setting up interval properties.
257
				AKFinterval.setInitialTime(0.0);
258
				AKFinterval.setEndTime(1.0);
259
			}
260
		}
261
		// Getting the current camera position and insert it into project camera list.
262
		Camera ca = view.getCamera();
263
		ProjectCamera camera = new ProjectCamera();
264
		camera.setDescription(name);
265
		camera.setCamera(ca);
266
		project.addCamera(camera);
267

  
268
		List<ProjectCamera> extentsList = filterExtendsList(baseName, project);
269
		keyFrameList = new ArrayList<IKeyFrame>();
270
		for (int i = 0; i < extentsList.size(); i++) {
271
			ProjectCamera projectCamera = (ProjectCamera) extentsList.get(i);
272
			IKeyFrame kf3D = null;
273
			try {
274
				kf3D = (IKeyFrame) extPoint.create("KeyFrame3DFlat");
275
			} catch (InstantiationException e) {
276
				e.printStackTrace();
277
			} catch (IllegalAccessException e) {
278
				e.printStackTrace();
279
			}
280

  
281
			// Setting up the initial and end time interval.
282
			double fin = AKFinterval.getEndTime();
283
			double ini = AKFinterval.getInitialTime();
284
			double size = extentsList.size();
285
			// Calculating the correct time for this key frame.
286
			double tiempo = 0.0;
287
			if (i != 0)
288
				tiempo = i * ((fin - ini) / (size - 1.0));
289
			// Setting the time.
290
			kf3D.setTime(tiempo);
291
			// hacer funcion de insercion o adapter
292
			kf3D.setAnimatedObject(projectCamera);
293
			kf3D.CapturesProperties();
294
			keyFrameList.add(kf3D);
295
		}
296
		AKFinterval.setKeyFrameList(keyFrameList);
297

  
298
	}
299

  
300
	private static List<ProjectCamera> filterExtendsList(String baseName,
301
			Project project2) {
302
		List<ProjectCamera> extendsList = null;
303
		Object[] extentsList = project2.getCameras();
304
		for (int i = 0; i < extentsList.length; i++) {
305
			ProjectCamera projectCamera = (ProjectCamera) extentsList[i];
306
			if (projectCamera.getDescription().contains(baseName)) {
307
				if (extendsList == null)
308
					extendsList = new ArrayList<ProjectCamera>();
309
				extendsList.add(projectCamera);
310
			}
311
		}
312
		return extendsList;
313
	}
314

  
315
	private static AnimationTimeTrack getAnimationTimeTrack(String name,
316
			AnimationContainer ac, BaseView view) {
317

  
318
		AnimationTimeTrack att = null;
319
		if (view instanceof View) {
320
			att = AnimationUtils.getAnimationTimeTrackForView(name, ac,
321
					(View) view);
322
		}
323

  
324
		if (view instanceof View3D) {
325
			att = AnimationUtils.getAnimationTimeTrackForView3D(name, ac,
326
					(View3D) view);
327
		}
328
		return att;
329
	}
330

  
331
	private static AnimationTimeTrack getAnimationTimeTrackForView(String name,
332
			AnimationContainer ac, View view) {
333

  
334
		AnimationTimeTrack at = null;
335
		IAnimationTrack aa = ac.findTrack(name);
336
		if (aa == null) {
337

  
338
			// Getting the extension point.
339
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
340
					.getInstance();
341
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
342
					.get("Animation"));
343

  
344
			IAnimationType animationLayer2D = null;
345
			try {
346
				animationLayer2D = (IAnimationType) extPoint
347
						.create("AnimationLayer2D");
348
			} catch (InstantiationException e) {
349
				// TODO Auto-generated catch block
350
				e.printStackTrace();
351
			} catch (IllegalAccessException e) {
352
				// TODO Auto-generated catch block
353
				e.printStackTrace();
354
			}
355
			// Setting up the track properties
356
			at = (AnimationTimeTrack) ac.CreateTimeTrack(animationLayer2D);
357
			at.setName(name);
358
			at.setEnable(true);
359
			// Setting up the animated object
360
			// Creating the object 2D
361
			AnimatedObjectBase object2D = new AnimationObject2D();
362

  
363
			// Getting the interpolator
364
			IInterpolator inter2D = InterpolatorFactory
365
					.createObject("Interpolator2D");
366
			((AnimationObject2D)object2D).setAnimatedView(view);
367
			
368
			// Getting the interpolator funcion
369
			IInterpolatorTimeFuntion funtion = FuntionFactory
370
					.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
371
			inter2D.setFuntion(funtion);
372

  
373
			animationLayer2D.setInterpolator(inter2D);
374
			at.setAnimationType(animationLayer2D);
375
			animationLayer2D.setAnimatedObject(object2D);
376
			
377
			at.setAnimatedObject(object2D);
378
		} else {
379
			at = (AnimationTimeTrack) aa;
380
		}
381

  
382
		return at;
383

  
384
	}
385

  
386
	private static AnimationTimeTrack getAnimationTimeTrackForView3D(
387
			String name, AnimationContainer ac, View3D view) {
388

  
389
		AnimationTimeTrack at = null;
390
		IAnimationTrack aa = ac.findTrack(name);
391
		if (aa == null) {
392

  
393
			// Getting the extension point.
394
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
395
					.getInstance();
396
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
397
					.get("Animation"));
398

  
399
			IAnimationType animationLayer3DFlat = null;
400
			try {
401
				animationLayer3DFlat = (IAnimationType) extPoint
402
						.create("AnimationLayer3DFlat");
403
			} catch (InstantiationException e) {
404
				// TODO Auto-generated catch block
405
				e.printStackTrace();
406
			} catch (IllegalAccessException e) {
407
				e.printStackTrace();
408
			}
409
			at = (AnimationTimeTrack) ac.CreateTimeTrack(animationLayer3DFlat);
410

  
411
			at.setName(name);
412
			at.setEnable(true);
413

  
414
			AnimatedObjectBase object3D = new AnimationObject3DFlat();
415
			((AnimationObject3DFlat)object3D).setAnimatedCanvas3D(view.getCanvas3d());
416
			((AnimationObject3DFlat)object3D).setAnimatedView(view);
417
			
418
			at.setAnimatedObject(object3D);
419

  
420
			/** ******************************************************************* */
421
			IInterpolator interpolator3D = null;
422
			if (view.getPlanet().getCoordinateSystemType() == Planet.CoordinateSystemType.PROJECTED) {
423
				interpolator3D = InterpolatorFactory
424
						.createObject("Interpolator3DFlat");
425
			} else if (view.getPlanet().getCoordinateSystemType() == Planet.CoordinateSystemType.GEOCENTRIC) {
426
				interpolator3D = InterpolatorFactory
427
						.createObject("Interpolator3DSpherical");
428
			}
429

  
430
			IInterpolatorTimeFuntion funtion = FuntionFactory
431
					.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
432
			interpolator3D.setFuntion(funtion);
433
			animationLayer3DFlat.setInterpolator(interpolator3D);
434
			at.setAnimationType(animationLayer3DFlat);
435
			
436
			animationLayer3DFlat.setAnimatedObject(object3D);
437

  
438
			/** ********************************************************************* */
439
			/*******************************************************************
440
			 * old code * IInterpolator inter3DFlat = InterpolatorFactory
441
			 * .createObject("Interpolator3DFlat"); IInterpolatorTimeFuntion
442
			 * funtion = FuntionFactory
443
			 * .createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
444
			 * inter3DFlat.setFuntion(funtion);
445
			 * animationLayer3DFlat.setInterpolator(inter3DFlat);
446
			 * at.setAnimationType(animationLayer3DFlat);
447
			 * animationLayer3DFlat.setAnimatedObject(object3D); /
448
			 ******************************************************************/
449
		} else {
450
			at = (AnimationTimeTrack) aa;
451
		}
452
		return at;
453

  
454
	}
455

  
456
	/**
457
	 * Return a new animation document or the document where the view viewName is included
458
	 * 
459
	 * @param viewName
460
	 * @param project
461
	 * @return a new or actual animation document
462
	 */
463
	public static ProjectAnimationDocument createAnimationDocument(
464
			String viewName, Project project) {
465
		ProjectAnimationDocument pv = null;
466
		ArrayList<ProjectDocument> projectList = project
467
				.getDocumentsByType(ProjectAnimationDocumentFactory.registerName);
468
		Iterator<ProjectDocument> it = projectList.iterator();
469
		while (it.hasNext()) {
470
			ProjectDocument projectDocument = (ProjectDocument) it.next();
471
			if (viewName.equals(projectDocument.getName())) {
472
				pv = (ProjectAnimationDocument) projectDocument;
473
			}
474

  
475
		}
476
		if (pv == null) {
477
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
478
					.getInstance();
479
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
480
					.get("Documents"));
481
			ProjectDocumentFactory pdf = null;
482
			try {
483
				pdf = (ProjectDocumentFactory) extPoint
484
						.create(ProjectAnimationDocumentFactory.registerName);
485
			} catch (InstantiationException e) {
486
				e.printStackTrace();
487
			} catch (IllegalAccessException e) {
488
				e.printStackTrace();
489
			}
490
			pv = (ProjectAnimationDocument) pdf.create((Project) null);
491
			pv.setProjectDocumentFactory(pdf);
492
			pv.setName(viewName);
493
		}
494
		return pv;
495
	}
496

  
497
	/**
498
	 * Return the document indicated with the parameter name
499
	 * 
500
	 * @param name
501
	 * @param project
502
	 * @return
503
	 */
504
	public static ProjectAnimationDocument getProjectDocument(String name,
505
			Project project) {
506
		ProjectAnimationDocument pv = null;
507
		ArrayList<ProjectDocument> projectList = project
508
				.getDocumentsByType(ProjectAnimationDocumentFactory.registerName);
509
		Iterator<ProjectDocument> it = projectList.iterator();
510
		while (it.hasNext()) {
511
			ProjectDocument projectDocument = (ProjectDocument) it.next();
512
			if (name.equals(projectDocument.getName())) {
513
				pv = (ProjectAnimationDocument) projectDocument;
514
			}
515

  
516
		}
517
		return pv;
518
	}
519

  
520
	public static boolean exitsProject(String name, Project project) {
521
		boolean pv = false;
522
		ArrayList<ProjectDocument> projectList = project
523
				.getDocumentsByType(ProjectAnimationDocumentFactory.registerName);
524
		Iterator<ProjectDocument> it = projectList.iterator();
525
		while (it.hasNext()) {
526
			ProjectDocument projectDocument = (ProjectDocument) it.next();
527
			if (name.equals(projectDocument.getName())) {
528
				pv = true;
529
			}
530

  
531
		}
532
		return pv;
533
	}
534

  
535
	/**
536
	 * 
537
	 * @param name :
538
	 *            Track name.
539
	 * @param ac: animation container.
540
	 * @param object: animated object
541
	 * @return at : Return an animation track based in time.
542
	 * 
543
	 * Creating a animation track based in time.
544
	 */
545
	public static AnimationTimeTrack getAnimationTimeTrackTransparency(
546
			String name, AnimationContainer ac, BaseView view,
547
			IAnimatedObject object) {
548

  
549
		AnimationTimeTrack at = null;// this.animationTimeTrack;
550

  
551
		IAnimationTrack animationTrack = ac.findTrack(name);
552
		if (animationTrack == null) {
553

  
554
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
555
					.getInstance();
556
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
557
					.get("Animation"));
558

  
559
			IAnimationType animTransp = null;
560
			try {
561
				System.out.println(extPoint.getDescription());
562

  
563
				// Instancing my new animation based in transparency.
564
				animTransp = (IAnimationType) extPoint
565
						.create("AnimationTransparency");
566
			} catch (InstantiationException e) {
567
				e.printStackTrace();
568
			} catch (IllegalAccessException e) {
569
				e.printStackTrace();
570
			}
571

  
572
			at = (AnimationTimeTrack) ac.CreateTimeTrack(animTransp);
573
			at.setName(name);
574

  
575
			// Saving the view( in this case a BaseView).
576

  
577
			object.addAnimatedObject("view", view);
578

  
579
			at.setAnimatedObject(object);
580
			animTransp.setAnimatedObject(object);
581
			// My interpolator based in time and transparency.
582
			IInterpolator interTransparency = InterpolatorFactory
583
					.createObject("InterpolatorTransparency");
584
			animTransp.setInterpolator(interTransparency);
585
			at.setAnimationType(animTransp);
586
		} else {
587
			at = (AnimationTimeTrack) animationTrack;
588
		}
589
		return at;
590
	}
591
	
592
	/**
593
	 * Creating a transparency animation common 2D and 3D 
594
	 * @param window
595
	 * @param ac
596
	 * @param prefix
597
	 */
598
	
599
	public static void createLayerTransparencyAnimation(BaseView window,
600
			AnimationContainer ac, String prefix) {
601
		System.out.println("pulsado boton transparencias !!!");
602

  
603
		AnimationTimeTrack animationTimeTrack = null;
604
		AnimationKeyFrameInterval AKFinterval = null;
605
		List<IKeyFrame> keyFrameList = null;
606
		AnimatedObjectBase object = new AnimatedObjectBase();
607
		// Getting the animation extension point
608
		ExtensionPoints extensionPoints = ExtensionPointsSingleton
609
				.getInstance();
610
		ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
611
				.get("Animation"));
612

  
613
		// List of keyframes.
614
		// If the window is instance of View
615
		if (window instanceof BaseView) {
616

  
617
			BaseView view = (BaseView) window;
618

  
619
			// Generating the list of keyframes
620
			// keyFrameList = new ArrayList();
621
			IProjectView model = view.getModel();
622
			MapContext mapContext = model.getMapContext();
623
			FLayers layers = mapContext.getLayers();
624
			FLayer[] actives = layers.getActives();
625

  
626
			double fin = 1;// AKFinterval.getEndTime();
627
			double ini = 0;// AKFinterval.getInitialTime();
628
			double tiempo = 0.0;
629
			int size = actives.length;
630
			double incremento = ((fin - ini) / (size));
631
			for (int i = size - 1; i >= 0; i--) {// order in TOC.
632

  
633
				animationTimeTrack = null;
634
				animationTimeTrack = AnimationUtils
635
						.getAnimationTimeTrackTransparency("Track_layer_" + i,
636
								ac, view, object);
637
				animationTimeTrack.setEnable(true);
638
				object.addAnimatedObject("layer", actives[i]);
639

  
640
				// Generating the interval.
641
				AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack
642
						.createKeyFrameInterval();
643
				AKFinterval.setInitialTime(0.0);
644
				AKFinterval.setEndTime(1.0);
645

  
646
				keyFrameList = new ArrayList<IKeyFrame>();
647
				IKeyFrame kfTransAux = null;
648
				IKeyFrame kfTransIni = null;
649
				IKeyFrame kfTransFin = null;
650
				try {
651
					kfTransAux = (IKeyFrame) extPoint
652
							.create("KeyFrameTransparency");
653
					kfTransIni = (IKeyFrame) extPoint
654
							.create("KeyFrameTransparency");
655
					kfTransFin = (IKeyFrame) extPoint
656
							.create("KeyFrameTransparency");
657
				} catch (InstantiationException e1) {
658
					e1.printStackTrace();
659
				} catch (IllegalAccessException e1) {
660
					e1.printStackTrace();
661
				}
662
				// Calculating the time insertion.
663
				if (i == size - 1) // the keyframe is the first in the list.
664
					tiempo = ini + 0.001;
665

  
666
				// Three keyframes by track.
667
				// Keyframe 1 of the layer i.
668
				kfTransAux.setName("KF1_layer_" + i);// name of keyframe.
669
				kfTransAux.setTime(ini); // initial time interval.
670
				kfTransAux.setAnimatedObject(actives[i]);// set the object to
671
				// animate(a layer).
672
				kfTransAux.CapturesProperties(); // capturing actual
673
				// transparency.
674
				keyFrameList.add(kfTransAux); // adding in the list.
675

  
676
				// keyframe 2 of the layer i.
677
				kfTransIni.setName("KF2_layer_" + i);// name of keyframe.
678
				kfTransIni.setTime(tiempo); // initial time interval.
679
				kfTransIni.setAnimatedObject(actives[i]);// set the same
680
				// layer in the
681
				// second keyframe.
682
				kfTransIni.CapturesProperties(); // capturing actual
683
				// transparency.
684
				keyFrameList.add(kfTransIni); // adding in the list.
685

  
686
				// keyframe 3 of the layer i.
687
				try {
688
					if (i == 0) // the keyframe is the last in the list.
689
						tiempo = fin;
690
					else
691
						tiempo += incremento;
692

  
693
					kfTransFin.setName("KF3_layer_" + i);// name of keyframe.
694
					kfTransFin.setTime(tiempo);// saving final time interval.
695
					// kfTransFin.setLevelTransparency(0);// interpolation:
696
					// layer transparency in
697
					// the moment to 0.
698
					kfTransFin.setAnimatedObject(actives[i]); // save the same
699
					// layer in the
700
					// third
701
					// keyframe
702
					keyFrameList.add(kfTransFin);// adding to the list.
703
				} catch (Exception e) {
704
					// TODO Auto-generated catch block
705
					e.printStackTrace();
706
				}
707
				AKFinterval.setKeyFrameList(keyFrameList);// Adding the list
708
				// of keyframes to
709
				// the interval.
710

  
711
			}
712
		}
713
	}
714

  
715
}
tags/gvSIG_3D_Animation_1_0_SNAPSHOT_build_10/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/MenuAnimationTransparency.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.ai2.animationgui.gui;
21

  
22
import com.iver.ai2.animationgui.gui.document.ProjectAnimationDocument;
23
import com.iver.ai2.animationgui.gui.util.AnimationUtils;
24
import com.iver.andami.PluginServices;
25
import com.iver.andami.plugins.Extension;
26
import com.iver.andami.plugins.IExtension;
27
import com.iver.andami.ui.mdiManager.IWindow;
28
import com.iver.cit.gvsig.ProjectExtension;
29
import com.iver.cit.gvsig.animation.AnimationContainer;
30
import com.iver.cit.gvsig.animation.IAnimationType;
31
import com.iver.cit.gvsig.animation.animatedObject.AnimatedObjectBase;
32
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
33
import com.iver.cit.gvsig.animation.keyframe.interpolator.InterpolatorFactory;
34
import com.iver.cit.gvsig.animation.traks.AnimationTimeTrack;
35
import com.iver.cit.gvsig.animation.traks.IAnimationTrack;
36
import com.iver.cit.gvsig.fmap.MapContext;
37
import com.iver.cit.gvsig.fmap.layers.FLayer;
38
import com.iver.cit.gvsig.fmap.layers.FLayers;
39
import com.iver.cit.gvsig.project.Project;
40
import com.iver.cit.gvsig.project.documents.view.IProjectView;
41
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
42
import com.iver.utiles.extensionPoints.ExtensionPoint;
43
import com.iver.utiles.extensionPoints.ExtensionPoints;
44
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
45

  
46
/**
47
 * @author ?ngel
48
 * @since 1.1
49
 * 
50
 * Menu of animation transparency toolbar's options.
51
 */
52

  
53
public class MenuAnimationTransparency extends Extension {
54

  
55
	private Project project;
56

  
57
	// private AnimationContainer ac = null;
58
	private AnimationTimeTrack animationTimeTrack = null;
59
	private AnimatedObjectBase object = new AnimatedObjectBase();
60

  
61
	// It is the project Document create to create a fast animation.
62
	private ProjectAnimationDocument pad;
63

  
64
	public void execute(String actionCommand) {
65

  
66
		AnimationContainer ac;
67
		// if the button pressed is "this"
68
		if (actionCommand.equals("CREARANIMTRANSP")) {
69

  
70
			String prefix = "Default-animation-document";
71
			// if there is not create the default animation. we will create it.
72
			pad = AnimationUtils.createAnimationDocument(prefix, project);
73
			if (!AnimationUtils.exitsProject(prefix, project)){
74
				project.addDocument(pad);
75
			}
76

  
77
			// Getting the active windows
78
			IWindow window = PluginServices.getMDIManager().getActiveWindow();
79

  
80
			// Getting the animation container
81
			ac = pad.getAnimationContainer();
82
			// Generating the animation transparency
83
			AnimationUtils.createLayerTransparencyAnimation((BaseView) window,
84
					ac, prefix);
85

  
86
			// Menu Player.
87
			// AnimationPlayer ap = ac.getAnimationPlayer();
88
			// ap.setAnimationContainer(ac);
89
			// AnimationContol3D fp = new AnimationContol3D(ap);
90
			// PluginServices.getMDIManager().addWindow((IWindow) fp);
91
		}
92

  
93
		// System.out.println("pulsado boton transparencias !!!");
94
		//			
95
		// // Getting the active windows
96
		// IWindow window = PluginServices.getMDIManager().getActiveWindow();
97
		//			
98
		// // Getting the animation container
99
		// ac = this.getAnimationContainer();
100
		//			
101
		//			
102
		// // Getting the animation extension point
103
		// ExtensionPoints extensionPoints =
104
		// ExtensionPointsSingleton.getInstance();
105
		// ExtensionPoint extPoint = ((ExtensionPoint)
106
		// extensionPoints.get("Animation"));
107
		//			
108
		//			
109
		// //List of keyframes.
110
		// // If the window is instance of View
111
		// if (window instanceof BaseView) {
112
		//
113
		// BaseView view = (BaseView) window;
114
		//
115
		// // Generating the list of keyframes
116
		// //keyFrameList = new ArrayList();
117
		// IProjectView model = view.getModel();
118
		// MapContext mapContext = model.getMapContext();
119
		// FLayers layers = mapContext.getLayers();
120
		// FLayer[] actives = layers.getActives();
121
		//				
122
		// double fin = 1;//AKFinterval.getEndTime();
123
		// double ini = 0;//AKFinterval.getInitialTime();
124
		// double tiempo = 0.0;
125
		// int size = actives.length;
126
		// double incremento = ((fin - ini) / (size));
127
		// for(int i = size-1; i >= 0; i--){// order in TOC.
128
		//					
129
		// animationTimeTrack = null;
130
		// animationTimeTrack =
131
		// AnimationUtils.getAnimationTimeTrackTransparency("Track_layer_" + i,
132
		// ac);
133
		// animationTimeTrack.setEnabale(true);
134
		// object.addAnimatedObject("layer",actives[i]);
135
		//					
136
		//					
137
		// // Generating the interval.
138
		// AKFinterval = (AnimationKeyFrameInterval) animationTimeTrack
139
		// .createKeyFrameInterval();
140
		// AKFinterval.setInitialTime(0.0);
141
		// AKFinterval.setEndTime(1.0);
142
		//					
143
		// keyFrameList = new ArrayList<IKeyFrame>();
144
		// // KeyFrameTransparency kfTransAux = new KeyFrameTransparency();
145
		// IKeyFrame kfTransAux = null;
146
		// IKeyFrame kfTransIni = null;
147
		// IKeyFrame kfTransFin = null;
148
		// try {
149
		// kfTransAux = (IKeyFrame)extPoint.create("KeyFrameTransparency");
150
		// kfTransIni = (IKeyFrame)extPoint.create("KeyFrameTransparency");
151
		// kfTransFin = (IKeyFrame)extPoint.create("KeyFrameTransparency");
152
		// }
153
		// catch (InstantiationException e1) {
154
		// e1.printStackTrace();
155
		// } catch (IllegalAccessException e1) {
156
		// e1.printStackTrace();
157
		// }
158
		// //Calculating the time insertion.
159
		// if (i == size-1) // the keyframe is the first in the list.
160
		// tiempo = ini + 0.001;
161
		//					
162
		// //Three keyframes by track.
163
		// //Keyframe 1 of the layer i.
164
		// kfTransAux.setName("KF1_layer_" + i);//name of keyframe.
165
		// kfTransAux.setTime(ini); // initial time interval.
166
		// kfTransAux.setAnimatedObject(actives[i]);//set the object to
167
		// animate(a layer).
168
		// //kfTransAux.setLevelTransparency(255);
169
		// kfTransAux.CapturesProperties(); //capturing actual transparency.
170
		// keyFrameList.add(kfTransAux); // adding in the list.
171
		//					
172
		// //keyframe 2 of the layer i.
173
		// kfTransIni.setName("KF2_layer_" + i);//name of keyframe.
174
		// kfTransIni.setTime(tiempo); // initial time interval.
175
		// kfTransIni.setAnimatedObject(actives[i]);//set the same layer in the
176
		// second keyframe.
177
		// kfTransIni.CapturesProperties(); //capturing actual transparency.
178
		// keyFrameList.add(kfTransIni); // adding in the list.
179
		//					
180
		// //keyframe 3 of the layer i.
181
		// try {
182
		// if(i == 0) // the keyframe is the last in the list.
183
		// tiempo = fin;
184
		// else
185
		// tiempo += incremento;
186
		//						
187
		// kfTransFin.setName("KF3_layer_" + i);//name of keyframe.
188
		// kfTransFin.setTime(tiempo);// saving final time interval.
189
		// // kfTransFin.setLevelTransparency(0);// interpolation: layer
190
		// transparency in the moment to 0.
191
		// kfTransFin.setAnimatedObject(actives[i]); //save the same layer in
192
		// the third keyframe
193
		// keyFrameList.add(kfTransFin);//adding to the list.
194
		// } catch (Exception e) {
195
		// // TODO Auto-generated catch block
196
		// e.printStackTrace();
197
		// }
198
		// AKFinterval.setKeyFrameList(keyFrameList);// Adding the list of
199
		// keyframes to the interval.
200
		//					
201
		// }
202
		// }
203
		// }
204

  
205
	}
206

  
207
	public void postInitialize() {
208
		// Getting the project using plugin services.
209
		IExtension extension = PluginServices
210
				.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
211
		ProjectExtension pe = (ProjectExtension) extension;
212
		project = pe.getProject();
213

  
214
		PluginServices.getIconTheme().registerDefault(
215
				"transparency-icon",
216
				this.getClass().getClassLoader().getResource(
217
						"images/trans6.png"));
218
	}
219

  
220
	public void initialize() {
221
		// TODO Auto-generated method stub
222
	}
223

  
224
	
225
	/**
226
	 * 
227
	 * @param name :
228
	 *            Track name.
229
	 * @param ac :
230
	 *            animation container.
231
	 * @return at : Return a animation track based in time.
232
	 * 
233
	 * Creating a animation track based in time.
234
	 */
235
	private AnimationTimeTrack getAnimationTimeTrack_DELETED(String name,
236
			AnimationContainer ac) {
237

  
238
		AnimationTimeTrack at = this.animationTimeTrack;
239

  
240
		IAnimationTrack animationTrack = ac.findTrack(name);
241
		if (animationTrack == null) {
242

  
243
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
244
					.getInstance();
245
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
246
					.get("Animation"));
247
			com.iver.andami.ui.mdiManager.IWindow f = PluginServices // window
248
																		// active.
249
					.getMDIManager().getActiveWindow();
250

  
251
			if (f instanceof BaseView) {
252
				IAnimationType animTransp = null;
253
				try {
254
					System.out.println(extPoint.getDescription());
255

  
256
					// Instancing my new animation based in transparency.
257
					animTransp = (IAnimationType) extPoint
258
							.create("AnimationTransparency");
259
				} catch (InstantiationException e) {
260
					e.printStackTrace();
261
				} catch (IllegalAccessException e) {
262
					e.printStackTrace();
263
				}
264

  
265
				at = (AnimationTimeTrack) ac.CreateTimeTrack(animTransp);
266
				at.setName(name);
267

  
268
				// Saving the view( in this case a BaseView).
269
				BaseView view = (BaseView) f;
270

  
271
				object.addAnimatedObject("view", view);
272

  
273
				at.setAnimatedObject(object);
274
				animTransp.setAnimatedObject(object);
275
				// My interpolator based in time and transparency.
276
				IInterpolator interTransparency = InterpolatorFactory
277
						.createObject("InterpolatorTransparency");
278
				animTransp.setInterpolator(interTransparency);
279
				at.setAnimationType(animTransp);
280
			}
281
		}
282
		return at;
283
	}
284

  
285
	/**
286
	 * @see com.iver.andami.plugins.IExtension#isVisible() Options to see the
287
	 *      button in the tool bar. View: must be a base view. One or more
288
	 *      layers in the view.
289
	 */
290
	public boolean isVisible() {
291
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
292
				.getMDIManager().getActiveWindow();
293

  
294
		if (f == null) {
295
			return false;
296
		}
297

  
298
		// Only isVisible = true, where the view have layers.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff