Skip to content

Commit

Permalink
OrientDirectionOfTravelProperty -> VelocityOrientationProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
mramato committed Mar 26, 2015
1 parent 4e162e5 commit 238bc6f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Interpolation.html
Expand Up @@ -104,7 +104,7 @@
position : position,

//Automatically compute orientation based on position movement.
orientation : new Cesium.OrientDirectionOfTravelProperty(position),
orientation : new Cesium.VelocityOrientationProperty(position),

//Load the Cesium plane model to represent the entity
model : {
Expand Down
4 changes: 2 additions & 2 deletions CHANGES.md
Expand Up @@ -13,8 +13,8 @@ Change Log
* Added `Entity.isShowing` which is a read-only property that indicates if an entity is currently being drawn.
* Added support for the KML `visibility` element.
* Added `PolylineArrowMaterialProperty` to allow entities materials to use polyline arrows.
* Added `OrientDirectionOfTravelProperty` which can be used to easily orient Entity graphics (such as a model) along the direction it is moving.
* Added a new Sandcastle demo, [Interpolation](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Interpolation.html&label=Showcases), which not only illustrates time-dynamic position interpolation options, but also uses the new `OrientDirectionOfTravelProperty` to orient an aircraft in flight.
* Added `VelocityOrientationProperty` which can be used to easily orient Entity graphics (such as a model) along the direction it is moving.
* Added a new Sandcastle demo, [Interpolation](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Interpolation.html&label=Showcases), which not only illustrates time-dynamic position interpolation options, but also uses the new `VelocityOrientationProperty` to orient an aircraft in flight.
* Improved `viewer.zoomTo` and `viewer.flyTo` so they are now "best effort" and work even if some entities being zoomed to are not currently in the scene.
* Fixed `PointerEvent` detection so that it works with older implementations of the specification. This also fixes lack of mouse handling when detection failed, such as when using Cesium in the Windows `WebBrowser` control.
* Fixed an issue with transparency. [#2572](https://github.com/AnalyticalGraphicsInc/cesium/issues/2572)
Expand Down
Expand Up @@ -27,9 +27,9 @@ define([

/**
* A {@link Property} which evaluates to a {@link Quaternion} rotation
* oriented along the direction of travel of the provided {@link PositionProperty}.
* based on the velocity of the provided {@link PositionProperty}.
*
* @alias OrientDirectionOfTravelProperty
* @alias VelocityOrientationProperty
* @constructor
*
* @param {Property} [position] The position property used to compute the orientation.
Expand All @@ -41,10 +41,10 @@ define([
* position.addSamples(...);
* var entity = viewer.entities.add({
* position : position,
* orientation : new Cesium.OrientDirectionOfTravelProperty(position)
* orientation : new Cesium.VelocityOrientationProperty(position)
* }));
*/
var OrientDirectionOfTravelProperty = function(position, ellipsoid) {
var VelocityOrientationProperty = function(position, ellipsoid) {
this._position = undefined;
this._subscription = undefined;
this._ellipsoid = undefined;
Expand All @@ -54,10 +54,10 @@ define([
this.ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
};

defineProperties(OrientDirectionOfTravelProperty.prototype, {
defineProperties(VelocityOrientationProperty.prototype, {
/**
* Gets a value indicating if this property is constant.
* @memberof OrientDirectionOfTravelProperty.prototype
* @memberof VelocityOrientationProperty.prototype
*
* @type {Boolean}
* @readonly
Expand All @@ -69,7 +69,7 @@ define([
},
/**
* Gets the event that is raised whenever the definition of this property changes.
* @memberof OrientDirectionOfTravelProperty.prototype
* @memberof VelocityOrientationProperty.prototype
*
* @type {Event}
* @readonly
Expand All @@ -81,7 +81,7 @@ define([
},
/**
* Gets or sets the position property used to compute orientation.
* @memberof OrientDirectionOfTravelProperty.prototype
* @memberof VelocityOrientationProperty.prototype
*
* @type {Property}
*/
Expand Down Expand Up @@ -110,7 +110,7 @@ define([
},
/**
* Gets or sets the ellipsoid used to determine which way is up.
* @memberof OrientDirectionOfTravelProperty.prototype
* @memberof VelocityOrientationProperty.prototype
*
* @type {Property}
*/
Expand Down Expand Up @@ -139,13 +139,13 @@ define([
var step = 1.0 / 60.0;

/**
* Gets the value of the property.
* Gets the value of the property at the provided time.
*
* @param {JulianDate} [time] The time for which to retrieve the value.
* @param {Quaternion} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Quaternion} The modified result parameter or a new instance if the result parameter was not supplied.
*/
OrientDirectionOfTravelProperty.prototype.getValue = function(time, result) {
VelocityOrientationProperty.prototype.getValue = function(time, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required');
Expand Down Expand Up @@ -205,13 +205,13 @@ define([
* @param {Property} [other] The other property.
* @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.
*/
OrientDirectionOfTravelProperty.prototype.equals = function(other) {
VelocityOrientationProperty.prototype.equals = function(other) {
return this === other ||//
(other instanceof OrientDirectionOfTravelProperty &&
(other instanceof VelocityOrientationProperty &&
Property.equals(this._position, other._position) &&
(this._ellipsoid === other._ellipsoid ||
this._ellipsoid.equals(other._ellipsoid)));
};

return OrientDirectionOfTravelProperty;
return VelocityOrientationProperty;
});
@@ -1,6 +1,6 @@
/*global defineSuite*/
defineSuite([
'DataSources/OrientDirectionOfTravelProperty',
'DataSources/VelocityOrientationProperty',
'Core/Cartesian3',
'Core/Ellipsoid',
'Core/Event',
Expand All @@ -9,7 +9,7 @@ defineSuite([
'Core/Quaternion',
'DataSources/SampledPositionProperty'
], function(
OrientDirectionOfTravelProperty,
VelocityOrientationProperty,
Cartesian3,
Ellipsoid,
Event,
Expand All @@ -23,7 +23,7 @@ defineSuite([
var time = JulianDate.now();

it('can default construct', function() {
var property = new OrientDirectionOfTravelProperty();
var property = new VelocityOrientationProperty();
expect(property.isConstant).toBe(true);
expect(property.definitionChanged).toBeInstanceOf(Event);
expect(property.position).toBeUndefined();
Expand All @@ -33,7 +33,7 @@ defineSuite([

it('can construct with arguments', function() {
var position = new SampledPositionProperty();
var property = new OrientDirectionOfTravelProperty(position, Ellipsoid.UNIT_SPHERE);
var property = new VelocityOrientationProperty(position, Ellipsoid.UNIT_SPHERE);
expect(property.isConstant).toBe(true);
expect(property.definitionChanged).toBeInstanceOf(Event);
expect(property.position).toBe(position);
Expand All @@ -42,7 +42,7 @@ defineSuite([
});

it('setting position raises definitionChanged event', function() {
var property = new OrientDirectionOfTravelProperty();
var property = new VelocityOrientationProperty();

var listener = jasmine.createSpy('listener');
property.definitionChanged.addEventListener(listener);
Expand All @@ -54,7 +54,7 @@ defineSuite([

it('subscribes/unsubscribes to position definitionChanged and propagates up', function() {
var position = new SampledPositionProperty();
var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

var listener = jasmine.createSpy('listener');
property.definitionChanged.addEventListener(listener);
Expand All @@ -73,7 +73,7 @@ defineSuite([

it('setting position does not raise definitionChanged event for same data', function() {
var position = new SampledPositionProperty();
var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

var listener = jasmine.createSpy('listener');
property.definitionChanged.addEventListener(listener);
Expand All @@ -83,7 +83,7 @@ defineSuite([
});

it('setting ellipsoid raises definitionChanged event', function() {
var property = new OrientDirectionOfTravelProperty();
var property = new VelocityOrientationProperty();

var listener = jasmine.createSpy('listener');
property.definitionChanged.addEventListener(listener);
Expand All @@ -93,7 +93,7 @@ defineSuite([
});

it('setting ellipsoid does not raise definitionChanged event for same data', function() {
var property = new OrientDirectionOfTravelProperty();
var property = new VelocityOrientationProperty();

var listener = jasmine.createSpy('listener');
property.definitionChanged.addEventListener(listener);
Expand All @@ -109,7 +109,7 @@ defineSuite([
var position = new SampledPositionProperty();
position.addSamples(times, values);

var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

expect(property.getValue(times[0])).toEqual(new Quaternion(-0.49781357154789996, -0.5021769090497131, -0.50215778744446, -0.49779461608731784));
expect(property.getValue(times[1])).toEqual(new Quaternion(-0.49781359332642117, -0.5021768874604212, -0.5021577659852654, -0.4977946379931618));
Expand All @@ -122,7 +122,7 @@ defineSuite([
var position = new SampledPositionProperty();
position.addSamples(times, values);

var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

var expected = new Cartesian3();
var result = property.getValue(times[0], expected);
Expand All @@ -136,7 +136,7 @@ defineSuite([
position.forwardExtrapolationType = ExtrapolationType.NONE;
position.backwardExtrapolationType = ExtrapolationType.NONE;

var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

var result = property.getValue(new JulianDate());
expect(result).toBeUndefined();
Expand All @@ -148,7 +148,7 @@ defineSuite([
position.forwardExtrapolationType = ExtrapolationType.NONE;
position.backwardExtrapolationType = ExtrapolationType.NONE;

var property = new OrientDirectionOfTravelProperty(position);
var property = new VelocityOrientationProperty(position);

var result = property.getValue(new JulianDate(1, 0));
expect(result).toBeUndefined();
Expand All @@ -157,8 +157,8 @@ defineSuite([
it('equals works', function() {
var position = new SampledPositionProperty();

var left = new OrientDirectionOfTravelProperty();
var right = new OrientDirectionOfTravelProperty();
var left = new VelocityOrientationProperty();
var right = new VelocityOrientationProperty();

expect(left.equals(right)).toBe(true);

Expand All @@ -176,7 +176,7 @@ defineSuite([
});

it('getValue throws without time', function() {
var property = new OrientDirectionOfTravelProperty();
var property = new VelocityOrientationProperty();
expect(function() {
property.getValue();
}).toThrowDeveloperError();
Expand Down

0 comments on commit 238bc6f

Please sign in to comment.