Revision 20201 trunk/libraries/libAnimationCommon/src/main/java/com/iver/cit/gvsig/animation/animationType/AnimationTransparency.java

View differences:

AnimationTransparency.java
1 1
package com.iver.cit.gvsig.animation.animationType;
2 2

  
3
import com.iver.ai2.gvsig3dgui.view.View3D;
4
import com.iver.andami.PluginServices;
5
import com.iver.andami.ui.mdiManager.IWindow;
3 6
import com.iver.cit.gvsig.animation.IAnimationType;
4 7
import com.iver.cit.gvsig.animation.animatedObject.AnimationObjectTransparency;
8
import com.iver.cit.gvsig.animation.animatedObject.IAnimatedObject;
5 9
import com.iver.cit.gvsig.animation.keyFrame.KeyFrameTransparency;
6 10
import com.iver.cit.gvsig.animation.keyframe.IAnimationTypeKeyFrame;
11
import com.iver.cit.gvsig.animation.keyframe.interpolator.FuntionFactory;
7 12
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator;
13
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorTimeFuntion;
8 14
import com.iver.cit.gvsig.fmap.layers.FLyrDefault;
9 15
import com.iver.cit.gvsig.project.documents.view.gui.BaseView;
10 16
import com.iver.utiles.IPersistence;
......
19 25
	private int typeTrack = IAnimationType.TIME_TYPE_TRACK;
20 26
	private IInterpolator interpolator;
21 27
	private BaseView view;
22
	private AnimationObjectTransparency animationObjectTransparency;
28
	String nameView;
29
	//private AnimationObjectTransparency animationObjectTransparency;
30
	private IAnimatedObject animationObjectTransparency = new AnimationObjectTransparency() ;
31
	private String titleWindow;
23 32

  
24 33
	public AnimationTransparency() {
25 34
	}
......
68 77
		
69 78
		layer.setTransparency(trans);		
70 79
		layer.setDirty(true);
71
		//((ViewPort3D)layer.getMapContext().getViewPort()).setDirty(true);
72 80
		layer.getMapContext().invalidate();
73 81
		
74 82
	//	System.err.println("despues: " + System.currentTimeMillis());
......
95 103
	}
96 104

  
97 105
	public Object getAnimatedObject() {
98
		// TODO Auto-generated method stub
106
		if(this.animationObjectTransparency != null){
107
			// getting all views.
108
			try{
109
				IWindow[] viewArray = PluginServices.getMDIManager().getAllWindows();
110
				for (int i = 0; i < viewArray.length; i++) {
111
					IWindow window = viewArray[i];
112
					if (window.getClass().getName().equals(this.nameView)){
113
						// get the actual name of the view, and compare it with the view saved in xml.
114
						if(window.getWindowInfo().getTitle().equals(this.titleWindow)){
115
							BaseView newView = (BaseView)window;
116
							this.animationObjectTransparency.addAnimatedObject("view", newView);
117
//							this.animationObject3DFlat.setAnimatedView(newView);
118
							this.setAnimatedObject(this.animationObjectTransparency);
119
							IInterpolatorTimeFuntion funtion = FuntionFactory.createObject("com.iver.cit.gvsig.animation.keyframe.interpolator.LinearFuntion");
120
							this.interpolator.setFuntion(funtion);
121
						}
122
					}
123
				}
124
			}catch(Exception e) {
125
				e.printStackTrace();
126
			}
127
		}
99 128
		return this.animationObjectTransparency;
100 129
	}
101 130

  
102 131
	public void setAnimatedObject(Object object) {
103
		//this.view = (BaseView) object;
104
		this.animationObjectTransparency = (AnimationObjectTransparency) object;
132
		//this.animationObjectTransparency = (AnimationObjectTransparency) object;
133
		this.animationObjectTransparency = (IAnimatedObject) object;
105 134
	}
106 135

  
107 136
	/*
......
110 139
	
111 140
	public XMLEntity getXMLEntity() {
112 141
		
142
		//View3D myActualView = null;
143
		
113 144
		XMLEntity xml = new XMLEntity();
114 145
		xml.putProperty("className", this.getClassName());
115 146
		xml.putProperty("description", description);
116 147
		xml.putProperty("animationTrackTipe", typeTrack);
117
		xml.putProperty("nameView", animationObjectTransparency.getNameView());
118
		xml.putProperty("nameLayer", animationObjectTransparency.getNameLayer());
148
		//xml.putProperty("nameClassView", animationObjectTransparency.getNameView());
149
		//myActualView = (View3D) animationObjectTransparency.getAnimatedView();
119 150
		
151
		View3D myActualView = (View3D) animationObjectTransparency.getAnimatedObject("view");
152
		xml.putProperty("nameClassView", myActualView.getClass().getName());
153
		
154
		
155
		
156
		titleWindow = myActualView.getWindowInfo().getTitle();
157
		xml.putProperty("titleWindow", titleWindow);
120 158
		xml.addChild(((IPersistence)this.interpolator).getXMLEntity());
121 159
		return xml;
122 160
	}
123 161

  
124 162
	public void setXMLEntity(XMLEntity xml) {
125 163
		
126
		String nameView, nameLayer;
164
		String nameLayer;
127 165
		
128 166
		if (xml.contains("className"))
129 167
			this.className=	xml.getStringProperty("className");
130 168
		if (xml.contains("animationTrackTipe"))
131 169
			this.typeTrack = xml.getIntProperty("animationTrackTipe");
132 170
		if (xml.contains("nameView"))
133
			nameView =	xml.getStringProperty("nameView");
171
			this.nameView =	xml.getStringProperty("nameView");
134 172
		if (xml.contains("nameLayer"))
135 173
			nameLayer =	xml.getStringProperty("nameLayer");
136 174
		

Also available in: Unified diff