Statistics
| Revision:

root / trunk / libraries / libAnimationCommon / src / main / java / com / iver / cit / gvsig / animation / keyFrame / KeyFrameTransparency.java @ 20153

History | View | Annotate | Download (3.45 KB)

1
package com.iver.cit.gvsig.animation.keyFrame;
2

    
3
import java.util.List;
4
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
5
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
6
import com.iver.utiles.XMLEntity;
7

    
8

    
9
/**
10
 * 
11
 * @author ?ngel.
12
 * 
13
 * Class to create a keyframe used in animation with transparency.
14
 *
15
 */
16

    
17
public class KeyFrameTransparency implements IKeyFrame {
18

    
19
        private String name;
20
        private double time;
21
        private int levelTransparency;
22
        private boolean visibility;
23
        private FLyrDefault layerDefault;
24
        private String className;
25

    
26

    
27
        /**
28
         * 
29
         * @see com.iver.cit.gvsig.animation.keyframe.IKeyFrame#CapturesProperties()
30
         * Capturing the property transparency of the layer and the property is selected?. 
31
         */
32
        
33
        public void CapturesProperties() {
34
                if (layerDefault != null){
35
                        levelTransparency = this.layerDefault.getTransparency();
36
                        visibility = this.layerDefault.isVisible();//Check box is selected?.
37
                }
38
        }
39

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

    
49
        public List getPropertiesList() {
50
                // TODO Auto-generated method stub
51
                return null;
52
        }
53

    
54
        /**
55
         * @param name: name of the keyframe.
56
         * Setting the keyframe name.
57
         */
58
        
59
        public void setName(String name) {
60
                this.name = name;
61

    
62
        }
63

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

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

    
80
        /**
81
         * 
82
         * @return the Object to animate.(FLyrDefault)
83
         */
84
        
85
        public Object getAnimatedObject() {
86
                return layerDefault;
87
        }
88

    
89
        /**
90
         * 
91
         * @param object : Object to animate.
92
         * Setting the object to animate.(FLyrDefault).
93
         * 
94
         */
95
        public void setAnimatedObject(Object object) {
96
                this.layerDefault = (FLyrDefault) object;
97
        }
98

    
99
        /**
100
         * Getting the time of the keyframe.
101
         */
102
        
103
        public double getTime() {
104
                return time;
105
        }
106
        
107
        public double getLevelTransparency() {
108
                return levelTransparency;
109
        }
110

    
111
        public void setLevelTransparency(int levelTransparency) {
112
                this.levelTransparency = levelTransparency;
113
        }
114

    
115
        /**
116
         * Setting the time of the keyframe.
117
         */
118
        
119
        public void setTime(double time) {
120
                this.time = time;
121
        }
122

    
123
        /**
124
         * @return the name of the class.
125
         */
126
        public String getClassName() {
127
                // TODO Auto-generated method stub
128
                return this.getClass().getName();
129
        }
130

    
131
        /*         
132
         * IPersistence methods.
133
         */
134

    
135
        public XMLEntity getXMLEntity() {
136
                
137
                XMLEntity xml = new XMLEntity();
138
                
139
                xml.putProperty("className", this.getClassName());
140
                xml.putProperty("keyFrameName", name);
141
                xml.putProperty("levelTransparency", levelTransparency);
142
                xml.putProperty("visibility", visibility);
143
                xml.putProperty("time", time);
144
                
145
                return xml;
146
        }
147

    
148
        public void setXMLEntity(XMLEntity xml) {
149
                
150
        //        if (xml.contains("className"))
151
        //                this.className = xml.getStringProperty("className");
152
                if (xml.contains("keyFrameName"))
153
                        this.name = xml.getStringProperty("keyFrameName");
154
                if (xml.contains("levelTransparency"))
155
                        this.levelTransparency = xml.getIntProperty("levelTransparency");
156
                if (xml.contains("visibility"))
157
                        this.visibility = xml.getBooleanProperty("visibility");
158
                if (xml.contains("time"))
159
                        this.time = xml.getDoubleProperty("time");
160
        }
161

    
162
}