Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ac-html-desc cannot receive CallbackProperty position #406

Open
nadavpld opened this issue Dec 17, 2021 · 0 comments
Open

ac-html-desc cannot receive CallbackProperty position #406

nadavpld opened this issue Dec 17, 2021 · 0 comments

Comments

@nadavpld
Copy link

Trying to simulate a flight path of a 3d model helicopter.

<ac-map>
	<ac-layer acFor="let plane of planes$" [context]="this" [store]="true">
		<ac-model-desc props="{
			position: plane.position,
			minimumPixelSize: 100,
			uri: '../assets/models/scene.gltf'
		  }">
		  </ac-model-desc>
		<ac-html-desc props="{position: plane.position, show: true}">
			<ng-template let-plane>
				<div style="color: white">callsign</div>
			</ng-template>
		</ac-html-desc>
	</ac-layer>
</ac-map>

First try was a success, showing the model and the html as follows :

		this.planes = [
			{
				id: '0',
				actionType: ActionType.ADD_UPDATE,
				entity: {
					position: new Cesium.Cartesian3.fromDegrees(33, 34)
				}
			},
			{
				id: '1',
				actionType: ActionType.ADD_UPDATE,
				entity: {
					position: new Cesium.Cartesian3.fromDegrees(33, 34)
				}
			}
		];
		this.planes$ = from(this.planes);

I have used a setInterval function which updated the position through a call for updateLayer

Thinking forward (displaying hundreds of planes), the updateLayer call is not scalable, I have tried using CallbackProperty as follows

		this.planes = [
			{
				id: '0',
				actionType: ActionType.ADD_UPDATE,
				entity: {
					position: new Cesium.CallbackProperty(this.getPosition_0.bind(this), false)
				}
			},
			{
				id: '1',
				actionType: ActionType.ADD_UPDATE,
				entity: {
					position: new Cesium.CallbackProperty(this.getPosition_1.bind(this), false)
				}
			}
		];
		this.planes$ = from(this.planes);

The models are moving smoothless, the html label (which later will include a more complex view) was not showing at all.

By changing <ac-html-desc props="{position: plane.position, show: true}"> to <ac-html-desc props="{position: plane.position.getValue(), show: true}">
I got it to show, but obviously it is not updating and the label stays behind

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant