root / trunk / libraries / libAnimation2D / src / main / java / com / iver / cit / gvsig / animation / keyFrame / KeyFrame2D.java @ 25868
History | View | Annotate | Download (3.64 KB)
1 | 23597 | afraile | /* 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 | 20149 | jcampos | package com.iver.cit.gvsig.animation.keyFrame; |
21 | |||
22 | 23224 | afraile | import java.awt.geom.Rectangle2D; |
23 | 20149 | jcampos | 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 | 25868 | afraile | /**
|
30 | * @author ?ngel Fraile Gri??n e-mail: angel.fraile@iver.es
|
||
31 | * @since 1.1
|
||
32 | *
|
||
33 | */
|
||
34 | 20149 | jcampos | public class KeyFrame2D implements IKeyFrame { |
35 | |||
36 | private String name; |
||
37 | private double time; |
||
38 | 23224 | afraile | private String aliasKeyFrame = "KeyFrame2D"; |
39 | 20149 | jcampos | |
40 | ProjectExtent projectExtent = null;
|
||
41 | 23224 | afraile | private double valueX; |
42 | private double valueY; |
||
43 | private double valueW; |
||
44 | private double valueH; |
||
45 | 20149 | jcampos | |
46 | |||
47 | public void CapturesProperties() { |
||
48 | // TODO Auto-generated method stub
|
||
49 | } |
||
50 | |||
51 | public void CapturesProperties(ProjectExtent projectExtent) { |
||
52 | this.projectExtent = projectExtent;
|
||
53 | } |
||
54 | |||
55 | public String getName() { |
||
56 | return this.name; |
||
57 | } |
||
58 | |||
59 | 23597 | afraile | public List<IKeyFrame> getPropertiesList() { |
60 | 20149 | jcampos | // TODO Auto-generated method stub
|
61 | return null; |
||
62 | } |
||
63 | |||
64 | public void setName(String name) { |
||
65 | this.name = name;
|
||
66 | |||
67 | } |
||
68 | |||
69 | 23597 | afraile | public void setPropertiesList(List<IKeyFrame> list) { |
70 | 20149 | jcampos | // TODO Auto-generated method stub
|
71 | } |
||
72 | |||
73 | public String toString() { |
||
74 | String result;
|
||
75 | result = " keyframe2D:\n";
|
||
76 | result += " tiempo: " + this.time; |
||
77 | result += " nombre del extent: " + this.projectExtent.getDescription(); |
||
78 | |||
79 | return result;
|
||
80 | } |
||
81 | |||
82 | |||
83 | public Object getAnimatedObject() { |
||
84 | return projectExtent;
|
||
85 | } |
||
86 | public void setAnimatedObject(Object object) { |
||
87 | this.projectExtent = (ProjectExtent) object;
|
||
88 | } |
||
89 | |||
90 | public double getTime() { |
||
91 | return time;
|
||
92 | } |
||
93 | |||
94 | public void setTime(double time) { |
||
95 | this.time = time;
|
||
96 | } |
||
97 | |||
98 | public String getClassName() { |
||
99 | return this.getClass().getName(); |
||
100 | } |
||
101 | |||
102 | public XMLEntity getXMLEntity() {
|
||
103 | XMLEntity xml = new XMLEntity();
|
||
104 | |||
105 | xml.putProperty("className", this.getClassName()); |
||
106 | 23224 | afraile | xml.putProperty("keyFrameAlias", aliasKeyFrame);
|
107 | 20149 | jcampos | xml.putProperty("time", time);
|
108 | |||
109 | xml.addChild((this.projectExtent).getXMLEntity());
|
||
110 | |||
111 | return xml;
|
||
112 | } |
||
113 | |||
114 | public void setXMLEntity(XMLEntity xml) { |
||
115 | |||
116 | if (xml.contains("time")) |
||
117 | this.time = xml.getDoubleProperty("time"); |
||
118 | 23224 | afraile | if (xml.contains("keyFrameAlias")) |
119 | this.aliasKeyFrame = xml.getStringProperty("keyFrameAlias"); |
||
120 | 20149 | jcampos | |
121 | XMLEntity xmlProp = xml.getChild(0);
|
||
122 | 23224 | afraile | if (xmlProp.contains("extentX")) { |
123 | valueX = xmlProp.getDoubleProperty("extentX");
|
||
124 | 20149 | jcampos | } |
125 | 23224 | afraile | if (xmlProp.contains("extentY")) { |
126 | valueY = xmlProp.getDoubleProperty("extentY");
|
||
127 | } |
||
128 | if (xmlProp.contains("extentW")) { |
||
129 | valueW = xmlProp.getDoubleProperty("extentW");
|
||
130 | } |
||
131 | if (xmlProp.contains("extentH")) { |
||
132 | valueH = xmlProp.getDoubleProperty("extentH");
|
||
133 | } |
||
134 | 20149 | jcampos | |
135 | 23224 | afraile | Rectangle2D rectangle2D = new Rectangle2D.Double(valueX, valueY, valueW, valueH); |
136 | this.projectExtent = new ProjectExtent(); |
||
137 | this.projectExtent.setExtent(rectangle2D);
|
||
138 | 20149 | jcampos | |
139 | } |
||
140 | } |