void MultiViewWindow::addRenderer( int viewIndex, Renderer::pointer renderer) { if(getViews().size() == 0) throw Exception("You must set the nr of views before adding renderers to MultiViewWindow"); getView(viewIndex)->addRenderer(renderer); }
void GetView<T>::populateTreeWidgetItem(QTreeWidgetItem* pRoot) { VERIFYNR(pRoot != NULL); const std::vector<View*> views = getViews(); for (std::vector<View*>::const_iterator iter = views.begin(); iter != views.end(); ++iter) { View* pView = *iter; VERIFYNR(pView != NULL); if (pView->isKindOf(TypeConverter::toString<T>()) == false) { continue; } QTreeWidgetItem* pChild = new QTreeWidgetItem; std::string name = pView->getDisplayName(); if (name.empty() == true) { name = pView->getName(); } std::vector<std::string> classList; Service<DesktopServices>()->getViewTypes(pView->getObjectType(), classList); VERIFYNR(classList.empty() == false); pChild->setText(GetSessionItemBase<T>::NameColumn, QString::fromStdString(name)); pChild->setData(GetSessionItemBase<T>::NameColumn, GetSessionItemBase<T>::SessionItemRole, QVariant::fromValue<void*>(pView)); pChild->setText(GetSessionItemBase<T>::TypeColumn, QString::fromStdString(classList.front())); pChild->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); pRoot->addChild(pChild); } }
bool OsgManager::doUpdate(double dt) { // There is a bug in the scene initialisation where addSceneElement() will not be correctly executed if // performed inside of doInitialize(), this needs to be fixed // HS-2014-dec-12 // #workaround if (!m_hudElement->isInitialized()) { getRuntime()->getScene()->addSceneElement(m_hudElement); } if (Manager::doUpdate(dt)) { m_viewer->frame(); // \note HS-2013-dec-12 This will work as long as we deal with one view, when we move to stereoscopic // we might have to revise things. Or just assume that most views have the same size if (m_viewer->getNumViews() > 0) { auto dimensions = getViews()[0]->getDimensions(); m_hudElement->setViewPort(dimensions[0], dimensions[1]); } return true; } else { return false; } }
void GetLayer<T>::populateTreeWidgetItem(QTreeWidgetItem* pRoot) { VERIFYNR(pRoot != NULL); const std::vector<View*> views = getViews(); for (std::vector<View*>::const_iterator iter = views.begin(); iter != views.end(); ++iter) { View* pView = *iter; VERIFYNR(pView != NULL); std::auto_ptr<QTreeWidgetItem> pChild(new QTreeWidgetItem); std::string name = pView->getDisplayName(); if (name.empty() == true) { name = pView->getName(); } std::vector<std::string> classList; Service<DesktopServices>()->getViewTypes(pView->getObjectType(), classList); VERIFYNR(classList.empty() == false); pChild->setText(GetSessionItemBase<T>::NameColumn, QString::fromStdString(name)); pChild->setData(GetSessionItemBase<T>::NameColumn, GetSessionItemBase<T>::SessionItemRole, QVariant::fromValue<void*>(pView)); pChild->setText(GetSessionItemBase<T>::TypeColumn, QString::fromStdString(classList.front())); pChild->setFlags(Qt::NoItemFlags); populateTreeWidgetItemWithLayers(pChild.get()); if (pChild->childCount() > 0) { pRoot->addChild(pChild.release()); } } }
vector<int>* Views::getViews(TransactionID* tid) { #ifdef IXV_DEBUG debug_printf(*ec, "getViews(tid->getId()=%i, tid->getTimeStamp()=%i)\n", tid->getId(), tid->getTimeStamp()); #endif return getViews(tid, ""); }
void Layout::trigger( const Canvas* canvas, const bool active ) { LBASSERT( canvas ); getConfig()->postNeedsFinish(); const Views& views = getViews(); for( Views::const_iterator i = views.begin(); i != views.end(); ++i ) { View* view = *i; view->trigger( canvas, active ); } }
osgViewer::View* CompositeViewer::findOSGViewByID( const eq::uint128_t& id ) { Views views; getViews( views ); for( Views::iterator vitr = views.begin( ); vitr != views.end( ); ++vitr) { osg::ref_ptr< osgView > v = static_cast< osgView* >( *vitr ); if( v->getID( ) == id ) return v.get( ); } return NULL; }
void CompositeViewer::setGlobalContext( osg::GraphicsContext *context ) { Views views; getViews( views ); for( Views::iterator vitr = views.begin( ); vitr != views.end( ); ++vitr) { osg::ref_ptr< osg::Camera > camera = static_cast< osgView* >( *vitr )->getCamera( ); if( !camera->getGraphicsContext( )) { camera->setGraphicsContext( context ); camera->setViewport( 0, 0, context->getTraits( )->width, context->getTraits( )->height ); } } }
void MultiViewWindow::createLayout() { // Remove old layout by deleting it QLayout* layout = mWidget->layout(); delete layout; // Add new layout std::vector<View*> views = getViews(); if(mVerticalMode) { QVBoxLayout* mainLayout = new QVBoxLayout; for(View* view : views) { mainLayout->addWidget(view); } mainLayout->setContentsMargins(0, 0, 0, 0); mWidget->setLayout(mainLayout); } else { QHBoxLayout* mainLayout = new QHBoxLayout; for(View* view : views) { mainLayout->addWidget(view); } mainLayout->setContentsMargins(0, 0, 0, 0); mWidget->setLayout(mainLayout); } }
void MultiViewWindow::removeAllRenderers() { std::vector<View*> views = getViews(); for(View* view : views) { view->removeAllRenderers(); } }