Hi Nick and Mike
Simphony agent probing is sufficient anyway, I was just trying to do
something extra based on someone's request.
Thanks for your help anyway.
Bojan
-----Original Message-----
From: North, Michael [mailto:north@...]
Sent: Tuesday, 7 October 2008 3:44 AM
To: Collier, Hugh N.; Bojan Lovric
Cc: repast-interest
Subject: RE: [Repast-interest] Custom Display
Bojan:
As Nick observed, this is something we are working on for the next
release.
Mike
-----Original Message-----
From: Nick Collier [mailto:nick.collier@...]
Sent: Thursday, October 02, 2008 10:03 AM
To: Bojan Lovric
Cc: repast-interest
Subject: Re: [Repast-interest] Custom Display
Bojan,
Re. probing, this will be difficult, I think, as the ProbeManager is
not exposed to client simulation code. The ProbeManager is a field in
RSApplication that is added as a ProbeListener to any Display that
extends AbstractDisplay and is added to simphony gui the normal
display mechanism.
I'm not sure it will be possible for you get a reference to the
ProbeManager without making some changes to simphony itself. However,
perhaps you can use the source code to it to replicate something
similar.
I'll make a note that we should open up simphony to expose the probe
manager.
Nick
On Oct 2, 2008, at 2:26 AM, Bojan Lovric wrote:
> Thanks Nick and Eric
>
> The mouse scroll wheel zoom works well now :)
>
> As for my first question, I was not aware how to bring up the agent
> property screen as seen in attached jpg (AgentPropertyView). I don't
> have a problem implementing a mouse event listener for double click
> etc...
>
> I am trying and still having trouble viewing my existing agent
> properties via newly created blue node (see Strength View.jpg). I
> would
> like corresponding agent properties to appear as seen in
> AgentPropertyView.jpg when double clicking the blue node.
>
> Thanks
> Bojan
>
> -----Original Message-----
> From: Tatara, Eric R. [mailto:tatara@...]
> Sent: Thursday, 2 October 2008 3:16 AM
> To: Collier, Hugh N.; Bojan Lovric
> Cc: repast-interest
> Subject: RE: [Repast-interest] Custom Display
>
> Just a quick note on the mouse wheel listener, the
> repastPiccoloMouseWheelListener inner class of RepastCanvas2D use the
> double fields RepastCanvas2D.mousePositionX and
> RepastCanvas2D.mousePositionY as the point about which the zoom view
> scales. If it's a fixed position, you can just use the center of the
> canvas, or as with the RepastCanvas2D class, you may include a second
> listener that sets the zoom center point based on the mouse position.
> We use:
>
> public class repastPiccoloMouseMotionListener implements
> MouseMotionListener{
>
> public void mouseDragged(MouseEvent e) {
> // TODO Auto-generated method stub
>
> }
>
> public void mouseMoved(MouseEvent e) {
> mousePositionX = e.getX();
> mousePositionY = e.getY();
> }
> }
>
>
> Eric Tatara, Ph.D.
> Assistant Software Engineer
> Center for Complex Adaptive Agent Systems Simulation
> Decision and Information Sciences Division
> Argonne National Laboratory
>
> -----Original Message-----
> From: Nick Collier [mailto:nick.collier@...]
> Sent: Wednesday, October 01, 2008 8:12 AM
> To: Bojan Lovric
> Cc: repast-interest
> Subject: Re: [Repast-interest] Custom Display
>
> Bojan,
>
> For the probing, you need to add a PInputEvenListener to the PCanvas.
> The code for that is in Display2D:
>
> PInputEventListener listener = new PBasicInputEventHandler() {
> public void mouseClicked(PInputEvent pInputEvent) {
> if (pInputEvent.isLeftMouseButton()
> && pInputEvent.getClickCount() == 2) {
> PPickPath path = pInputEvent.getPath();
> Point2D probeLocation = pInputEvent.getPosition();
> probe(path, probeLocation);
> }
> }
> };
> canvas.addInputEventListener(listener);
>
> The probe method goes through the List of PNodes given by the
> PickPath.getNodeStackReference(). We have a map that associates the
> actual agents with their representative PNodes so then we do a map
> lookup, I think.
>
>
> For the zoom, you add a MouseWheelListener to the PCanvas. The Mouse
> wheel listener that repast uses is in RepastCanvas2D:
>
> public class repastPiccoloMouseWheelListener implements
> MouseWheelListener{
> private double minScale = 0;
> private double maxScale = Double.MAX_VALUE;
>
> public void mouseWheelMoved(MouseWheelEvent e) {
> PCamera camera = getCamera();
>
> double dx = -e.getWheelRotation();
>
> double scaleDelta = (1.0 + (0.1 * dx));
>
> double currentScale = camera.getViewScale();
> double newScale = currentScale * scaleDelta;
>
> if (newScale < minScale)
> scaleDelta = minScale / currentScale;
>
> if ((maxScale > 0) && (newScale > maxScale))
> scaleDelta = maxScale / currentScale;
>
> Point2D point = camera.localToView(new
> Point2D.Double(mousePositionX,mousePositionY));
>
> camera.scaleViewAboutPoint(scaleDelta,
> point.getX(), point.getY());
> }
> }
>
>
>
>
> On Oct 1, 2008, at 2:55 AM, Bojan Lovric wrote:
>
>> Nick,
>>
>> I was thinking of a separate (new Simphony display) to pop up in one
>> of my custom tabs. I managed to do this using Piccolo, and I have
>> created my own nodes and placed them the way I want to.
>>
>> Now I am trying to:
>>
>> 1 - Figure out how to bring up the agent properties when clicking on
>> my piccolo created nodes.
>>
>> 2 - how to change the piccolo zoom to use scroll wheel (like symphony
>> display)
>>
>> Or I might try what u suggested below.
>>
>> Any suggestions ?
>>
>> Thanks
>> Bojan
>>
>> -----Original Message-----
>> From: Nick Collier [mailto:nick.collier@...]
>> Sent: Thursday, 4 September 2008 10:37 PM
>> To: Bojan Lovric
>> Cc: repast-interest
>> Subject: Re: [Repast-interest] Custom Display
>>
>> Bojan,
>>
>> When you say place the simphony display within your display, do you
>> mean have the simphony display show up in your tab as a separate
>> panel? Or, do you mean mimic that kind of display in your tab?
>>
>> At any rate, the following might help. Displays are created in
>> simphony by passing a DisplayDescriptor to a DisplayProducer (in the
>> constructor) and then calling the appropriate createDisplay* method.
>> Once you have a display, you can call getPanel() on it which will get
>> the actual displayed component. If you want only the piccolo nodes
>> that represent the agents, then that's more complicated. In that
>> case,
>
>> you are better off looking at the Display2D code and creating your
>> own nodes.
>>
>> Nick
>>
>>
>> On Sep 3, 2008, at 2:16 AM, Bojan Lovric wrote:
>>
>>> Hello
>>>
>>> Previously I have asked how to create a custom display tabs within
>>> Simphony, and this is going really well, thanks Nick.
>>>
>>> Now I am trying to place one of Simphony displays (Simphony 2D
>>> Display with all of my agents on it) within one of my custom
>>> Simphony
>
>>> display tabs.
>>> Essentially I want to create a custom display for a specific agent
>>> and then I would like to display strength value between this agent
>>> and all other agents in its network.
>>>
>>> At the moment I am learning how to use Picollo in order to draw few
>>> agents and their attributes, however this display does not need to
>>> be
>
>>> anything special, just few agents and their strength value
>>> displayed.
>
>>> So I am thinking that a simple "dump" of one of my Simphony displays
>>> (already implemented) to my custom tab is all I need to do, but not
>>> too sure how to?
>>>
>>> Any suggestions are welcome
>>>
>>> Thanks
>>> Bojan
>>>
>>>
>>> -----Original Message-----
>>> Sent: Thursday, 1 May 2008 11:47 PM
>>> To: Bojan Lovric
>>> Cc: repast-interest
>>> Subject: Re: [Repast-interest] Custom Display
>>>
>>> Bojan,
>>>
>>> All simphony displays implement IDisplay. Attached
>>> (CustomDisplay.java) is an example that displays a panel with a
>>> simple label in it. Note that most of the methods are empty or
>>> return
>
>>> null.
>>> The important methods are render, update and getPanel. When update
>>> is
>
>>> called the display should update its internal state to reflect the
>>> latest state of whatever its displaying. When render is called, the
>>> display should draw those updates. getPanel is called during
>>> initialization to put a panel into a display tab.
>>>
>>> The next step then is telling simphony to load this display during
>>> initialization. You do that with a ModelInitializer. The model
>>> initializer is run once just after your scenario is loaded. It can
>>> be
>
>>> used to add additional items to the scenario tree that's displayed
>>> on
>
>>> the left hand side of simphony. Its not immediately obvious but this
>>> is actually a tree of actions that simphony executes when it
>>> initializes a model prior to a run. A model initializer then can add
>>> a custom action that initializes a custom display. The
>>> TrapInitializer attached does just that. The second added controller
>>> action is what sets up the custom display. Lastly, you need tell
>>> Simphony to run your ModelInitializer and you do that in the
>>> scenario.xml file located in your scenario directory (e.g.
>>> mousetrap.rs) by adding a model.initializer entry. For example,
>>>
>>> <model.initializer
>>> class="repast.simphony.demo.mousetrap.TrapInitializer" />
>>>
>>>
>>> Note that the examples attached conform with the current code so
>>> there may be a few small changes to make it work with what you are
>>> using.
>>> Those should be obvious though. Let me know if you have any
>>> questions.
>>>
>>> Nick
>>>
>>>
>>>
>>>
>>> On Apr 30, 2008, at 7:59 PM, Bojan Lovric wrote:
>>>
>>>> Nick,
>>>
>>>
>>
----------------------------------------------------------------------
>> --
>> -
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge Build the coolest Linux based applications with Moblin SDK
>>> & win great prizes Grand prize is a trip for two to an Open Source
>>> event anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Repast-interest mailing list
>>> Repast-interest@...
>>> https://lists.sourceforge.net/lists/listinfo/repast-interest
>>
>
>
>
------------------------------------------------------------------------
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge Build the coolest Linux based applications with Moblin SDK &
> win great prizes Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Repast-interest mailing list
> Repast-interest@...
> https://lists.sourceforge.net/lists/listinfo/repast-interest
> <AgentProperyView.jpg><Strength View.jpg>
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest
|