swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makeProbeAtX$Y - Can I create a custom probe map for an object?


From: Geoff Wright
Subject: Re: makeProbeAtX$Y - Can I create a custom probe map for an object?
Date: Fri, 7 Jun 2002 08:54:13 -0400
User-agent: KMail/1.4.1

Hi Paul, 

Thanks for the link to the source code. I will be interested in learning more 
about JNI (when time permits..).

As for the Probes...
I looked at both jheatbugs and heatbugs from swarmapps but I am still missing 
something important.

In jheatbugs, you create a HeatbugObserverProbeMap and add variables and 
messages to it with the addVar() and addMessage() methods.  
HeatbugModelProbeMap is also created and customizable with the addVar() and 
addMessage() methods.

I can see that both of these ProbeMaps are customizable. However, there is a 
third ProbeMap that is created with a "makeProbeAtX$Y" method operating on an 
Object2dDisplay object.  That is, when you click on a bug in the raster 
display, you get a ProbeMap for that object.  I am not able to see if/how 
this ProbeMap can be customized.  It seems to me that all of the probed 
object's public members are put on the probe.  

The code that introduces this functionality into the model is:

    // Also, tell the world raster to send mouse clicks to the
    // heatbugDisplay this allows the user to right-click on the
    // display to probe the bugs.
    try {
      worldRaster.setButton$Client$Message 
        (3, heatbugDisplay, new Selector (heatbugDisplay.getClass (), 
                                          "makeProbeAtX$Y", true));
    } catch (Exception e) {
      System.err.println ("Exception makeProbeAtX$Y: " 
                          + e.getMessage ());
    }

Perhaps I am thinking about this the wrong way but it seems to me that I would 
have to get into the Objective C code to figure out what's going on with this 
..

>From Object2dDisplay.m:120
// code to make a probe for an object at a specific point. This is
// good to make as a button client for Raster widgets
- makeProbeAtX: (unsigned)x Y: (unsigned)y

and then,

>From simtoolsgui.h:271
//#: This macro creates a probe display for the given object
#define CREATE_PROBE_DISPLAY(anObject) \
  _createProbeDisplay(anObject)

So, it seems to me that I will have to get into the ObjectiveC code to figure 
out what's going on with the ProbeMap created with the "makeProbeAt" method.
Is my intuition right here or is there easier fix that I am overlooking?

Thanks again,
geoff
        



On Thursday 06 June 2002 15:00, Paul E Johnson wrote:
> Hey, Geoff:
>
> You can control what things appear in a probe. Take a look at the
> swarmapps for objective C, in the heatbugs, for example.  Or, I suppose,
> look in jheatbugs, to see the same. THat part is pretty easy.
>
> The source code for all swarm is available. Look on the ftp server and
> there is a directory "src" and if you are using a newish swarm, it will
> be under "testing". Now I'm running:
>
> ftp://ftp.swarm.org/pub/swarm/src/testing/swarm-2002-05-14.tar.gz
>
> I'm sorry to say I don't have more documentation to give about how the
> jni works, but I think there are lots of Java books for that.
>
> Geoff Wright wrote:
> > Hi.
> >
> > In the jSwarm tutorial there is an application called SimpleObserverBug3.
> >  One of the features of this app is that we are introduced how to send a
> > message through the ZoomRaster object to an Object2dDisplay object.  That
> > is, when I click on a bug on the raster display window, a probe map for
> > the bug appears.
> >
> > According the jSwarm tutorial, it creates a COMPLETE probe map.
> >
> > Question 1: Is there any way to customize this probe map?
> >
> > For example, I have created a Commodity class which has fields: type and
> > quantity.  Each bug in my model can have one or multiple instances of
> > this class. (I am trying to think in OOP terms, so please correct me if
> > this sounds wrong).  That is, the bug can have a productionCommodity of
> > type 2 and quantity 5.  Now, when I probe the bug, I get something like
> > this:
> >
> > xPos = 42
> > yPos = 37
> > productionCommodity - Commodity
> > ...
> > ...
> >
> > I would like to be able to probe the bug and get something like this:
> >
> > xPos = 42
> > yPos = 37
> > productionCommodity: type = 2; quantity = 5
> > ...
> > ...
> >
> > Is it possible to do something like this?
> >
> > Also, I am using swarm.jar which gives me access to a number of compiled
> > swarm objects.  My understanding is that these objects are written in
> > ObjectiveC and there is some sort of interface (JNI) that allows java
> > apps access to these objects.  Where can I learn more about this and can
> > someone point me to where I would find the source code for these swarm
> > objects?
> >
> > Thank  you.
> > geoff


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]