Fawkes API  Fawkes Development Version
skel_drawer.h
00001 
00002 /***************************************************************************
00003  *  skel_drawer.h - OpenNI Visualization: 3D skeleton drawer
00004  *
00005  *  Created: Sat Apr 02 19:56:55 2011
00006  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_OPENNI_PCLVIEWER_SKEL_DRAWER_H_
00024 #define __PLUGINS_OPENNI_PCLVIEWER_SKEL_DRAWER_H_
00025 
00026 #include <plugins/openni/utils/types.h>
00027 
00028 #include <interfaces/HumanSkeletonInterface.h>
00029 #include <interfaces/HumanSkeletonProjectionInterface.h>
00030 #include <interfaces/ObjectPositionInterface.h>
00031 
00032 class SkelGuiSkeletonDrawer3D
00033 {
00034  public:
00035   /** Print state enum. */
00036   typedef enum {
00037     PRINT_NONE,         /**< Print neither ID nor state */
00038     PRINT_ID,           /**< Print only ID */
00039     PRINT_ID_STATE      /**< Print ID and state */
00040   } PrintState;
00041 
00042   SkelGuiSkeletonDrawer3D(fawkes::openni::UserMap &users,
00043                           fawkes::openni::HandMap &hands);
00044 
00045   void draw();
00046 
00047   void toggle_print_state();
00048   void set_print_state(PrintState state);
00049 
00050  private:
00051   void print_string(void *font, char *str);
00052   void draw_limb(float *p1, float conf1, float *p2, float conf2);
00053   void draw_user(fawkes::openni::UserInfo &user);
00054   void draw_circle(unsigned int id, float *p, float radius);
00055 
00056  private:
00057   fawkes::openni::UserMap  &__users;
00058   fawkes::openni::HandMap  &__hands;
00059 
00060   PrintState __print_state;
00061 };
00062 
00063 #endif