void MyTuioServer::send_blobs(std::vector<cBlob>& blobs, std::vector<Area>& areas, cv::Rect& roi){ currentTime = TuioTime::getSessionTime(); initFrame(currentTime); cBlob *pb; Area *pa; // printf("Area size: %i\n", areas.size()); float lx,ly; for (int i = 0; i < blobs.size(); i++) { pb = &blobs[i]; pa = &areas[pb->areaid-1]; switch( pb->event ){ case BLOB_UP: { printf("Remove cursor\n"); //assert( pb->cursor != NULL ); if( pb->cursor == NULL ) break; removeTuioCursor(pb->cursor); } break; case BLOB_DOWN: { //assert( pb->cursor == NULL ); localCoords(pb,pa,&roi,&lx,&ly); if( pb->cursor == NULL ){ pb->cursor = addTuioCursor(lx,ly,tuioSessionId(pb)); printf("Add cursor %i \n", (int)tuioSessionId(pb)); }else{ updateTuioCursor(pb->cursor,lx,ly); } } break; case BLOB_MOVE: default: { localCoords(pb,pa,&roi,&lx,&ly); //assert( pb->cursor != NULL ); if( pb->cursor == NULL ){ pb->cursor = addTuioCursor(lx,ly,tuioSessionId(pb)); }else{ printf("Move cursor %i to %f %f \n", (int)tuioSessionId(pb),lx,ly ); updateTuioCursor(pb->cursor,lx,ly); } } break; } } //processEvents(); stopUntouchedMovingCursors();//? commitFrame(); /* if (cursor->getTuioTime()==currentTime) return; tuioServer->updateTuioCursor(cursor,x,y); cursor = tuioServer->addTuioCursor(x,y); tuioServer->removeTuioCursor(cursor); std::list<TuioCursor*> cursorList = tuioServer->getTuioCursors(); */ }
void Sender::removeUntouchedStoppedCursors(){ std::list<Cursor*>::iterator it = mCursors.begin(); while (it != mCursors.end()) { Cursor *cursor = (*it); if ((cursor->getTime() != mCurrentFrameTime) && (!cursor->isMoving())) { removeTuioCursor(cursor); it = mCursors.begin(); } else it++; } }
void moTUIOSystemData::removeUntouchedStoppedCursors() { if (cursorList.size()==0) return; std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin(); while (tuioCursor!=cursorList.end()) { TuioCursor *tcur = (*tuioCursor); if ((tcur->getTuioTime()!=currentFrameTime) && (!tcur->isMoving())) { removeTuioCursor(tcur); tuioCursor = cursorList.begin(); } else tuioCursor++; } }
void TouchServer::removeRightCursor(const unsigned int user) { // this user does not currently have any cursors if (cursorMap_.count(user) == 0) return; // user is in map // if the users' left cursor is not NULL, remove it and set NULL if(cursorMap_[user].rightCursor_ != NULL) { removeTuioCursor(cursorMap_[user].rightCursor_); cursorMap_[user].rightCursor_ = NULL; } }