TUIO C++ Developer API
TuioManager.h
1 /*
2  TUIO C++ Library
3  Copyright (c) 2005-2017 Martin Kaltenbrunner <martin@tuio.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 3.0 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library.
17 */
18 
19 #ifndef INCLUDED_TUIOMANAGER_H
20 #define INCLUDED_TUIOMANAGER_H
21 
22 #include "TuioDispatcher.h"
23 
24 #include <iostream>
25 #include <list>
26 #include <algorithm>
27 
28 #define OBJ_MESSAGE_SIZE 108 // setMessage + fseqMessage size
29 #define CUR_MESSAGE_SIZE 88
30 #define BLB_MESSAGE_SIZE 116
31 
32 namespace TUIO {
62  class LIBDECL TuioManager : public TuioDispatcher {
63 
64  public:
65 
69  TuioManager();
70 
74  ~TuioManager();
75 
87  TuioObject* addTuioObject(int sym, float xp, float yp, float a);
88 
97  void updateTuioObject(TuioObject *tobj, float xp, float yp, float a);
98 
105  void removeTuioObject(TuioObject *tobj);
106 
112  void addExternalTuioObject(TuioObject *tobj);
113 
119  void updateExternalTuioObject(TuioObject *tobj);
120 
127  void removeExternalTuioObject(TuioObject *tobj);
128 
138  TuioCursor* addTuioCursor(float xp, float yp);
139 
147  void updateTuioCursor(TuioCursor *tcur, float xp, float yp);
148 
155  void removeTuioCursor(TuioCursor *tcur);
156 
162  void addExternalTuioCursor(TuioCursor *tcur);
163 
169  void updateExternalTuioCursor(TuioCursor *tcur);
170 
177  void removeExternalTuioCursor(TuioCursor *tcur);
178 
192  TuioBlob* addTuioBlob(float xp, float yp, float angle, float width, float height, float area);
193 
205  void updateTuioBlob(TuioBlob *tblb, float xp, float yp, float angle, float width, float height, float area);
206 
213  void removeTuioBlob(TuioBlob *tblb);
214 
220  void addExternalTuioBlob(TuioBlob *tblb);
221 
227  void updateExternalTuioBlob(TuioBlob *tblb);
228 
235  void removeExternalTuioBlob(TuioBlob *tblb);
236 
242  void initFrame(TuioTime ttime);
243 
248  void commitFrame();
249 
254  long getSessionID();
255 
260  long getFrameID();
261 
266  TuioTime getFrameTime();
267 
273  std::list<TuioObject*> getUntouchedObjects();
274 
280  std::list<TuioCursor*> getUntouchedCursors();
281 
287  std::list<TuioBlob*> getUntouchedBlobs();
288 
292  void stopUntouchedMovingObjects();
293 
297  void stopUntouchedMovingCursors();
298 
302  void stopUntouchedMovingBlobs();
303 
307  void removeUntouchedStoppedObjects();
308 
312  void removeUntouchedStoppedCursors();
313 
317  void removeUntouchedStoppedBlobs();
318 
325  TuioObject* getClosestTuioObject(float xp, float yp);
326 
333  TuioCursor* getClosestTuioCursor(float xp, float yp);
334 
341  TuioBlob* getClosestTuioBlob(float xp, float yp);
342 
347  void setVerbose(bool verbose) { this->verbose=verbose; }
348  bool isVerbose() { return verbose; }
349 
350  void setInversion(bool ix, bool iy, bool ia) {
351  invert_x = ix;
352  invert_y = iy;
353  invert_a = ia;
354  };
355 
356  void setInvertXpos(bool ix) { invert_x = ix; };
357  void setInvertYpos(bool iy) { invert_y = iy; };
358  void setInvertAngle(bool ia) { invert_a = ia; };
359  bool getInvertXpos() { return invert_x; };
360  bool getInvertYpos() { return invert_y; };
361  bool getInvertAngle() { return invert_a; };
362  void resetTuioObjects();
363  void resetTuioCursors();
364  void resetTuioBlobs();
365 
366  protected:
367  std::list<TuioCursor*> freeCursorList;
368  std::list<TuioCursor*> freeCursorBuffer;
369 
370  std::list<TuioBlob*> freeBlobList;
371  std::list<TuioBlob*> freeBlobBuffer;
372 
373  TuioTime currentFrameTime;
374  long currentFrame;
375  int maxCursorID;
376  int maxBlobID;
377  long sessionID;
378 
379  bool updateObject;
380  bool updateCursor;
381  bool updateBlob;
382  bool verbose;
383 
384  bool invert_x;
385  bool invert_y;
386  bool invert_a;
387  };
388 }
389 #endif /* INCLUDED_TUIOMANAGER_H */
Definition: TuioTime.h:48
Definition: FlashSender.h:166
Definition: TuioManager.h:62
Definition: TuioObject.h:32
void setVerbose(bool verbose)
Definition: TuioManager.h:347
Definition: TuioDispatcher.h:39
Definition: TuioBlob.h:32
Definition: TuioCursor.h:32