Revision 23595 trunk/libraries/libAnimation3D/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationLayer3DFlat.java
AnimationLayer3DFlat.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.animation.animationType; |
|
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 |
*/ |
|
2 | 19 |
|
3 |
//import org.gvsig.gvsig3dgui.view.View3D; |
|
4 | 20 |
|
21 |
package com.iver.cit.gvsig.animation.animationType; |
|
22 |
|
|
5 | 23 |
import org.gvsig.osgvp.viewer.IViewerContainer; |
6 | 24 |
|
7 | 25 |
import com.iver.ai2.gvsig3d.camera.ProjectCamera; |
... | ... | |
27 | 45 |
private String name = "Animacion vista 3D plana"; |
28 | 46 |
private int typeTrack = IAnimationType.TIME_TYPE_TRACK; |
29 | 47 |
private IInterpolator interpolator; |
30 |
// private String nameClassView; |
|
31 | 48 |
|
32 | 49 |
private IAnimatedObject animationObject3DFlat = new AnimationObject3DFlat() ; |
33 | 50 |
private String titleWindow; |
... | ... | |
64 | 81 |
|
65 | 82 |
public void AppliesToObject(Object animated) { |
66 | 83 |
|
67 |
// TODO implementar esta funcion para vistas 3D esfericas. |
|
68 | 84 |
KeyFrame3DFlat keyf = (KeyFrame3DFlat) animated; |
69 | 85 |
ProjectCamera projectCamera = (ProjectCamera) keyf.getAnimatedObject(); |
70 | 86 |
|
71 | 87 |
m_canvas3d = (IViewerContainer) ((AnimationObject3DFlat)animationObject3DFlat).getAnimatedCanvas3D(); |
72 | 88 |
m_canvas3d.getOSGViewer().setCamera(projectCamera.getCamera()); |
73 |
|
|
74 |
// View3D view3D = (View3D) animationObject3DFlat.getAnimatedObject("view"); |
|
75 |
// view3D.setCamera(projectCamera.getCamera()); |
|
76 |
|
|
77 |
// Hud hud = (Hud) view.getCanvas3d().getOSGViewer().getNodeFromHUD(0); |
|
78 |
// hud.setAnimationTime(AnimationPlayer.getCurrentTime()/1000); |
|
79 |
// hud.updateHud(); |
|
80 |
|
|
81 |
|
|
82 |
//view3D.getCanvas3d().repaint(); |
|
89 |
|
|
83 | 90 |
m_canvas3d.repaint(); |
84 | 91 |
} |
85 | 92 |
|
... | ... | |
109 | 116 |
IWindow[] viewArray = PluginServices.getMDIManager().getAllWindows(); |
110 | 117 |
for (int i = 0; i < viewArray.length; i++) { |
111 | 118 |
IWindow window = viewArray[i]; |
112 |
//if the view is a view3D |
|
113 |
//if (window.getClass().getName().equals(this.nameClassView)){ |
|
114 |
// get the actual name of the view, and compare it with the view saved in xml. |
|
115 | 119 |
if(window.getWindowInfo().getTitle().equals(this.titleWindow)){ |
116 | 120 |
BaseView newView = (BaseView)window;// Working with base view |
117 | 121 |
((AnimationObject3DFlat) this.animationObject3DFlat).setAnimatedView(newView); |
... | ... | |
131 | 135 |
public void setAnimatedObject(Object object) { |
132 | 136 |
if (object instanceof AnimationObject3DFlat) |
133 | 137 |
this.animationObject3DFlat = (IAnimatedObject) object; |
134 |
|
|
135 | 138 |
} |
136 | 139 |
|
137 | 140 |
public XMLEntity getXMLEntity() { |
138 | 141 |
|
139 |
|
|
140 | 142 |
XMLEntity xml = new XMLEntity(); |
141 | 143 |
xml.putProperty("className", this.getClassName()); |
142 | 144 |
xml.putProperty("description", description); |
143 | 145 |
xml.putProperty("animationTrackTipe", typeTrack); |
144 | 146 |
|
145 | 147 |
BaseView myActualView = (BaseView) animationObject3DFlat.getAnimatedObject("view"); |
146 |
//xml.putProperty("nameClassView", myActualView.getClass().getName()); |
|
147 | 148 |
|
148 | 149 |
titleWindow = myActualView.getWindowInfo().getTitle(); |
149 | 150 |
xml.putProperty("titleWindow", titleWindow); |
... | ... | |
156 | 157 |
this.className= xml.getStringProperty("className"); |
157 | 158 |
if (xml.contains("animationTrackTipe")) |
158 | 159 |
this.typeTrack = xml.getIntProperty("animationTrackTipe"); |
159 |
// if (xml.contains("nameClassView")) |
|
160 |
// this.nameClassView = xml.getStringProperty("nameClassView"); |
|
161 | 160 |
if (xml.contains("titleWindow")) |
162 | 161 |
this.titleWindow = xml.getStringProperty("titleWindow"); |
163 | 162 |
|
... | ... | |
165 | 164 |
|
166 | 165 |
try { |
167 | 166 |
String class_name = xmlInterpolator.getStringProperty("className"); |
168 |
Class classInterpolator = Class.forName(class_name); |
|
167 |
Class<?> classInterpolator = Class.forName(class_name);
|
|
169 | 168 |
Object obj = classInterpolator .newInstance(); |
170 | 169 |
IPersistence objPersist = (IPersistence) obj; |
171 | 170 |
objPersist.setXMLEntity(xmlInterpolator); |
Also available in: Unified diff