Revision 32257

View differences:

tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/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_13/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_13/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_13/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_13/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_13/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/AnimationContol3D.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
package com.iver.ai2.animationgui.gui;
20

  
21
import java.awt.Checkbox;
22
import java.awt.GridBagConstraints;
23
import java.awt.Insets;
24
import java.awt.event.ActionEvent;
25
import java.awt.event.ActionListener;
26
import java.awt.event.FocusEvent;
27
import java.awt.event.FocusListener;
28
import java.awt.event.ItemEvent;
29
import java.awt.event.ItemListener;
30
import java.awt.event.KeyEvent;
31
import java.awt.event.KeyListener;
32
import java.net.URL;
33
import java.util.ArrayList;
34
import java.util.Iterator;
35
import java.util.List;
36

  
37
import javax.swing.ImageIcon;
38
import javax.swing.JButton;
39
import javax.swing.JComboBox;
40
import javax.swing.JLabel;
41
import javax.swing.JOptionPane;
42
import javax.swing.JPanel;
43
import javax.swing.JTextField;
44

  
45
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
46
import org.gvsig.gvsig3dgui.view.View3D;
47
import org.gvsig.osgvp.planets.PlanetViewer;
48
import org.gvsig.osgvp.terrain.TerrainViewer;
49

  
50
import com.iver.ai2.gvsig3d.resources.ResourcesFactory;
51
import com.iver.andami.PluginServices;
52
import com.iver.cit.gvsig.animation.AnimationPlayer;
53
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
54

  
55
/**
56
 * @author �ngel Fraile Gri��n  e-mail: angel.fraile@iver.es
57
 * @since 1.1
58
 * 
59
 * Class to create and to process the event's panel animation.
60
 */
