123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- define([
- '../Core/defined',
- '../Core/defineProperties',
- '../Core/DeveloperError',
- '../Core/Event',
- '../Core/isArray',
- '../Core/TimeIntervalCollection',
- './Property'
- ], function(
- defined,
- defineProperties,
- DeveloperError,
- Event,
- isArray,
- TimeIntervalCollection,
- Property) {
- "use strict";
-
- var TimeIntervalCollectionProperty = function() {
- this._definitionChanged = new Event();
- this._intervals = new TimeIntervalCollection();
- this._intervals.changedEvent.addEventListener(TimeIntervalCollectionProperty.prototype._intervalsChanged, this);
- };
- defineProperties(TimeIntervalCollectionProperty.prototype, {
-
- isConstant : {
- get : function() {
- return this._intervals.isEmpty;
- }
- },
-
- definitionChanged : {
- get : function() {
- return this._definitionChanged;
- }
- },
-
- intervals : {
- get : function() {
- return this._intervals;
- }
- }
- });
-
- TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
-
- if (!defined(time)) {
- throw new DeveloperError('time is required');
- }
-
- var value = this._intervals.findDataForIntervalContainingDate(time);
- if (defined(value) && (typeof value === 'object' && !isArray(value))) {
- return value.clone(result);
- }
- return value;
- };
-
- TimeIntervalCollectionProperty.prototype.equals = function(other) {
- return this === other ||
- (other instanceof TimeIntervalCollectionProperty &&
- this._intervals.equals(other._intervals, Property.equals));
- };
-
- TimeIntervalCollectionProperty.prototype._intervalsChanged = function() {
- this._definitionChanged.raiseEvent(this);
- };
- return TimeIntervalCollectionProperty;
- });
|