Print

Print


Thank you very much for the suggestions, all three of you.

@Joey: I did consider storing the graph as both a MASON Network and a JUNG graph. It's a fast and easy solution, but not the most elegant or flexible. Plus, the graph can get quite large, so I didn't want to have a redundant copy in memory. My custom GraphPortrayal class is a bit of a hack as well (it only works if all vertices are also placed in a Continuous2D field) but it seems to do the trick. Thanks for the highlighting idea though, it would allow me to chache the main graph and only redraw the highlighted parts when needed.

@Sean: I do have multiple FieldPortrayals in my Display, only one of which is static. So I think caching the graph as an image is the way to go here.

@Ernesto: That's an interesting suggestion and is probably the most elegant solution. My concern is integrating MASON with JUNG nicely, and while both you an Sean raise excellent points on how to achieve this, it sounds like a bit more work than I want to spend on this problem right now. As I mentioned, a custom Portrayal class for JUNG graphs does the trick a well, and works fine for the moment. But I will keep this in mind should I ever decide to do it properly, and I will also take another look at the JUNG example code.

Thanks again for all your help, this has answered all my questions and given me a lot to work with.

Cheers,
Miriam
________________________________________
Von: MASON Multiagent Simulation Toolkit [[log in to unmask]]" im Auftrag von "Sean Luke [[log in to unmask]]
Gesendet: Mittwoch, 22. Juli 2015 10:54
An: [log in to unmask]
Betreff: Re: MASON and JUNG: Portrayal Class

On Jul 22, 2015, at 10:43 AM, Ernesto Carrella <[log in to unmask]> wrote:

> Depending on how much work you need MASON GUI to do, you could also ditch display2D and draw using Jung directly. I always felt Jung 2.0 have some of the most elegant API for drawing simple graphs (aging a bit now that Java 8 replaced most of the apache commons used by Jung, but still great).
> Nice tutorial here:
> http://www.grotto-networking.com/JUNG/JUNG2-Tutorial.pdf

The old MASON-Jung stuff that Maciej had hacked together included a Display just for Jung, I thought, which was distinct from Display2D and Display3D (a DisplayJung, as it were).  You might try starting there.

Alternatively, you could modify Display2D so that its InnerDisplay2D is instead some subclass of a Jung component or panel instead of what it is, which is (I think?) a subclass of JPanel.  This would then let you hack in the ability to draw Jung stuff in the lowest layer and maybe other MASON stuff on top if you cared, but more importantly, it'd be an easy way to hack Jung stuff into Display2D directly.

Sean