61

  
62
public class AnimationContol3D extends GridBagLayoutPanel implements
63
		ActionListener, KeyListener, ItemListener, FocusListener {
64

  
65
	/**
66
	 * default static final serial version ID
67
	 */
68
	private static final long serialVersionUID = 1L;
69

  
70
	private int operation; // Used in choice's functions
71

  
72
	private JLabel label = null;
73

  
74
	private JLabel label2 = null;
75
	
76
	private JLabel label3 = null;
77

  
78
	private JTextField textosegs = null;
79

  
80
	private JComboBox choice = null;
81

  
82
	private JButton buttonIcon = null;
83

  
84
	private JButton buttonIcon1 = null;
85

  
86
	private JButton buttonIcon2 = null;
87

  
88
	private JButton buttonIcon3 = null;
89

  
90
	private ImageIcon image = null;
91

  
92
	private ImageIcon image1 = null;
93

  
94
	private ImageIcon image2 = null;
95

  
96
	private ImageIcon image3 = null;
97

  
98
	private Checkbox checkbox = null;
99

  
100
	private String buttonPath;
101

  
102
	private double globalTime;
103

  
104
	private AnimationPlayer animationPlayer;
105

  
106
	private int animationMode;
107

  
108
	private boolean playFlag = false;
109

  
110
	private boolean pauseFlag = false;
111

  
112
	private StateUpdate runnable;
113

  
114
	private ArrayList<WindowClosedListener> actionCommandListeners = new ArrayList<WindowClosedListener>();
115

  
116
	private List<BaseView> viewListAdded =  new ArrayList<BaseView>();
117
	
118

  
119
	/**
120
	 * Default constructor.
121
	 * 
122
	 * @param animationPlayer: player associate
123
	 */
124
	public AnimationContol3D(AnimationPlayer animationPlayer) {
125

  
126
		this.animationPlayer = animationPlayer;
127
		this.animationPlayer.setAnimationPlayerState(AnimationPlayer.ANIMATION_INITIAL);
128

  
129
		// Setting up the button path
130
		String oldPath = ResourcesFactory.getExtPath();// Save the path.
131
		ResourcesFactory
132
				.setExtPath("/gvSIG/extensiones/com.iver.ai2.animationgui.gui/images/reproductoranim/");
133
		ResourcesFactory.setExtPath("/images/reproductoranim/");// my new path
134
		buttonPath = ResourcesFactory.getResourcesPath();
135
		URL path;
136
		path = this.getClass().getClassLoader().getResource("images/reproductoranim/");
137
		buttonPath = path.getPath(); 
138
		ResourcesFactory.setExtPath(oldPath);// Restore the old path.
139
		System.out.println(oldPath);
140
		System.out.println(buttonPath);
141

  
142
		initialize();
143
	}
144

  
145
	/*
146
	 * Panel creation.
147
	 * 
148
	 */
149
	private void initialize() {
150
		// Bag where have declared the characteristic of a Component in the
151
		// panel.
152
		GridBagConstraints c;
153

  
154
		/*
155
		 * gridx: column position in grid gridy: row position in grid anchor:
156
		 * bottom of space
157
		 */
158

  
159
		// Creation of four buttons: play, stop, pause y record.
160
		c = new GridBagConstraints();
161
		c.gridx = 0;
162
		c.gridy = 0;
163
		c.insets = new Insets(2, 5, 2, 2);
164

  
165
		this.add(getPlayButton(), c);
166

  
167
		c = new GridBagConstraints();
168
		c.gridx = 1;
169
		c.gridy = 0;
170
		c.insets = new Insets(2, 2, 2, 2);
171
		this.add(getPauseButton(), c);
172

  
173
		c = new GridBagConstraints();
174
		c.gridx = 2;
175
		c.gridy = 0;
176
		c.insets = new Insets(2, 2, 2, 2);
177
		this.add(getStopButton(), c);
178

  
179
		c = new GridBagConstraints();
180
		c.gridx = 3;
181
		c.gridy = 0;
182
		c.gridwidth = 2;
183
		c.fill = GridBagConstraints.BOTH;
184
		c.insets = new Insets(2, 2, 2, 5);
185
		this.add(getRecButton(), c);
186

  
187
		// Space between rows.
188
		c = new GridBagConstraints();
189
		c.insets = new Insets(2, 5, 2, 2);
190
		c.gridx = 1;
191
		c.gridy = 1;
192
		c.anchor = GridBagConstraints.WEST;
193
		this.add(getLabelDuration(), c);
194

  
195
		// textField to introduce the duration of the movie in seconds or
196
		// frames.
197
		c = new GridBagConstraints();
198
		c.insets = new Insets(2, 2, 2, 5);
199
		c.gridx = 2;
200
		c.gridy = 1;
201
		c.gridwidth = 1;
202
		c.anchor = GridBagConstraints.WEST;
203
		c.fill = GridBagConstraints.BOTH;
204
		this.add(getSeconds(), c);
205

  
206
		c = new GridBagConstraints();
207
		c.insets = new Insets(2, 2, 2, 5);
208
		c.gridx = 3;
209
		c.gridy = 1;
210
		c.gridwidth = 1;
211
		c.anchor = GridBagConstraints.WEST;
212
		c.fill = GridBagConstraints.BOTH;
213
		this.add(getLabelSeconds(), c);
214
		
215
		// checkbox for the provisional selection of video in seconds or frames.
216
		// c.gridx = 3;
217
		// c.gridy = 1;
218
		// c.gridwidth = 2;
219
		// c.anchor = GridBagConstraints.EAST;
220
		// this.add(getJCheckBox(), c);
221

  
222
		c = new GridBagConstraints();
223
		c.insets = new Insets(2, 5, 2, 2);
224
		c.gridx = 1;
225
		c.gridy = 3;
226
		c.anchor = GridBagConstraints.WEST;
227
		this.add(getLabelMode(), c);
228
		
229
		
230
		// choice for mode player selection.
231
		c = new GridBagConstraints();
232
		c.insets = new Insets(2, 2, 5, 5);
233
		c.gridx = 2;
234
		c.gridy = 3;
235
		c.anchor = GridBagConstraints.WEST;
236
		c.fill = GridBagConstraints.BOTH;
237
		c.gridwidth = 3;
238
		this.add(getChoiceValue(), c);
239
		choice.setSelectedIndex(this.animationPlayer.getAnimationMode());
240
		
241
		c = new GridBagConstraints();
242
		c.insets = new Insets(0, 0, 0, 0);
243
		c.gridx = 0;
244
		c.gridy = 3;
245
		c.gridwidth = 5;
246
		c.weightx = 1.0;
247
		c.weighty = 1.0;
248
		this.add(new JPanel(), c);
249

  
250
		setGlobalTime(this.animationPlayer.getGlobalTime() / 1000);
251

  
252
	}
253

  
254
	/**
255
	 * 
256
	 * @return JLabel.
257
	 */
258
	private JLabel getLabelMode() {
259
		label2 = new JLabel(PluginServices.getText(this, "Label_Mode"));
260
		label2.setToolTipText(PluginServices.getText(this, "Modo_de_reproduccion"));
261
		return label2;
262
	}
263

  
264
	/**
265
	 * 
266
	 * @return JLabel.
267
	 */
268
	private JLabel getLabelDuration() {
269
		label = new JLabel(PluginServices.getText(this, "Label_Duration"));
270
		label.setToolTipText(PluginServices.getText(this, "Duracion_de_la_animacion"));
271
		return label;
272
	}
273

  
274
	private JLabel getLabelSeconds() {
275
		label3 = new JLabel(PluginServices.getText(this, "seconds"));
276
		return label3;
277
	}
278
	
279
	/**
280
	 * @return Choice. Return the choice with the different modes of display.
281
	 */
282
	private JComboBox getChoiceValue() {
283
		if (choice == null) {
284
			choice = new JComboBox();
285
			choice.addItem(PluginServices.getText(this, "Loop_mode"));
286
			choice.addItem(PluginServices.getText(this,"Ping_pong_loop"));
287
			choice.addItem(PluginServices.getText(this,"Play_once"));
288
			choice.addItem(PluginServices.getText(this,"Loop_once_backwards"));
289
			choice.addItemListener(this);
290
			choice.setToolTipText(PluginServices.getText(this, "Modo_de_reproduccion"));
291
		}
292
		return choice;
293
	}
294

  
295
	/**
296
	 * @return TextField. Return textfield where the user put the seconds of the
297
	 *         movie.
298
	 */
299
	private JTextField getSeconds() {
300
		if (textosegs == null) {
301
			textosegs = new JTextField(PluginServices
302
					.getText(this, "Text_Secs"), 4);
303
			textosegs.setName("SECONDS");
304
			textosegs.setHorizontalAlignment(JTextField.RIGHT);
305
			textosegs.addKeyListener(this);
306
			textosegs.addFocusListener(this);
307
			textosegs.setToolTipText(PluginServices.getText(this, "Duracion_de_la_animacion"));
308
		}
309
		return textosegs;
310
	}
311

  
312
	/**
313
	 * @return JButton. Return record button.
314
	 */
315
	private JButton getRecButton() {
316
		if (buttonIcon3 == null) {
317
			buttonIcon3 = new JButton();
318
			// path where are the image to load in the button.
319
			image3 = new ImageIcon(buttonPath + "/record.png");
320
			buttonIcon3.setIcon(image3);
321
			buttonIcon3.setActionCommand("REC");
322
			buttonIcon3.addActionListener(this);
323
			buttonIcon3.setToolTipText(PluginServices.getText(this, "Grabar_animacion"));
324
		}
325
		return buttonIcon3;
326
	}
327

  
328
	/**
329
	 * @return JButton. Return stop button.
330
	 */
331
	private JButton getStopButton() {
332
		if (buttonIcon2 == null) {
333
			buttonIcon2 = new JButton();
334
			image2 = new ImageIcon(buttonPath + "/stop.png");
335
			buttonIcon2.setIcon(image2);
336
			buttonIcon2.setActionCommand("STOP");
337
			buttonIcon2.addActionListener(this);
338
			buttonIcon2.setToolTipText(PluginServices.getText(this, "Stop"));
339
		}
340
		return buttonIcon2;
341
	}
342

  
343
	/**
344
	 * @return JButton. Return pause button.
345
	 */
346
	private JButton getPauseButton() {
347
		if (buttonIcon1 == null) {
348
			buttonIcon1 = new JButton();
349
			image1 = new ImageIcon(buttonPath + "/pause.png");
350
			buttonIcon1.setIcon(image1);
351
			buttonIcon1.setActionCommand("PAUSE");
352
			buttonIcon1.addActionListener(this);
353
			buttonIcon1.setToolTipText(PluginServices.getText(this, "Pause"));
354
		}
355
		return buttonIcon1;
356
	}
357

  
358
	/**
359
	 * @return JButton. Return play button.
360
	 */
361
	public JButton getPlayButton() {
362
		if (buttonIcon == null) {
363
			buttonIcon = new JButton();
364
			image = new ImageIcon(buttonPath + "/play.png");
365
			buttonIcon.setIcon(image);
366
			buttonIcon.setActionCommand("PLAY");
367
			buttonIcon.addActionListener(this);
368
			buttonIcon.setIcon(image);
369
			buttonIcon.setToolTipText(PluginServices.getText(this, "Play"));
370
		
371
		}
372
		return buttonIcon;
373
	}
374
	
375
	/**
376
	 * 
377
	 * @param viewListAdded: open views list
378
	 */
379
	
380
	public void setViewListAdded(List<BaseView> viewListAdded) {
381
		this.viewListAdded = viewListAdded;
382
	}
383

  
384

  
385
	/**
386
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
387
	 *      logic events of pressed buttons.
388
	 */
389
	public void actionPerformed(ActionEvent arg0) {
390
		String actionCommand = arg0.getActionCommand();
391
		
392
		if (actionCommand.equals("PLAY")) { // play pressed
393
			
394
			if(this.animationPlayer.getAnimationContainer().isEmpty())
395
			{
396
				JOptionPane.showMessageDialog(null,PluginServices.getText(this,"Animacion_sin_vistas_incluidas"),
397
						"Animaci�n vacia", JOptionPane.WARNING_MESSAGE);
398
				return;
399
			}
400
			
401
			if (runnable == null) {
402
				runnable = new StateUpdate();
403
				// Create the thread supplying it with the runnable object
404
				Thread thread = new Thread(runnable);
405
				// Start the thread
406
				thread.start();
407
			}
408
			
409
			Iterator<BaseView> iter = viewListAdded.iterator();
410
			while (iter.hasNext()) {
411
				Object object = iter.next();
412
				if (object instanceof View3D){
413
					((View3D) object).getCanvas3d().getOSGViewer().setCameraManipulator(null);
414
				}
415
			}
416
			
417
			this.animationPlayer.play();
418
			playFlag = true;
419
			if (this.animationPlayer.getAnimationPlayerState() == AnimationPlayer.ANIMATION_PLAY) {
420
				image = new ImageIcon(buttonPath + "/playon.png");
421
				buttonIcon.setIcon(image);
422
			
423
				if (pauseFlag) {
424
					image1 = new ImageIcon(buttonPath + "/pause.png");
425
					buttonIcon1.setIcon(image1);
426
				}
427

  
428
			}
429

  
430
		} else if (actionCommand.equals("PAUSE")) { // pause pressed
431

  
432
			this.animationPlayer.pause();
433
			if (this.animationPlayer.getAnimationPlayerState() == AnimationPlayer.ANIMATION_PAUSE
434
					&& playFlag) {
435
				playFlag = false;
436
				pauseFlag = true;
437
				image = new ImageIcon(buttonPath + "/play.png");
438
				buttonIcon.setIcon(image);
439
				image1 = new ImageIcon(buttonPath + "/pauseon.png");
440
				buttonIcon1.setIcon(image1);
441
			}
442
		} else if (actionCommand.equals("STOP")) {
443

  
444
			Iterator<BaseView> iter = viewListAdded.iterator();
445
			while (iter.hasNext()) {
446
				Object object = iter.next();
447
				if (object instanceof View3D){
448
					((TerrainViewer) ((View3D) object).getCanvas3d().getOSGViewer()).restoreCustomTerrainManipulator();
449
				}
450
			}
451
			
452
			animationPlayer.stop();
453
			if (runnable != null)
454
				runnable.end();
455
			if (this.animationPlayer.getAnimationPlayerState() == AnimationPlayer.ANIMATION_STOP
456
					&& (playFlag || pauseFlag)) {
457

  
458
				if (playFlag) {
459
					image = new ImageIcon(buttonPath + "/play.png");
460
					buttonIcon.setIcon(image);
461
					playFlag = false;
462
				} else {
463
					image1 = new ImageIcon(buttonPath + "/pause.png");
464
					buttonIcon1.setIcon(image1);
465
					pauseFlag = false;
466
				}
467
			}
468
		
469
		} else if (actionCommand.equals("REC")) {
470
			animationPlayer.record();
471
			JOptionPane.showMessageDialog(null, "Opci�n no disponible",
472
					"Alertas de prueba", JOptionPane.WARNING_MESSAGE);
473

  
474
		}// if
475
	}// public void
476

  
477
	/*
478
	 * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
479
	 * 
480
	 */
481
	public void keyPressed(KeyEvent arg0) {
482
		// TODO Auto-generated method stub
483
	}
484

  
485
	/**
486
	 * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
487
	 *      Events when you put the film�s seconds in the animation panel.
488
	 */
489
	public void keyReleased(KeyEvent arg0) {
490
//		System.out.println("valor del campo segundos: "
491
//				+ this.textosegs.getText());
492
		try {
493
			globalTime = new Double(this.textosegs.getText()).doubleValue();
494
		}
495
		catch (Exception e) {
496
		}
497
		this.animationPlayer.setGlobalTime(globalTime);
498
	}
499

  
500
	/*
501
	 * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
502
	 */
503
	public void keyTyped(KeyEvent arg0) {
504
		// TODO Auto-generated method stub
505
	}
506

  
507
	/**
508
	 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
509
	 *      ItemListener methods.
510
	 */
511
	public void itemStateChanged(ItemEvent event) {
512
		Object obj = event.getSource();
513
		if (obj == choice) {
514
			operation = choice.getSelectedIndex(); // get select item.
515
			setMode(operation);
516
		} else if (obj == checkbox) {
517
			System.out.println("opcion seleccionada checkbox");
518
		}
519
	}
520

  
521
	/*
522
	 * Player options modes. 
523
	 */
524
	private void setMode(int option) {
525

  
526
		if (option == 2) {
527
			animationMode = AnimationPlayer.PLAY_ONCE;
528
		} else if (option == 0) {
529
			animationMode = AnimationPlayer.LOOP;
530
		} else if (option == 3) {
531
			animationMode = AnimationPlayer.PLAY_ONCE_BACKWARDS;
532
		} else if (option == 1)
533
			animationMode = AnimationPlayer.PING_PONG_LOOP;
534
		
535
		this.animationPlayer.setAnimationMode(animationMode);
536

  
537
		//System.out.println("opcion: " + mode);
538
	}
539

  
540
	public void setGlobalTime(double time) {
541
		textosegs.setText(Double.toString(time));
542
	}
543

  
544
	/*
545
	 * Class to control the automatically stop state of the actual animation.
546
	 */
547

  
548
	public class StateUpdate implements Runnable {
549

  
550
		private boolean finish = false;
551

  
552
		public void run() {
553

  
554
			while (true) {
555
				try {
556
					Thread.sleep(800);
557
					synchronized (this) {
558
						if (finish) {
559
							Iterator<BaseView> iter = viewListAdded.iterator();
560
							while (iter.hasNext()) {
561
								Object object = iter.next();
562
								if (object instanceof View3D){
563
									((TerrainViewer) ((View3D) object).getCanvas3d().getOSGViewer()).restoreCustomTerrainManipulator();
564
								}
565
							}
566
							break;
567
						}
568
					}
569
				} catch (InterruptedException e) {
570

  
571
					e.printStackTrace();
572
				}
573
				
574
				if (animationPlayer.getAnimationPlayerState() == AnimationPlayer.ANIMATION_STOP
575
						&& (playFlag || pauseFlag)) {
576

  
577
					if (playFlag) {
578
						image = new ImageIcon(buttonPath + "/play.png");
579
						buttonIcon.setIcon(image);
580
						playFlag = false;
581
					} else {
582
						image1 = new ImageIcon(buttonPath + "/pause.png");
583
						buttonIcon1.setIcon(image1);
584
						pauseFlag = false;
585
					}
586
					runnable.end();
587
				}// long if
588
			}
589
		}
590

  
591
		/*
592
		 * function to stop the thread.
593
		 */
594

  
595
		public synchronized void end() {
596
			finish = true;
597
			runnable = null;
598
		}
599
	}// end class StateUpdate.
600

  
601
	/**
602
	 * Add a listener in a event list
603
	 * @param listener
604
	 */
605
	public void addWindowClosedListener(WindowClosedListener listener) {
606
		if (!actionCommandListeners.contains(listener))
607
			actionCommandListeners.add(listener);
608
	}
609
	
610
	/**
611
	 * Clear a listener in a event list
612
	 * @param listener
613
	 */
614
	public void removeWindowClosedListener(WindowClosedListener listener) {
615
		actionCommandListeners.remove(listener);
616
	}
617

  
618
	public void focusGained(FocusEvent e) {
619
		// TODO Auto-generated method stub
620
	}
621

  
622
	public void focusLost(FocusEvent e) {
623
		textosegs.setText(Double.toString(globalTime));
624
	}
625
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/toc/AnimationDateModePanel.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.toc;
21

  
22
import java.awt.Choice;
23
import java.awt.Dimension;
24
import java.awt.GridBagConstraints;
25
import java.awt.Insets;
26
import java.awt.event.ActionListener;
27
import java.awt.event.ItemEvent;
28
import java.awt.event.ItemListener;
29

  
30
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
31
import org.gvsig.gui.beans.swing.JButton;
32

  
33
import com.iver.andami.PluginServices;
34
import com.iver.andami.ui.mdiManager.SingletonWindow;
35
import com.iver.andami.ui.mdiManager.WindowInfo;
36
import com.iver.cit.gvsig.animation.IAnimationType;
37

  
38
/**
39
 * Dialogo donde se muestran las propiedades de una vista
40
 * 
41
 * @author Fernando Gonz?lez Cort?s
42
 */
43
public class AnimationDateModePanel extends GridBagLayoutPanel implements
44
		SingletonWindow, ItemListener{
45

  
46

  
47
	/**
48
	 * 
49
	 */
50
	private static final long serialVersionUID = 1L;
51

  
52
	private int width = 250;
53

  
54
	private int height = 100;
55

  
56
	private GridBagLayoutPanel okCancelPanel;
57

  
58
	private JButton okButton;
59
	
60
	private Choice choice = null;
61

  
62
	private int animationMode;
63

  
64
	private int operation;
65

  
66
	private IAnimationType animationDay;
67

  
68
	/**
69
	 * This is the default constructor
70
	 * @param animationType 
71
	 * 
72
	 */
73
	public AnimationDateModePanel(IAnimationType animationType) {
74

  
75
		animationDay = animationType;
76
		initialize();
77

  
78
	}
79

  
80
	/**
81
	 * This method initializes the panel
82
	 */
83
	private void initialize() {
84
		
85
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
86
		gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
87
		gridBagConstraints1.gridy = 2;
88
		gridBagConstraints1.weightx = 1.0;
89
		gridBagConstraints1.gridx = 1;
90
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
91
		gridBagConstraints.gridx = 1;
92
		gridBagConstraints.gridheight = 2;
93
		gridBagConstraints.gridwidth = 2;
94
		gridBagConstraints.insets = new Insets(15, 0, 0, 0);
95
		gridBagConstraints.gridy = 3;
96
		
97
		this.add(getChoiceValue(), gridBagConstraints1);
98
		this.add(getOkCancelPanel(),gridBagConstraints);
99
		
100
		setName(PluginServices.getText(this, "Transparency"));
101
		this.setPreferredSize(new Dimension(width, height));
102
		this.setSize(new Dimension(width, height));
103

  
104
	}
105

  
106
	
107
	private Choice getChoiceValue() {
108
		// TODO Auto-generated method stub
109
		if (choice == null) {
110
			choice = new Choice();
111
			// choice.addItem( textopru );
112
			choice.addItem("Intervalo");
113
			choice.addItem("Incremental");
114
			choice.addItem("Decremental");
115
			// choice.addItem( "modo3" );
116
			// choice.addItem( "modo4" );
117
			choice.addItemListener(this);
118
		}
119
		return choice;
120
	}
121

  
122

  
123
	private GridBagLayoutPanel getOkCancelPanel() {
124
		if (okCancelPanel == null) {
125
			ActionListener okAction;
126
			okAction = new java.awt.event.ActionListener() {
127
				public void actionPerformed(java.awt.event.ActionEvent e) {
128
					
129
//					animationDay.setFilterMode(animationMode);
130
					PluginServices.getMDIManager().closeWindow(
131
							AnimationDateModePanel.this);
132
				}
133
			};
134
			okCancelPanel = new GridBagLayoutPanel();
135
			okCancelPanel.setAlignmentX(GridBagLayoutPanel.RIGHT_ALIGNMENT);
136
			okButton = new JButton();
137
			okButton.setText("Aceptar");
138
			okButton.addActionListener(okAction);
139

  
140
			okCancelPanel.addComponent(okButton);
141
		}
142
		return okCancelPanel;
143
	}
144

  
145
	
146
	/**
147
	 * 
148
	 * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
149
	 * @return WindowInfo: window parameters
150
	 */
151

  
152
	public WindowInfo getWindowInfo() {
153
		WindowInfo m_viewinfo = new WindowInfo();
154
		m_viewinfo.setTitle(PluginServices.getText(this, "Transparency"));
155
		m_viewinfo.setHeight(height);
156
		m_viewinfo.setWidth(width);
157
		return m_viewinfo;
158
	}
159

  
160
	public Object getWindowModel() {
161
		return null;
162
	}
163

  
164
	public void itemStateChanged(ItemEvent event) {
165
		Object obj = event.getSource();
166
		if (obj == choice) {
167
			operation = choice.getSelectedIndex(); // get select item.
168
			getMensaje(operation);
169
		} 
170
		
171
	}
172
	private void getMensaje(int option) {
173
		String mode = choice.getItem(option);
174
//		if (mode.equals("Intervalo")) {
175
//			animationMode = DateFilter.BOTH;
176
//		} else if (mode.equals("Incremental")) {
177
//			animationMode = DateFilter.BEFORE_BEGIN;
178
//		} else if (mode.equals("Decremental")) {
179
//			animationMode = DateFilter.AFTER_END;
180
//		}
181
		System.out.println("opcion: " + mode);
182
	}
183

  
184
	public Object getWindowProfile() {
185
		// TODO Auto-generated method stub
186
		return WindowInfo.TOOL_PROFILE;
187
	}
188

  
189

  
190
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/toc/TocAnimationDate.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.toc;
21

  
22
import java.sql.Date;
23

  
24
import com.iver.andami.PluginServices;
25
import com.iver.andami.plugins.IExtension;
26
import com.iver.andami.ui.mdiManager.IWindow;
27
import com.iver.cit.gvsig.ProjectExtension;
28
import com.iver.cit.gvsig.animation.AnimationContainer;
29
import com.iver.cit.gvsig.animation.IAnimationType;
30
import com.iver.cit.gvsig.animation.interval.AnimationDatedInterval;
31
import com.iver.cit.gvsig.animation.traks.AnimationDatedTrack;
32
import com.iver.cit.gvsig.animation.traks.IAnimationTrack;
33
import com.iver.cit.gvsig.fmap.MapContext;
34
import com.iver.cit.gvsig.fmap.layers.FLayer;
35
import com.iver.cit.gvsig.project.Project;
36
import com.iver.cit.gvsig.project.documents.view.IProjectView;
37
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
38
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
39
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
40
import com.iver.utiles.extensionPoints.ExtensionPoint;
41
import com.iver.utiles.extensionPoints.ExtensionPoints;
42
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
43

  
44
public class TocAnimationDate extends AbstractTocContextMenuAction {
45

  
46
	private AnimationDatedTrack adt;
47
	
48
	FLayer layer;
49

  
50
	public String getGroup() {
51
		return "group6"; // FIXME
52
	}
53

  
54
	public int getGroupOrder() {
55
		return 60;
56
	}
57

  
58
	public int getOrder() {
59
		return 10;
60
	}
61

  
62
	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
63
		// return selectedItems.length == 1;
64

  
65
		// return true;
66

  
67
		boolean enable = false;
68

  
69
		if (selectedItems.length > 0)
70
			enable = true;
71

  
72
		return enable;
73

  
74
	}
75

  
76
	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
77
		// return true;
78
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
79
				.getMDIManager().getActiveWindow();
80

  
81
		if (f == null) {
82
			return false;
83
		}
84

  
85
		if (!isTocItemBranch(item))
86
			return false;
87

  
88
		BaseView vista = (BaseView) f;
89
		
90
		IProjectView model = vista.getModel();
91
		MapContext mapa = model.getMapContext();
92
	
93
		return mapa.getLayers().getLayersCount() > 0;
94
	}
95

  
96
	public void execute(ITocItem item, FLayer[] selectedItems) {
97
		System.out
98
				.println("MENU CONTEXTUAL DE GENERACION DE ANIMACIONES DE FECHAS");
99

  
100
//		// Getting view3
101
//		com.iver.andami.ui.mdiManager.IWindow view = PluginServices
102
//				.getMDIManager().getActiveWindow();
103
//		BaseView vista3D =  (BaseView) view;
104
//		 MapControl model = (MapControl)vista3D.getModel();
105
//		model.setEnabled(true);
106
		
107
		layer = selectedItems[0];
108
		
109
		// Generate animation using filters
110
		generateAniamtionDate();
111
		
112
		// introducir layer
113
		
114
//		this.adt.setAnimatedObject(layer);
115
		// Show the animation control player
116
//		AnimationDateModePanel = new AnimationDateModePanel();
117
//		AnimationDateModePanel.setModal(true);
118
//		AnimationDateModePanel.pack();
119
//		AnimationDateModePanel.setVisible(true);
120
		
121
		
122
		AnimationDateModePanel fp = new AnimationDateModePanel(adt.getAnimationType());
123
		PluginServices.getMDIManager().addWindow((IWindow) fp);
124
		
125
		
126
	}
127

  
128
	public String getText() {
129
		// Name that appears in toc menu
130
		return "Animacion de fecha";
131
	}
132

  
133
	private Project getProject() {
134
		IExtension extension = PluginServices
135
				.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
136
		ProjectExtension pe = (ProjectExtension) extension;
137
		return pe.getProject();
138
	}
139

  
140
	private void generateAniamtionDate() {
141
		// TODO Auto-generated method stub
142
		// traerse el contenedor
143
		//Project project = this.getProject();
144
		AnimationContainer ac = null;//(AnimationContainer) project.getAnimationContainer();
145
		// desactivar los track existentes
146

  
147
		// crear el track
148
		adt = getAnimationDateTrack("Date-track", ac);
149
		// generar un intervalo por cada fecha
150

  
151
		// DEBUGGGGG!!!!
152
		System.out.println(ac);
153
	}
154

  
155
	private AnimationDatedTrack getAnimationDateTrack(String name,
156
			AnimationContainer ac) {
157
		AnimationDatedTrack at = null;
158
		IAnimationTrack aa = ac.findTrack(name);
159
		if (aa == null) {
160

  
161
			ExtensionPoints extensionPoints = ExtensionPointsSingleton
162
					.getInstance();
163
			ExtensionPoint extPoint = ((ExtensionPoint) extensionPoints
164
					.get("Animation"));
165

  
166
			// traerse el tipo de animacion
167
			IAnimationType animationDate3D = null;
168
			try {
169
				animationDate3D = (IAnimationType) extPoint
170
						.create("AnimationDate3D");
171
			} catch (InstantiationException e) {
172
				// TODO Auto-generated catch block
173
				e.printStackTrace();
174
			} catch (IllegalAccessException e) {
175
				// TODO Auto-generated catch block
176
				e.printStackTrace();
177
			}
178
			animationDate3D.setAnimatedObject(layer);
179
			at = (AnimationDatedTrack) ac.CreateDatedTrack(animationDate3D);
180
			at.setName(name);
181
			at.setEnable(true);
182
			
183
			//crear el intervalo
184
			AnimationDatedInterval adi = (AnimationDatedInterval) at.createInterval();
185
			adi.setBeginDateInterval(Date.valueOf("2000-01-01"));
186
			adi.setEndDateInterval(Date.valueOf("2000-01-04"));
187
			
188
			
189
//			at.setAnimatedObject(layer);
190
			// at.setAnimationType(animationDate3D);
191
		}
192

  
193
		return at;
194

  
195
	}
196

  
197
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/extensions/extAnimationGUI/src/com/iver/ai2/animationgui/gui/WindowClosedListener.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
package com.iver.ai2.animationgui.gui;
20

  
21
import java.util.EventListener;
22
import java.util.EventObject;
23

  
24
public interface WindowClosedListener extends EventListener {
25
	/**
26
	 * Evento que se dispara cuando se cierra una ventana.
27
	 * @param e
28
	 */
29
	public void actionClosed(EventObject e);
30
}
tags/gvSIG_3D_Animation_1_9_SNAPSHOT_build_13/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"));
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff