How to use the terriajs-cesium/Source/Core/JulianDate.fromIso8601 function in terriajs-cesium

To help you get started, we’ve selected a few terriajs-cesium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TerriaJS / terriajs / test / Models / CatalogItemSpec.js View on Github external
item.clock = new DataSourceClock();
    item.clock.currentTime = JulianDate.fromIso8601("2019-07-03");
    terria.clock.currentTime = JulianDate.fromIso8601("2021-05-11");
    item.isEnabled = true;
    // Force the time to propogate from the terria.clock to the catalogItems.clock.
    terria.clock.tick();
    // These are sanity checks to make sure this test cases is established correctly.
    expect(item.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2019-07-03")
    );
    expect(item.currentTime).toEqual(JulianDate.fromIso8601("2019-07-03"));
    expect(terria.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2021-05-11")
    );

    item.currentTime = JulianDate.fromIso8601("2031-03-23");
    expect(item.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2031-03-23")
    );
    expect(item.currentTime).toEqual(JulianDate.fromIso8601("2031-03-23"));
    expect(terria.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2021-05-11")
    );
  });
github TerriaJS / terriajs / test / ReactViews / FeatureInfoSectionSpec.jsx View on Github external
const template = "<div>{{terria.currentTime}}</div>";

      const timeInterval = new TimeInterval({
        start: JulianDate.fromIso8601("2017-11-23T19:47:53+11:00"),
        stop: JulianDate.fromIso8601("2018-01-03T07:05:00Z"),
        isStartIncluded: true,
        isStopIncluded: false
      });
      const intervals = new TimeIntervalCollection([timeInterval]);
      const availableDate = JulianDate.toDate(timeInterval.start);
      catalogItem.intervals = intervals;
      catalogItem.availableDates = [availableDate];

      catalogItem.canUseOwnClock = true;
      catalogItem.useOwnClock = true;
      catalogItem.clock.currentTime = JulianDate.fromIso8601(
        "2017-12-19T17:13:11+07:00"
      );
      terria.clock.currentTime = JulianDate.fromIso8601(
        "2001-01-01T01:01:01+01:00"
      ); // An decoy date to make sure that we are indeed using the catalog items clock and not terria.clock.
      const section = (
         {}}
        /&gt;
      );
      const result = getShallowRenderedOutput(section);
github TerriaJS / terriajs / test / Models / CatalogItemSpec.js View on Github external
// Force the time to propogate from the terria.clock to the catalogItems.clock.
    terria.clock.tick();
    // These are sanity checks to make sure this test cases is established correctly.
    expect(item.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2021-05-11")
    );
    expect(item.currentTime).toEqual(JulianDate.fromIso8601("2021-05-11"));
    expect(terria.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2021-05-11")
    );

    terria.clock.currentTime = JulianDate.fromIso8601("2023-11-29");
    // Don't need to explicitly propogate the value as it should be copied when useOwnClock is changed.
    item.useOwnClock = true;
    expect(item.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2023-11-29")
    );
    expect(item.currentTime).toEqual(JulianDate.fromIso8601("2023-11-29"));
    expect(terria.clock.currentTime).toEqual(
      JulianDate.fromIso8601("2023-11-29")
    );
  });
github TerriaJS / terriajs / test / ViewModels / AnimationViewModelSpec.js View on Github external
it('should set time to time within an interval as usual', function() {
                expect(terria.clock.currentTime).not.toEqual(JulianDate.fromIso8601('2016-01-04'));
                setTime(JulianDate.fromIso8601('2016-01-04'));
                expect(terria.clock.currentTime).toEqual(JulianDate.fromIso8601('2016-01-04'));
            });
github TerriaJS / terriajs / test / ViewModels / AnimationViewModelSpec.js View on Github external
it('should set time to time within an interval as usual', function() {
                expect(terria.clock.currentTime).not.toEqual(JulianDate.fromIso8601('2016-01-04'));
                setTime(JulianDate.fromIso8601('2016-01-04'));
                expect(terria.clock.currentTime).toEqual(JulianDate.fromIso8601('2016-01-04'));
            });
github TerriaJS / terriajs / test / Models / ClockSpec.js View on Github external
it("should advance across a gap on tick if the tick would put currentTime into a gap", function() {
      clock.clockStep = ClockStep.TICK_DEPENDENT;
      clock.shouldAnimate = true;
      clock.currentTime = JulianDate.fromIso8601("2016-01-07");

      expect(clock.currentTime).not.toEqual(
        JulianDate.fromIso8601("2016-01-12")
      );

      clock.tick();

      expect(clock.currentTime).toEqual(JulianDate.fromIso8601("2016-01-12"));
    });
github TerriaJS / terriajs / test / ViewModels / FeatureInfoPanelViewModelSpec.js View on Github external
timeVaryingItem.load().then(function() {
            expect(timeVaryingItem.dataSource.entities.values.length).toBeGreaterThan(0);
            panel.terria.nowViewing.add(timeVaryingItem);
            var feature = timeVaryingItem.dataSource.entities.values[0];
            var pickedFeatures = new PickedFeatures();
            pickedFeatures.features.push(feature);
            pickedFeatures.allFeaturesAvailablePromise = runLater(function() {});

            terria.clock.currentTime = JulianDate.fromIso8601('2010-02-02');

            return panel.showFeatures(pickedFeatures).then(function() {
                expect(panel.sections[0].templatedInfo).toEqual(targetBlank);

                terria.clock.currentTime = JulianDate.fromIso8601('2012-02-02');
                terria.clock.tick();
                expect(panel.sections[0].templatedInfo).toEqual(targetABC);

                terria.clock.currentTime = JulianDate.fromIso8601('2014-02-02');
                terria.clock.tick();
                expect(panel.sections[0].templatedInfo).toEqual(targetDEF);
            });
        }).then(done).otherwise(done.fail);
github TerriaJS / terriajs / test / Models / WebMapServiceCatalogItemSpec.js View on Github external
.then(function() {
        expect(wmsItem.intervals.length).toEqual(9);
        expect(wmsItem.intervals.get(8).start).toEqual(
          JulianDate.fromIso8601("2015-07-01T01:00:00Z")
        );
        expect(wmsItem.intervals.get(8).stop).toEqual(
          JulianDate.fromIso8601("2015-07-01T01:15:00Z")
        );
      })
      .then(done)
github TerriaJS / terriajs / test / Models / ImageryLayerCatalogItemSpec.js View on Github external
expect(function() {
        catalogItem.intervals = new TimeIntervalCollection([
          new TimeInterval({
            start: JulianDate.fromIso8601("2013-08-07T00:00:00.00Z"),
            stop: JulianDate.fromIso8601("2115-08-09T00:00:00.00Z")
          })
        ]);
      }).toThrow();
    });
github TerriaJS / terriajs / lib / ModelMixins / DiscretelyTimeVaryingMixin.ts View on Github external
function toJulianDate(time: string | undefined): JulianDate | undefined {
  if (time === undefined) {
    return undefined;
  }
  return JulianDate.fromIso8601(time);
}