|
From: Richard S. <js...@dm...> - 2011-07-29 14:27:58
|
Hi,
I have a display that is an instance of DisplayOGL2D. I also have a
class implementing ModelInitializer. If I call the getPanel() method on
the DisplayOGL2D object, the display in question does not render for
some reason. I realise this might be an unusual thing to do, but I want
to change the properties of one particular display programmatically on
initialisation (is there a better way to get hold of a display
programmatically?). After a very long chase through the code, I think
the problem may be that the call to getPanel() creates a null panel
within the display.
I have reproduced a small implementation to replicate the problem below
- in a context which just adds agents to a Network which is itself
displayed in a 2D display with all the Repast Simphony defaults. Any
help if I'm doing something wrong much appreciated.
public class TestInitialiser implements ModelInitializer {
@Override
public void initialize(Scenario scen, RunEnvironmentBuilder
builder) {
scen.addMasterControllerAction(new
NullAbstractControllerAction() {
//@Override
public void runInitialize(RunState runState, Context
context, Parameters runParams) {
List<IDisplay> listOfDisplays =
runState.getGUIRegistry().getDisplays();
for (IDisplay display : listOfDisplays) {
System.out.println(display.getClass().getName());
//having the line above is fine, but with
the line below, the display doesn't render
//If I comment out the following line the display renders OK.
System.out.println(display.getPanel().getName());
};
}
});
}
}
J Richard Snape
PhD Student
----------------
CASCADE (Complex Adaptive Systems, Cognitive Agents and Distributed
Energy) project : a Complexity Science-Based Investigation into the
Smart Grid Concept see, http://www.iesd.dmu.ac.uk/~cascade
<http://www.iesd.dmu.ac.uk/~cascade>
---------------
Queens Building, The Gateway, Leicester LE1 9BH
Email: js...@dm... <mailto:js...@dm...>
Mobile +44(0)7980 585778
|