Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
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,
)
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(
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;
}
});
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) {
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() {
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) {
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)),
}
}
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()
},
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)),
}
}