Esempio n. 1
0
void FrameLabelObjectImp::setAnimations(View* pView)
{
   if (getLocked() == false)
   {
      reset();
      vector<Animation*> pAnimations;
      if (pView != NULL)
      {
         SpatialDataView* pSpatialDataView = dynamic_cast<SpatialDataView*>(pView);
         if (pSpatialDataView == NULL)
         {
            mpView.reset(pView);
            mpAnimationController.reset(mpView->getAnimationController());
            if (mpAnimationController.get() != NULL)
            {
               pAnimations = mpAnimationController->getAnimations();
            }
         }
         else
         {
            mpLayerList.reset(pSpatialDataView->getLayerList());
            VERIFYNRV(mpLayerList.get() != NULL);

            vector<Layer*> pLayers;
            mpLayerList->getLayers(RASTER, pLayers);
            for (vector<Layer*>::iterator iter = pLayers.begin(); iter != pLayers.end(); ++iter)
            {
               RasterLayer* pRasterLayer = dynamic_cast<RasterLayer*>(*iter);
               VERIFYNRV(pRasterLayer != NULL);
               pRasterLayer->attach(SIGNAL_NAME(RasterLayer, AnimationChanged),
                  Slot(this, &FrameLabelObjectImp::updateAnimations));
               pRasterLayer->attach(SIGNAL_NAME(Subject, Deleted),
                  Slot(this, &FrameLabelObjectImp::layerDeleted));
               mLayers.push_back(pRasterLayer);
               if (pRasterLayer->getAnimation() != NULL)
               {
                  pAnimations.push_back(pRasterLayer->getAnimation());
               }
            }
         }
      }

      insertAnimations(pAnimations);
   }
}