Exemple #1
0
bool DiHdfImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   if (!RasterElementImporterShell::execute(pInArgList, pOutArgList))
   {
      return false;
   }
   SpatialDataView* pView = (pOutArgList == NULL) ? NULL : pOutArgList->getPlugInArgValue<SpatialDataView>("View");
   if (pView != NULL)
   {
      if (pView->createDefaultAnimation() == NULL)
      {
         return false;
      }
      AnimationController* pController = Service<AnimationServices>()->getAnimationController(pView->getName());
      if (pController == NULL)
      {
         return false;
      }
      pController->setAnimationCycle(REPEAT);
      pController->setCanDropFrames(false);
      pController->setIntervalMultiplier(2);
      AnimationToolBar* pToolbar = static_cast<AnimationToolBar*>(Service<DesktopServices>()->getWindow("Animation", TOOLBAR));
      VERIFY(pToolbar);
      pToolbar->setAnimationController(pController);
   }
   return true;
}
Exemple #2
0
TimelineWidget::TimelineWidget(QWidget *pParent) : QWidget(pParent),
      mDragType(TimelineWidget::DRAGGING_NONE),
      mpDragging(NULL),
      mpToolbar(SIGNAL_NAME(AnimationToolBar, ControllerChanged), Slot(this, &TimelineWidget::controllerChanged)),
      mpControllerAttachments(SIGNAL_NAME(AnimationController, FrameChanged), Slot(this, &TimelineWidget::currentFrameChanged)),
      mpSessionExplorer(SIGNAL_NAME(DockWindow, AboutToShowContextMenu), Slot(this, &TimelineWidget::polishSessionExplorerContextMenu))
{
   mpControllerAttachments.addSignal(SIGNAL_NAME(AnimationController, AnimationAdded), Slot(this, &TimelineWidget::currentFrameChanged));

   mpD = new PrivateData;
   setRange(mpD->minValue, mpD->maxValue, false);
   setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
   setMouseTracking(true);
   setContextMenuPolicy(Qt::PreventContextMenu);

   AnimationToolBar *pToolBar = static_cast<AnimationToolBar*>(Service<DesktopServices>()->getWindow("Animation", TOOLBAR));
   mpToolbar.reset(pToolBar);
   setAnimationController(pToolBar->getAnimationController());

   // install context menu listeners
   SessionExplorer *pSes = static_cast<SessionExplorer*>(Service<DesktopServices>()->getWindow("Session Explorer", DOCK_WINDOW));
   mpSessionExplorer.reset(pSes);
   mpNewAnimationAction = new QAction("New Animation", this);
   mpNewAnimationAction->setStatusTip("Create an empty animation controller of a specified type.");
   VERIFYNR(connect(mpNewAnimationAction, SIGNAL(triggered()), this, SLOT(createNewController())));
}
void AnimationTestDlg::toggleTimeDisplay()
{
   Service<DesktopServices> pDesktop;

   AnimationToolBar* pToolBar = dynamic_cast<AnimationToolBar*>(pDesktop->getWindow("Animation", TOOLBAR));
   if (pToolBar != NULL)
   {
      pToolBar->setHideTimestamp(pToolBar->getHideTimestamp() == false);
   }
}
void AnimationTestDlg::createController()
{
   if (mpController.get() == NULL)
   {
      mAnimationNumber = 0;
      mpController.reset(Service<AnimationServices>()->createAnimationController("AnimationTest", FRAME_TIME));
      VERIFYNRV(mpController.get() != NULL);

      AnimationToolBar* pToolBar = dynamic_cast<AnimationToolBar*>
         (Service<DesktopServices>()->getWindow("Animation", TOOLBAR));
      if (pToolBar != NULL)
      {
         pToolBar->setAnimationController(mpController.get());
      }
   }
}
Exemple #5
0
bool VideoImporter::execute(PlugInArgList *pInArgList, PlugInArgList *pOutArgList)
{
   if(pInArgList == NULL)
   {
      return false;
   }
   // Create a message log step
   mProgress = ProgressTracker(pInArgList->getPlugInArgValue<Progress>(ProgressArg()),
      "Execute video importer", "coan", "{6385aa93-ff7f-4ee7-9308-b3476aca544b}");

   DataElement* pElmnt = pInArgList->getPlugInArgValue<DataElement>(ImportElementArg());
   mpRasterElement = dynamic_cast<RasterElement*>(pElmnt);
   mpStreamElement = dynamic_cast<Any*>(pElmnt);
   if (mpRasterElement == NULL && mpStreamElement == NULL)
   {
      mProgress.report("The data element input value is invalid.", 0, ERRORS, true);
      return false;
   }

   if (mpRasterElement != NULL)
   {
      mProgress.report("Initialize display.", 1, NORMAL);
      if (!mpRasterElement->createDefaultPager())
      {
         //return checkAbortOrError("Could not allocate resources for new RasterElement", pStep.get());
         return false;
      }
      // schedule load of first frame
      Any* pParent = dynamic_cast<Any*>(mpRasterElement->getParent());
      VERIFY(pParent != NULL);
      VideoStream* pStream = dynamic_cast<VideoStream*>(pParent->getData());
      VERIFY(pStream != NULL);
      if (!pStream->setDisplay(mpRasterElement))
      {
         mProgress.report("Unable to display the stream.", 0, ERRORS, true);
         return false;
      }

      // Create the view
      if(!isBatch() && !Service<SessionManager>()->isSessionLoading())
      {
         SpatialDataView *pView = createView();
         if(pView == NULL)
         {
            mProgress.report("The view could not be created.", 0, ERRORS, true);
            return false;
         }

         // Add the view to the output arg list
         if(pOutArgList != NULL)
         {
            pOutArgList->setPlugInArgValue("View", pView);
         }
      }
      mProgress.report("Display initialization complete.", 100, NORMAL);
   }
   else if (mpStreamElement != NULL)
   {
      mProgress.report("Initialize video stream.", 1, NORMAL);
      // initialize the stream data
      VideoStream* pStream = NULL;
      std::vector<PlugIn*> instances = Service<PlugInManagerServices>()->getPlugInInstances("Video Stream Manager");
      StreamManager* pStreamManager = instances.empty() ? NULL : dynamic_cast<StreamManager*>(instances.front());
      if (pStreamManager != NULL)
      {
         if (pStreamManager->initializeStream(mpStreamElement))
         {
            pStream = dynamic_cast<VideoStream*>(mpStreamElement->getData());
         }
      }
      if (pStream == NULL)
      {
         mProgress.report("Unable to initialize the video stream.", 0, ERRORS, true);
         return false;
      }
      
      // create animation
      AnimationController* pController = Service<AnimationServices>()->getAnimationController(mpStreamElement->getName());
      if (pController == NULL)
      {
         pController = Service<AnimationServices>()->createAnimationController(mpStreamElement->getName(), FRAME_TIME);
      }
      if (pController == NULL)
      {
         mProgress.report("Unable to create animation.", 0, ERRORS, true);
         return false;
      }
      if (!isBatch())
      {
         AnimationToolBar* pToolBar = static_cast<AnimationToolBar*>(Service<DesktopServices>()->getWindow("Animation", TOOLBAR));
         VERIFY(pToolBar);
         pToolBar->setAnimationController(pController);
      }
      Animation* pAnim = pController->createAnimation(mpStreamElement->getName());
      VERIFY(pAnim != NULL);
      if (!pStream->setAnimation(pAnim, pController))
      {
         mProgress.report("Unable to create animation.", 0, ERRORS, true);
         return false;
      }

      mProgress.report("Video stream initialization complete.", 100, NORMAL);
   }

   mProgress.upALevel();
   return true;
}