Revision 23224 trunk/libraries/libAnimation2D/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationLayer2D.java
AnimationLayer2D.java | ||
---|---|---|
26 | 26 |
private View view; |
27 | 27 |
private AnimationObject2D animationObject2D = new AnimationObject2D() ; |
28 | 28 |
private String titleWindow; |
29 |
private String nameClassView; |
|
29 |
//private String nameClassView;
|
|
30 | 30 |
|
31 | 31 |
public AnimationLayer2D() { |
32 | 32 |
this.interpolator = new Interpolator2D(); |
... | ... | |
61 | 61 |
// Casting the animated object |
62 | 62 |
KeyFrame2D keyFrame2D = (KeyFrame2D) animated; |
63 | 63 |
// Applies to object |
64 |
//this.view = (View) animationObject2D.getAnimatedObject("view2D"); |
|
64 | 65 |
this.view = (View) this.animationObject2D.getAnimatedView(); |
65 | 66 |
this.view.getMapControl().getViewPort().setExtent( |
66 | 67 |
((ProjectExtent) keyFrame2D.getAnimatedObject()).getExtent()); |
67 | 68 |
// Repainting the object |
68 | 69 |
this.view.getMapControl().drawMap(true); |
69 |
// this.view.repaintMap();
|
|
70 |
//this.view.repaintMap();
|
|
70 | 71 |
} |
71 | 72 |
|
72 | 73 |
public int getTypeTrack() { |
... | ... | |
89 | 90 |
|
90 | 91 |
|
91 | 92 |
public Object getAnimatedObject() { |
92 |
// if view is null. |
|
93 |
if(this.view == null){ |
|
93 |
if(this.animationObject2D != null) { |
|
94 | 94 |
// getting all views. |
95 | 95 |
try{ |
96 | 96 |
IWindow[] viewArray = PluginServices.getMDIManager().getAllWindows(); |
97 | 97 |
for (int i = 0; i < viewArray.length; i++) { |
98 | 98 |
IWindow window = viewArray[i]; |
99 |
if (window.getClass().getName().equals(this.nameClassView)){ |
|
100 |
// get the actual name of the view, and compare it with the view saved in xml. |
|
101 | 99 |
if(window.getWindowInfo().getTitle().equals(this.titleWindow)){ |
102 | 100 |
BaseView newView = (BaseView)window; |
103 | 101 |
this.animationObject2D.setAnimatedView(newView); |
... | ... | |
105 | 103 |
IInterpolatorTimeFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion"); |
106 | 104 |
this.interpolator.setFuntion(funtion); |
107 | 105 |
} |
108 |
//this.view = (View3D)newView; |
|
109 |
} |
|
110 | 106 |
} |
111 | 107 |
}catch(Exception e) { |
112 | 108 |
e.printStackTrace(); |
... | ... | |
116 | 112 |
} |
117 | 113 |
|
118 | 114 |
|
119 |
// public Object getAnimatedObject() { |
|
120 |
// // TODO Auto-generated method stub |
|
121 |
// this.view = (View) this.animationObject2D.getAnimatedView(); |
|
122 |
// return this.view; |
|
123 |
// } |
|
124 |
|
|
125 |
// public void setAnimatedObject(Object object) { |
|
126 |
// this.view = (View) object; |
|
127 |
// |
|
128 |
// } |
|
129 | 115 |
public void setAnimatedObject(Object object) { |
130 |
this.animationObject2D = (AnimationObject2D) object; |
|
116 |
if (object instanceof AnimationObject2D) |
|
117 |
this.animationObject2D = (AnimationObject2D) object; |
|
131 | 118 |
|
132 | 119 |
} |
133 | 120 |
public XMLEntity getXMLEntity() { |
... | ... | |
138 | 125 |
xml.putProperty("className", this.getClassName()); |
139 | 126 |
xml.putProperty("description", description); |
140 | 127 |
xml.putProperty("animationTrackTipe", typeTrack); |
141 |
xml.putProperty("nameClassView", animationObject2D.getNameClassView()); |
|
128 |
// xml.putProperty("nameClassView", animationObject2D.getNameClassView());
|
|
142 | 129 |
myActualView = (View) animationObject2D.getAnimatedView(); |
143 | 130 |
titleWindow = myActualView.getWindowInfo().getTitle(); |
144 | 131 |
xml.putProperty("titleWindow", titleWindow); |
... | ... | |
147 | 134 |
} |
148 | 135 |
|
149 | 136 |
public void setXMLEntity(XMLEntity xml) { |
150 |
// if (xml.contains("className"))
|
|
151 |
// this.className= xml.getStringProperty("className");
|
|
137 |
if (xml.contains("className")) |
|
138 |
this.className= xml.getStringProperty("className"); |
|
152 | 139 |
if (xml.contains("animationTrackTipe")) |
153 | 140 |
this.typeTrack = xml.getIntProperty("animationTrackTipe"); |
154 |
if (xml.contains("nameClassView")) |
|
155 |
this.nameClassView = xml.getStringProperty("nameClassView"); |
|
141 |
// if (xml.contains("nameClassView"))
|
|
142 |
// this.nameClassView = xml.getStringProperty("nameClassView");
|
|
156 | 143 |
if (xml.contains("titleWindow")) |
157 | 144 |
this.titleWindow = xml.getStringProperty("titleWindow"); |
158 | 145 |
|
Also available in: Unified diff