Revision 15498

View differences:

import/ext3D/branches/ext3D_v1.1/extAnimationCommon/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extAnimationCommon</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/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="com.iver.ai2.gvsig3dgui" />
5
	
6
	<libraries library-dir="./lib"/>
7
	<resourceBundle name="text"/>
8
	<extensions>
9
		<extension class-name="com.iver.cit.gvsig.animation.ExtensionTransparency"
10
			description="Extensi?n encargada de registrar los tipos de animacion 3D."
11
			active="true"
12
			priority="50">					
13
		</extension>
14
	</extensions>
15
</plugin-config>
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/config/text.properties
1
#Default language
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
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/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>
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/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
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/src/com/iver/cit/gvsig/animation/AnimationTransparency.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import com.iver.cit.gvsig.animation.keyframe.IAnimationTypeKeyFrame;
4
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
5
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
6
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
7

  
8

  
9
public class AnimationTransparency implements IAnimationTypeKeyFrame {
10

  
11
	private String className = this.getClass().getName();
12
	private String description = "Animacion basada en Transparencias";
13
	private String name = "AnimationTransparency";
14
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
15
	private IInterpolator interpolator;
16
	private BaseView view;
17

  
18
	public AnimationTransparency() {
19
	}
20

  
21
	public String getClassName() {
22
		return className;
23
	}
24

  
25
	public String getDescription() {
26
		return description;
27
	}
28

  
29
	public String getName() {
30
		return name;
31
	}
32

  
33
	public void setClassName(String className) {
34
		this.className = className;
35
	}
36

  
37
	public void setDescription(String description) {
38
		this.description = description;
39
	}
40

  
41
	public void setName(String name) {
42
		this.name = name;
43
	}
44

  
45
	/**
46
	 * 
47
	 * @param animate : Object to animate.
48
	 *  Application of attributes to our object animated.
49
	 *  In this animation the object is a layer(FLyerDefault).
50
	 *  Attributes: layer transparency.
51
	 *  invalidate(): repaint the view. 
52
	 */
53
	
54
	public void AppliesToObject(Object animated) {
55

  
56
		KeyFrameTransparency kf = (KeyFrameTransparency) animated;
57
		FLyrDefault layer = (FLyrDefault)kf.getAnimatedObject();
58
		int trans = (int)kf.getLevelTransparency();
59
		
60
	//	System.err.println("antes: " + System.currentTimeMillis());
61
	//	long antes = System.currentTimeMillis();
62
		
63
		layer.setTransparency(trans);		
64
		layer.getMapContext().invalidate();
65
			
66
		
67
	//	System.err.println("despues: " + System.currentTimeMillis());
68
	//	long despues = System.currentTimeMillis();
69
	//	System.err.println("intervalo de tiempo: " + (despues-antes));
70
		
71
		System.err.println("aplicando transparencia " + trans + " al objeto " + layer.getName());
72
	}
73

  
74
	public int getTypeTrack() {
75
		return typeTrack;
76
	}
77

  
78
	public void setTypeTrack(int typeTrack) {
79
		this.typeTrack = typeTrack;
80
	}
81

  
82
	public IInterpolator getInterpolator() {
83
		return this.interpolator;
84
	}
85

  
86
	public void setInterpolator(IInterpolator interpolator) {
87
		this.interpolator = interpolator;
88
	}
89

  
90
	public Object getAnimatedObject() {
91
		// TODO Auto-generated method stub
92
		return this.view;
93
	}
94

  
95
	public void setAnimatedObject(Object object) {
96
		this.view = (BaseView) object;
97
	}
98
}
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/src/com/iver/cit/gvsig/animation/InterpolatorTransparency.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.util.List;
4

  
5
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
6
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
7
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorFuntion;
8
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
9
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
10

  
11

  
12
/**
13
 *  Class to interpolate the transparency of a activated layer.
14
 */
