home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / hello6 / aearthw6.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  24.4 KB  |  621 lines

  1. /******************************************************************************
  2. * .FILE:         aearthw6.cpp                                                 *
  3. *                                                                             *
  4. * .DESCRIPTION:  Hello World Sample Program Version 6: Class Implementation   *
  5. *                                                                             *
  6. * .CLASSES:      AEarthWindow                                                 *
  7. *                AEarthWindowResizeHandler                                    *
  8. *                ATwinkleTimeHandler                                          *
  9. *                Star                                                         *
  10. *                                                                             *
  11. * .COPYRIGHT:                                                                 *
  12. *    Licensed Material - Program-Property of IBM                              *
  13. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  14. *                                                                             *
  15. * .DISCLAIMER:                                                                *
  16. *   The following [enclosed] code is sample code created by IBM               *
  17. *   Corporation.  This sample code is not part of any standard IBM product    *
  18. *   and is provided to you solely for the purpose of assisting you in the     *
  19. *   development of your applications.  The code is provided 'AS IS',          *
  20. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  21. *   arising out of your use of the sample code, even if they have been        *
  22. *   advised of the possibility of such damages.                               *
  23. *                                                                             *
  24. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  25. *                                                                             *
  26. ******************************************************************************/
  27.  
  28. #include <ibase.hpp>
  29. #include <stdlib.h>
  30. #include "aearthw6.hpp"
  31.  
  32. /**************************************************************************
  33. * Class Star::Star--Constructor for drawing a star                        *
  34. **************************************************************************/
  35. Star::Star(const IPoint &pt)
  36.   : dimStar(pt,pt)
  37.   , brightStar(IRectangle(2,2))
  38.   , noStar(IRectangle(2,2))
  39. {
  40.   intensity=bright;
  41.   brightStar.setEnclosingRect(brightStar.enclosingRect().centerAt(pt));
  42.   noStar.setEnclosingRect(noStar.enclosingRect().centerAt(pt));
  43.   IGraphicBundle noStarBundle;
  44.   noStarBundle.setFillColor(IColor::black)
  45.               .setPenColor(IColor::black)
  46.               .setFillPattern(IGraphicBundle::filled);
  47.   noStar.setGraphicBundle(noStarBundle);
  48. }
  49. /**************************************************************************
  50. * Class Star::~Star--Destructor for drawing a star                        *
  51. **************************************************************************/
  52. Star::~Star()
  53. {
  54. }
  55.  
  56. /**************************************************************************
  57. * Class Star::setPoint--Sets the point where a star is located            *
  58. **************************************************************************/
  59. Star
  60.  &Star::setPoint(const IPoint &pt)
  61. {
  62.   dimStar.setEndingPoint(IPoint(pt.x()+1, pt.y()+1));
  63.   dimStar.setStartingPoint(pt);
  64.   brightStar.setEnclosingRect(brightStar.enclosingRect().centerAt(pt));
  65.   noStar.setEnclosingRect(noStar.enclosingRect().centerAt(pt));
  66.   return *this;
  67. }
  68. /**************************************************************************
  69. * Class Star::setIntensity - Sets the intensity of the star               *
  70. **************************************************************************/
  71. Star
  72.  &Star::setIntensity(const Intensity it)
  73. {
  74.   intensity=it;
  75.   return *this;
  76. }
  77. /**************************************************************************
  78. * Class Star::setGraphicBundle - sets the graphic bundles for drawing the *
  79. *   stars.                                                                *
  80. **************************************************************************/
  81. Star
  82.  &Star::setGraphicBundle(const IGraphicBundle &igb)
  83. {
  84.   dimStar.setGraphicBundle(igb);
  85.   brightStar.setGraphicBundle(igb);
  86.   return *this;
  87. }
  88.  
  89. /**************************************************************************
  90. * Class Star::flicker - randomly sets the star from bright to dim         *
  91. **************************************************************************/
  92. Star
  93.  &Star::flicker()
  94. {
  95.   if (rand()%2)
  96.     intensity=bright;
  97.   else
  98.     intensity=dim;
  99.   return *this;
  100. }
  101.  
  102. /**************************************************************************
  103. * Class Star::drawOn - Draws a dim or bright star on the Graphic Context  *
  104. **************************************************************************/
  105. Star
  106.  &Star::drawOn(IGraphicContext &gc)
  107. {
  108.   if (intensity==bright)
  109.   {
  110.     brightStar.drawOn(gc);
  111.   }
  112.   else
  113.   {
  114.     noStar.drawOn(gc);
  115.     dimStar.drawOn(gc);
  116.   }
  117.   return *this;
  118. }
  119.  
  120. /**************************************************************************
  121. * AEarthWindow :: AEarthWindow - Constructor for the Earth window         *
  122. **************************************************************************/
  123. AEarthWindow :: AEarthWindow(unsigned long windowId,
  124.                              IWindow * parowWindow,
  125.                              const IRectangle& rect)
  126.                :IDrawingCanvas(windowId, parowWindow, parowWindow, rect)
  127.                 ,spaceColor(IColor::black)
  128.                 ,globeColor(IColor::cyan)
  129.                 ,starColor(IColor::white)
  130.                 ,earthWindowResizeHandler(this)
  131.                 ,twinkling(false)
  132.                 ,starIntensity(bright)
  133.                 ,atmosphereLayers(3)
  134. {
  135. /*------------------------------------------------------------------------|
  136. |  Performs the initial draw of the stars and the world.  The first       |
  137. |  elements in both starlist and earthArc are set to null so that the     |
  138. |  objects will be created.  paintStars and paintWorld will then          |
  139. |  initialize the objects.                                                |
  140. -------------------------------------------------------------------------*/
  141.   starlist[0]=0;
  142.   earthArc[0]=0;
  143.   paintWorld( ISize(0,0) );
  144.  
  145. /*------------------------------------------------------------------------|
  146. |  Adds all of the objects to the glist and then attaches it to the       |
  147. |    IDrawingCanvas.                                                      |
  148. -------------------------------------------------------------------------*/
  149.   graphList.addAsLast(space)
  150.            .addAsLast(atmosphereGraphicList)
  151.            .addAsLast(starGraphicList);
  152.  
  153.   setGraphicList(&graphList);
  154.  
  155. /*------------------------------------------------------------------------|
  156. |   The ResizeHandler is attached to the AEarthWindow object to begin     |
  157. |   handling resize events.  Each time the IDrawingCanvas window needs to |
  158. |   be resized, AEarthWindowResizeHandler::resizeWindow function will be  |
  159. |   called.  The first painting occurs because of IWindow::show.          |
  160. -------------------------------------------------------------------------*/
  161.  
  162.   earthWindowResizeHandler.handleEventsFor(this);
  163.   twinkleTimer.setInterval(500);
  164.   show();
  165. } /* end AEarthWindow :: AEarthWindow(...) */
  166.  
  167. /**************************************************************************
  168. * AEarthWindow :: ~AEarthWindow - Destructor for Earth window             *
  169. **************************************************************************/
  170. AEarthWindow :: ~AEarthWindow()
  171. {
  172. /*------------------------------------------------------------------------|
  173. | Tell earthWindowResizeHandler to stop handling events for AEarthWindow. |
  174. -------------------------------------------------------------------------*/
  175.   earthWindowResizeHandler.stopHandlingEventsFor(this);
  176.  
  177. /*------------------------------------------------------------------------|
  178. | Tell the timer to stop twinkling.                                       |
  179. -------------------------------------------------------------------------*/
  180.   if (twinkleTimer.isStarted())
  181.      twinkleTimer.stop();
  182.  
  183. /*------------------------------------------------------------------------|
  184. | Delete the graphic objects in starlist and earthArc list.               |
  185. -------------------------------------------------------------------------*/
  186.   for (int i=0;i<13 ;i++ )
  187.   {
  188.     delete starlist[i];
  189.   }
  190.  
  191.   for (i=0;i<=atmosphereLayers ; i++ )
  192.   {
  193.     delete earthArc[i];
  194.   }
  195. } /* end AEarthWindow :: ~AEarthWindow() */
  196.  
  197.  
  198. /**************************************************************************
  199. * AEarthWindow :: paintWorld - paint a view of Earth from space           *
  200. **************************************************************************/
  201. IBase::Boolean
  202.   AEarthWindow :: paintWorld( ISize newSize )
  203. {
  204.   Boolean
  205.     worldPainted = false;
  206. /*------------------------------------------------------------------------|
  207. | Construct the graphic bundles that will be attached to each layer of    |
  208. | atmosphere or planet.  This will only be perormed on the first call of  |
  209. | this function.                                                          |
  210. |------------------------------------------------------------------------*/
  211.   IGraphicBundle
  212.     arcbundle[4];
  213.   if (!earthArc[0])
  214.   {
  215.     arcbundle[0]
  216.      .setFillPattern(IGraphicBundle::filled)
  217.      .setPenColor(globeColor)
  218.      .setFillColor(globeColor);
  219.     arcbundle[1]
  220.      .setFillPattern(IGraphicBundle::filled)
  221.      .setPenColor(IColor::blue)
  222.      .setFillColor(IColor::blue);
  223.     arcbundle[2]
  224.      .setFillPattern(IGraphicBundle::filled)
  225.      .setPenColor(IColor::darkCyan)
  226.      .setFillColor(IColor::darkCyan);
  227.     arcbundle[3]
  228.      .setFillPattern(IGraphicBundle::filled)
  229.      .setPenColor(IColor::darkBlue)
  230.      .setFillColor(IColor::darkBlue);
  231.   }
  232.  
  233.  
  234. /*------------------- Construct Squares for Arc Casings ------------------|
  235. | Construct four squares such that the leftCenter, topCenter, and         |
  236. |   rightCenter points describe the arcs to be drawn for the Earth and    |
  237. |   its atmosphere.  The squares are constructed from IRectangle objects  |
  238. |   positioned initially at the center of the presentation space          |
  239. |   rectangle and then moved 1/2 the square's width to the left and a     |
  240. |   full square's height plus an arbitrary offset down.                   |
  241. |------------------------------------------------------------------------*/
  242.   IRectangle
  243.     psRect = IRectangle( IPoint(0,0), newSize );
  244.   const int
  245.     arcs=4;
  246.   const float
  247.     arcDropFactor[arcs] = {1.0/8,  1.0/16,  1.0/32, 0},
  248.     arcSizeFactor[arcs] = {9.0/4, 21.0/8,  45.0/16, 3};
  249.   const long
  250.     psHeight=psRect.height();
  251.   long
  252.     arcDrop,
  253.     arcDiameter;
  254.   IPair
  255.     arcOffset;
  256.   IRectangle
  257.     arcSquare[arcs];
  258.   int i;
  259.  
  260.   for (i=0;i<arcs;i++ )
  261.   {
  262.     arcDrop = psHeight*arcDropFactor[i];
  263.     arcDiameter = psHeight*arcSizeFactor[i];
  264.     arcOffset = IPair(-1*arcDiameter/2,-1*arcDiameter-arcDrop);
  265.     arcSquare[i] = IRectangle(psRect.center(),
  266.                      ISize(arcDiameter, arcDiameter));
  267.     arcSquare[i].moveBy(arcOffset);
  268.   }
  269.  
  270. /*------------------------------- Color Space ----------------------------|
  271. | Set the background color to space, which is IColor::black.              |
  272. |------------------------------------------------------------------------*/
  273.   IGraphicBundle spaceBundle;
  274.   spaceBundle.setPenColor(spaceColor)
  275.              .setFillColor(spaceColor)
  276.              .setFillPattern(IGraphicBundle::filled);
  277.   space.setEnclosingRect(rect());
  278.   space.setGraphicBundle(spaceBundle);
  279.  
  280.  
  281. /*-------------------- Draw the Earth and Atmosphere ---------------------|
  282. | Draw the earth and the number of layers of atmosphere specified in      |
  283. |   atmosphereLayers.  arcSquare[0] contains the arc dimension for the    |
  284. |   earth and the other arcSquare objects specify each atmosphere layer.  |
  285. | The arcs are drawn by drawing an ellipse and allowing the program to    |
  286. |   clip the bottom half of the ellipse.  This section of code sets       |
  287. |   the enclosing rectangle that defines the ellipse.  The graphic        |
  288. |   bundles are also attached to set the pen color, fill color, and       |
  289. |   the fill pattern for each ellipse.                                    |
  290. | The ellipses are only instantiated on the first call to this function.  |
  291. -------------------------------------------------------------------------*/
  292.   if (earthArc[0])
  293.   {
  294.     for(i=3;i>=0;i--)
  295.       earthArc[i]->setEnclosingRect(arcSquare[i]);
  296.   }
  297.   else
  298.   {
  299.      atmosphereGraphicList.removeAll();
  300.      for(i=3;i>=0;i--)
  301.      {
  302.         earthArc[i]=new IGEllipse(arcSquare[i]);
  303.         earthArc[i]->setGraphicBundle(arcbundle[i]);
  304.         atmosphereGraphicList.addAsLast(*earthArc[i]);
  305.      }
  306.     earthArc[0]->setGraphicBundle(arcbundle[0]);
  307.   }
  308. /*--------------------------- Paint the Stars ----------------------------|
  309. | Call the AEarthWindow function for painting the stars.                  |
  310. |------------------------------------------------------------------------*/
  311.   worldPainted=paintStars();
  312.  
  313.   return (worldPainted);
  314.  
  315. } /* end AEarthWindow :: paintWorld(..) */
  316.  
  317. /**************************************************************************
  318. * AEarthWindow :: paintStars - paint the stars in the Earth window        *
  319. **************************************************************************/
  320. IBase::Boolean
  321.   AEarthWindow :: paintStars()
  322. {
  323.   Boolean starsPainted = false;
  324.  
  325. /*------------------- Get Presentation Space Objects ---------------------|
  326. | Get the presentation space handle (called "graphics context" in AIX)    |
  327. |   and the rectangle of the area that needs to be painted.               |
  328. |------------------------------------------------------------------------*/
  329.   const IRectangle
  330.     psRect(rect());
  331.  
  332. /*------------------- Construct Stars from IPoints -----------------------|
  333. | Construct a star array where each star is a point within the            |
  334. |   presentation space rectangle.  Each point is computed as a fraction   |
  335. |   of the psRect size offset from the origin of the psRect.              |
  336. |------------------------------------------------------------------------*/
  337.   const int
  338.     stars=13;
  339.   const IPair
  340.     psOrigin(psRect.bottomLeft()),
  341.     psSize(psRect.size());
  342.   int
  343.     i, j;
  344.  
  345.   IPoint
  346.     star[stars];
  347.     star[0] =IPoint(psOrigin+psSize.scaledBy(0.98,0.43));
  348.     star[1] =IPoint(psOrigin+psSize.scaledBy(0.70,0.69));
  349.     star[2] =IPoint(psOrigin+psSize.scaledBy(0.20,0.50));
  350.     star[3] =IPoint(psOrigin+psSize.scaledBy(0.80,0.63));
  351.     star[4] =IPoint(psOrigin+psSize.scaledBy(0.05,0.41));
  352.     star[5] =IPoint(psOrigin+psSize.scaledBy(0.50,0.69));
  353.     star[6] =IPoint(psOrigin+psSize.scaledBy(0.60,0.94));
  354.     star[7] =IPoint(psOrigin+psSize.scaledBy(0.10,0.87));
  355.     star[8] =IPoint(psOrigin+psSize.scaledBy(0.40,0.81));
  356.     star[9] =IPoint(psOrigin+psSize.scaledBy(0.25,0.69));
  357.     star[10]=IPoint(psOrigin+psSize.scaledBy(0.75,0.63));
  358.     star[11]=IPoint(psOrigin+psSize.scaledBy(0.30,0.87));
  359.     star[12]=IPoint(psOrigin+psSize.scaledBy(0.95,0.87));
  360.  
  361.  
  362. /*------------------------------------------------------------------------|
  363. | Draw the stars by setting the starBundle to white and by setting the    |
  364. | position of that the star will be drawn at.  On the first call to this  |
  365. | function, each star will instantiated while setting the location and    |
  366. | the graphic bundle will be set to starBundle.                           |
  367. |------------------------------------------------------------------------*/
  368.   IGraphicBundle starBundle;
  369.   starBundle.setPenColor(starColor)
  370.             .setFillColor(starColor)
  371.             .setFillPattern(IGraphicBundle::filled);
  372.  
  373.   if (starlist[0])
  374.   {
  375.     for (i=0;i<stars;i++)
  376.     {
  377.       starlist[i]->setPoint(star[i]);
  378.       starlist[i]->setIntensity(starIntensity);
  379.     }
  380.   }
  381.   else
  382.   {
  383.     starGraphicList.removeAll();
  384.     for (int i=0;i<stars ;i++ )
  385.     {
  386.       starlist[i]=new Star(star[i]);
  387.       starlist[i]->setGraphicBundle(starBundle);
  388.       starlist[i]->setIntensity(starIntensity);
  389.       starGraphicList.addAsLast(*starlist[i]);
  390.     }
  391.   }
  392.   if (twinkling)
  393.   {
  394.     twinkleStars();
  395.   }
  396.   starsPainted = true;
  397.   return (starsPainted);
  398.  
  399. } /* end AEarthWindow :: paintStars(...) */
  400.  
  401. /**************************************************************************
  402. * Class AEarthWindow:: twinkleStars - Make the stars twinkle and refresh  *
  403. **************************************************************************/
  404. IBase::Boolean
  405.   AEarthWindow::twinkleStars()
  406. {
  407.   if (twinkling)
  408.   {
  409. /*------------------------------------------------------------------------|
  410. | If the stars are twinkling, then call the flicker function for each     |
  411. | and redraw them on the IDrawingCanvas.                                  |
  412. | Since we are not drawing to the drawing canvas but to the graphic       |
  413. | context, set the recoordination height for portability.                 |
  414. -------------------------------------------------------------------------*/
  415.     IGraphicContext gc(presSpace());
  416. #ifdef IC_WIN
  417.     gc.setRecoordinationHeight( size().height() );
  418. #endif
  419.     for (int i=0;i<13 ;i++ )
  420.       starlist[i]->flicker();
  421.     starGraphicList.drawOn(gc);
  422.   }
  423.   return true;
  424. }
  425.  
  426.  
  427. /******************************************************************************
  428. * Class AEarthWIndowResizeHandler :: AEarthWindowResizeHandler - Constructor  *
  429. *   for the timecard's pie chart                                              *
  430. *                                                                             *
  431. * Define yourself as an IResizeHandler                                        *
  432. * Store a pointer to the pie chart                                            *
  433. ******************************************************************************/
  434. AEarthWindowResizeHandler::AEarthWindowResizeHandler( AEarthWindow * aew )
  435.      :IResizeHandler()
  436.      , earthWindow ( aew )
  437. {
  438. }
  439.  
  440.  
  441. /******************************************************************************
  442. * Class AEarthWindowResizeHandler :: ~AEarthWindowResizeHandler - Destructor  *
  443. ******************************************************************************/
  444. AEarthWindowResizeHandler::~AEarthWindowResizeHandler( )
  445. {
  446. }
  447.  
  448.  
  449. /**************************************************************************
  450. * Class AEarthWindowResizeHandler :: windowResize() - Called when a       *
  451. *   resize event occurs for the drawing canvas.                           *
  452. **************************************************************************/
  453. IBase::Boolean AEarthWindowResizeHandler::windowResize( IResizeEvent& event )
  454. {
  455. /*-------------------------------------------------------------------------
  456. | Call our own resizing function and repaint the drawing canvas.          |
  457. -------------------------------------------------------------------------*/
  458.    earthWindow->paintWorld( event.newSize() );
  459.    earthWindow->refresh();
  460.    return false;
  461. }
  462.  
  463.  
  464. /**************************************************************************
  465. * Class AEarthWindow :: enableBright - Set the star intensity to bright   *
  466. *   or dim.                                                               *
  467. **************************************************************************/
  468. AEarthWindow
  469.   &AEarthWindow :: enableBright(Boolean makingBright)
  470. {
  471.   if (makingBright && starIntensity != bright)
  472.   {
  473.     starIntensity = bright;
  474.     paintStars();
  475.     refresh();
  476.   }
  477.   else if (!makingBright && starIntensity != dim)
  478.   {
  479.     starIntensity = dim;
  480.     paintStars();
  481.     refresh();
  482.   }
  483.   return (*this);
  484. } /* end AEarthWindow :: enableBright */
  485.  
  486.  
  487. /**************************************************************************
  488. * Class AEarthWindow :: disableBright - Set the star intensity to dim.    *
  489. **************************************************************************/
  490. AEarthWindow
  491.   &AEarthWindow :: disableBright()
  492. {
  493.   return (enableBright(false));
  494. } /* end AEarthWindow :: disableBright */
  495.  
  496.  
  497. /**************************************************************************
  498. * AEarthWindow :: isBright                                                *
  499. *   Return true if starIntensity is bright, else return false.            *
  500. **************************************************************************/
  501. const IBase::Boolean
  502.   AEarthWindow :: isBright()
  503. {
  504.   return (starIntensity==bright);
  505. } /* end AEarthWindow :: isBright */
  506.  
  507.  
  508. /**************************************************************************
  509. * Class AEarthWindow :: setLayers - Set the atmosphere layers from 0 to 3.*
  510. **************************************************************************/
  511. AEarthWindow
  512.   &AEarthWindow :: setLayers(const unsigned long layers)
  513. {
  514.   if(layers>3)
  515.     atmosphereLayers=3;
  516.   else
  517.   {
  518.     atmosphereLayers=layers;
  519.     atmosphereGraphicList.removeAll();
  520.     for (int i=atmosphereLayers;i>=0 ;i-- )
  521.     {
  522.       atmosphereGraphicList.addAsLast(*earthArc[i]);
  523.     }
  524.   }
  525.   refresh();
  526.   return (*this);
  527. } /* end AEarthWindow :: setLayers */
  528.  
  529.  
  530. /**************************************************************************
  531. * Class AEarthWindow :: layers - Return the current number of layers      *
  532. *   of atmosphere.                                                        *
  533. **************************************************************************/
  534. const unsigned long
  535.   AEarthWindow :: layers()
  536. {
  537.   return (atmosphereLayers);
  538. } /* end AEarthWindow :: layers */
  539.  
  540.  
  541. /**************************************************************************
  542. * Class AEarthWindow :: enableTwinkle - Make the stars twinkle.           *
  543. **************************************************************************/
  544. AEarthWindow
  545.   &AEarthWindow :: enableTwinkle(Boolean turningOn)
  546. {
  547.   if (turningOn && !twinkling)
  548.   {
  549.     twinkling=true;
  550.     twinkleTimer.start(new ATwinkleTimeHandler(this));
  551.     twinkleStars();
  552.   }
  553.   else if (!turningOn && twinkling)
  554.   {
  555.     twinkling=false;
  556.     twinkleTimer.stop();
  557.     paintStars();
  558.   }
  559.   return (*this);
  560. } /* end AEarthWindow :: enableTwinkle (...) */
  561.  
  562.  
  563. /**************************************************************************
  564. * Class AEarthWindow :: disableTwinkle - Make the stars stop twinkling.   *
  565. **************************************************************************/
  566. AEarthWindow
  567.   &AEarthWindow :: disableTwinkle()
  568. {
  569.   return (enableTwinkle(false));
  570. } /* end AEarthWindow :: disableTwinkle() */
  571.  
  572.  
  573. /**************************************************************************
  574. * Class AEarthWindow :: isTwinkling -Are the stars twinkling?             *
  575. **************************************************************************/
  576. const IBase::Boolean
  577.   AEarthWindow :: isTwinkling()
  578. {
  579.   return (twinkling);
  580. } /* end AEarthWindow :: isTwinkling() */
  581.  
  582.  
  583. /**************************************************************************
  584. * AEarthWindow :: setEarthColor - Set the color used for drawing the      *
  585. *   inner arc that represents Earth.                                      *
  586. **************************************************************************/
  587. AEarthWindow
  588.   &AEarthWindow :: setEarthColor(const IColor &hue)
  589. {
  590.   globeColor = hue;
  591.   IGraphicBundle newEarthColor;
  592.   newEarthColor.setFillColor(hue)
  593.                .setPenColor(hue)
  594.                .setFillPattern(IGraphicBundle::filled);
  595.   earthArc[0]->setGraphicBundle(newEarthColor);
  596.   refresh();
  597.   return (*this);
  598. } /* end AEarthWindow :: setEarthColor(...) */
  599.  
  600.  
  601. /**************************************************************************
  602. * Class AEarthWindow :: earthColor - Return the current color being used  *
  603. *   to draw the Earth.                                                    *
  604. **************************************************************************/
  605. const IColor
  606.   &AEarthWindow :: earthColor()
  607. {
  608.   return (globeColor);
  609. } /* end AEarthWindow :: earthColor() */
  610.  
  611.  
  612. /**************************************************************************
  613. * Class ATwinkleTimeHandler :: tick - Process ATimeHandler ticks by       *
  614. *   calling the AEarthWindow function for twinkling the stars.            *
  615. **************************************************************************/
  616. void ATwinkleTimeHandler::timerExpired(unsigned long timeid)
  617. {
  618.   aew->twinkleStars();
  619. }
  620.  
  621.