SensorDataDisplay.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  SensorDataDisplay.cpp
00003  *
00004  *  (C) 2006 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: SensorDataDisplay.cpp 45149 2011-06-06 12:55:08Z cnluzon $
00009  *******************************************************************************/
00010 
00011 
00012 #include <QGridLayout>
00013 #include <QBoxLayout>
00014 #include <QLabel>
00015 #include <QPixmap>
00016 #include <QtGui>
00017 #include <vector>
00018 #include <vector>
00019 #include <QDialog>
00020 #include <QComboBox>
00021 
00022 
00023 #include <QPushButton>
00024 
00025 //#include "Messages/SceneGraphM.h"
00026 //#include "Messages/GetLaserscanDirectedM.h"
00027 
00028 #include "SensorDataGLWidget.h"
00029 #include "SensorDataDisplay.h"
00030 
00031 #include "PainterPlugin.h"
00032 #include "PainterCheckBox.h"
00033 //#include "RobotPainter.h"
00034 //#include "SonarPainter.h"
00035 //#include "ParticlePainter.h"
00036 //#include "ParticleGridPainter.h"
00037 //#include "PathPainter.h"
00038 //#include "POIPainter.h"
00039 //#include "MapPainter.h"
00040 //#include "PersonPainter.h"
00041 //#include "SilhouettePainter.h"
00042 #include "NewLaserDataPainter.h"
00043 //#include "RobotPosesPainter.h"
00044 //#include "LaserScan3DPainter.h"
00045 //#include "RGBDepthPainter.h"
00046 //#include "SceneGraphPainter.h"
00047 //#include "ImagePainter.h"
00048 //#include "TofPainter.h"
00049 //#include "SkeletonPainter.h"
00050 //#include "PersonParticlePainter.h"
00051 
00052 #define THIS SensorDataDisplay
00053 
00054 QSize THIS::minimumSizeHint() const
00055 {
00056   return QSize ( 200, 100 );
00057 }
00058 QSize THIS::sizeHint() const
00059 {
00060   return QSize ( 500, 400 );
00061 }
00062 
00063 THIS::THIS ( bool useDefaultPlugins, QWidget *parent ) : QWidget ( parent )
00064 {
00065 
00066   // create the openGL widget
00067   m_GlWidget = new SensorDataGLWidget ( this );
00068 
00069   // create the painter plugins & options dialog box
00070   m_OptionsLayout = new QVBoxLayout();
00071 
00072         if ( useDefaultPlugins )
00073         {
00074                 //NOTE: ordering of this list is important for alpha blending to work correctly
00075 //                addPainter ( new ImagePainter(), true );
00076 //                addPainter ( new LaserScan3DPainter(), true );
00077 //                addPainter ( new RGBDepthPainter(), true );
00078                 addPainter ( new NewLaserDataPainter(), true );
00079 //                addPainter ( new MapPainter(), true );
00080 //                addPainter ( new TofPainter(), true );
00081 //                addPainter ( new SceneGraphPainter(), true );
00082 //                addPainter ( new POIPainter(), true );
00083 //                addPainter ( new SonarPainter(), false );
00084 //                addPainter ( new PathPainter(), true );
00085 //                addPainter ( new PersonPainter(), true );
00086 //                addPainter ( new SilhouettePainter(), true );
00087 //                addPainter ( new SkeletonPainter(), true );
00088 //                addPainter ( new ParticlePainter(), false );
00089 //                addPainter ( new PersonParticlePainter(), true );
00090 //                addPainter ( new RobotPosesPainter(), false );
00091 //                addPainter ( new ParticleGridPainter(), false );
00092 //                addPainter ( new RobotPainter(), false );
00093         }
00094 
00095   m_OptionsDialog = new QDialog();
00096   m_OptionsDialog->setWindowTitle ( "Display Options" );
00097   m_OptionsDialog->setLayout ( m_OptionsLayout );
00098   m_OptionsDialog->setFocusPolicy(Qt::NoFocus);
00099 
00100 
00101   //Drop-down list
00102   m_NodeSelector = new QComboBox( this );
00103   m_NodeSelectorInitialized = false;
00104   m_NodeSelector->setFocusPolicy(Qt::NoFocus);
00105   connect( m_NodeSelector, SIGNAL(activated(const QString&)), m_GlWidget, SLOT(followNode(const QString&)));
00106 
00107   //create move button...
00108   QPushButton* buttonCameraMove = new QPushButton ( QString::fromUtf8("360° View"), this );
00109   connect ( buttonCameraMove, SIGNAL ( pressed() ), m_GlWidget, SLOT ( performCameraMove() ) );
00110   buttonCameraMove->setFocusPolicy(Qt::NoFocus);
00111 
00112 
00113   //create options button...
00114   QPushButton* buttonOptions = new QPushButton ( "Options", this );
00115   connect ( buttonOptions, SIGNAL ( pressed() ), m_OptionsDialog, SLOT ( show() ) );
00116 buttonOptions->setFocusPolicy(Qt::NoFocus);
00117 
00118 
00119   // create main layout
00120   QVBoxLayout* vLayout = new QVBoxLayout( );
00121   vLayout->addWidget ( m_GlWidget );
00122 
00123   QHBoxLayout* hLayout = new QHBoxLayout( );
00124 //  hLayout->addWidget ( checkBoxFixedLookPosition );
00125   hLayout->addWidget ( m_NodeSelector );
00126   hLayout->addWidget ( buttonOptions );
00127   hLayout->addWidget ( buttonCameraMove );
00128 
00129   vLayout->addLayout( hLayout );
00130 
00131 /*  gridLayout->setRowStretch ( 0, 2 );
00132   gridLayout->setRowStretch ( 1, 0 );*/
00133   setLayout ( vLayout );
00134 
00135   this->setFocus();
00136 }
00137 
00138 
00139 void THIS::addPainter ( PainterPlugin* painter, bool visible )
00140 {
00141   m_GlWidget->addPainter ( painter );
00142   PainterCheckBox* painterCB = new PainterCheckBox ( painter );
00143   m_OptionsLayout->addWidget ( painterCB );
00144   connect ( painterCB , SIGNAL ( changed() ), m_GlWidget, SLOT ( updateGL() ) );
00145   painterCB->setChecked ( visible );
00146 }
00147 
00148 
00149 //void THIS::processMessage ( Message* newMessage )
00150 //{
00151 //  switch ( newMessage->getType() )
00152 //  {
00153 
00154 //    case MessageTypes::STOP_MESSAGE:
00155 //      m_OptionsDialog->close();
00156 //      break;
00157 
00158 //    case MessageTypes::SCENE_GRAPH_M:
00159 //    {
00160 //      if ( !m_NodeSelectorInitialized )
00161 //      {
00163 //        if ( SceneGraphM* message = Message::castTo<SceneGraphM> ( newMessage ) )
00164 //        {
00165 //          std::list<std::string> nodeNames=message->getSceneGraph().getSelectableNodeNames();
00166 //          std::list<std::string>::iterator it = nodeNames.begin();
00167 //          int i=0;
00168 //          while ( it != nodeNames.end() )
00169 //          {
00170 //            m_NodeSelector->addItem( it->c_str() );
00171 //            if ( *it == "Robot" )
00172 //            {
00173 //              m_NodeSelector->setCurrentIndex(i);
00174 //            }
00176 //            it++;
00177 //            i++;
00178 //          }
00179 //          m_NodeSelectorInitialized = true;
00180 //        }
00181 //      }
00182 //      break;
00183 //    }
00184 
00185 //    default:
00186 //      break;
00187 //  }
00188 //}
00189 
00190 THIS::~THIS()
00191 {
00192 }


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43