gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Adding the index of agent information to Inspect View #3902

Closed hqnghi88 closed 1 year ago

hqnghi88 commented 1 year ago

In the Inspect View of agent, we have its name,

Screenshot 2023-10-06 at 10 26 11

but If we want to access it by index, for example, in interactive console, we need to query by where expression: write first((road where (each.name="road2604")).shape.perimeter;

Is there a simpler solution by using index? or we could add the agent's index to the inspect view? write road[2604].shape.perimeter;

AlexisDrogoul commented 1 year ago

I have decided to (finally !) add index as a built-in constant attribute to agents. Why it was not there is a bit of a mystery (there was probably a reason once, but I can't remember it). This has to be tested carefully as it may have some implications on:

1) Models that import GIS data with an index attribute and create agents from it: this index will not be considered 2) Species that declare an attribute called index. It will conflict with the new attribute (esp. if it is not constant) 3) Code that uses an index temp variable: warnings will appear.

Please report any further issues with this !