📄 swarm.overview.mag4.build-observer.sect1.html
字号:
<HTML><HEAD><TITLE>Building a Graphical Observer Swarm</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Mag 4x:Sketch of Code "HREF="swarm.overview.mag4.chapter.html"><LINKREL="PREVIOUS"TITLE="Scheduling a Model Swarm"HREF="swarm.overview.mag4.schedule-swarm.sect1.html"><LINKREL="NEXT"TITLE="Building a Data Graph"HREF="swarm.overview.mag4.build-graph.sect1.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.overview.mag4.schedule-swarm.sect1.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 4. Mag 4x:Sketch of Code</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.overview.mag4.build-graph.sect1.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SWARM.OVERVIEW.MAG4.BUILD-OBSERVER.SECT1">4.6. Building a Graphical Observer Swarm</A></H1><P>With the model swarm defined, arranging for a graphical observer Swarm is the next step. For Heatbugs, the code is in HeatbugObserverSwarm. The structure of an observer swarm is almost exactly like building a model swarm.</P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><PRECLASS="PROGRAMLISTING">@interface HeatbugObserverSwarm : GUISwarm { int displayFrequency; // one parameter: update freq id displayActions; // schedule data structs id displaySchedule; HeatbugModelSwarm * heatbugModelSwarm; // the Swarm we're observing // Lots of display objects. First, widgets XColormap * colormap; // allocate colours ZoomRaster * worldRaster; // 2d display widget EZGraph * unhappyGraph; // graphing widget // Now, higher order display and data objects Value2dDisplay * heatDisplay; // display the heat Object2dDisplay * heatbugDisplay; // display the heatbugs} </PRE></TD></TR></TABLE><P>Again we have input parameters (display frequency), schedule data structures, and resident objects (model swarm, display widgets). The important exception is that HeatbugObserverSwarm is a subclass not just of the generic Swarm class, but specifically a GUISwarm. That implies that the HeatbugObserverSwarm will contain a control panel to allow the user to stop execution, and will also have a special <TTCLASS="LITERAL">go</TT> method to set everything running.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.overview.mag4.schedule-swarm.sect1.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.overview.mag4.build-graph.sect1.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Scheduling a Model Swarm</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.overview.mag4.chapter.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Building a Data Graph</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -