Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.BillboardGroup.prototype.createBillboard = function(position, callbacks) {
const billboard = this._billboards.add({
show: true,
position,
pixelOffset: new Cesium.Cartesian2(
this._options.shiftX,
this._options.shiftY
),
eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0),
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.CENTER,
scale: 1.0,
image: this._options.iconUrl,
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
})
// if editable
if (callbacks) {
var _self = this
const screenSpaceCameraController = this._scene
.screenSpaceCameraController
{/* TODO: add loop function */}
viewModel.barWidth = undefined
viewModel.distanceLabel = undefined
return
}
var now = getTimestamp()
if (now < viewModel._lastLegendUpdate + 250) {
return
}
viewModel._lastLegendUpdate = now
// Find the distance between two pixels at the bottom center of the screen.
var width = scene.canvas.clientWidth
var height = scene.canvas.clientHeight
var left = scene.camera.getPickRay(new Cartesian2((width / 2) | 0, height - 1))
var right = scene.camera.getPickRay(new Cartesian2(1 + (width / 2) | 0, height - 1))
var globe = scene.globe
var leftPosition = globe.pick(left, scene)
var rightPosition = globe.pick(right, scene)
if (!defined(leftPosition) || !defined(rightPosition)) {
viewModel.barWidth = undefined
viewModel.distanceLabel = undefined
return
}
var leftCartographic = globe.ellipsoid.cartesianToCartographic(leftPosition)
var rightCartographic = globe.ellipsoid.cartesianToCartographic(rightPosition)
geodesic.setEndPoints(leftCartographic, rightCartographic)
const minimumSnowImageSize = useMemo(() => new Cartesian2(snowParticleSize, snowParticleSize), [
snowParticleSize,
* Removes a control from this toolbar.
* @param {NavControl} control The control to remove.
*/
NavigationViewModel.prototype.remove = function (control) {
this.controls.remove(control)
}
/**
* Checks if the control given is the last control in the control array.
* @param {NavControl} control The control to remove.
*/
NavigationViewModel.prototype.isLastControl = function (control) {
return (control === this.controls[this.controls.length - 1])
}
var vectorScratch = new Cartesian2()
NavigationViewModel.prototype.handleMouseDown = function (viewModel, e) {
var scene = this.terria.scene
if (scene.mode === SceneMode.MORPHING) {
return true
}
if (viewModel.navigationLocked) {
return true
}
var compassElement = e.currentTarget
var compassRectangle = e.currentTarget.getBoundingClientRect()
var maxDistance = compassRectangle.width / 2.0
var center = new Cartesian2((compassRectangle.right - compassRectangle.left) / 2.0, (compassRectangle.bottom - compassRectangle.top) / 2.0)
var clickLocation = new Cartesian2(e.clientX - compassRectangle.left, e.clientY - compassRectangle.top)
var vector = Cartesian2.subtract(clickLocation, center, vectorScratch)
addPolygon: function (polygon, geocontroller, options) {
var polygonObject = polygon.map(function (coordinate) {
return convertPointCoordinate(coordinate);
});
var cartPoints = _.map(polygonObject, function (point) {
return Cesium.Cartographic.fromDegrees(point.longitude, point.latitude, point.altitude);
});
var cartesian = geocontroller.ellipsoid.cartographicArrayToCartesianArray(cartPoints);
var unselectedPolygonRef = geocontroller.mapViewer.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.WHITE,
cellAlpha: 0.0,
lineCount: new Cesium.Cartesian2(2, 2),
lineThickness: new Cesium.Cartesian2(2.0, 2.0),
lineOffset: new Cesium.Cartesian2(0.0, 0.0)
}),
perPositionHeight: true
},
show: true,
resultId: options.id,
showWhenSelected: false
});
var selectedPolygonRef = geocontroller.mapViewer.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.BLACK,
cellAlpha: 0.0,
viewModel.rotateMouseMoveFunction = function (e) {
var compassRectangle = compassElement.getBoundingClientRect()
var center = new Cartesian2((compassRectangle.right - compassRectangle.left) / 2.0, (compassRectangle.bottom - compassRectangle.top) / 2.0)
var clickLocation = new Cartesian2(e.clientX - compassRectangle.left, e.clientY - compassRectangle.top)
var vector = Cartesian2.subtract(clickLocation, center, vectorScratch)
var angle = Math.atan2(-vector.y, vector.x)
var angleDifference = angle - viewModel.rotateInitialCursorAngle
var newCameraAngle = CesiumMath.zeroToTwoPi(viewModel.rotateInitialCameraAngle - angleDifference)
var camera = viewModel.terria.scene.camera
var oldTransform
if (defined(viewModel.rotateFrame)) {
oldTransform = Matrix4.clone(camera.transform, oldTransformScratch)
camera.lookAtTransform(viewModel.rotateFrame)
}
var currentCameraAngle = -camera.heading
point.longitude,
point.latitude,
point.altitude
)
)
let cartesian = map.scene.globe.ellipsoid.cartographicArrayToCartesianArray(
cartPoints
)
const unselectedPolygonRef = map.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.WHITE,
cellAlpha: 0.0,
lineCount: new Cesium.Cartesian2(2, 2),
lineThickness: new Cesium.Cartesian2(2.0, 2.0),
lineOffset: new Cesium.Cartesian2(0.0, 0.0),
}),
perPositionHeight: true,
},
show: true,
resultId: options.id,
showWhenSelected: false,
})
const selectedPolygonRef = map.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.BLACK,
cellAlpha: 0.0,
point.altitude
)
)
let cartesian = map.scene.globe.ellipsoid.cartographicArrayToCartesianArray(
cartPoints
)
const unselectedPolygonRef = map.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.WHITE,
cellAlpha: 0.0,
lineCount: new Cesium.Cartesian2(2, 2),
lineThickness: new Cesium.Cartesian2(2.0, 2.0),
lineOffset: new Cesium.Cartesian2(0.0, 0.0),
}),
perPositionHeight: true,
},
show: true,
resultId: options.id,
showWhenSelected: false,
})
const selectedPolygonRef = map.entities.add({
polygon: {
hierarchy: cartesian,
material: new Cesium.GridMaterialProperty({
color: Cesium.Color.BLACK,
cellAlpha: 0.0,
lineCount: new Cesium.Cartesian2(2, 2),
lineThickness: new Cesium.Cartesian2(2.0, 2.0),