-
Notifications
You must be signed in to change notification settings - Fork 339
Expand file tree
/
Copy pathPositionAnimator.java
More file actions
97 lines (84 loc) · 2.39 KB
/
PositionAnimator.java
File metadata and controls
97 lines (84 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* Copyright (C) 2012 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration.
* All Rights Reserved.
*/
package gov.nasa.worldwind.animation;
import gov.nasa.worldwind.geom.*;
import gov.nasa.worldwind.util.*;
/**
* @author jym
* @version $Id: PositionAnimator.java 1171 2013-02-11 21:45:02Z dcollins $
*/
public class PositionAnimator extends BasicAnimator
{
protected Position begin;
protected Position end;
protected final PropertyAccessor.PositionAccessor propertyAccessor;
public PositionAnimator(
Interpolator interpolator,
Position begin,
Position end,
PropertyAccessor.PositionAccessor propertyAccessor)
{
super(interpolator);
if (interpolator == null)
{
this.interpolator = new ScheduledInterpolator(10000);
}
if (begin == null || end == null)
{
String message = Logging.getMessage("nullValue.PositionIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (propertyAccessor == null)
{
String message = Logging.getMessage("nullValue.ViewPropertyAccessorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.begin = begin;
this.end = end;
this.propertyAccessor = propertyAccessor;
}
public void setBegin(Position begin)
{
this.begin = begin;
}
public void setEnd(Position end)
{
this.end = end;
}
public Position getBegin()
{
return this.begin;
}
public Position getEnd()
{
return this.end;
}
public PropertyAccessor.PositionAccessor getPropertyAccessor()
{
return this.propertyAccessor;
}
protected void setImpl(double interpolant)
{
Position newValue = this.nextPosition(interpolant);
if (newValue == null)
return;
boolean success = this.propertyAccessor.setPosition(newValue);
if (!success)
{
this.flagLastStateInvalid();
}
if (interpolant >= 1)
{
this.stop();
}
}
protected Position nextPosition(double interpolant)
{
return Position.interpolateGreatCircle(interpolant, this.begin, this.end);
}
}