Many ui panels needs interaction with same object
- by user877329
I am developing a tool for simulating systems like the Gray-Scott model (That is systems where spatial distribution depends on time). The actual model is loaded from a DLL or shared object and the simulation is performed by a Simulation object.
There are at least two situations when the simulation needs to be destroyed:
The user loads a new model
The user changes the size of the domain
To make sure nothing goes wrong, the current Model, Simulation, and rendering Thread are all managed by an ApplicationState object. But the two cases above are initiated from two different UI objects. Is it then ok to distribute a reference to the ApplicationState object to all panels that need to access at least one method on the ApplicationState object?
Another solution would be to use aggregation so that the panel from which the user chooses model knows the simulation parameter panel.
Also, the ApplicationState class seems somewhat clumsy, so I would like to have something else