Is it just a matter of doing:
and then, when changing color
int hColor = ((AgentClass) (((MasonGeometry)object).getUserData())).getHealthStatus(); 
and use it for everyhing else by just casting?

On Wed, Feb 13, 2019 at 6:55 PM Annetta Burger <[log in to unmask]> wrote:
I am currently using setUserData() and getUserData() to get the dynamic health status of my agents for Portrayals:

               this.getGeometry().setUserData(this.getHealthStatus());  --- in the Constructor
               int hColor = (int) (((MasonGeometry)object).getUserData());  --- in the UI

However, I am now trying to use GeoMason's getObjectsWithinDistance(), which returns a bag of objects with points. This function requires the use of casting to get the object or any attribute of the object other than the Point Geometry. For example, I'd like to get either the object itself or the object's assigned ID.

Example of casting solution from getObjectsWithinDistance() in DSchelling:
 DPerson neighbor = (DPerson) ((MasonGeometry) o).getUserData();

I can't use getUserData() for both purposes. It seems to only set one agent attribute. Is there another way to do either of these things? Can setUserData() ever be used for more than one attribute.

Thanks in advance!

Ernesto Carrella