Thanks for the quick reply. That was all the help i needed about the
inspectors. I had seen that stuff in the tutorials about the
inspectors, but didn't know to pull them up. I think it was around
tutorial 4 when i stopped reading and just decided to dig into the code.
one more question. right now, i am simulating an agent broadcasting a
message to its neighbors by having it put its neighbors in a Bag and
reading their state information that way. (this is kind of a 'pull'
operation as opposed to the real world 'push' operation). is there a
better way to simulate sending a message to your neighbors? also, is
there any way to simulate line of sight behavior of this message passing?
Sean Luke wrote:
> MASON has facilities for inspecting objects automatically by
> double-clicking on them. But it has no built-in facilities for user
> selection and moving. However, it DOES have easy hooks for them, at
> least in the 2D environment.
> A useful method to examine is Display2D.createInspectors(...). This
> method is called when the user double-clicks on the Display2D (by a
> mouse listener that passed in a 1x1 rectangle at the mouse-click
> point). createInspectors calls a method called
> Display2D.objectsHitBy(rect), which returns an array of Bags, one Bag
> per FieldPortrayal attached to the Display2D. Each Bag contains
> LocationWrappers pointing to all the objects in the fields which
> intersected with this point. Display3D has similar methods.
> You are free to add a mouse listener, or modify Display2D's, and call
> objectsHitBy to get the objects yourself and do whatever you like with
> them. At present we do not have any method for *changing* the
> "location" of an object, to move it per se -- mostly because we hadn't
> bothered to write such a monster yet -- but it's definitely doable.
> We do have a hook for Portrayals (setSelected(...), unused at the
> moment) which allows you to tell Portrayals that certain underlying
> objects have been "selected" by the user -- perhaps he clicked on them
> one time or something. But we've not hooked that up yet. Wouldn't be
> hard to wire it I guess.
> On Feb 14, 2006, at 8:03 PM, Ben Axelrod wrote:
>> I recently started using MASON a few weeks ago. I am modifying tutorial
>> 5 for a quick and dirty distributed network simulator. I would like to
>> allow the user to select a node or group of nodes with the mouse. (the
>> nodes are now motionless in my simulation). this selection only needs
>> to set a boolean member variable. what is the easiest way to do this?
>> PS. I am pretty good with C++, but still new to Java...