How to use the terriajs-cesium/Source/Core/DeveloperError.default 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 / lib / Models / SensorObservationServiceCatalogItem.js View on Github external
function addDurationToIso8601(dateIso8601, durationString) {
  if (!defined(dateIso8601) || dateIso8601.length < 3) {
    throw new DeveloperError("Bad date " + dateIso8601);
  }
  var duration = parseFloat(durationString);
  if (isNaN(duration) || duration === 0) {
    throw new DeveloperError("Bad duration " + durationString);
  }
  var julianDate = JulianDate.fromIso8601(dateIso8601, scratchJulianDate);
  var units = durationString.slice(durationString.length - 1);
  if (units === "s") {
    julianDate = JulianDate.addSeconds(julianDate, duration, scratchJulianDate);
  } else if (units === "h") {
    julianDate = JulianDate.addHours(julianDate, duration, scratchJulianDate);
  } else if (units === "d") {
    // Use addHours on 24 * numdays - on my casual reading of addDays, it needs an integer.
    julianDate = JulianDate.addHours(
      julianDate,
      duration * 24,
      scratchJulianDate
    );
  } else if (units === "y") {
    var days = Math.round(duration * 365);
github TerriaJS / terriajs / lib / Models / SensorObservationServiceCatalogItem.js View on Github external
function buildConcepts(item) {
  var concepts = [];
  if (!defined(item.procedures) || !defined(item.observableProperties)) {
    throw new DeveloperError(
      "Both `procedures` and `observableProperties` arrays must be defined on the catalog item."
    );
  }
  if (item.procedures.length > 1) {
    var concept = new DisplayVariablesConcept(item.proceduresName);
    concept.id = "procedures"; // must match the key of item['procedures']
    concept.requireSomeActive = true;
    concept.items = item.procedures.map((value, index) => {
      return new VariableConcept(value.title || value.identifier, {
        parent: concept,
        id: value.identifier, // used in the SOS request to identify the procedure.
        active: index === item.initialProcedureIndex
      });
    });
    concepts.push(concept);
    item._previousProcedureIdentifier =
github TerriaJS / terriajs / lib / Models / GlobeOrMap.js View on Github external
GlobeOrMap.prototype.raise = function(index) {
  throw new DeveloperError("raise must be implemented in the derived class.");
};
github TerriaJS / terriajs / lib / Models / FunctionParameter.js View on Github external
var FunctionParameter = function(options) {
  if (!defined(options) || !defined(options.terria)) {
    throw new DeveloperError("options.terria is required.");
  }

  if (!defined(options.catalogFunction)) {
    throw new DeveloperError("options.catalogFunction is required.");
  }

  if (!defined(options.id)) {
    throw new DeveloperError("options.id is required.");
  }

  this._terria = options.terria;
  this._catalogFunction = options.catalogFunction;
  this._id = options.id;

  this._loadingPromise = undefined;
  this._lastLoadInfluencingValues = undefined;

  /**
   * Gets or sets a value indicating whether the parameter is currently loading.  This property
   * is observable.
github TerriaJS / terriajs / lib / Models / GlobeOrMap.js View on Github external
GlobeOrMap.prototype.showImageryLayer = function(options) {
  throw new DeveloperError(
    "showImageryLayer must be implemented in the derived class."
  );
};
github TerriaJS / terriajs / lib / Models / GlobeOrMap.js View on Github external
GlobeOrMap.prototype.getCurrentExtent = function() {
  throw new DeveloperError(
    "getCurrentExtent must be implemented in the derived class."
  );
};
github TerriaJS / terriajs / lib / Models / GlobeOrMap.js View on Github external
GlobeOrMap.prototype.lowerToBottom = function(item) {
  throw new DeveloperError(
    "lowerToBottom must be implemented in the derived class."
  );
};
github TerriaJS / terriajs / lib / Models / FunctionParameter.js View on Github external
get: function() {
      throw new DeveloperError(
        "FunctionParameter.type must be overridden in derived classes."
      );
    }
  },
github TerriaJS / terriajs / lib / Models / ShareDataService.js View on Github external
ShareDataService.prototype.resolveData = function(token) {
  var that = this;

  if (!this.isUsable) {
    throw new DeveloperError("ShareDataService is not usable because ###");
  }

  return loadJson(this.url + "/" + token)
    .then(function(json) {
      return json;
    })
    .otherwise(function() {
      that.terria.error.raiseEvent(
        new TerriaError({
          title: "Couldn't expand URL",
          message:
            "\
The share data service used to launch " +
            that.terria.appName +
            " was not located. \
This may indicate an error in the link or that the service is unavailable at this time. \
github TerriaJS / terriajs / lib / Models / GoogleUrlShortener.js View on Github external
GoogleUrlShortener.prototype.shorten = function(url) {
  if (!this.isUsable) {
    throw new DeveloperError(
      "GoogleUrlShortener is not usable because Terria.configPrameters.googleUrlShortenerKey is not defined."
    );
  }

  return loadWithXhr({
    url:
      this.url + "?key=" + this.terria.configParameters.googleUrlShortenerKey,
    method: "POST",
    data: JSON.stringify({ longUrl: url }),
    headers: { "Content-Type": "application/json" },
    responseType: "json"
  }).then(function(result) {
    var hashIndex = result.id.lastIndexOf("/");
    if (hashIndex === -1 || hashIndex >= result.id.length) {
      throw new RuntimeError("Unexpected url shortening result");
    } else {