00001 /****************************************************************************** 00002 * \file 00003 * 00004 * $Id:$ 00005 * 00006 * Copyright (C) Brno University of Technology 00007 * 00008 * This file is part of software developed by dcgm-robotics@FIT group. 00009 * 00010 * Author: Vit Stancl (stancl@fit.vutbr.cz) 00011 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00012 * Date: dd/mm/2011 00013 * 00014 * This file is free software: you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation, either version 3 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This file is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this file. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #pragma once 00029 #ifndef BUT_CAMCAST_H 00030 #define BUT_CAMCAST_H 00031 00032 #include <rviz/display.h> 00033 #include <rviz/view_controller.h> 00034 #include "rviz/properties/forwards.h" 00035 #include "rviz/properties/property.h" 00036 #include "rviz/properties/edit_enum_property.h" 00037 #include "rviz/properties/property_manager.h" 00038 00039 #include <OGRE/OgreTexture.h> 00040 #include <OGRE/OgreSceneNode.h> 00041 #include <OgreManualObject.h> 00042 #include <OgreCamera.h> 00043 00044 #include <wx/wx.h> 00045 #include <string> 00046 #include <boost/signals.hpp> 00047 00048 #include "ros_rtt_texture.h" 00049 00050 namespace rviz 00051 { 00052 class WindowManagerInterface; 00053 } 00054 00055 namespace srs_ui_but 00056 { 00057 00058 00059 class CButCamCast : public rviz::Display 00060 { 00061 public: 00062 class CControllPane : public wxPanel 00063 { 00064 public: 00066 typedef boost::signal< void (bool) > tSigCheckboxState; 00067 00069 typedef boost::signal< void ( std::string ) > tSigSave; 00070 00071 public: 00073 CControllPane(wxWindow *parent, const wxString& title, rviz::WindowManagerInterface * wmi ); 00074 00076 void OnChckToggle(wxCommandEvent& event); 00077 00079 virtual void OnSave(wxCommandEvent& event); 00080 00082 tSigCheckboxState & getSigChckBox(){ return m_sigCheckBox; } 00083 00085 tSigSave & getSigSave(){ return m_sigSave; } 00086 00087 protected: 00089 rviz::WindowManagerInterface * m_wmi; 00090 00092 wxCheckBox * m_chkb; 00093 00095 wxButton * m_button; 00096 00098 tSigCheckboxState m_sigCheckBox; 00099 00101 tSigSave m_sigSave; 00102 private: 00103 DECLARE_EVENT_TABLE() 00104 }; // class CControllPane 00105 00106 public: 00108 CButCamCast(const std::string & name,rviz::VisualizationManager * manager); 00109 00111 ~CButCamCast(); 00112 00113 //OverridesfromDisplay 00114 virtual void targetFrameChanged(){} 00115 virtual void fixedFrameChanged(){} 00116 virtual void createProperties(){} 00117 00119 virtual void update (float wall_dt, float ros_dt); 00120 00121 protected: 00122 //overridesfromDisplay 00123 virtual void onEnable(); 00124 virtual void onDisable(); 00125 00127 bool createGeometry(const ros::NodeHandle & nh); 00128 00130 void destroyGeometry(); 00131 00133 //void setTimerPeriod(float period); 00134 00136 void onTimerPublish(const ros::TimerEvent&); 00137 00139 void onPublishStateChanged(bool state); 00140 00142 void onSave( std::string filename ); 00143 00144 protected: 00146 Ogre::SceneNode * m_sceneNode; 00147 00149 std::string m_camCastPublisherName; 00150 00152 ros::Publisher m_camCastPublisher; 00153 00155 CRosRttTexture * m_textureWithRtt; 00156 00158 ros::Timer m_timer; 00159 00161 double m_timerPeriod; 00162 00164 bool m_bPublish; 00165 00167 CControllPane * m_pane; 00168 00169 };//class CButCamCast 00170 00171 } // namespace srs_ui_but 00172 00173 #endif // BUT_CAMCAST_H