Print

Print


Is it just a matter of doing:

 this.getGeometry().setUserData(this);

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
> and
>                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!
> Annetta
>


-- 
Ernesto Carrella
http://secure-web.cisco.com/1DjgMcgE9WnHct0tFoJV_yVwiqgiS1uPVVgEof_fKe1z83oYlLEO01-3TMgDwqEgkSvAbG0acmQ-rV2UVr4NqrF5LtFSRyZ7m-fp3dn2hen7uA-rR2pqdPp2VFc9KB41aIug7jEYzea1plZ4lTbD0rLMr6uhUcqqEVe5cz8Dv6W38T2rJWyM4YMvDFPDB_Ffi6HPVXCwVanf4vns8sEohd6z6DUPOlzOprIn47BRX8vWIr4oqvNd-ooOZo4LGii7id0W_XZRLksEMNM3yzOXIh67HioSLaPSqEsBbXX9uLeesf1QARbOks_p_MstzadG0tF3woI63XsYfzQGLHIuaCQoZy5FPoEc9018C_yoEIKCV_x291xu88v8uMSbTD_Wg_NG38inAC_rBfRpwF4mWo_vRjFq18Jv6QHG6vgSXJwEXRzGAA5kYdOc-hLn_erFTPXVR-wRcM-30kijgp-eAqIcN7BYXth0eR2d6Q53iZhI/http%3A%2F%2Fcarrknight.github.io%2F