Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
testPlonter() {
this.eventManager
.register({
event: CesiumEvent.LEFT_CLICK,
pick: PickOptions.PICK_ONE,
pickFilter: entity => entity.id === '1' || entity.id === '2' || entity.id === '11' || entity.id === '10',
})
.pipe(map(result => result.entities))
.subscribe(result => {
console.log('plonter result: ' + JSON.stringify(result));
alert('picked: ' + JSON.stringify(result));
});
}
ngAfterViewInit(): void {
setTimeout(() => this.snackBar.open('Click on player icon to choose him', '', {duration: 3000}), 3000);
this.eventManager = this.mapsManager.getMap().getMapEventsManager();
this.clickEvent = this.eventManager.register({
event: CesiumEvent.LEFT_CLICK,
pick: PickOptions.PICK_ONE,
entityType: AcEntity,
});
this.clickEvent
.filter(result => result.entities && (result.entities[0] as PlayerFields.Fragment).type === 'PLAYER')
.map(result => result.entities[0])
.subscribe(selectedPlayer => {
if (selectedPlayer.state !== 'DEAD'){
const currentSelected = this.takeControlService.selectedPlayerToControl;
if (currentSelected) {
this.takeControlService.selectedPlayerToControl = currentSelected.id === selectedPlayer.id ? null : selectedPlayer;
} else {
this.takeControlService.selectedPlayerToControl = selectedPlayer;
}
}
})
const position = Cesium.Cartesian3.fromRadians(oldPos.longitude + 0.0001, oldPos.latitude);
this.points$.next({
id: '1',
actionType: ActionType.ADD_UPDATE,
entity: AcEntity.create({
width: 10,
color: Cesium.Color.BLUE,
position,
}),
});
}, 500);
this.mapEventsManager.register({
event: CesiumEvent.LEFT_CLICK,
pick: PickOptions.PICK_ONE
}).subscribe(result => {
if (result.cesiumEntities && result.cesiumEntities.length) {
this.cameraService.trackEntity(result.cesiumEntities[0], {flyTo: true, altitude: 10000});
}
});
}