Select to view content in your preferred language

Edit graphic properities at runtime?

914
3
05-08-2013 05:23 AM
ThomasBinu
Deactivated User
How can I edit the properties of a graphic at runtime , for example ,to change the attributes and geometry. I went through the api reference and there are no set methods for any property of a graphic.

Thanks,

Tom
0 Kudos
3 Replies
deleted-user-ATjHIWsdQYmT
Deactivated User
Here's how the API defines a Graphic:

Graphic objects are immutable, which means its state cannot change after construction. When a Graphic object is added to a GraphicsLayer via the GraphicsLayer#addGraphic(Graphic) method, this method returns a unique ID (UID) which you can then use to reference the added graphic for subsequent operations. Graphic objects are stateless so there is no guarantee that a feature in the GraphicsLayer exists after the request for the Graphic object is completed.

So, from that - I would say, no you cannot change attributes or geometry at runtime.
0 Kudos
ThomasBinu
Deactivated User
Here's how the API defines a Graphic:

Graphic objects are immutable, which means its state cannot change after construction. When a Graphic object is added to a GraphicsLayer via the GraphicsLayer#addGraphic(Graphic) method, this method returns a unique ID (UID) which you can then use to reference the added graphic for subsequent operations. Graphic objects are stateless so there is no guarantee that a feature in the GraphicsLayer exists after the request for the Graphic object is completed.

So, from that - I would say, no you cannot change attributes or geometry at runtime.


Thank you for the info andrew. However, I think the iOS version allows editing properties at runtime. Isn't the arcgis API structure designed the same way across both the platforms?
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
I stand somewhat corrected... While you cannot update a graphic directly, it looks like you can update it's attribute(s) by referencing the graphics ID from the GraphicsLayer.   

Check out GraphicsLayer.updateGraphic(int id, Map<String, Object> attributes) in the API reference.
Updates the attributes of a graphic specified by id with an attribute map.





0 Kudos