How to use the terriajs-cesium/Source/Core/defaultValue.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 / GeoJsonCatalogItem.js View on Github external
!defined(options.markerSymbol)
      ) {
        entity.point = new PointGraphics({
          color: getColor(
            defaultValue(properties["marker-color"], options.markerColor)
          ),
          pixelSize: defaultValue(
            properties["marker-size"],
            options.markerSize / 2
          ),
          outlineWidth: defaultValue(
            properties["stroke-width"],
            options.strokeWidth
          ),
          outlineColor: getColor(
            defaultValue(properties.stroke, options.polygonStroke)
          ),
          heightReference: options.clampToGround
            ? HeightReference.RELATIVE_TO_GROUND
            : null
        });
        if (defined(properties["marker-opacity"])) {
          // not part of SimpleStyle spec, but why not?
          entity.point.color.alpha = parseFloat(properties["marker-opacity"]);
        }
        entity.billboard = undefined;
      }
      if (defined(entity.billboard) && defined(properties["marker-opacity"])) {
        entity.billboard.color = new Color(
          1.0,
          1.0,
          1.0,
github TerriaJS / terriajs / lib / Models / LegendHelper.js View on Github external
} else if (legendHelper.tableColumn.isEnum) {
    var tableColumnStyle = legendHelper.tableColumnStyle;
    var uniqueValues = legendHelper.tableColumn.uniqueValues;
    legendHelper._binColors = buildEnumBinColors(
      legendHelper,
      uniqueValues,
      tableColumnStyle.colorBinMethod,
      tableColumnStyle.colorBins
    );
    legendProps = buildEnumLegendProps(legendHelper, uniqueValues);
  } else {
    var colorMap = defaultValue(
      legendHelper.tableColumnStyle.colorMap,
      defaultScalarColorMap
    );
    var colorBins = defaultValue(
      legendHelper.tableColumnStyle.colorBins,
      defaultNumberOfColorBins
    );

    legendHelper._colorGradient = buildColorGradient(colorMap);
    legendHelper._binColors = buildBinColors(legendHelper, colorBins);
    legendProps = buildLegendProps(legendHelper, colorMap);
  }
  if (defined(legendProps)) {
    legendHelper._legend = new Legend(legendProps);
  } else {
    legendHelper._legend = null; // use null so that we know it tried and failed, so don't try again.
  }
}
github TerriaJS / terriajs / lib / Models / CswCatalogGroup.js View on Github external
CswCatalogGroup.prototype._load = function() {
  var postDataTemplate;

  // if we are only searching for wps resources, then use a faster (narrower) csw search
  if (this.includeWps && !anyResourceFormatExceptWps(this)) {
    postDataTemplate = defaultValue(
      this.getRecordsTemplate,
      CswCatalogGroup.wpsGetRecordsTemplate
    );
  } else {
    postDataTemplate = defaultValue(
      this.getRecordsTemplate,
      CswCatalogGroup.defaultGetRecordsTemplate
    );
  }

  var that = this;
  var startPosition = 1;
  var lastPostData;

  function loadNextPage() {
    var postData = postDataTemplate.replace("{startPosition}", startPosition);
github TerriaJS / terriajs / lib / Models / GeoJsonCatalogItem.js View on Github external
width: style["marker-width"],
          height: style["marker-height"],
          rotation: style["marker-angle"],
          color: Color.WHITE
        };

        /* If no marker symbol was provided but Cesium has generated one for a point, then turn it into
         a filled circle instead of the default marker. */
      } else if (
        defined(entity.billboard) &&
        !defined(properties["marker-symbol"]) &&
        !defined(options.markerSymbol)
      ) {
        entity.point = new PointGraphics({
          color: getColor(
            defaultValue(properties["marker-color"], options.markerColor)
          ),
          pixelSize: defaultValue(
            properties["marker-size"],
            options.markerSize / 2
          ),
          outlineWidth: defaultValue(
            properties["stroke-width"],
            options.strokeWidth
          ),
          outlineColor: getColor(
            defaultValue(properties.stroke, options.polygonStroke)
          ),
          heightReference: options.clampToGround
            ? HeightReference.RELATIVE_TO_GROUND
            : null
        });
github TerriaJS / terriajs / lib / ViewModels / BingMapsSearchProviderViewModel.js View on Github external
var BingMapsSearchProviderViewModel = function(options) {
  SearchProviderViewModel.call(this);

  options = defaultValue(options, defaultValue.EMPTY_OBJECT);

  this.terria = options.terria;
  this._geocodeInProgress = undefined;

  this.name = "Locations";
  this.url = defaultValue(options.url, "//dev.virtualearth.net/");
  if (this.url.length > 0 && this.url[this.url.length - 1] !== "/") {
    this.url += "/";
  }
  this.key = BingMapsApi.getKey(options.key);
  this.flightDurationSeconds = defaultValue(options.flightDurationSeconds, 1.5);
  this.primaryCountry = defaultValue(options.primaryCountry, "Australia");
  this.culture = defaultValue(options.culture, "en-au");

  if (!this.key) {
    console.warn(
      "The " +
        this.name +
        " geocoder will always return no results because a Bing Maps key has not been provided. Please get a Bing Maps key from bingmapsportal.com and add it to parameters.bingMapsKey in config.json."
    );
  }
};
github TerriaJS / terriajs / lib / Models / FunctionParameter.js View on Github external
this._loadingPromise = undefined;
  this._lastLoadInfluencingValues = undefined;

  /**
   * Gets or sets a value indicating whether the parameter is currently loading.  This property
   * is observable.
   * @type {Boolean}
   */
  this.isLoading = false;

  /**
   * Gets or sets the name of the parameter.
   * @type {String}
   */
  this.name = defaultValue(options.name, options.id);

  /**
   * Gets or sets the description of the parameter.
   * @type {String}
   */
  this.description = options.description;

  /**
   * Gets or sets a value indicating whether this parameter is required.
   * @type {Boolean}
   * @default false
   */
  this.isRequired = defaultValue(options.isRequired, false);

  /**
   * A converter that can be used to convert this parameter for use with a {@link CatalogFunction}.
github TerriaJS / terriajs / lib / Core / pollToPromise.js View on Github external
var pollToPromise = function(f, options) {
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);

  var pollInterval = defaultValue(options.pollInterval, 1);
  var timeout = defaultValue(options.timeout, 5000);

  var deferred = when.defer();

  var startTimestamp = getTimestamp();
  var endTimestamp = startTimestamp + timeout;

  function poller() {
    if (f()) {
      deferred.resolve();
    } else {
      if (getTimestamp() > endTimestamp) {
        deferred.reject();
      } else {
        setTimeout(poller, pollInterval);
      }
    }
github TerriaJS / terriajs / lib / Models / addUserCatalogMember.js View on Github external
return when(newCatalogMemberOrPromise, function(newCatalogItem) {
    if (!defined(newCatalogItem)) {
      return;
    }

    newCatalogItem.isUserSupplied = true;

    terria.catalog.userAddedDataGroup.add(newCatalogItem);

    if (defaultValue(options.open, true) && defined(newCatalogItem.isOpen)) {
      newCatalogItem.isOpen = true;
    }

    if (
      defaultValue(options.enable, true) &&
      defined(newCatalogItem.isEnabled)
    ) {
      newCatalogItem.isEnabled = true;
    }

    if (
      defaultValue(options.zoomTo, true) &&
      defined(newCatalogItem.zoomToAndUseClock)
    ) {
      newCatalogItem.zoomToAndUseClock();
    }
github TerriaJS / terriajs / lib / Models / Terria.js View on Github external
var Terria = function(options) {
  if (!defined(options) || !defined(options.baseUrl)) {
    throw new DeveloperError("options.baseUrl is required.");
  }

  options.languageOverrides = defined(options.languageOverrides)
    ? options.languageOverrides
    : {};

  this.language = combine(options.languageOverrides, language);

  this.baseUrl = defaultValue(options.baseUrl, "build/TerriaJS/");
  if (this.baseUrl.lastIndexOf("/") !== this.baseUrl.length - 1) {
    this.baseUrl += "/";
  }

  var cesiumBaseUrl = defaultValue(
    options.cesiumBaseUrl,
    this.baseUrl + "build/Cesium/build/"
  );
  if (cesiumBaseUrl.lastIndexOf("/") !== cesiumBaseUrl.length - 1) {
    cesiumBaseUrl += "/";
  }
  this.cesiumBaseUrl = cesiumBaseUrl;
  buildModuleUrl.setBaseUrl(cesiumBaseUrl);

  /**
   * Gets or sets the instance to which to report Google Analytics-style log events.
github TerriaJS / terriajs / lib / Models / Terria.js View on Github external
*/
  this.batchGeocoder = options.batchGeocoder;

  /**
   * An event that is raised when a user-facing error occurs.  This is especially useful for errors that happen asynchronously and so
   * cannot be raised as an exception because no one would be able to catch it.  Subscribers are passed the {@link TerriaError}
   * that occurred as the only function parameter.
   * @type {CesiumEvent}
   */
  this.error = new CesiumEvent();

  /**
   * Gets or sets the map mode.
   * @type {ViewerMode}
   */
  this.viewerMode = defaultValue(options.viewerMode, ViewerMode.CesiumTerrain);

  /**
   * Gets or sets the current base map.
   * @type {ImageryLayerCatalogItem}
   */
  this.baseMap = undefined;

  /**
   * Gets or sets the current fog settings, used in the Cesium Scene/Fog constructor.
   * @type {Object}
   */
  this.fogSettings = undefined;

  /**
   * Gets or sets the name of the base map to use.
   * @type {String}

terriajs-cesium

Cesium for TerriaJS.

Apache-2.0
Latest version published 8 months ago

Package Health Score

68 / 100
Full package analysis