Ejemplo n.º 1
0
// Attention: This function needs to be consummated
void Aircraft::drawWithInstruments(const RECT &rect)
{
	// When the client area minimized, just return.
	if (rect.right == 0 || rect.bottom == 0)
		return;

	// Calculate the differences
	float diff = calculateDifferences(rect);
	z_ = z_ + diff;
	y_ = -50.0f;
	x_ = 300.0f;

	drawModel();
}
void RangeProfilePlotManager::updateContextMenu(Subject& subject, const std::string& signal, const boost::any& value)
{
   ContextMenu* pMenu = boost::any_cast<ContextMenu*>(value);
   if (pMenu == NULL)
   {
      return;
   }
   QAction* pDiffAction = new QAction("Calculate Difference", pMenu->getActionParent());
   VERIFYNRV(mpView);
   int numSelectedObjects = mpView->getNumSelectedObjects(true);

   if (numSelectedObjects != 2)
   {
      pDiffAction->setEnabled(false);
   }
   else
   {
      std::list<PlotObject*> objects;
      mpView->getSelectedObjects(objects, true);
      for (std::list<PlotObject*>::const_iterator obj = objects.begin(); obj != objects.end(); ++obj)
      {
         std::string name;
         (*obj)->getObjectName(name);
         if (name == "Difference")
         {
            pDiffAction->setEnabled(false);
            break;
         }
      }
   }

   VERIFYNR(connect(pDiffAction, SIGNAL(triggered()), this, SLOT(calculateDifferences())));
   pMenu->addActionBefore(pDiffAction, "SPECTRAL_RANGEPROFILEPLOT_DIFFERENCE_ACTION", APP_PLOTWIDGET_PRINT_ACTION);

   QAction* pDelAction = new QAction(
      (numSelectedObjects > 1) ? "Delete Plots" : "Delete Plot", pMenu->getActionParent());
   if (mpView != NULL && numSelectedObjects == 0)
   {
      pDelAction->setEnabled(false);
   }
   VERIFYNR(connect(pDelAction, SIGNAL(triggered()), this, SLOT(deleteSelectedPlots())));
   pMenu->addActionAfter(pDelAction, "SPECTRAL_RANGEPROFILEPLOT_DELETE_ACTION",
      "SPECTRAL_RANGEPROFILEPLOT_DIFFERENCE_ACTION");
}