本文整理汇总了C++中SpatialDataView::setAnimationController方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::setAnimationController方法的具体用法?C++ SpatialDataView::setAnimationController怎么用?C++ SpatialDataView::setAnimationController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::setAnimationController方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupAnimations
bool MultiLayerMovie::setupAnimations()
{
// Create the controller
Service<AnimationServices> pServices;
AnimationController* pController = pServices->getAnimationController("MultiLayerMovie");
if (pController != NULL)
{
pServices->destroyAnimationController(pController);
}
pController = pServices->createAnimationController("MultiLayerMovie", FRAME_TIME);
if (pController == NULL)
{
return false;
}
pController->setCanDropFrames(false);
// Set the controller into each of the views
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(mpWindow->getView());
if (pView == NULL)
{
pServices->destroyAnimationController(pController);
return false;
}
pView->setAnimationController(pController);
// Create the animations for each layer
Animation* pAnimation1 = pController->createAnimation("MultiLayerMovie1");
Animation* pAnimation2 = pController->createAnimation("MultiLayerMovie2");
Animation* pAnimation3 = pController->createAnimation("MultiLayerMovie3");
if (pAnimation1 == NULL || pAnimation2 == NULL || pAnimation3 == NULL)
{
pServices->destroyAnimationController(pController);
return false;
}
// Set up the frames for each animation
const int timeOffset = mNumBands/4;
vector<AnimationFrame> frames1;
vector<AnimationFrame> frames2;
vector<AnimationFrame> frames3;
for (int i = 0; i < mNumBands; ++i)
{
AnimationFrame frame1("frame", i, static_cast<double>(i)/mNumBands);
AnimationFrame frame2("frame", i, static_cast<double>(i+timeOffset)/(mNumBands+timeOffset));
AnimationFrame frame3("frame", i, static_cast<double>(i+2*timeOffset)/(mNumBands+timeOffset));
frames1.push_back(frame1);
frames2.push_back(frame2);
frames3.push_back(frame3);
}
// Set the frames into the animations
pAnimation1->setFrames(frames1);
pAnimation2->setFrames(frames2);
pAnimation3->setFrames(frames3);
// Assign the animations to the layers
mpLayer1->setAnimation(pAnimation1);
mpLayer2->setAnimation(pAnimation2);
mpLayer3->setAnimation(pAnimation3);
return true;
}
示例2: sessionItemDropped
void TimelineWidget::sessionItemDropped(Subject &subject, const std::string &signal, const boost::any &v)
{
SessionItem *pItem = boost::any_cast<SessionItem*>(v);
if(pItem == NULL)
{
return;
}
RasterElement *pRasterElement = dynamic_cast<RasterElement*>(pItem);
RasterLayer *pRasterLayer = dynamic_cast<RasterLayer*>(pItem);
ThresholdLayer *pThresholdLayer = dynamic_cast<ThresholdLayer*>(pItem);
if(pRasterElement != NULL)
{
std::vector<Window*> windows;
Service<DesktopServices>()->getWindows(SPATIAL_DATA_WINDOW, windows);
for(std::vector<Window*>::iterator window = windows.begin(); window != windows.end(); ++window)
{
SpatialDataView *pView = static_cast<SpatialDataWindow*>(*window)->getSpatialDataView();
std::vector<Layer*> layers;
pView->getLayerList()->getLayers(layers);
for(std::vector<Layer*>::iterator layer = layers.begin(); layer != layers.end(); ++layer)
{
RasterLayer *pRasterLayer = dynamic_cast<RasterLayer*>(*layer);
ThresholdLayer *pThresholdLayer = dynamic_cast<ThresholdLayer*>(*layer);
RasterElement *pElement = static_cast<RasterElement*>((*layer)->getDataElement());
if(pElement == pRasterElement && (pRasterLayer != NULL || pThresholdLayer != NULL))
{
if(mpD->mpController == NULL)
{
createNewController(true, true, (*layer)->getName());
}
pView->setAnimationController(mpD->mpController);
if(pRasterLayer != NULL)
{
TimelineUtils::createAnimationForRasterLayer(pRasterLayer, mpD->mpController);
}
else
{
TimelineUtils::createAnimationForThresholdLayer(pThresholdLayer, mpD->mpController);
}
}
}
}
}
else if(pRasterLayer != NULL)
{
if(mpD->mpController == NULL)
{
createNewController(true, true, pRasterLayer->getName());
}
TimelineUtils::createAnimationForRasterLayer(pRasterLayer, mpD->mpController);
}
else if(pThresholdLayer != NULL)
{
if(mpD->mpController == NULL)
{
createNewController(true, true, pThresholdLayer->getName());
}
TimelineUtils::createAnimationForThresholdLayer(pThresholdLayer, mpD->mpController);
}
layout(true);
}