123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import defined from "../Core/defined.js";
- import DeveloperError from "../Core/DeveloperError.js";
- import Event from "../Core/Event.js";
- import TimeIntervalCollection from "../Core/TimeIntervalCollection.js";
- import Property from "./Property.js";
- function TimeIntervalCollectionProperty() {
- this._definitionChanged = new Event();
- this._intervals = new TimeIntervalCollection();
- this._intervals.changedEvent.addEventListener(
- TimeIntervalCollectionProperty.prototype._intervalsChanged,
- this
- );
- }
- Object.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.clone === "function") {
- 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);
- };
- export default TimeIntervalCollectionProperty;
|