UNPKG

terriajs

Version:

Geospatial data visualization platform.

1,348 lines (1,200 loc) 480 kB
webpackJsonp([0],{ /***/ 2203: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(3), __webpack_require__(2), __webpack_require__(11), __webpack_require__(455), __webpack_require__(92), __webpack_require__(117) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defined, defineProperties, DeveloperError, Event, EventHelper, TimeIntervalCollection, Property) { 'use strict'; function subscribeAll(property, eventHelper, definitionChanged, intervals) { function callback() { definitionChanged.raiseEvent(property); } var items = []; eventHelper.removeAll(); var length = intervals.length; for (var i = 0; i < length; i++) { var interval = intervals.get(i); if (defined(interval.data) && items.indexOf(interval.data) === -1) { eventHelper.add(interval.data.definitionChanged, callback); } } } /** * A {@link Property} which is defined by a {@link TimeIntervalCollection}, where the * data property of each {@link TimeInterval} is another Property instance which is * evaluated at the provided time. * * @alias CompositeProperty * @constructor * * * @example * var constantProperty = ...; * var sampledProperty = ...; * * //Create a composite property from two previously defined properties * //where the property is valid on August 1st, 2012 and uses a constant * //property for the first half of the day and a sampled property for the * //remaining half. * var composite = new Cesium.CompositeProperty(); * composite.intervals.addInterval(Cesium.TimeInterval.fromIso8601({ * iso8601 : '2012-08-01T00:00:00.00Z/2012-08-01T12:00:00.00Z', * data : constantProperty * })); * composite.intervals.addInterval(Cesium.TimeInterval.fromIso8601({ * iso8601 : '2012-08-01T12:00:00.00Z/2012-08-02T00:00:00.00Z', * isStartIncluded : false, * isStopIncluded : false, * data : sampledProperty * })); * * @see CompositeMaterialProperty * @see CompositePositionProperty */ function CompositeProperty() { this._eventHelper = new EventHelper(); this._definitionChanged = new Event(); this._intervals = new TimeIntervalCollection(); this._intervals.changedEvent.addEventListener(CompositeProperty.prototype._intervalsChanged, this); } defineProperties(CompositeProperty.prototype, { /** * Gets a value indicating if this property is constant. A property is considered * constant if getValue always returns the same result for the current definition. * @memberof CompositeProperty.prototype * * @type {Boolean} * @readonly */ isConstant : { get : function() { return this._intervals.isEmpty; } }, /** * Gets the event that is raised whenever the definition of this property changes. * The definition is changed whenever setValue is called with data different * than the current value. * @memberof CompositeProperty.prototype * * @type {Event} * @readonly */ definitionChanged : { get : function() { return this._definitionChanged; } }, /** * Gets the interval collection. * @memberof CompositeProperty.prototype * * @type {TimeIntervalCollection} */ intervals : { get : function() { return this._intervals; } } }); /** * Gets the value of the property at the provided time. * * @param {JulianDate} time The time for which to retrieve the value. * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied. */ CompositeProperty.prototype.getValue = function(time, result) { var innerProperty = this._intervals.findDataForIntervalContainingDate(time); if (defined(innerProperty)) { return innerProperty.getValue(time, result); } return undefined; }; /** * Compares this property to the provided property and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Property} [other] The other property. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ CompositeProperty.prototype.equals = function(other) { return this === other || // (other instanceof CompositeProperty && // this._intervals.equals(other._intervals, Property.equals)); }; /** * @private */ CompositeProperty.prototype._intervalsChanged = function() { subscribeAll(this, this._eventHelper, this._definitionChanged, this._intervals); this._definitionChanged.raiseEvent(this); }; return CompositeProperty; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2204: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(1), __webpack_require__(0), __webpack_require__(3), __webpack_require__(2), __webpack_require__(11), __webpack_require__(230), __webpack_require__(2203), __webpack_require__(117) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defaultValue, defined, defineProperties, DeveloperError, Event, ReferenceFrame, CompositeProperty, Property) { 'use strict'; /** * A {@link CompositeProperty} which is also a {@link PositionProperty}. * * @alias CompositePositionProperty * @constructor * * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined. */ function CompositePositionProperty(referenceFrame) { this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED); this._definitionChanged = new Event(); this._composite = new CompositeProperty(); this._composite.definitionChanged.addEventListener(CompositePositionProperty.prototype._raiseDefinitionChanged, this); } defineProperties(CompositePositionProperty.prototype, { /** * Gets a value indicating if this property is constant. A property is considered * constant if getValue always returns the same result for the current definition. * @memberof CompositePositionProperty.prototype * * @type {Boolean} * @readonly */ isConstant : { get : function() { return this._composite.isConstant; } }, /** * Gets the event that is raised whenever the definition of this property changes. * The definition is changed whenever setValue is called with data different * than the current value. * @memberof CompositePositionProperty.prototype * * @type {Event} * @readonly */ definitionChanged : { get : function() { return this._definitionChanged; } }, /** * Gets the interval collection. * @memberof CompositePositionProperty.prototype * * @type {TimeIntervalCollection} */ intervals : { get : function() { return this._composite.intervals; } }, /** * Gets or sets the reference frame which this position presents itself as. * Each PositionProperty making up this object has it's own reference frame, * so this property merely exposes a "preferred" reference frame for clients * to use. * @memberof CompositePositionProperty.prototype * * @type {ReferenceFrame} */ referenceFrame : { get : function() { return this._referenceFrame; }, set : function(value) { this._referenceFrame = value; } } }); /** * Gets the value of the property at the provided time in the fixed frame. * * @param {JulianDate} time The time for which to retrieve the value. * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied. */ CompositePositionProperty.prototype.getValue = function(time, result) { return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; /** * Gets the value of the property at the provided time and in the provided reference frame. * * @param {JulianDate} time The time for which to retrieve the value. * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result. * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied. */ CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) { var innerProperty = this._composite._intervals.findDataForIntervalContainingDate(time); if (defined(innerProperty)) { return innerProperty.getValueInReferenceFrame(time, referenceFrame, result); } return undefined; }; /** * Compares this property to the provided property and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Property} [other] The other property. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ CompositePositionProperty.prototype.equals = function(other) { return this === other || // (other instanceof CompositePositionProperty && // this._referenceFrame === other._referenceFrame && // this._composite.equals(other._composite, Property.equals)); }; /** * @private */ CompositePositionProperty.prototype._raiseDefinitionChanged = function() { this._definitionChanged.raiseEvent(this); }; return CompositePositionProperty; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2205: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(1), __webpack_require__(0), __webpack_require__(3), __webpack_require__(2), __webpack_require__(11), __webpack_require__(455), __webpack_require__(230), __webpack_require__(117) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defaultValue, defined, defineProperties, DeveloperError, Event, EventHelper, ReferenceFrame, Property) { 'use strict'; /** * A {@link PositionProperty} whose value is an array whose items are the computed value * of other PositionProperty instances. * * @alias PositionPropertyArray * @constructor * * @param {Property[]} [value] An array of Property instances. * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined. */ function PositionPropertyArray(value, referenceFrame) { this._value = undefined; this._definitionChanged = new Event(); this._eventHelper = new EventHelper(); this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED); this.setValue(value); } defineProperties(PositionPropertyArray.prototype, { /** * Gets a value indicating if this property is constant. This property * is considered constant if all property items in the array are constant. * @memberof PositionPropertyArray.prototype * * @type {Boolean} * @readonly */ isConstant : { get : function() { var value = this._value; if (!defined(value)) { return true; } var length = value.length; for (var i = 0; i < length; i++) { if (!Property.isConstant(value[i])) { return false; } } return true; } }, /** * Gets the event that is raised whenever the definition of this property changes. * The definition is changed whenever setValue is called with data different * than the current value or one of the properties in the array also changes. * @memberof PositionPropertyArray.prototype * * @type {Event} * @readonly */ definitionChanged : { get : function() { return this._definitionChanged; } }, /** * Gets the reference frame in which the position is defined. * @memberof PositionPropertyArray.prototype * @type {ReferenceFrame} * @default ReferenceFrame.FIXED; */ referenceFrame : { get : function() { return this._referenceFrame; } } }); /** * Gets the value of the property. * * @param {JulianDate} [time] The time for which to retrieve the value. This parameter is unused since the value does not change with respect to time. * @param {Cartesian3[]} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3[]} The modified result parameter or a new instance if the result parameter was not supplied. */ PositionPropertyArray.prototype.getValue = function(time, result) { return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result); }; /** * Gets the value of the property at the provided time and in the provided reference frame. * * @param {JulianDate} time The time for which to retrieve the value. * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result. * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied. */ PositionPropertyArray.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) { var value = this._value; if (!defined(value)) { return undefined; } var length = value.length; if (!defined(result)) { result = new Array(length); } var i = 0; var x = 0; while (i < length) { var property = value[i]; var itemValue = property.getValueInReferenceFrame(time, referenceFrame, result[i]); if (defined(itemValue)) { result[x] = itemValue; x++; } i++; } result.length = x; return result; }; /** * Sets the value of the property. * * @param {Property[]} value An array of Property instances. */ PositionPropertyArray.prototype.setValue = function(value) { var eventHelper = this._eventHelper; eventHelper.removeAll(); if (defined(value)) { this._value = value.slice(); var length = value.length; for (var i = 0; i < length; i++) { var property = value[i]; if (defined(property)) { eventHelper.add(property.definitionChanged, PositionPropertyArray.prototype._raiseDefinitionChanged, this); } } } else { this._value = undefined; } this._definitionChanged.raiseEvent(this); }; /** * Compares this property to the provided property and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Property} [other] The other property. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ PositionPropertyArray.prototype.equals = function(other) { return this === other || // (other instanceof PositionPropertyArray && // this._referenceFrame === other._referenceFrame && // Property.arrayEquals(this._value, other._value)); }; PositionPropertyArray.prototype._raiseDefinitionChanged = function() { this._definitionChanged.raiseEvent(this); }; return PositionPropertyArray; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2206: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0), __webpack_require__(3), __webpack_require__(2), __webpack_require__(11), __webpack_require__(32), __webpack_require__(117) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defined, defineProperties, DeveloperError, Event, RuntimeError, Property) { 'use strict'; function resolveEntity(that) { var entityIsResolved = true; if (that._resolveEntity) { var targetEntity = that._targetCollection.getById(that._targetId); if (defined(targetEntity)) { targetEntity.definitionChanged.addEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged, that); that._targetEntity = targetEntity; that._resolveEntity = false; } else { //The property has become detached. It has a valid value but is not currently resolved to an entity in the collection targetEntity = that._targetEntity; entityIsResolved = false; } if (!defined(targetEntity)) { throw new RuntimeError('target entity "' + that._targetId + '" could not be resolved.'); } } return entityIsResolved; } function resolve(that) { var targetProperty = that._targetProperty; if (that._resolveProperty) { var entityIsResolved = resolveEntity(that); var names = that._targetPropertyNames; targetProperty = that._targetEntity; var length = names.length; for (var i = 0; i < length && defined(targetProperty); i++) { targetProperty = targetProperty[names[i]]; } if (defined(targetProperty)) { that._targetProperty = targetProperty; that._resolveProperty = !entityIsResolved; } else if (!defined(that._targetProperty)) { throw new RuntimeError('targetProperty "' + that._targetId + '.' + names.join('.') + '" could not be resolved.'); } } return targetProperty; } /** * A {@link Property} which transparently links to another property on a provided object. * * @alias ReferenceProperty * @constructor * * @param {EntityCollection} targetCollection The entity collection which will be used to resolve the reference. * @param {String} targetId The id of the entity which is being referenced. * @param {String[]} targetPropertyNames The names of the property on the target entity which we will use. * * @example * var collection = new Cesium.EntityCollection(); * * //Create a new entity and assign a billboard scale. * var object1 = new Cesium.Entity({id:'object1'}); * object1.billboard = new Cesium.BillboardGraphics(); * object1.billboard.scale = new Cesium.ConstantProperty(2.0); * collection.add(object1); * * //Create a second entity and reference the scale from the first one. * var object2 = new Cesium.Entity({id:'object2'}); * object2.model = new Cesium.ModelGraphics(); * object2.model.scale = new Cesium.ReferenceProperty(collection, 'object1', ['billboard', 'scale']); * collection.add(object2); * * //Create a third object, but use the fromString helper function. * var object3 = new Cesium.Entity({id:'object3'}); * object3.billboard = new Cesium.BillboardGraphics(); * object3.billboard.scale = Cesium.ReferenceProperty.fromString(collection, 'object1#billboard.scale'); * collection.add(object3); * * //You can refer to an entity with a # or . in id and property names by escaping them. * var object4 = new Cesium.Entity({id:'#object.4'}); * object4.billboard = new Cesium.BillboardGraphics(); * object4.billboard.scale = new Cesium.ConstantProperty(2.0); * collection.add(object4); * * var object5 = new Cesium.Entity({id:'object5'}); * object5.billboard = new Cesium.BillboardGraphics(); * object5.billboard.scale = Cesium.ReferenceProperty.fromString(collection, '\\#object\\.4#billboard.scale'); * collection.add(object5); */ function ReferenceProperty(targetCollection, targetId, targetPropertyNames) { this._targetCollection = targetCollection; this._targetId = targetId; this._targetPropertyNames = targetPropertyNames; this._targetProperty = undefined; this._targetEntity = undefined; this._definitionChanged = new Event(); this._resolveEntity = true; this._resolveProperty = true; targetCollection.collectionChanged.addEventListener(ReferenceProperty.prototype._onCollectionChanged, this); } defineProperties(ReferenceProperty.prototype, { /** * Gets a value indicating if this property is constant. * @memberof ReferenceProperty.prototype * @type {Boolean} * @readonly */ isConstant : { get : function() { return Property.isConstant(resolve(this)); } }, /** * Gets the event that is raised whenever the definition of this property changes. * The definition is changed whenever the referenced property's definition is changed. * @memberof ReferenceProperty.prototype * @type {Event} * @readonly */ definitionChanged : { get : function() { return this._definitionChanged; } }, /** * Gets the reference frame that the position is defined in. * This property is only valid if the referenced property is a {@link PositionProperty}. * @memberof ReferenceProperty.prototype * @type {ReferenceFrame} * @readonly */ referenceFrame : { get : function() { return resolve(this).referenceFrame; } }, /** * Gets the id of the entity being referenced. * @memberof ReferenceProperty.prototype * @type {String} * @readonly */ targetId : { get : function() { return this._targetId; } }, /** * Gets the collection containing the entity being referenced. * @memberof ReferenceProperty.prototype * @type {EntityCollection} * @readonly */ targetCollection : { get : function() { return this._targetCollection; } }, /** * Gets the array of property names used to retrieve the referenced property. * @memberof ReferenceProperty.prototype * @type {String[]} * @readonly */ targetPropertyNames : { get : function() { return this._targetPropertyNames; } }, /** * Gets the resolved instance of the underlying referenced property. * @memberof ReferenceProperty.prototype * @type {Property} * @readonly */ resolvedProperty : { get : function() { return resolve(this); } } }); /** * Creates a new instance given the entity collection that will * be used to resolve it and a string indicating the target entity id and property. * The format of the string is "objectId#foo.bar", where # separates the id from * property path and . separates sub-properties. If the reference identifier or * or any sub-properties contains a # . or \ they must be escaped. * * @param {EntityCollection} targetCollection * @param {String} referenceString * @returns {ReferenceProperty} A new instance of ReferenceProperty. * * @exception {DeveloperError} invalid referenceString. */ ReferenceProperty.fromString = function(targetCollection, referenceString) { var identifier; var values = []; var inIdentifier = true; var isEscaped = false; var token = ''; for (var i = 0; i < referenceString.length; ++i) { var c = referenceString.charAt(i); if (isEscaped) { token += c; isEscaped = false; } else if (c === '\\') { isEscaped = true; } else if (inIdentifier && c === '#') { identifier = token; inIdentifier = false; token = ''; } else if (!inIdentifier && c === '.') { values.push(token); token = ''; } else { token += c; } } values.push(token); return new ReferenceProperty(targetCollection, identifier, values); }; /** * Gets the value of the property at the provided time. * * @param {JulianDate} time The time for which to retrieve the value. * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied. */ ReferenceProperty.prototype.getValue = function(time, result) { return resolve(this).getValue(time, result); }; /** * Gets the value of the property at the provided time and in the provided reference frame. * This method is only valid if the property being referenced is a {@link PositionProperty}. * * @param {JulianDate} time The time for which to retrieve the value. * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result. * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied. */ ReferenceProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) { return resolve(this).getValueInReferenceFrame(time, referenceFrame, result); }; /** * Gets the {@link Material} type at the provided time. * This method is only valid if the property being referenced is a {@link MaterialProperty}. * * @param {JulianDate} time The time for which to retrieve the type. * @returns {String} The type of material. */ ReferenceProperty.prototype.getType = function(time) { return resolve(this).getType(time); }; /** * Compares this property to the provided property and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Property} [other] The other property. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ ReferenceProperty.prototype.equals = function(other) { if (this === other) { return true; } var names = this._targetPropertyNames; var otherNames = other._targetPropertyNames; if (this._targetCollection !== other._targetCollection || // this._targetId !== other._targetId || // names.length !== otherNames.length) { return false; } var length = this._targetPropertyNames.length; for (var i = 0; i < length; i++) { if (names[i] !== otherNames[i]) { return false; } } return true; }; ReferenceProperty.prototype._onTargetEntityDefinitionChanged = function(targetEntity, name, value, oldValue) { if (this._targetPropertyNames[0] === name) { this._resolveProperty = true; this._definitionChanged.raiseEvent(this); } }; ReferenceProperty.prototype._onCollectionChanged = function(collection, added, removed) { var targetEntity = this._targetEntity; if (defined(targetEntity)) { if (removed.indexOf(targetEntity) !== -1) { targetEntity.definitionChanged.removeEventListener(ReferenceProperty.prototype._onTargetEntityDefinitionChanged, this); this._resolveEntity = true; this._resolveProperty = true; } else if (this._resolveEntity) { //If targetEntity is defined but resolveEntity is true, then the entity is detached //and any change to the collection needs to incur an attempt to resolve in order to re-attach. //without this if block, a reference that becomes re-attached will not signal definitionChanged resolve(this); if (!this._resolveEntity) { this._definitionChanged.raiseEvent(this); } } } }; return ReferenceProperty; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2207: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(6) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( freezeObject) { 'use strict'; /** * Defined the orientation of stripes in {@link StripeMaterialProperty}. * * @exports StripeOrientation */ var StripeOrientation = { /** * Horizontal orientation. * @type {Number} */ HORIZONTAL : 0, /** * Vertical orientation. * @type {Number} */ VERTICAL : 1 }; return freezeObject(StripeOrientation); }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2208: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(5), __webpack_require__(1), __webpack_require__(0), __webpack_require__(3), __webpack_require__(2), __webpack_require__(11), __webpack_require__(23), __webpack_require__(117) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( Cartesian3, defaultValue, defined, defineProperties, DeveloperError, Event, JulianDate, Property) { 'use strict'; /** * A {@link Property} which evaluates to a {@link Cartesian3} vector * based on the velocity of the provided {@link PositionProperty}. * * @alias VelocityVectorProperty * @constructor * * @param {Property} [position] The position property used to compute the velocity. * @param {Boolean} [normalize=true] Whether to normalize the computed velocity vector. * * @example * //Create an entity with a billboard rotated to match its velocity. * var position = new Cesium.SampledProperty(); * position.addSamples(...); * var entity = viewer.entities.add({ * position : position, * billboard : { * image : 'image.png', * alignedAxis : new Cesium.VelocityVectorProperty(position, true) // alignedAxis must be a unit vector * } * })); */ function VelocityVectorProperty(position, normalize) { this._position = undefined; this._subscription = undefined; this._definitionChanged = new Event(); this._normalize = defaultValue(normalize, true); this.position = position; } defineProperties(VelocityVectorProperty.prototype, { /** * Gets a value indicating if this property is constant. * @memberof VelocityVectorProperty.prototype * * @type {Boolean} * @readonly */ isConstant : { get : function() { return Property.isConstant(this._position); } }, /** * Gets the event that is raised whenever the definition of this property changes. * @memberof VelocityVectorProperty.prototype * * @type {Event} * @readonly */ definitionChanged : { get : function() { return this._definitionChanged; } }, /** * Gets or sets the position property used to compute the velocity vector. * @memberof VelocityVectorProperty.prototype * * @type {Property} */ position : { get : function() { return this._position; }, set : function(value) { var oldValue = this._position; if (oldValue !== value) { if (defined(oldValue)) { this._subscription(); } this._position = value; if (defined(value)) { this._subscription = value._definitionChanged.addEventListener(function() { this._definitionChanged.raiseEvent(this); }, this); } this._definitionChanged.raiseEvent(this); } } }, /** * Gets or sets whether the vector produced by this property * will be normalized or not. * @memberof VelocityVectorProperty.prototype * * @type {Boolean} */ normalize : { get : function() { return this._normalize; }, set : function(value) { if (this._normalize === value) { return; } this._normalize = value; this._definitionChanged.raiseEvent(this); } } }); var position1Scratch = new Cartesian3(); var position2Scratch = new Cartesian3(); var timeScratch = new JulianDate(); var step = 1.0 / 60.0; /** * Gets the value of the property at the provided time. * * @param {JulianDate} [time] The time for which to retrieve the value. * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned. * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied. */ VelocityVectorProperty.prototype.getValue = function(time, result) { return this._getValue(time, result); }; /** * @private */ VelocityVectorProperty.prototype._getValue = function(time, velocityResult, positionResult) { if (!defined(velocityResult)) { velocityResult = new Cartesian3(); } var property = this._position; if (Property.isConstant(property)) { return this._normalize ? undefined : Cartesian3.clone(Cartesian3.ZERO, velocityResult); } var position1 = property.getValue(time, position1Scratch); var position2 = property.getValue(JulianDate.addSeconds(time, step, timeScratch), position2Scratch); //If we don't have a position for now, return undefined. if (!defined(position1)) { return undefined; } //If we don't have a position for now + step, see if we have a position for now - step. if (!defined(position2)) { position2 = position1; position1 = property.getValue(JulianDate.addSeconds(time, -step, timeScratch), position2Scratch); if (!defined(position1)) { return undefined; } } if (Cartesian3.equals(position1, position2)) { return this._normalize ? undefined : Cartesian3.clone(Cartesian3.ZERO, velocityResult); } if (defined(positionResult)) { position1.clone(positionResult); } var velocity = Cartesian3.subtract(position2, position1, velocityResult); if (this._normalize) { return Cartesian3.normalize(velocity, velocityResult); } return Cartesian3.divideByScalar(velocity, step, velocityResult); }; /** * Compares this property to the provided property and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Property} [other] The other property. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ VelocityVectorProperty.prototype.equals = function(other) { return this === other ||// (other instanceof VelocityVectorProperty && Property.equals(this._position, other._position)); }; return VelocityVectorProperty; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2209: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(6) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( freezeObject) { 'use strict'; /** * Style options for corners. * * @demo The {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Corridor.html&label=Geometries|Corridor Demo} * demonstrates the three corner types, as used by {@link CorridorGraphics}. * * @exports CornerType */ var CornerType = { /** * <img src="Images/CornerTypeRounded.png" style="vertical-align: middle;" width="186" height="189" /> * * Corner has a smooth edge. * @type {Number} * @constant */ ROUNDED : 0, /** * <img src="Images/CornerTypeMitered.png" style="vertical-align: middle;" width="186" height="189" /> * * Corner point is the intersection of adjacent edges. * @type {Number} * @constant */ MITERED : 1, /** * <img src="Images/CornerTypeBeveled.png" style="vertical-align: middle;" width="186" height="189" /> * * Corner is clipped. * @type {Number} * @constant */ BEVELED : 2 }; return freezeObject(CornerType); }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /***/ 2210: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(1), __webpack_require__(0), __webpack_require__(2), __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defaultValue, defined, DeveloperError, CesiumMath) { 'use strict'; var factorial = CesiumMath.factorial; function calculateCoefficientTerm(x, zIndices, xTable, derivOrder, termOrder, reservedIndices) { var result = 0; var reserved; var i; var j; if (derivOrder > 0) { for (i = 0; i < termOrder; i++) { reserved = false; for (j = 0; j < reservedIndices.length && !reserved; j++) { if (i === reservedIndices[j]) { reserved = true; } } if (!reserved) { reservedIndices.push(i); result += calculateCoefficientTerm(x, zIndices, xTable, derivOrder - 1, termOrder, reservedIndices); reservedIndices.splice(reservedIndices.length - 1, 1); } } return result; } result = 1; for (i = 0; i < termOrder; i++) { reserved = false; for (j = 0; j < reservedIndices.length && !reserved; j++) { if (i === reservedIndices[j]) { reserved = true; } } if (!reserved) { result *= x - xTable[zIndices[i]]; } } return result; } /** * An {@link InterpolationAlgorithm} for performing Hermite interpolation. * * @exports HermitePolynomialApproximation */ var HermitePolynomialApproximation = { type : 'Hermite' }; /** * Given the desired degree, returns the number of data points required for interpolation. * * @param {Number} degree The desired degree of interpolation. * @param {Number} [inputOrder=0] The order of the inputs (0 means just the data, 1 means the data and its derivative, etc). * @returns {Number} The number of required data points needed for the desired degree of interpolation. * @exception {DeveloperError} degree must be 0 or greater. * @exception {DeveloperError} inputOrder must be 0 or greater. */ HermitePolynomialApproximation.getRequiredDataPoints = function(degree, inputOrder) { inputOrder = defaultValue(inputOrder, 0); return Math.max(Math.floor((degree + 1) / (inputOrder + 1)), 2); }; /** * Interpolates values using Hermite Polynomial Approximation. * * @param {Number} x The independent variable for which the dependent variables will be interpolated. * @param {Number[]} xTable The array of independent variables to use to interpolate. The values * in this array must be in increasing order and the same value must not occur twice in the array. * @param {Number[]} yTable The array of dependent variables to use to interpolate. For a set of three * dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}. * @param {Number} yStride The number of dependent variable values in yTable corresponding to * each independent variable value in xTable. * @param {Number[]} [result] An existing array into which to store the result. * @returns {Number[]} The array of interpolated values, or the result parameter if one was provided. */ HermitePolynomialApproximation.interpolateOrderZero = function(x, xTable, yTable, yStride, result) { if (!defined(result)) { result = new Array(yStride); } var i; var j; var d; var s; var len; var index; var length = xTable.length; var coefficients = new Array(yStride); for (i = 0; i < yStride; i++) { result[i] = 0; var l = new Array(length); coefficients[i] = l; for (j = 0; j < length; j++) { l[j] = []; } } var zIndicesLength = length, zIndices = new Array(zIndicesLength); for (i = 0; i < zIndicesLength; i++) { zIndices[i] = i; } var highestNonZeroCoef = length - 1; for (s = 0; s < yStride; s++) { for (j = 0; j < zIndicesLength; j++) { index = zIndices[j] * yStride + s; coefficients[s][0].push(yTable[index]); } for (i = 1; i < zIndicesLength; i++) { var nonZeroCoefficients = false; for (j = 0; j < zIndicesLength - i; j++) { var zj = xTable[zIndices[j]]; var zn = xTable[zIndices[j + i]]; var numerator; if (zn - zj <= 0) { index = zIndices[j] * yStride + yStride * i + s; numerator = yTable[index]; coefficients[s][i].push(numerator / factorial(i)); } else { numerator = (coefficients[s][i - 1][j + 1] - coefficients[s][i - 1][j]); coefficients[s][i].push(numerator / (zn - zj)); } nonZeroCoefficients = nonZeroCoefficients || (numerator !== 0); } if (!nonZeroCoefficients) { highestNonZeroCoef = i - 1; } } } for (d = 0, len = 0; d <= len; d++) { for (i = d; i <= highestNonZeroCoef; i++) { var tempTerm = calculateCoefficientTerm(x, zIndices, xTable, d, i, []); for (s = 0; s < yStride; s++) { var coeff = coefficients[s][i][0]; result[s + d * yStride] += coeff * tempTerm; } } } return result; }; var arrayScratch = []; /** * Interpolates values using Hermite Polynomial Approximation. * * @param {Number} x The independent variable for which the dependent variables will be interpolated. * @param {Number[]} xTable The array of independent variables to use to interpolate. The values * in this array must be in increasing order and the same value must not occur twice in the array. * @param {Number[]} yTable The array of dependent variables to use to interpolate. For a set of three * dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}. * @param {Number} yStride The number of dependent variable values in yTable corresponding to * each independent variable value in xTable. * @param {Number} inputOrder The number of derivatives supplied for input. * @param {Number} outputOrder The number of derivatives desired for output. * @param {Number[]} [result] An existing array into which to store the result. * * @returns {Number[]} The array of interpolated values, or the result parameter if one was provided. */ HermitePolynomialApproximation.interpolate = function(x, xTable, yTable, yStride, inputOrder, outputOrder, result) { var resultL