Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libAnimation2D / src / main / java / com / iver / cit / gvsig / animation / keyFrame / KeyFrame2D.java @ 23597

History | View | Annotate | Download (3.55 KB)

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.cit.gvsig.animation.keyFrame;
21

    
22
import java.awt.geom.Rectangle2D;
23
import java.util.List;
24

    
25
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame;
26
import com.iver.cit.gvsig.project.ProjectExtent;
27
import com.iver.utiles.XMLEntity;
28

    
29
public class KeyFrame2D implements IKeyFrame {
30

    
31
        private String name;
32
        private double time;
33
        private  String aliasKeyFrame = "KeyFrame2D";
34

    
35
        ProjectExtent projectExtent = null;
36
        private double valueX;
37
        private double valueY;
38
        private double valueW;
39
        private double valueH;
40

    
41

    
42
        public void CapturesProperties() {
43
                // TODO Auto-generated method stub
44
        }
45

    
46
        public void CapturesProperties(ProjectExtent projectExtent) {
47
                this.projectExtent = projectExtent;
48
        }
49

    
50
        public String getName() {
51
                return this.name;
52
        }
53

    
54
        public List<IKeyFrame> getPropertiesList() {
55
                // TODO Auto-generated method stub
56
                return null;
57
        }
58

    
59
        public void setName(String name) {
60
                this.name = name;
61

    
62
        }
63

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

    
68
        public String toString() {
69
                String result;
70
                result = " keyframe2D:\n";
71
                result += " tiempo: " + this.time;
72
                result += " nombre del extent: " + this.projectExtent.getDescription();
73

    
74
                return result;
75
        }
76

    
77

    
78
        public Object getAnimatedObject() {
79
                return projectExtent;
80
        }
81
        public void setAnimatedObject(Object object) {
82
                this.projectExtent = (ProjectExtent) object;
83
        }
84

    
85
        public double getTime() {
86
                return time;
87
        }
88

    
89
        public void setTime(double time) {
90
                this.time = time;
91
        }
92

    
93
        public String getClassName() {
94
                return this.getClass().getName();
95
        }
96

    
97
        public XMLEntity getXMLEntity() {
98
                XMLEntity xml = new XMLEntity();
99
                
100
                xml.putProperty("className", this.getClassName());
101
                xml.putProperty("keyFrameAlias", aliasKeyFrame);
102
                xml.putProperty("time", time);
103
                
104
                xml.addChild((this.projectExtent).getXMLEntity());
105
                
106
                return xml;
107
        }
108

    
109
        public void setXMLEntity(XMLEntity xml) {
110
                
111
                if (xml.contains("time"))
112
                        this.time = xml.getDoubleProperty("time");
113
                if (xml.contains("keyFrameAlias"))
114
                        this.aliasKeyFrame = xml.getStringProperty("keyFrameAlias");
115
                
116
                XMLEntity xmlProp = xml.getChild(0);
117
                if (xmlProp.contains("extentX")) {
118
                        valueX = xmlProp.getDoubleProperty("extentX");
119
                }
120
                if (xmlProp.contains("extentY")) {
121
                        valueY = xmlProp.getDoubleProperty("extentY");
122
                }
123
                if (xmlProp.contains("extentW")) {
124
                        valueW = xmlProp.getDoubleProperty("extentW");
125
                }
126
                if (xmlProp.contains("extentH")) {
127
                        valueH = xmlProp.getDoubleProperty("extentH");
128
                }
129
                
130
                Rectangle2D rectangle2D = new Rectangle2D.Double(valueX, valueY, valueW, valueH);
131
                this.projectExtent = new ProjectExtent();
132
                this.projectExtent.setExtent(rectangle2D);
133
                
134
        }
135
}