OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

QtAppScreen.h

Go to the documentation of this file.
00001 /* ========================================================================
00002  * Copyright (c) 2006,
00003  * Institute for Computer Graphics and Vision
00004  * Graz University of Technology
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are
00009  * met:
00010  *
00011  * Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the following disclaimer.
00013  *
00014  * Redistributions in binary form must reproduce the above copyright
00015  * notice, this list of conditions and the following disclaimer in the
00016  * documentation and/or other materials provided with the distribution.
00017  *
00018  * Neither the name of the Graz University of Technology nor the names of
00019  * its contributors may be used to endorse or promote products derived from
00020  * this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00023  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00024  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00026  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  * ========================================================================
00034  * PROJECT: OpenTracker
00035  * ======================================================================== */
00079 #ifndef OTQT_QTAPPSCREEN_H
00080 #define OTQT_QTAPPSCREEN_H
00081 #include <dllinclude.h>
00082 #if USE_OTQT
00083 
00084 #include "OTQtMath.h"
00085 #include "OTQtLog.h"
00086 #include <core/ConfigNode.h>
00087 #include <core/Event.h>
00088 #include <qpoint.h>
00089 #include <string>
00090 
00091 namespace ot {
00092 
00093 //--------------------------------------------------------------------------------
00141 class OPENTRACKER_API QtAppScreen : public ConfigNode {
00142 public:
00149   typedef struct {
00151     Event local_cs_root;
00153     Event corner;
00154   } ASCorner;
00159   typedef struct {
00161     Event as_cs_root;
00163     ASCorner top_left;
00165     ASCorner top_right;
00167     ASCorner bottom_right;
00169     ASCorner bottom_left;
00170   } CalibInputData;
00175   class CalibOutputData
00176   {
00177   public:
00178       CalibOutputData()
00179           : as_cs_orient(4),
00180             as_cs_root_to_screen_root(3),
00181             as_width_vec(3),
00182             as_height_vec(3)
00183       {
00184           OTQT_DEBUG("CalibOutputData(): as_cs_orient.size () = %i\n", as_cs_orient.size());
00185       };
00186       ~CalibOutputData()
00187       {};
00188   public:
00190     std::vector<float> as_cs_orient;
00192     std::vector<float> as_cs_root_to_screen_root;
00194     std::vector<float> as_width_vec;
00196     std::vector<float> as_height_vec;
00197   };
00198 
00202   enum MPDLocationState {
00204     MPD_LOC_UNKNOWN = 0x00,
00206     MPD_LOC_INSIDE_SC = 0x01,
00208     MPD_LOC_OUTSIDE_SC = 0x02,
00209   };
00210 
00211 private:
00217   class ASData
00218   {
00219   public:
00220       ASData()
00221           : as_cs_root(),
00222             as_screen_root(),
00223             as_width_vec(3),
00224             as_height_vec(3),
00225             as_depth_scalar_front(0),
00226             as_depth_scalar_back(0)
00227       {};
00228       ~ASData()
00229       {};
00230   public:
00232     Event as_cs_root;
00234     Event as_screen_root;
00236     std::vector<float> as_width_vec;
00238     std::vector<float> as_height_vec;
00240     float as_depth_scalar_front;
00242     float as_depth_scalar_back;
00243   };
00248   typedef struct {
00250     Event position;
00252     bool mpd_loc_inside_screen_cuboid;
00254     QPoint desktop_coords;
00255   } MPData;
00256 
00257 public:
00274   static void convert(CalibInputData const & in, CalibOutputData & out);
00282   static void convert(CalibOutputData const & out, StringTable & table);
00283 
00284 public:
00293   QtAppScreen(StringTable & table);
00294   ~QtAppScreen() { };
00295 
00296 private:
00297   QtAppScreen();
00298   QtAppScreen(QtAppScreen const & ref);
00299   QtAppScreen operator = (QtAppScreen const & ref);
00300 
00301 public: // methods
00311   void updateASPD(Event const & as_cs_root);
00322   void updateMPD(Event const & mpd_pos);
00328   MPDLocationState getMPDLocation() const;
00333   inline bool isMPDInsideScreenCuboid() const { return mp_data_.mpd_loc_inside_screen_cuboid; };
00339   inline QPoint getMPD2DCoords() const { return mp_data_.desktop_coords; };
00344   inline Event getMPD3DPosition() const { return mp_data_.position; };
00345 
00346 private: // members
00348   CalibOutputData calib_out_;
00350   ASData as_data_init_;
00352   ASData as_data_;
00354   MPData mp_data_;
00355 
00356 };
00357 
00358 } // namespace ot
00359 
00360 #endif // USE_OTQT
00361 
00362 #endif // OTQT_QTAPPSCREEN_H
00363 
00364 
00365 /*
00366  * ------------------------------------------------------------
00367  *   End of QtAppScreen.h
00368  * ------------------------------------------------------------
00369  *   Automatic Emacs configuration follows.
00370  *   Local Variables:
00371  *   mode:c++
00372  *   c-basic-offset: 4
00373  *   eval: (c-set-offset 'substatement-open 0)
00374  *   eval: (c-set-offset 'case-label '+)
00375  *   eval: (c-set-offset 'statement 'c-lineup-runin-statements)
00376  *   eval: (setq indent-tabs-mode nil)
00377  *   End:
00378  * ------------------------------------------------------------
00379  */

copyright (c) 2006 Graz University of Technology