void RvizLogo::onDisable() { if (frame_) { frame_->Show(false); } else { WindowManagerInterface* wm = vis_manager_->getWindowManager(); wm->closePane(panel_); } }
void RvizLogo::onEnable() { if (frame_) { frame_->Show(true); } else { WindowManagerInterface* wm = vis_manager_->getWindowManager(); wm->showPane(panel_); } }
void CameraDisplaySave::onEnable() { subscribe(); if (frame_) { frame_->Show(true); } else { WindowManagerInterface* wm = vis_manager_->getWindowManager(); wm->showPane(render_panel_); } render_panel_->getRenderWindow()->setActive(true); }
void CameraDisplaySave::onDisable() { render_panel_->getRenderWindow()->setActive(false); if (frame_) { frame_->Show(false); } else { WindowManagerInterface* wm = vis_manager_->getWindowManager(); wm->closePane(render_panel_); } unsubscribe(); clear(); }
CameraDisplaySave::~CameraDisplaySave() { unsubscribe(); caminfo_tf_filter_.clear(); if (frame_) { frame_->Destroy(); } else { WindowManagerInterface* wm = vis_manager_->getWindowManager(); wm->removePane(render_panel_); render_panel_->Destroy(); } delete screen_rect_; scene_node_->getParentSceneNode()->removeAndDestroyChild(scene_node_->getName()); }
/** Constructor */ RvizLogo::RvizLogo(const std::string& name, VisualizationManager* manager/*wxWindow *parent, const wxString& title, rviz::WindowManagerInterface * wmi */) : Display( "logo", manager ), frame_(0) //: wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize(280, 180), wxTAB_TRAVERSAL, title) //, m_wmi( wmi ) { string path = ros::package::getPath("cob_3d_mapping_demonstrator") + "/ros/files/logo_title.jpg"; // Create controls //m_button = new wxButton(this, ID_RESET_BUTTON, wxT("Reset map")); wxWindow* parent = 0; WindowManagerInterface* wm = vis_manager_->getWindowManager(); if (wm) { parent = wm->getParentWindow(); } else { frame_ = new wxFrame(0, wxID_ANY, wxString::FromAscii(""), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN); parent = frame_; } panel_ = new wxImagePanel(parent, wxString::FromAscii(path.c_str()),wxBITMAP_TYPE_JPEG); //if (!pic_.LoadFile(wxT("/home/goa/git/cob_environment_perception_intern/cob_3d_mapping_demonstrator/lib/logo.jpg"),wxBITMAP_TYPE_JPEG)) ROS_ERROR("Image file not found!"); //logo_ = new wxStaticBitmap(panel_, wxID_ANY, pic_); //wxSizer *vsizer = new wxBoxSizer(wxVERTICAL); //vsizer->Add(logo_, 1, wxALIGN_CENTER); //vsizer->SetSizeHints(panel_); //panel_->SetSizerAndFit(vsizer); if (wm) { wm->addPane(name, panel_); } }
void ImageDisplay::onInitialize() { { static uint32_t count = 0; std::stringstream ss; ss << "ImageDisplay" << count++; img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, ss.str()); } img_scene_node_ = img_scene_manager_->getRootSceneNode()->createChildSceneNode(); { static int count = 0; std::stringstream ss; ss << "ImageDisplayObject" << count++; screen_rect_ = new Ogre::Rectangle2D(true); screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1); screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f); ss << "Material"; material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); material_->setSceneBlending( Ogre::SBT_REPLACE ); material_->setDepthWriteEnabled(false); material_->setReceiveShadows(false); material_->setDepthCheckEnabled(false); material_->getTechnique(0)->setLightingEnabled(false); Ogre::TextureUnitState* tu = material_->getTechnique(0)->getPass(0)->createTextureUnitState(); tu->setTextureName(texture_.getTexture()->getName()); tu->setTextureFiltering( Ogre::TFO_NONE ); material_->setCullingMode(Ogre::CULL_NONE); Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); screen_rect_->setBoundingBox(aabInf); screen_rect_->setMaterial(material_->getName()); img_scene_node_->attachObject(screen_rect_); } render_panel_ = new RenderPanel(); render_panel_->getRenderWindow()->setAutoUpdated(false); render_panel_->getRenderWindow()->setActive( false ); render_panel_->resize( 640, 480 ); render_panel_->initialize(img_scene_manager_, context_); WindowManagerInterface* wm = context_->getWindowManager(); if (wm) { panel_container_ = wm->addPane( getName(), render_panel_); } render_panel_->setAutoRender(false); render_panel_->setOverlaysEnabled(false); render_panel_->getCamera()->setNearClipDistance( 0.01f ); if( panel_container_ ) { connect( panel_container_, SIGNAL( visibilityChanged( bool ) ), this, SLOT( setEnabled( bool ))); } }
void CameraDisplay::onInitialize() { caminfo_tf_filter_ = new tf::MessageFilter<sensor_msgs::CameraInfo>(*vis_manager_->getTFClient(), "", 2, update_nh_); bg_scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); fg_scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); { static int count = 0; UniformStringStream ss; ss << "CameraDisplayObject" << count++; //background rectangle bg_screen_rect_ = new Ogre::Rectangle2D(true); bg_screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f); ss << "Material"; bg_material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); bg_material_->setDepthWriteEnabled(false); bg_material_->setReceiveShadows(false); bg_material_->setDepthCheckEnabled(false); bg_material_->getTechnique(0)->setLightingEnabled(false); Ogre::TextureUnitState* tu = bg_material_->getTechnique(0)->getPass(0)->createTextureUnitState(); tu->setTextureName(texture_.getTexture()->getName()); tu->setTextureFiltering( Ogre::TFO_NONE ); tu->setAlphaOperation( Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, 0.0 ); bg_material_->setCullingMode(Ogre::CULL_NONE); bg_material_->setSceneBlending( Ogre::SBT_REPLACE ); Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); bg_screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND); bg_screen_rect_->setBoundingBox(aabInf); bg_screen_rect_->setMaterial(bg_material_->getName()); bg_scene_node_->attachObject(bg_screen_rect_); bg_scene_node_->setVisible(false); //overlay rectangle fg_screen_rect_ = new Ogre::Rectangle2D(true); fg_screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f); fg_material_ = bg_material_->clone( ss.str()+"fg" ); fg_screen_rect_->setBoundingBox(aabInf); fg_screen_rect_->setMaterial(fg_material_->getName()); fg_material_->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA ); fg_screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1); fg_scene_node_->attachObject(fg_screen_rect_); fg_scene_node_->setVisible(false); } setAlpha( 0.5f ); render_panel_ = new RenderPanel(); render_panel_->getRenderWindow()->addListener( this ); render_panel_->getRenderWindow()->setAutoUpdated(false); render_panel_->getRenderWindow()->setActive( false ); render_panel_->resize( 640, 480 ); render_panel_->initialize(vis_manager_->getSceneManager(), vis_manager_); WindowManagerInterface* wm = vis_manager_->getWindowManager(); if( wm ) { panel_container_ = wm->addPane(name_, render_panel_); } render_panel_->setAutoRender(false); render_panel_->setOverlaysEnabled(false); render_panel_->getCamera()->setNearClipDistance( 0.01f ); caminfo_tf_filter_->connectInput(caminfo_sub_); caminfo_tf_filter_->registerCallback(boost::bind(&CameraDisplay::caminfoCallback, this, _1)); vis_manager_->getFrameManager()->registerFilterForTransformStatusCheck(caminfo_tf_filter_, this); if( panel_container_ ) { // TODO: wouldn't it be better to connect this straight to the wrapper? connect( panel_container_, SIGNAL( visibilityChanged( bool ) ), this, SLOT( setWrapperEnabled( bool ))); } }
CameraDisplaySave::CameraDisplaySave( const std::string& name, VisualizationManager* manager ) : Display( name, manager ) , transport_("raw") , caminfo_tf_filter_(*manager->getTFClient(), "", 2, update_nh_) , new_caminfo_(false) , texture_(update_nh_) , frame_(0) , force_render_(false) , render_listener_(this) { scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); { static int count = 0; std::stringstream ss; ss << "CameraDisplaySaveObject" << count++; screen_rect_ = new Ogre::Rectangle2D(true); screen_rect_->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1); screen_rect_->setCorners(-1.0f, 1.0f, 1.0f, -1.0f); ss << "Material"; material_ = Ogre::MaterialManager::getSingleton().create( ss.str(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); material_->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA ); material_->setDepthWriteEnabled(false); material_->setReceiveShadows(false); material_->setDepthCheckEnabled(false); #if 1 material_->getTechnique(0)->setLightingEnabled(false); Ogre::TextureUnitState* tu = material_->getTechnique(0)->getPass(0)->createTextureUnitState(); tu->setTextureName(texture_.getTexture()->getName()); tu->setTextureFiltering( Ogre::TFO_NONE ); tu->setAlphaOperation( Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, 0.0 ); #else material_->getTechnique(0)->setLightingEnabled(true); material_->setAmbient(Ogre::ColourValue(0.0f, 1.0f, 1.0f, 1.0f)); #endif material_->setCullingMode(Ogre::CULL_NONE); Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); screen_rect_->setBoundingBox(aabInf); screen_rect_->setMaterial(material_->getName()); scene_node_->attachObject(screen_rect_); } setAlpha( 0.5f ); wxWindow* parent = 0; WindowManagerInterface* wm = vis_manager_->getWindowManager(); if (wm) { parent = wm->getParentWindow(); } else { frame_ = new wxFrame(0, wxID_ANY, wxString::FromAscii(name.c_str()), wxPoint(100,100), wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN); parent = frame_; } render_panel_ = new RenderPanel(parent, false); render_panel_->SetSize(wxSize(640, 480)); if (wm) { wm->addPane(name, render_panel_); } render_panel_->createRenderWindow(); render_panel_->initialize(vis_manager_->getSceneManager(), vis_manager_); render_panel_->setAutoRender(false); render_panel_->getRenderWindow()->addListener(&render_listener_); render_panel_->getViewport()->setOverlaysEnabled(false); render_panel_->getViewport()->setClearEveryFrame(true); render_panel_->getRenderWindow()->setActive(false); render_panel_->getRenderWindow()->setAutoUpdated(false); render_panel_->getCamera()->setNearClipDistance( 0.1f ); caminfo_tf_filter_.connectInput(caminfo_sub_); caminfo_tf_filter_.registerCallback(boost::bind(&CameraDisplaySave::caminfoCallback, this, _1)); vis_manager_->getFrameManager()->registerFilterForTransformStatusCheck(caminfo_tf_filter_, this); }