PersonParticlePainter.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  PersonParticlePainter.cpp
00003  *
00004  *  (C) 2011 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: $
00009  *******************************************************************************/
00010 
00011 #include "PersonParticlePainter.h"
00012 
00013 #include "Messages/TrackedPeopleM.h"
00014 #include "Messages/PersonParticleFilterDataM.h"
00015 
00016 #include <QtOpenGL>
00017 #include <GL/glut.h>
00018 
00019 #include "Architecture/Config/Config.h"
00020 
00021 #define THIS PersonParticlePainter
00022 
00023 THIS::THIS() : PainterPlugin( )
00024 {
00025   setName ( "People particles (test)" );
00026   m_ParticleModel = SceneGraph ( "config/PersonParticle.xml" );
00027   m_OtherParticleModel = SceneGraph ( "config/OtherParticle.xml" );
00028   m_NumParticlesToDraw = Config::getInt("testParticleFilter.iNumParticlesToDraw");
00029 }
00030 
00031 
00032 THIS::~THIS()
00033 {
00034 }
00035 
00036 
00037 void THIS::processMessage ( Message* newMessage )
00038 {
00039   PainterPlugin::processMessage ( newMessage );
00040   switch ( newMessage->getType() )
00041   {
00042     case MessageTypes::PERSON_PARTICLE_FILTER_DATA_M:
00043       {
00044         if ( PersonParticleFilterDataM* message = Message::castTo<PersonParticleFilterDataM> ( newMessage ) )
00045         {
00046           //TRACE_INFO("Person Particle Message received");
00047           m_BestParticles = message->getBestCandidates();
00048           m_ParticleFilters = message->getParticleFilters();
00049 
00050           if (m_BestParticles.size() != m_ParticleFilters.size())
00051             TRACE_WARNING("Number of best candidates is different to the number of particle filters!");
00052 
00053           requestRedraw();
00054         }
00055         break;
00056       }
00057     default:
00058         break;
00059 
00060   } // switch
00061 }
00062 
00063 void THIS::paint ( float next2DLayer )
00064 {
00065 //  if (m_BestParticles.size() != m_ParticleFilters.size())
00066 //  {
00067 //    TRACE_ERROR("Number of best candidates is different to the number of particle filters!");
00068 //  }
00069 //  else
00070 //  {
00071 //    for (unsigned int i=0; i<m_BestParticles.size();++i)
00072 //    {
00073 //      //TRACE_INFO("Drawing particle " << i);
00074 //        // x front (depth), y left, z up (don't think there's anything to change here bc we receive positions already from robbie)
00075 //        m_ParticleModel.setTranslationMatrix("center.position", BaseLib::Math::Vec3d(m_BestParticles.at(i).getCenterXPos(), m_BestParticles.at(i).getCenterYPos(), 10.0));
00076 //        m_ParticleModel.paintGl();
00077 //        //m_ParticleModel.findNode("center")->paintGl();
00078 //        // Draw the rest of the X particles for each particle filter
00079 
00080 //        unsigned int particlesLimit;
00081 //        if(m_ParticleFilters.at(i)!=0)
00082 //        {
00083 //          particlesLimit = m_ParticleFilters.at(i)->numParticles();
00084 //        }
00085 //        else
00086 //        {
00087 //          TRACE_ERROR("m_ParticleFilters.at(i) is a Null-Pointer");
00088 //          break;
00089 //        }
00090 //        for (unsigned int j=0; j<m_NumParticlesToDraw && j<particlesLimit; j++)
00091 //        {
00092 //        //    TRACE_INFO("Painting rest of the particles");
00093 //            PersonState p = m_ParticleFilters.at(i)->getState(j);
00094 
00095 //            m_OtherParticleModel.setTranslationMatrix("other.position", BaseLib::Math::Vec3d(p.getCenterXPos(),p.getCenterYPos(), 10.0));
00096 //            m_OtherParticleModel.paintGl();
00097 //        }
00098 //    }
00099 //  }
00100 }
00101 
00102 
00103 
00104 #undef THIS


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