Statistics
| Revision:

svn-gvsig-desktop / import / ext3D / branches / ext3D_v1.1 / libAnimation / src / com / iver / cit / gvsig / animation / interval / AnimationDatedInterval.java @ 15445

History | View | Annotate | Download (3.09 KB)

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

    
3
import java.sql.Date;
4
import java.text.SimpleDateFormat;
5
import com.iver.utiles.DateTime;
6
import com.iver.cit.gvsig.animation.IAnimationType;
7

    
8
import com.iver.utiles.IPersistance;
9
import com.iver.utiles.XMLEntity;
10

    
11
public class AnimationDatedInterval implements IAnimationInterval, IPersistance {
12

    
13
        private Date beginDateInterval;
14

    
15
        private Date endDateInterval;
16
        
17
        private        String beginDateString = new String();
18
        
19
        private String endDateString = new String();
20

    
21
        private String sFormat = new String( "Y-m-d" );
22

    
23
        private String className;
24
        
25
        static final SimpleDateFormat sdf = new SimpleDateFormat( "dd/MM/yyyy" );
26
        
27

    
28
        public Date getBeginDateInterval() {
29
                return beginDateInterval;
30
        }
31

    
32
        public void setBeginDateInterval(Date beginDateInterval) {
33
                this.beginDateInterval = beginDateInterval;
34
        }
35

    
36
        public Date getEndDateInterval() {
37
                return endDateInterval;
38
        }
39

    
40
        public void setEndDateInterval(Date endDateInterval) {
41
                this.endDateInterval = endDateInterval;
42
        }
43

    
44
        public String toString() {
45
                String result = "Intervalo de " + this.beginDateInterval + " a "
46
                                + this.endDateInterval;
47
                return result;
48
        }
49

    
50
        public double getEndTime() {
51
                return this.endDateInterval.getTime();
52
        }
53

    
54
        public double getInitialTime() {
55
                return this.beginDateInterval.getTime();
56
        }
57

    
58
        public double getIntervalTime() {
59
                return (this.endDateInterval.getTime() - this.beginDateInterval
60
                                .getTime());
61
        }
62

    
63
        public void setEndTime(double time) {
64
                this.endDateInterval.setTime((long) time);
65

    
66
        }
67

    
68
        public void setInitialTime(double time) {
69
                this.beginDateInterval.setTime((long) time);
70

    
71
        }
72

    
73
        public void setIntervalTime(double time) {
74
                // TODO generate method to calculate interval time
75

    
76
        }
77

    
78
        public void Apply(double tini, double tend, IAnimationType animationType, Object animated) {
79
                // TODO Auto-generated method stub
80
                
81
        }
82

    
83
        public void apply(double tini, double tend, IAnimationType animationType, Object animated) {
84
                // falta completar la funcion 
85
                System.out.println("PINTANDO OBJETO");
86
//                animationType.AppliesToObject(animated);
87
                
88
        }
89

    
90
        
91
        /*         
92
         * IPersistance methods.
93
         */
94

    
95
        public String getClassName() {
96
                // TODO Auto-generated method stub
97
                return null;
98
        }
99
        
100
        public XMLEntity getXMLEntity() {
101
                
102
                XMLEntity xml = new XMLEntity();
103
                xml.putProperty("className", this.getClassName());                                
104
        //        xml.putProperty("beginDateInterval", beginDateString);
105
        //        xml.putProperty("endDateInterval", endDateString);
106
                
107
                beginDateString = DateTime.dateToString(beginDateInterval, sFormat);
108
                endDateString = DateTime.dateToString(endDateInterval, sFormat);
109
                
110
                xml.putProperty("begin_date", beginDateString);
111
                xml.putProperty("end_date", endDateString);
112
                
113
                
114
                return xml;
115
        }
116

    
117
        public void setXMLEntity(XMLEntity xml) {
118
                
119
                
120
                if (xml.contains("class_name"))
121
                        className =        xml.getStringProperty("class_name");
122
                if (xml.contains("begin_date"))
123
                        beginDateString = xml.getStringProperty("begin_date");
124
                if (xml.contains("end_date"))
125
                        endDateString = xml.getStringProperty("end_date");
126
                
127
        }
128
}