swarm-support
[Top][All Lists]
Advanced

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

Re: Geometry Archiving still not working the way a I wish


From: Paul E. Johnson
Subject: Re: Geometry Archiving still not working the way a I wish
Date: Fri, 05 Feb 1999 16:25:55 -0600

"Marcus G. Daniels" wrote:
> 
> >>>>> "PJ" == Paul E Johnson <address@hidden> writes:
> 
> PJ> That has me puzzled. Care to enlighten?
> 
> Include <misc.h> to declare strdup.
> 
Thanks. That made the warning go away. Now here is my situation. The
.swarmArchiver file shows the widget names I expect and saves geometry
for them. However, when I run the program again, the widgets are not
laid out according to the geometry in .swarmArchiver. Here is the
.swarmArchiver file:
(archiver
  (list
    (cons '(recruiter default)
      (list
        (cons 'PolicySpace00
          (make-instance 'WindowGeometryRecord  #:position '(4 528)))
        (cons 'PolicySpace01
          (make-instance 'WindowGeometryRecord  #:position '(394 580)))
        (cons 'PolicySpace02
          (make-instance 'WindowGeometryRecord  #:position '(196 196)))
        (cons 'ProbeDisplay-ObserverSwarm
          (make-instance 'WindowGeometryRecord  #:position '(984 64)))
        (cons 'ProbeDisplay-modelSwarm
          (make-instance 'WindowGeometryRecord  #:position '(691 -7)))
        (cons 'panelWidget
          (make-instance 'WindowGeometryRecord  #:position '(10 8)))
        (cons 'proposalRaster
          (make-instance 'WindowGeometryRecord  #:position '(174 174)))
        (cons 'stabilityGraph-graph
          (make-instance 'WindowGeometryRecord  #:position '(542 295)))
        (cons 'policyRaster
          (make-instance 'WindowGeometryRecord  #:position '(818
595)))))))
~

I have verified that the geometry numbers in this file do change in
response to the program. 

Here is the relevant portion of ObserverSwarm.m

This is from buildObjects. :
   for(i=0; i< (DIMENSION/2); i++)
     {
   char rasterName[15];

   sprintf(rasterName,"PolicySpace%02d",i);
   policyRaster = [WhiteRaster create: [self getZone]];
   [policyRaster setSpaceNumber: i];
   [policyRaster setWindowTitle: rasterName];
   [policyRaster setWindowGeometryRecordName: strdup (rasterName) ];
  // SET_WINDOW_GEOMETRY_RECORD_NAME(policyRaster);
   [policyRaster setColormap: colorMap];
   [policyRaster setZoomFactor: 4];
   [policyRaster setWidth: [[modelSwarm getPolicySpace:i] getSizeX]
                   Height: [[modelSwarm getPolicySpace:i] getSizeY]];
   [policyRaster pack];                             // draw the window.
   [policyRasterList addLast: policyRaster];


The buildActions part is standard, AFAIK, except I use createForEach to
make the displays go for all the rasters in the policyDisplayList:

  displayActions = [ActionGroup create: [self getZone]];

    [displayActions createActionTo: stabilityGraph       message:
M(step)];
    [displayActions createActionForEach: policyRasterList    message:
M(eraseNew)];
    [displayActions createActionTo: proposalRaster      message:
M(eraseNew)];
    [displayActions createActionForEach: voterDisplayList        
message: M(display)];
    [displayActions createActionForEach: policyDisplayList         
message: M(display)];
    [displayActions createActionTo: proposalDisplay       message:
M(display)];
    [displayActions createActionTo: proposalRaster       message:
M(drawSelf)];
    [displayActions createActionForEach: policyRasterList        
message: M(drawSelf)];
    [displayActions createActionTo: actionCache message: M(doTkEvents)];

I did macro programming in SAS years ago and it had a way around
problems like this. Instead of having "policyDisplay" inside the loop
that creates the rasters, in SAS you could put "policyDisplay%i" and
when it ran it would resolve the %i by adding 00, 01, etc, on each
loop.  That would create the separate names you needed.  Is there
something comparable I could use here? 

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (913) 864-9086
Lawrence, Kansas 66045                FAX: (913) 864-5700

                  ==================================
   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]