How to use the cesium.Material function in cesium

To help you get started, we’ve selected a few 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 codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / lib / cesium-drawhelper / DrawHelper.js View on Github external
}
    this._highlightedSurface = surface
  }

  _.prototype.disableAllEditMode = function() {
    this.setEdited(undefined)
  }

  _.prototype.setEdited = function(surface) {
    if (this._editedSurface && !this._editedSurface.isDestroyed()) {
      this._editedSurface.setEditMode(false)
    }
    this._editedSurface = surface
  }

  const material = Cesium.Material.fromType(Cesium.Material.ColorType)
  material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 0.5)

  const defaultShapeOptions = {
    ellipsoid: Cesium.Ellipsoid.WGS84,
    textureRotationAngle: 0.0,
    height: 0.0,
    asynchronous: true,
    show: true,
    debugShowBoundingVolume: false,
  }

  let defaultSurfaceOptions = copyOptions(defaultShapeOptions, {
    appearance: new Cesium.EllipsoidSurfaceAppearance({
      aboveGround: false,
    }),
    material,
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / map.cesium.js View on Github external
)
      const cartPoints = _.map(lineObject, point =>
        Cesium.Cartographic.fromDegrees(
          point.longitude,
          point.latitude,
          point.altitude
        )
      )
      const cartesian = map.scene.globe.ellipsoid.cartographicArrayToCartesianArray(
        cartPoints
      )

      const polylineCollection = new Cesium.PolylineCollection()
      const polyline = polylineCollection.add({
        width: 8,
        material: Cesium.Material.fromType('PolylineOutline', {
          color: determineCesiumColor(options.color),
          outlineColor: Cesium.Color.WHITE,
          outlineWidth: 4,
        }),
        id: options.id,
        positions: cartesian,
      })

      if (map.scene.terrainProvider) {
        const promise = Cesium.sampleTerrain(
          map.scene.terrainProvider,
          5,
          cartPoints
        )
        Cesium.when(promise, updatedCartographic => {
          const positions = map.scene.globe.ellipsoid.cartographicArrayToCartesianArray(
github codice / ddf / catalog / ui / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / shapes.js View on Github external
addLine: function (line, geocontroller, options) {
    var lineObject = line.map(function (coordinate) {
      return convertPointCoordinate(coordinate);
    });
    var cartPoints = _.map(lineObject, function (point) {
      return Cesium.Cartographic.fromDegrees(point.longitude, point.latitude, point.altitude);
    });
    var cartesian = geocontroller.ellipsoid.cartographicArrayToCartesianArray(cartPoints);

    var polylineCollection = new Cesium.PolylineCollection();
    var polyline = polylineCollection.add({
      width: 8,
      material: Cesium.Material.fromType('PolylineOutline', {
        color: determineCesiumColor(options.color),
        outlineColor: Cesium.Color.WHITE,
        outlineWidth: 4
      }),
      id: options.id,
      positions: cartesian
    });

    if (geocontroller.scene.terrainProvider) {
      var promise = Cesium.sampleTerrain(geocontroller.scene.terrainProvider, 5, cartPoints);
      Cesium.when(promise, function (updatedCartographic) {
        var positions = geocontroller.ellipsoid.cartographicArrayToCartesianArray(updatedCartographic);
        if (updatedCartographic[0].height && !options.view.isDestroyed) {
          polyline.positions = positions;
        }
      });
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / map.cesium.js View on Github external
geometry._polylines.forEach(polyline => {
          polyline.material = Cesium.Material.fromType('PolylineOutline', {
            color: determineCesiumColor('rgba(0,0,0, .1)'),
            outlineColor: determineCesiumColor('rgba(255,255,255, .1)'),
            outlineWidth: 4,
          })
        })
      } else if (geometry.showWhenSelected) {
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.circle.js View on Github external
const centerPt = Turf.point([modelProp.lon, modelProp.lat])
    const circleToCheck = new TurfCircle(
      centerPt,
      DistanceUtils.getDistanceInMeters(
        modelProp.radius,
        modelProp.radiusUnits
      ),
      64,
      'meters'
    )

    this.primitive = new Cesium.PolylineCollection()
    this.primitive.add({
      width: 8,
      material: Cesium.Material.fromType('PolylineOutline', {
        color: color
          ? Cesium.Color.fromCssColorString(color)
          : Cesium.Color.KHAKI,
        outlineColor: Cesium.Color.WHITE,
        outlineWidth: 4,
      }),
      id: 'userDrawing',
      positions: Cesium.Cartesian3.fromDegreesArray(
        _.flatten(circleToCheck.geometry.coordinates)
      ),
    })

    this.options.map.scene.primitives.add(this.primitive)
    this.options.map.scene.requestRender()
  },
  handleRegionStop() {
github codice / ddf / catalog / ui / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / shapes.js View on Github external
geometry._polylines.forEach(function (polyline) {
        polyline.material = Cesium.Material.fromType('PolylineOutline', {
          color: determineCesiumColor(options.color),
          outlineColor: options.isSelected ? Cesium.Color.BLACK : Cesium.Color.WHITE,
          outlineWidth: 4
        });
      });
    } else if (geometry.showWhenSelected) {
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.base.line.js View on Github external
constructDottedLinePrimitive = coordinates => {
    const color = this.model.get('color')

    return {
      width: 4,
      material: Cesium.Material.fromType('PolylineDash', {
        color: color
          ? Cesium.Color.fromCssColorString(color)
          : Cesium.Color.KHAKI,
        dashLength: 16.0,
        dashPattern: 7.0,
      }),
      id: 'userDrawing',
      positions: Cesium.Cartesian3.fromDegreesArray(_.flatten(coordinates)),
    }
  }
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.bbox.js View on Github external
this.destroyOldPrimitive()

    const coordinates = [
      [rectangle.east, rectangle.north],
      [rectangle.west, rectangle.north],
      [rectangle.west, rectangle.south],
      [rectangle.east, rectangle.south],
      [rectangle.east, rectangle.north],
    ]

    const color = this.model.get('color')

    this.primitive = new Cesium.PolylineCollection()
    this.primitive.add({
      width: 8,
      material: Cesium.Material.fromType('PolylineOutline', {
        color: color
          ? Cesium.Color.fromCssColorString(color)
          : Cesium.Color.KHAKI,
        outlineColor: Cesium.Color.WHITE,
        outlineWidth: 4,
      }),
      id: 'userDrawing',
      positions: Cesium.Cartesian3.fromRadiansArray(_.flatten(coordinates)),
    })

    this.options.map.scene.primitives.add(this.primitive)
    this.options.map.scene.requestRender()
  },
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.base.line.js View on Github external
constructLinePrimitive = coordinates => {
    const color = this.model.get('color')

    return {
      width: 8,
      material: Cesium.Material.fromType('PolylineOutline', {
        color: color
          ? Cesium.Color.fromCssColorString(color)
          : Cesium.Color.KHAKI,
        outlineColor: Cesium.Color.WHITE,
        outlineWidth: 4,
      }),
      id: 'userDrawing',
      positions: Cesium.Cartesian3.fromDegreesArray(_.flatten(coordinates)),
    }
  }