void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid) { scenes.clear(); typedef std::set<osgViewer::Scene*> SceneSet; SceneSet sceneSet; for(RefViews::iterator vitr = _views.begin(); vitr != _views.end(); ++vitr) { osgViewer::View* view = vitr->get(); if (view->getScene() && (!onlyValid || view->getScene()->getSceneData())) { if (sceneSet.count(view->getScene())==0) { sceneSet.insert(view->getScene()); scenes.push_back(view->getScene()); } } } }
void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid) { typedef std::set<osgViewer::Scene*> SceneSet; SceneSet sceneSet; for(RefViews::iterator vitr = _views.begin(); vitr != _views.end(); ++vitr) { osgViewer::View* view = vitr->get(); if (view->getScene() && (!onlyValid || view->getScene()->getSceneData())) { sceneSet.insert(view->getScene()); } } for(SceneSet::iterator sitr = sceneSet.begin(); sitr != sceneSet.end(); ++sitr) { scenes.push_back(const_cast<osgViewer::Scene*>(*sitr)); } }