15

  
16
public class InterpolatorTransparency implements IInterpolator {
17

  
18
	public BaseView view;
19
	
20
	public IKeyFrame interpolate(List kfList, int index, double time) {
21
		KeyFrameTransparency KF = new KeyFrameTransparency();
22

  
23
		// if the list of keyframes is empty.
24
		if (kfList == null)
25
			return null;
26

  
27
 
28
		switch (kfList.size()) {
29
		// this case when there are only has 2 keyframes
30
		case 2:
31
		
32
			KeyFrameTransparency kf1 = (KeyFrameTransparency) kfList.get(0);
33
			KeyFrameTransparency kf2 = (KeyFrameTransparency) kfList.get(1);
34
			
35
			if (index == 1) {
36
				KeyFrameTransparency kaux = kf1;
37
				kf1 = kf2;
38
				kf2 = kaux;
39
			}
40

  
41
			if ((kf1 == null) ||(kf2 == null))
42
				return null;
43
			//initial transparency level.
44
			double transparencia1 = kf1.getLevelTransparency();
45
			//final transparency level.
46
			double transparencia2 = kf2.getLevelTransparency();
47
			
48
			// Object to animate getting the keyframe.
49
			FLyrDefault fd1 = (FLyrDefault) kf1.getAnimatedObject();
50
			//FLyrDefault fd2 = (FLyrDefault) kf2.getAnimatedObject();
51
			
52
			double time1 = kf1.getTime();//initial time.
53
			double time2 = kf2.getTime();//final time.
54
			double valorTrans = linearInterpolate(transparencia1, transparencia2, time1, time2, time);
55
			System.out.println("valor interpolado " + valorTrans);
56
			
57
			//Creating the keyframe KF to return.
58
				try {
59
					KF.setLevelTransparency((int)valorTrans);
60
					KF.setAnimatedObject(fd1);// keyframe with the layer and the new transparecy to apply.
61
				} catch (Exception e) {
62
					// TODO Auto-generated catch block
63
					e.printStackTrace();
64
				}
65
		}
66
		return KF;
67
	}
68

  
69
	
70
	private double linearInterpolate(double minX, double minX2, double timePos,
71
			double timePos2, double time) {
72
		// P1 + (P2-P1)*((t-t1)/(t2-t1))
73
		return (minX + (minX2 - minX)
74
				* ((time - timePos) / (timePos2 - timePos)));
75
	}
76

  
77
	public Object getAnimatedObject() {
78
		return null;
79
	}
80

  
81
	public void setAnimatedObject(Object ani) {
82
	}
83

  
84
	public IInterpolatorFuntion getFuntion() {
85
		// TODO Auto-generated method stub
86
		return null;
87
	}
88

  
89

  
90
	public void setFuntion(IInterpolatorFuntion arg0) {
91
		// TODO Auto-generated method stub
92
		
93
	}
94
}
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/src/com/iver/cit/gvsig/animation/KeyFrameTransparency.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import java.util.List;
4

  
5
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
6
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
7
import com.iver.utiles.XMLEntity;
8

  
9

  
10

  
11
/**
12
 * 
13
 * @author 
14
 * 
15
 * Class to create a keyframe used in animation with transparency.
16
 *
17
 */
