Revision 684
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/DefaultAnimatorWrapper.java | ||
---|---|---|
1 |
package org.gvsig.animation3d.swing.impl; |
|
2 |
|
|
3 |
import org.gvsig.animation3d.swing.api.Animator; |
|
4 |
|
|
5 |
|
|
6 |
/** |
|
7 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
|
8 |
* |
|
9 |
*/ |
|
10 |
public class DefaultAnimatorWrapper implements Animator { |
|
11 |
|
|
12 |
private gov.nasa.worldwind.animation.Animator wwAnimator; |
|
13 |
|
|
14 |
/** |
|
15 |
* @param wwAnimator |
|
16 |
*/ |
|
17 |
public DefaultAnimatorWrapper(gov.nasa.worldwind.animation.Animator wwAnimator) { |
|
18 |
this.wwAnimator = wwAnimator; |
|
19 |
} |
|
20 |
|
|
21 |
@Override |
|
22 |
public void next() { |
|
23 |
this.wwAnimator.next(); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public void start() { |
|
28 |
this.wwAnimator.start(); |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public void stop() { |
|
33 |
this.wwAnimator.stop(); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public boolean hasNext() { |
|
38 |
return this.wwAnimator.hasNext(); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public void set(double interpolant) { |
|
43 |
this.wwAnimator.set(interpolant); |
|
44 |
} |
|
45 |
|
|
46 |
} |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/DefaultWWAnimationWrapper.java | ||
---|---|---|
1 |
package org.gvsig.animation3d.swing.impl; |
|
2 |
|
|
3 |
import gov.nasa.worldwind.animation.Animator; |
|
4 |
|
|
5 |
/** |
|
6 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
|
7 |
* |
|
8 |
*/ |
|
9 |
public class DefaultWWAnimationWrapper implements Animator { |
|
10 |
|
|
11 |
private org.gvsig.animation3d.swing.api.Animator animator; |
|
12 |
|
|
13 |
/** |
|
14 |
* @param animator |
|
15 |
*/ |
|
16 |
public DefaultWWAnimationWrapper(org.gvsig.animation3d.swing.api.Animator animator) { |
|
17 |
this.animator = animator; |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
public void next() { |
|
22 |
this.animator.next(); |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void start() { |
|
27 |
this.animator.start(); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public void stop() { |
|
32 |
this.animator.stop(); |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public boolean hasNext() { |
|
37 |
return this.animator.hasNext(); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public void set(double interpolant) { |
|
42 |
this.animator.set(interpolant); |
|
43 |
} |
|
44 |
|
|
45 |
} |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/DefaultAnimation3DSwingManager.java | ||
---|---|---|
1 | 1 |
package org.gvsig.animation3d.swing.impl; |
2 | 2 |
|
3 |
import gov.nasa.worldwind.View; |
|
4 |
import gov.nasa.worldwind.WorldWind; |
|
5 |
import gov.nasa.worldwind.animation.AnimationSupport; |
|
6 |
import gov.nasa.worldwind.avlist.AVKey; |
|
7 |
import gov.nasa.worldwind.awt.WorldWindowGLJPanel; |
|
8 |
import gov.nasa.worldwind.geom.Angle; |
|
9 |
import gov.nasa.worldwind.geom.LatLon; |
|
10 |
import gov.nasa.worldwind.geom.Position; |
|
11 |
import gov.nasa.worldwind.view.orbit.FlyToOrbitViewAnimator; |
|
12 |
import gov.nasa.worldwind.view.orbit.OrbitView; |
|
13 |
|
|
3 | 14 |
import java.util.ArrayList; |
4 | 15 |
import java.util.Collection; |
5 | 16 |
import java.util.List; |
... | ... | |
8 | 19 |
import org.gvsig.animation3d.swing.api.Animation3D; |
9 | 20 |
import org.gvsig.animation3d.swing.api.Animation3DPanel; |
10 | 21 |
import org.gvsig.animation3d.swing.api.Animation3DSwingManager; |
22 |
import org.gvsig.animation3d.swing.api.Animator; |
|
11 | 23 |
import org.gvsig.animation3d.swing.api.Frame3D; |
12 | 24 |
import org.gvsig.animation3d.swing.api.Frame3DCreationException; |
13 | 25 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
... | ... | |
17 | 29 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
18 | 30 |
import org.gvsig.tools.persistence.impl.DelegatedList; |
19 | 31 |
import org.gvsig.view3d.swing.api.MapControl3D; |
20 |
import org.gvsig.view3d.swing.api.ViewPort3D; |
|
21 | 32 |
|
22 | 33 |
/** |
23 | 34 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
... | ... | |
51 | 62 |
} |
52 | 63 |
|
53 | 64 |
@Override |
54 |
public Frame3D getFrame3D(String name, MapControl3D mapControl3D)
|
|
65 |
public Frame3D createFrame3D(String name, MapControl3D mapControl3D)
|
|
55 | 66 |
throws Frame3DCreationException { |
56 |
|
|
57 |
ViewPort3D viewport = mapControl3D.getViewPort(); |
|
58 |
double heading = viewport.getHeading(); |
|
59 |
double pitch = viewport.getPitch(); |
|
60 |
double elevation = viewport.getElevation(); |
|
61 |
double zoom = viewport.getZoom(); |
|
62 | 67 |
|
68 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
69 |
double heading = orbitView.getHeading().getDegrees(); |
|
70 |
double pitch = orbitView.getPitch().getDegrees(); |
|
71 |
double elevation = orbitView.getCenterPosition().getElevation(); |
|
72 |
double zoom = orbitView.getZoom(); |
|
73 |
|
|
63 | 74 |
Point position = null; |
64 |
double x = viewport.getCenterPosition().getX();
|
|
65 |
double y = viewport.getCenterPosition().getY();
|
|
75 |
double x = orbitView.getCenterPosition().getLongitude().getDegrees();
|
|
76 |
double y = orbitView.getCenterPosition().getLatitude().getDegrees();
|
|
66 | 77 |
try { |
67 | 78 |
position = GeometryLocator.getGeometryManager().createPoint(x, y, SUBTYPES.GEOM2D); |
68 | 79 |
} catch (CreateGeometryException e) { |
... | ... | |
75 | 86 |
return createFrame3D(name, heading, pitch, elevation, position, zoom); |
76 | 87 |
} |
77 | 88 |
|
78 |
@Override |
|
79 | 89 |
public Frame3D createFrame3D(String name, double heading, double pitch, double elevation, |
80 | 90 |
Point position, double zoom) { |
81 | 91 |
return new DefaultFrame3D(name, heading, pitch, elevation, position, zoom); |
... | ... | |
88 | 98 |
} |
89 | 99 |
|
90 | 100 |
@Override |
91 |
public Animation3DPanel createAnimationManager(Map<String, ExtendedPropertiesSupport> properties) {
|
|
101 |
public Animation3DPanel createAnimationPanel(Map<String, ExtendedPropertiesSupport> properties) {
|
|
92 | 102 |
return new DefaultAnimation3DPanelController(properties); |
93 | 103 |
} |
94 | 104 |
|
95 |
// @Override |
|
96 |
// public void goTo(Frame3D frame) { |
|
97 |
// |
|
98 |
// Globe globe = this.getWwd().getView().getGlobe(); |
|
99 |
// OrbitView view = (OrbitView) this.getWwd().getView(); |
|
100 |
// view.stopAnimations(); |
|
101 |
// |
|
102 |
// double longitude = frame.getPosition().getX(); |
|
103 |
// double latitude = frame.getPosition().getY(); |
|
104 |
// Position lookFromPos = |
|
105 |
// new Position(LatLon.fromDegrees(latitude, longitude), globe.getElevation( |
|
106 |
// Angle.fromDegreesLatitude(latitude), |
|
107 |
// Angle.fromDegreesLongitude(longitude)) |
|
108 |
// + frame.getElevation()); |
|
109 |
// |
|
110 |
// final long MIN_LENGTH_MILLIS = 4000; |
|
111 |
// final long MAX_LENGTH_MILLIS = 14000; |
|
112 |
// long timeToMove = |
|
113 |
// AnimationSupport.getScaledTimeMillisecs(view.getEyePosition(), |
|
114 |
// lookFromPos, |
|
115 |
// MIN_LENGTH_MILLIS, MAX_LENGTH_MILLIS); |
|
116 |
// |
|
117 |
// Animator animator = |
|
118 |
// FlyToOrbitViewAnimator.createFlyToOrbitViewAnimator(view, |
|
119 |
// view.getCenterPosition(), |
|
120 |
// lookFromPos, view.getHeading(), Angle.fromDegrees(frame.getHeading()), |
|
121 |
// view.getPitch(), Angle.fromDegrees(frame.getPitch()), view.getZoom(), |
|
122 |
// frame.getZoom(), timeToMove, WorldWind.ABSOLUTE); |
|
123 |
// view.addAnimator(animator); |
|
124 |
// view.firePropertyChange(AVKey.VIEW, null, this.getWwd().getView()); |
|
125 |
// } |
|
126 |
// |
|
127 |
// @Override |
|
128 |
// public void goTo(List<Frame3D> frames) { |
|
129 |
// View view = this.getWwd().getView(); |
|
130 |
// view.stopAnimations(); |
|
131 |
// |
|
132 |
// Animator animator = null; |
|
133 |
// if (view instanceof OrbitView) { |
|
134 |
// animator = new MultipleFlyToOrbitViewAnimator((OrbitView) view, frames); |
|
135 |
// } |
|
136 |
// |
|
137 |
// view.addAnimator(animator); |
|
138 |
// view.firePropertyChange(AVKey.VIEW, null, this.getWwd().getView()); |
|
139 |
// } |
|
105 |
@Override |
|
106 |
public Animator createGoToAnimator(MapControl3D mapControl3D, Frame3D frame, |
|
107 |
final long minMillis, final long maxMillis) { |
|
108 |
|
|
109 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
110 |
double longitude = frame.getPosition().getX(); |
|
111 |
double latitude = frame.getPosition().getY(); |
|
112 |
Position endPos = |
|
113 |
new Position(LatLon.fromDegrees(latitude, longitude), frame.getElevation()); |
|
114 |
|
|
115 |
Position beginPos = |
|
116 |
Position.fromDegrees(orbitView.getCenterPosition().getLatitude().getDegrees(), |
|
117 |
orbitView.getCenterPosition().getLongitude().getDegrees(), orbitView |
|
118 |
.getCenterPosition().getElevation()); |
|
119 |
long timeToMove = |
|
120 |
AnimationSupport.getScaledTimeMillisecs(beginPos, endPos, minMillis, maxMillis); |
|
121 |
|
|
122 |
gov.nasa.worldwind.animation.Animator animator = |
|
123 |
FlyToOrbitViewAnimator.createFlyToOrbitViewAnimator(orbitView, beginPos, endPos, |
|
124 |
orbitView.getHeading(), Angle.fromDegrees(frame.getHeading()), |
|
125 |
orbitView.getPitch(), Angle.fromDegrees(frame.getPitch()), orbitView.getZoom(), |
|
126 |
frame.getZoom(), timeToMove, WorldWind.ABSOLUTE); |
|
127 |
return new DefaultAnimatorWrapper(animator); |
|
128 |
} |
|
129 |
|
|
130 |
@Override |
|
131 |
public Animator createGoToAnimator(MapControl3D mapControl3D, List<Frame3D> frames, |
|
132 |
long minMillis, long maxMillis) { |
|
133 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
134 |
gov.nasa.worldwind.animation.Animator animator = |
|
135 |
new MultipleFlyToOrbitViewAnimator(orbitView, frames, minMillis, maxMillis); |
|
136 |
return new DefaultAnimatorWrapper(animator); |
|
137 |
} |
|
138 |
|
|
139 |
@Override |
|
140 |
public void addAnimator(MapControl3D mapControl3D, Animator animator) { |
|
141 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
142 |
orbitView.addAnimator(new DefaultWWAnimationWrapper(animator)); |
|
143 |
orbitView.firePropertyChange(AVKey.VIEW, null, orbitView); |
|
144 |
} |
|
145 |
|
|
146 |
@Override |
|
147 |
public boolean isAnimating(MapControl3D mapControl3D) { |
|
148 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
149 |
return orbitView.isAnimating(); |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public void stopAnimations(MapControl3D mapControl3D) { |
|
154 |
OrbitView orbitView = getOrbitView(mapControl3D); |
|
155 |
orbitView.stopAnimations(); |
|
156 |
} |
|
157 |
|
|
158 |
private OrbitView getOrbitView(MapControl3D mapControl3D) { |
|
159 |
Object underLineComponent = mapControl3D.getUnderLineComponent(); |
|
160 |
if (underLineComponent instanceof WorldWindowGLJPanel) { |
|
161 |
WorldWindowGLJPanel wwd = (WorldWindowGLJPanel) underLineComponent; |
|
162 |
View view = wwd.getView(); |
|
163 |
if (view instanceof OrbitView) { |
|
164 |
return (OrbitView) view; |
|
165 |
} |
|
166 |
} |
|
167 |
throw new IllegalArgumentException( |
|
168 |
"Can not get WorldWind view from under line MapControl3D component"); |
|
169 |
} |
|
140 | 170 |
} |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/DefaultAnimation3DPanelController.java | ||
---|---|---|
23 | 23 |
import org.gvsig.animation3d.swing.api.Animation3DPanel; |
24 | 24 |
import org.gvsig.animation3d.swing.api.Animation3DSwingLocator; |
25 | 25 |
import org.gvsig.animation3d.swing.api.Animation3DSwingManager; |
26 |
import org.gvsig.animation3d.swing.api.Animator; |
|
26 | 27 |
import org.gvsig.animation3d.swing.api.Frame3D; |
27 | 28 |
import org.gvsig.animation3d.swing.api.Frame3DCreationException; |
28 | 29 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
... | ... | |
124 | 125 |
if (!animations.getSelectionModel().isSelectionEmpty()) { |
125 | 126 |
// Add frames 3D to table |
126 | 127 |
int selectedRow = animations.getSelectedRow(); |
127 |
DefaultAnimation3DTableModel model = (DefaultAnimation3DTableModel) animations.getModel(); |
|
128 |
DefaultAnimation3DTableModel model = |
|
129 |
(DefaultAnimation3DTableModel) animations.getModel(); |
|
128 | 130 |
Animation3D animation = model.getAnimation(selectedRow); |
129 | 131 |
initFramesTable(animation); |
130 | 132 |
|
... | ... | |
211 | 213 |
|
212 | 214 |
@Override |
213 | 215 |
public void actionPerformed(ActionEvent e) { |
214 |
doCenterFrameAction();
|
|
216 |
doZoomToFrameAction();
|
|
215 | 217 |
|
216 | 218 |
} |
217 | 219 |
}); |
... | ... | |
290 | 292 |
Frame3D newFrame3d = null; |
291 | 293 |
try { |
292 | 294 |
Animation3DSwingManager manager = Animation3DSwingLocator.getManager(); |
293 |
newFrame3d = manager.getFrame3D(name, mapControl3D);
|
|
295 |
newFrame3d = manager.createFrame3D(name, mapControl3D);
|
|
294 | 296 |
} catch (Frame3DCreationException e) { |
295 | 297 |
LOG.error("Error getting frame 3D", e); |
296 | 298 |
ThreadSafeDialogsManager dialogsManager = |
... | ... | |
383 | 385 |
|
384 | 386 |
} |
385 | 387 |
|
386 |
protected void doCenterFrameAction() {
|
|
388 |
protected void doZoomToFrameAction() {
|
|
387 | 389 |
if (this.frames.getSelectionModel().isSelectionEmpty()) { |
388 | 390 |
return; |
389 | 391 |
} |
... | ... | |
404 | 406 |
return; |
405 | 407 |
} |
406 | 408 |
|
407 |
// mapControl3D.goTo(frame); |
|
408 |
//TODO |
|
409 |
Animation3DSwingManager manager = Animation3DSwingLocator.getManager(); |
|
410 |
Animator goToAnimator = |
|
411 |
manager.createGoToAnimator(mapControl3D, frame, 4000, 16000); |
|
412 |
manager.addAnimator(mapControl3D, goToAnimator); |
|
409 | 413 |
} |
410 | 414 |
|
411 | 415 |
private void initAnimationsTable() { |
... | ... | |
560 | 564 |
} |
561 | 565 |
|
562 | 566 |
int selectedRow = this.animations.getSelectedRow(); |
563 |
DefaultAnimation3DTableModel model = (DefaultAnimation3DTableModel) this.animations.getModel(); |
|
567 |
DefaultAnimation3DTableModel model = |
|
568 |
(DefaultAnimation3DTableModel) this.animations.getModel(); |
|
564 | 569 |
Animation3D animation = model.getAnimation(selectedRow); |
565 | 570 |
List<Frame3D> frames = null; |
566 | 571 |
if (sphericalOption.isSelected()) { |
... | ... | |
568 | 573 |
} else { |
569 | 574 |
frames = animation.getFlatFrames(); |
570 | 575 |
} |
571 |
//mapControl3D.goTo(new ArrayList<Frame3D>(frames)); |
|
572 |
//TODO |
|
576 |
|
|
577 |
Animation3DSwingManager manager = Animation3DSwingLocator.getManager(); |
|
578 |
Animator goToAnimator = |
|
579 |
manager.createGoToAnimator(mapControl3D, frames, 4000, 16000); |
|
580 |
manager.addAnimator(mapControl3D, goToAnimator); |
|
573 | 581 |
} |
574 | 582 |
|
575 | 583 |
protected void doAddAnimation() { |
... | ... | |
580 | 588 |
new String[] { String.valueOf(animations.getRowCount()) }); |
581 | 589 |
Animation3D newAnimation = |
582 | 590 |
manager.createAnimation3D(name, new ArrayList<Frame3D>(), new ArrayList<Frame3D>()); |
583 |
DefaultAnimation3DTableModel tableModel = (DefaultAnimation3DTableModel) animations.getModel(); |
|
591 |
DefaultAnimation3DTableModel tableModel = |
|
592 |
(DefaultAnimation3DTableModel) animations.getModel(); |
|
584 | 593 |
tableModel.addAnimation(newAnimation); |
585 | 594 |
} |
586 | 595 |
|
... | ... | |
589 | 598 |
return; |
590 | 599 |
} |
591 | 600 |
int selectedRow = animations.getSelectedRow(); |
592 |
DefaultAnimation3DTableModel tableModel = (DefaultAnimation3DTableModel) animations.getModel(); |
|
601 |
DefaultAnimation3DTableModel tableModel = |
|
602 |
(DefaultAnimation3DTableModel) animations.getModel(); |
|
593 | 603 |
tableModel.removeAnimation(selectedRow); |
594 | 604 |
|
595 | 605 |
frames.setModel(new DefaultTableModel(0, 0)); |
... | ... | |
622 | 632 |
ExtendedPropertiesSupport viewProperties = views.get(viewName); |
623 | 633 |
Animation3DSwingManager manager = Animation3DSwingLocator.getManager(); |
624 | 634 |
List<Animation3D> animations = manager.getAnimations(viewProperties); |
625 |
DefaultAnimation3DTableModel animationTableModel = new DefaultAnimation3DTableModel(animations); |
|
635 |
DefaultAnimation3DTableModel animationTableModel = |
|
636 |
new DefaultAnimation3DTableModel(animations); |
|
626 | 637 |
this.animations.setModel(animationTableModel); |
627 | 638 |
this.addAnimation.setEnabled(true); |
628 | 639 |
removeAnimation.setEnabled(false); |
... | ... | |
686 | 697 |
return new Dimension(510, 530); |
687 | 698 |
} |
688 | 699 |
|
700 |
@SuppressWarnings("unchecked") |
|
689 | 701 |
@Override |
690 | 702 |
public void addViewDocument(String name, ExtendedPropertiesSupport viewDocument) { |
691 | 703 |
this.views.put(name, viewDocument); |
... | ... | |
698 | 710 |
this.viewsCombo.removeItem(name); |
699 | 711 |
} |
700 | 712 |
|
713 |
@SuppressWarnings("unchecked") |
|
701 | 714 |
@Override |
702 | 715 |
public void changeViewDocumentName(String oldValue, String newValue) { |
703 | 716 |
ExtendedPropertiesSupport viewDocument = this.views.remove(oldValue); |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.impl/src/main/java/org/gvsig/animation3d/swing/impl/MultipleFlyToOrbitViewAnimator.java | ||
---|---|---|
29 | 29 |
*/ |
30 | 30 |
public class MultipleFlyToOrbitViewAnimator extends CompoundAnimator { |
31 | 31 |
|
32 |
private final long DEFAULT_MIN_MILLIS = 4000; |
|
33 |
private final long DEFAULT_MAX_MILLIS = 14000; |
|
34 |
|
|
32 | 35 |
private List<Frame3D> frames; |
33 | 36 |
private int index; |
34 | 37 |
private OrbitView orbitView; |
38 |
private long minMillis; |
|
39 |
private long maxMillis; |
|
35 | 40 |
|
36 | 41 |
/** |
37 | 42 |
* @param orbitView |
... | ... | |
42 | 47 |
this.orbitView = orbitView; |
43 | 48 |
this.frames = frames; |
44 | 49 |
this.index = 0; |
50 |
this.minMillis = DEFAULT_MIN_MILLIS; |
|
51 |
this.maxMillis = DEFAULT_MAX_MILLIS; |
|
45 | 52 |
setFrame(frames.get(index)); |
46 | 53 |
} |
47 | 54 |
|
55 |
/** |
|
56 |
* |
|
57 |
* @param orbitView |
|
58 |
* @param frames |
|
59 |
* @param minMillis |
|
60 |
* @param maxMillis |
|
61 |
*/ |
|
62 |
public MultipleFlyToOrbitViewAnimator(OrbitView orbitView, List<Frame3D> frames, |
|
63 |
long minMillis, long maxMillis) { |
|
64 |
this(orbitView, frames); |
|
65 |
this.minMillis = minMillis; |
|
66 |
this.maxMillis = maxMillis; |
|
67 |
setFrame(frames.get(index)); |
|
68 |
} |
|
69 |
|
|
48 | 70 |
@Override |
49 | 71 |
protected void setImpl(double interpolant) { |
50 | 72 |
boolean allStopped = true; |
... | ... | |
77 | 99 |
Angle newPitch = Angle.fromDegrees(frame.getPitch()); |
78 | 100 |
|
79 | 101 |
long timeToMove = |
80 |
AnimationSupport.getScaledTimeMillisecs(orbitView.getEyePosition(), newCenterPos, 4000,
|
|
81 |
14000);
|
|
102 |
AnimationSupport.getScaledTimeMillisecs(orbitView.getEyePosition(), newCenterPos, |
|
103 |
minMillis, maxMillis);
|
|
82 | 104 |
|
83 | 105 |
interpolator = new ScheduledInterpolator(timeToMove); |
84 | 106 |
|
85 | 107 |
animators = |
86 | 108 |
createAnimators(orbitView, orbitView.getCenterPosition(), newCenterPos, |
87 | 109 |
orbitView.getHeading(), newHeading, orbitView.getPitch(), newPitch, |
88 |
orbitView.getZoom(), frame.getZoom(), timeToMove, |
|
89 |
WorldWind.ABSOLUTE); |
|
110 |
orbitView.getZoom(), frame.getZoom(), timeToMove, WorldWind.ABSOLUTE); |
|
90 | 111 |
} |
91 | 112 |
|
92 | 113 |
private Animator[] createAnimators(OrbitView orbitView, Position beginCenterPos, |
... | ... | |
97 | 118 |
new OnSurfacePositionAnimator(orbitView.getGlobe(), new ScheduledInterpolator( |
98 | 119 |
timeToMove), beginCenterPos, endCenterPos, |
99 | 120 |
OrbitViewPropertyAccessor.createCenterPositionAccessor(orbitView), altitudeMode); |
100 |
|
|
121 |
|
|
101 | 122 |
// Create an elevation animator with ABSOLUTE altitude mode because the |
102 | 123 |
// OrbitView altitude mode applies to the |
103 | 124 |
// center position, not the zoom. |
... | ... | |
105 | 126 |
new ViewElevationAnimator(orbitView.getGlobe(), beginZoom, endZoom, beginCenterPos, |
106 | 127 |
endCenterPos, WorldWind.ABSOLUTE, |
107 | 128 |
OrbitViewPropertyAccessor.createZoomAccessor(orbitView)); |
108 |
|
|
129 |
|
|
109 | 130 |
centerAnimator.useMidZoom = zoomAnimator.getUseMidZoom(); |
110 | 131 |
|
111 | 132 |
AngleAnimator headingAnimator = |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.api/src/main/java/org/gvsig/animation3d/swing/api/Animation3DSwingManager.java | ||
---|---|---|
33 | 33 |
* @param name |
34 | 34 |
* @param mapControl3D |
35 | 35 |
* @return frame3d |
36 |
* @throws Frame3DCreationException
|
|
36 |
* @throws Frame3DCreationException |
|
37 | 37 |
*/ |
38 |
public Frame3D getFrame3D(String name, MapControl3D mapControl3D) throws Frame3DCreationException; |
|
38 |
public Frame3D createFrame3D(String name, MapControl3D mapControl3D) |
|
39 |
throws Frame3DCreationException; |
|
39 | 40 |
|
40 | 41 |
/** |
41 | 42 |
* Creates new instance of {@link Animation3D} with name and {@link Frame3D} |
... | ... | |
73 | 74 |
public void setAnimations(ExtendedPropertiesSupport properties, List<Animation3D> animations); |
74 | 75 |
|
75 | 76 |
/** |
76 |
* Creates an animation manager panel to manager view 3D animations
|
|
77 |
* Creates an animation panel to manager view 3D animations |
|
77 | 78 |
* |
78 | 79 |
* @param properties |
79 | 80 |
* |
80 |
* @return An instance of Animation manager panel
|
|
81 |
* @return An instance of Animation panel |
|
81 | 82 |
*/ |
82 |
public Animation3DPanel createAnimationManager(Map<String, ExtendedPropertiesSupport> properties); |
|
83 |
public Animation3DPanel createAnimationPanel(Map<String, ExtendedPropertiesSupport> properties); |
|
84 |
|
|
85 |
/** |
|
86 |
* |
|
87 |
* @param mapControl3D |
|
88 |
* @param frame |
|
89 |
* @param minMillis |
|
90 |
* @param maxMillis |
|
91 |
* @return animator |
|
92 |
*/ |
|
93 |
public Animator createGoToAnimator(MapControl3D mapControl3D, Frame3D frame, |
|
94 |
final long minMillis, final long maxMillis); |
|
95 |
|
|
96 |
/** |
|
97 |
* |
|
98 |
* @param mapControl3D |
|
99 |
* @param frames |
|
100 |
* @param minMillis |
|
101 |
* @param maxMillis |
|
102 |
* @return animator |
|
103 |
*/ |
|
104 |
public Animator createGoToAnimator(MapControl3D mapControl3D, List<Frame3D> frames, |
|
105 |
final long minMillis, final long maxMillis); |
|
106 |
|
|
107 |
/** |
|
108 |
* |
|
109 |
* @param mapControl3D |
|
110 |
* @param goToAnimator |
|
111 |
*/ |
|
112 |
public void addAnimator(MapControl3D mapControl3D, Animator goToAnimator); |
|
113 |
|
|
114 |
/** |
|
115 |
* |
|
116 |
* @param mapControl3D |
|
117 |
*/ |
|
118 |
public void stopAnimations(MapControl3D mapControl3D); |
|
119 |
|
|
120 |
/** |
|
121 |
* |
|
122 |
* @param mapControl3D |
|
123 |
* @return boolean |
|
124 |
*/ |
|
125 |
public boolean isAnimating(MapControl3D mapControl3D); |
|
83 | 126 |
} |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.swing/org.gvsig.animation3d.swing.api/src/main/java/org/gvsig/animation3d/swing/api/Animator.java | ||
---|---|---|
1 |
package org.gvsig.animation3d.swing.api; |
|
2 |
|
|
3 |
public interface Animator { |
|
4 |
|
|
5 |
/** |
|
6 |
* Iterates to the next value. The implementation is expected to apply that |
|
7 |
* next value to the property |
|
8 |
* it is attached to. |
|
9 |
*/ |
|
10 |
void next(); |
|
11 |
|
|
12 |
/** |
|
13 |
* Starts the <code>Animator</code>. The implemenation should return |
|
14 |
* <code>true</code> from <code>hasNext</code> |
|
15 |
*/ |
|
16 |
void start(); |
|
17 |
|
|
18 |
/** |
|
19 |
* Stops the <code>Animator</code>. The implmenentation should return |
|
20 |
* <code>false</code> from <code>hasNext</code> |
|
21 |
*/ |
|
22 |
void stop(); |
|
23 |
|
|
24 |
/** |
|
25 |
* Returns <code>true</code> if the <code>Animator</code> has more elements. |
|
26 |
* |
|
27 |
* @return <code>true</code> if the <code>Animator</code> has more elements. |
|
28 |
*/ |
|
29 |
boolean hasNext(); |
|
30 |
|
|
31 |
/** |
|
32 |
* Set the value of the attached property to the value associated with this |
|
33 |
* interpolant value. |
|
34 |
* |
|
35 |
* @param interpolant |
|
36 |
* A value between 0 and 1. |
|
37 |
*/ |
|
38 |
void set(double interpolant); |
|
39 |
} |
org.gvsig.animation3d/trunk/org.gvsig.animation3d/org.gvsig.animation3d.app/org.gvsig.animation3d.app.mainplugin/src/main/java/org/gvsig/animation3d/app/mainplugin/Animation3DExtension.java | ||
---|---|---|
64 | 64 |
properties.put(document.getName(), (ExtendedPropertiesSupport) document); |
65 | 65 |
} |
66 | 66 |
|
67 |
animationManager = Animation3DSwingLocator.getManager().createAnimationManager(properties);
|
|
67 |
animationManager = Animation3DSwingLocator.getManager().createAnimationPanel(properties);
|
|
68 | 68 |
animationManager.asJComponent().addComponentListener(getComponentListener()); |
69 | 69 |
WindowManager windowManager = ToolsSwingLocator.getWindowManager(); |
70 | 70 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
Also available in: Unified diff