You would need to watch for changes to that input field and then update name property on that entity. You seemingly have it’s id (based on the screenshot) so, you would find that entity by id, and change it’s name property to the new value from the text input.
If you aren’t using the entity api and are instead using czml, you would just process a new czml packet with the id of the entity and the new name property and the entity would update.
Yeah so, in his example above, he created a single input that referenced an entity that he created right there. That probably wouldn’t your use case (having a variable just sitting there with a reference to the entity). So, for what I’m understanding your use case to be, you would have an entity id associated with each input, and then that input changes, using the input event on the element, you could get the entity from the entityCollection using getById and passing it the id of the entity. Then you would just set the label text for that entity, to the new value in the input.
The white text comes directly from the input field.
But here I can see that he creates a new instance in the right position and thus a new text instead of taking the existing instance and updating the text from it.
What should also be taken into account here is that the selection should be based on the ID. Otherwise I have the problem when I have several labels that only the last label is updated and not the one you want.
I ask for help.
I’ve had this problem since yesterday and I can’t solve it.
@Mr.Lion In the Sandcastle that I posted above, I demonstrated how to change the label.text property of an Entity. If you are adding multiple entities in your application, you need to store their id properties, so you can query the correct entity based on the ID, using EntityCollection.getById.
For example, if by clicking on the map, you are adding an entity to the viewer’s entity collection, you would simply use viewer.entities.getById(<ID_OF_YOUR_ENTITY_HERE>) and apply the change to that entity, as I have shown in my Sandcastle.
Additionally, you may also query the currently selected entity using viewer.selectedEntity and apply the changes to that.
wow looks good and you are a genius and very fast…
Unfortunately, I still haven’t made it myself. I always seem to make a mistake in thinking.
But you used something completely different here. You went through the view.camera.pickEllipsoid path.
In this way it records which entity belongs to which input field or where exactly are the relationships to each other set up here?
I have to analyze your example first to understand it better. Will then try to integrate your example into my code later. hope it works
There’s almost nothing in here.
I don’t even know what the function is good for and what exactly it does and in which areas it can be used etc.
It only says what type the parameters are and that’s it…
How am I supposed to learn like this?
I don’t know why, for example, you passed scene.globe.ellipsoid in the 2nd parameter. What exactly is the point?
I would be happy if someone could enlighten me on this.
I can’t find anything in the documentation.
In the documentation you could have saved the description of the parameter type. Because you get the information from the IDE anyway. Instead, they should have described what exactly the function does and what it is for.
The API documentation is there to help developers explore the different classes and methods in the library. If you’re looking for examples of API usage beyond what’s present in the documentation, it’s worth checking out the Sandcastle and the tutorials.
I couldn’t do it because I got type errors.
I do not get it. Text is a string of Type but the error says String and Cesium.Property do not match.
So I created this new instance of the label.
But I have the following problem with this.
When you click, the label looks like this:
And when I edit it:
So I see that all the properties I set are gone. Is also understandable since I created a new instance.
I also have the problem that the ID is no longer the same, it has also changed with the new instance.
How can I make it so that the instance doesn’t change and I can only edit the text?
I’m using TypeScript here and it’s not like in JS that the types don’t matter…
Get the following error:
Converting from type “string” to type “ConstantProperty” can be an error because the types do not have enough overlap. If this was intentional, first convert the expression to “unknown”.