18

  
19
public class KeyFrameTransparency implements IKeyFrame {
20

  
21
	private String name;
22
	private double time;
23
	private int levelTransparency;
24
	private String nameLayer;
25
	private FLyrDefault layerDefault;
26

  
27
	public void Apply(double Tini) {
28
		// TODO Auto-generated method stub
29

  
30
	}
31

  
32
	/**
33
	 * 
34
	 * @see com.iver.cit.gvsig.animation.keyframe.IKeyFrame#CapturesProperties()
35
	 * Capturing the property transparency of the layer. 
36
	 */
37
	
38
	public void CapturesProperties() {
39
		if (layerDefault != null)
40
			levelTransparency = this.layerDefault.getTransparency();
41
	}
42

  
43
	/**
44
	 * Getting the keyframe name.
45
	 */
46
	
47
	public String getName() {
48
		// TODO Auto-generated method stub
49
		return this.name;
50
	}
51

  
52
	public List getPropertiesList() {
53
		// TODO Auto-generated method stub
54
		return null;
55
	}
56

  
57
	/**
58
	 * Setting the keyframe name.
59
	 */
60
	
61
	public void setName(String name) {
62
		this.name = name;
63

  
64
	}
65

  
66
	public void setPropertiesList(List list) {
67
		// TODO Auto-generated method stub
68
	}
69

  
70
	/**
71
	 * Information of the keyframe in a String.
72
	 */
73
	
74
	public String toString() {
75
		String result;
76
		result = " keyframeTransparency:\n";
77
		result += " tiempo: " + this.time;
78
		// result= "Name: " + this.getName();
79
		return result;
80
	}
81

  
82
	public void Interpolate(Object p1, Object p2, double time) {
83
		// TODO Auto-generated method stub
84
	}
85

  
86
	/**
87
	 * 
88
	 * @return the Object to animate.(FLyrDefault)
89
	 */
90
	
91
	public Object getAnimatedObject() {
92
		return layerDefault;
93
	}
94

  
95
	/**
96
	 * 
97
	 * @param object : Object to animate.
98
	 * Setting the object to animate.(FLyrDefault).
99
	 * 
100
	 */
101
	public void setAnimatedObject(Object object) {
102
		this.layerDefault = (FLyrDefault) object;
103
	}
104

  
105
	/**
106
	 * Getting the time of the keyframe.
107
	 */
108
	
109
	public double getTime() {
110
		return time;
111
	}
112
	
113
	public double getLevelTransparency() {
114
		return levelTransparency;
115
	}
116

  
117
	public void setLevelTransparency(int levelTransparency) {
118
		this.levelTransparency = levelTransparency;
119
	}
120

  
121
	/**
122
	 * Setting the time of the keyframe.
123
	 */
124
	
125
	public void setTime(double time) {
126
		this.time = time;
127
	}
128

  
129
	public String getClassName() {
130
		// TODO Auto-generated method stub
131
		return this.getClass().getName();
132
	}
133

  
134
	/*	 
135
	 * IPersistence methods.
136
	 */
137

  
138
	public XMLEntity getXMLEntity() {
139
		// TODO Auto-generated method stub
140
		return null;
141
	}
142

  
143
	public void setXMLEntity(XMLEntity xml) {
144
		// TODO Auto-generated method stub
145

  
146
	}
147

  
148
}
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/src/com/iver/cit/gvsig/animation/AnimationTypeFactoryTransparency.java
1
package com.iver.cit.gvsig.animation;
2

  
3

  
4
public class AnimationTypeFactoryTransparency extends AnimationFactory {
5

  
6
	public static String registerName = "AnimationTransparency";
7
	
8
	
9
	public static AnimationTransparency animationTransparency;
10
	
11
	static {
12
		if (animationTransparency == null) {
13
			animationTransparency = new AnimationTransparency();
14
			animationTransparency.setClassName("AnimationTransparency");
15
			animationTransparency.setName("AnimationTransparency");
16
			animationTransparency.setDescription("Animacion basada en transparencias.");
17
		}
18
	}
19
	
20
	/**
21
	 * Creating a new animation in the factory.
22
	 */
23
	public Object create() {
24
		
25
       return animationTransparency;
26
	}
27
	
28
	/**
29
	 * Registers in the points of extension the Factory with alias.
30
	 */
31
	public static void register() {
32
		register(registerName, new AnimationTypeFactoryTransparency(), "com.iver.cit.gvsig.animation.AnimationTransparency");
33
	}
34

  
35
	public String getRegisterName() {
36
		return registerName;
37
	}
38

  
39
}
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/src/com/iver/cit/gvsig/animation/ExtensionTransparency.java
1
package com.iver.cit.gvsig.animation;
2

  
3
import com.iver.andami.plugins.Extension;
4

  
5
//import com.iver.ai2.gvsig3d.gui.AnimationContol3D;
6

  
7
/**
8
 * @author
9
 * @since 1.1
10
 */
11

  
12
public class ExtensionTransparency extends Extension {
13

  
14
	public void execute(String actionCommand) {
15

  
16
	}
17
	
18
	/**
19
	 * @see com.iver.andami.plugins.IExtension#initialize()
20
	 * Registering a new animation factory based in transparency and time.
21
	 */
22
	public void initialize() {
23

  
24
		AnimationTypeFactoryTransparency.register();
25
	}
26

  
27
	public boolean isEnabled() {
28
		// TODO Auto-generated method stub
29
		return true;
30
	}
31

  
32
	public boolean isVisible() {
33

  
34
		return false;
35
	}
36

  
37
}
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
	<description>
3
        Instala el plugin de ejemplo en Andami.
4
    </description>
5
	<!-- set global properties for this build -->
6
	<property name="src" location="src" />
7
	<property name="build" location="bin" />
8
	<property name="dist" location="dist" />
9
	<property name="plugin" value="com.iver.ai2.animationCommon" />
10
	<property name="extension-dir" location="../_fwAndami/gvSIG/extensiones" />
11
	<property name="logos-dir" location="../_fwAndami/theme" />
12
	<property name="gvsig-lib" location="../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib" />
13
	<!--property name="binaries-dir" location="../binaries" /-->
14

  
15
	<target name="init">
16
		<!-- Create the time stamp -->
17
		<tstamp />
18
		<!-- Create the build directory structure used by compile -->
19
		<mkdir dir="${build}" />
20
		<!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
21
		<buildnumber />
22

  
23
	</target>
24

  
25
	<target name="generate-without-source" description="generate the distribution without the source file" depends="">
26
		<!-- Create the distribution directory -->
27
		<mkdir dir="${dist}" />
28
		<mkdir dir="${dist}/lib" />
29
		<mkdir dir="${dist}/binaries" />
30
		<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file
31
         Except classes to be instantiated in core gvSIG -->
32
		<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" />
33

  
34
		<copy todir="${dist}/lib/">
35
			<fileset dir="lib/" includes="**/**" />
36
		</copy>
37
		<!-- Put in this .jar the classes to be instantiated in gvSIG -->
38
		<copy file="config/config.xml" todir="${dist}" />
39
		<copy file="config/about.htm" todir="${dist}" />
40

  
41
		<copy todir="${dist}">
42
			<fileset dir="config" includes="text*.properties" />
43
		</copy>
44
		<copy todir="${dist}/images">
45
			<fileset dir="images/" includes="**/**" excludes="**/*.db" />
46
		</copy>
47

  
48
		<move todir="${extension-dir}/${plugin}/">
49
			<fileset dir="${dist}" includes="**/**" />
50
		</move>
51
	</target>
52

  
53
	<target name="copy-binaries">
54
		<copy todir="${binaries-dir}">
55
			<fileset dir="binaries/" includes="**" />
56
		</copy>
57
	</target>
58

  
59
	<target name="debug-yes">
60
		<property name="debug" value="on" />
61
		<property name="debuglevel" value="lines, vars" />
62
	</target>
63

  
64
</project>
65

  
import/ext3D/branches/ext3D_v1.1/extAnimationCommon/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/Utiles/src"/>
6
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
7
	<classpathentry combineaccessrules="false" kind="src" path="/appgvSIG"/>
8
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/>
9
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/gvsig-animation.jar"/>
10
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/org.gvsig.fmap.raster.jar"/>
11
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/org.gvsig.raster.jar"/>
12
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/org.gvsig.raster.gui.jar"/>
13
	<classpathentry kind="lib" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/org.cresques.cts.jar"/>
14
	<classpathentry kind="output" path="bin"/>
15
</classpath>

Also available in: Unified diff