Home  >  Magazine  >  #73 May 2000  >  A Real-Time Data Plotting Program  >  Listing 1. Redrawing Screen
Friday, March 10, 2000 | Last Updated 12:06:22 PM


  

Listing 1. Redrawing Screen

// For either the AUTO_SCALE or TRACKING modes, we
// may need to schedule a new rendering with a new 
// mapping.  In AUTO_SCALE mode, a new rendering
// is needed if _allPointsBBBox != _map.viewPort.  
// Or in TRACKING mode, it is needed if 
// _trackingPort != _map.viewPort.
BBox *testBox;
testBox = (AUTO_SCALE == _viewMode) ? 
   &_allPointsBBox : &_trackingPort;

if (  (AUTO_SCALE == _viewMode)
    && memcmp(&_allPointsBBox,  &(_map.viewPort), 
    sizeof(BBox))  )
  _render.quePrivateRender(_allPointsBBox, 
     this->size());

// For TRACKING mode, we must also make sure that 
// the range following has not eaten up all our 
// resolution.
else if (  (TRACKING == _viewMode)
   && memcmp(&_trackingPort,  &(_map.viewPort), 
      sizeof(BBox))  )
{
  BBox tmpPort;
  tmpPort = _trackingPort; // Need copy for 
                          // rtpResCheck to modify
  if (!rtpResCheck(&tmpPort))
    _render.quePrivateRender(_trackingPort, 
       this->size());
  else // Notify user of problem, switch to 
       // USER_FIXED mode.
       // Mode change must come before message box
       //  to avoid recursion.
  {
    _viewMode = USER_FIXED;
    QMessageBox::warning(this, caption(),
"Resolution is insufficient to track new points.\n"
      "Fixing view port in current position.\n",
      QMessageBox::Ok | QMessageBox::Default, 0, 0);
  }
}