Revision 32154

View differences:

tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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_9_SNAPSHOT_build_12/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.terrain.Terrain;
36
import org.gvsig.osgvp.viewer.Camera;
37

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

  
74
public class AnimationUtils {
75

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

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

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

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

  
111
		System.out.println(ac);
112

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  
299
	}
300

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

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

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

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

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

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

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

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

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

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

  
383
		return at;
384

  
385
	}
386

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

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

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

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

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

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

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

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

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

  
455
	}
456

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

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

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

  
517
		}
518
		return pv;
519
	}
520

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

  
532
		}
533
		return pv;
534
	}
535

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

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

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

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

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

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

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

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

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

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

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

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

  
618
			BaseView view = (BaseView) window;
619

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

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

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

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

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

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

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

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

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

  
712
			}
713
		}
714
	}
715

  
716
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_12/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

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff