public void addTuioCursor(TuioCursor tcur)
 {
     lock (_lockObj)
     {
         _eventQueue.Enqueue(new TuioEvent(ETuioEventType.ADD_CURSOR, tcur));
     }
 }
Exemplo n.º 2
0
        public void UpdateTuioCursor(TuioCursor tuioCursor)
        {
            _refreshTimer.Stop();

            int pid = tuioCursor.getCursorID();

            int i = _pointerTouchInfos.FindIndex(pti => pti.PointerInfo.PointerId == pid);

            if (i != -1)
            {
                int x = (int)((tuioCursor.getX() * (_screenRect.Width + _calibrationBuffer.Width)) + _calibrationBuffer.Left + _screenRect.Left);
                int y = (int)((tuioCursor.getY() * (_screenRect.Height + _calibrationBuffer.Height)) + _calibrationBuffer.Top + _screenRect.Top);

                PointerTouchInfo pointerTouchInfo = _pointerTouchInfos[i];
                pointerTouchInfo.PointerInfo.PointerFlags    = PointerFlags.UPDATE | PointerFlags.INRANGE | ((this.IsContactEnabled) ? PointerFlags.INCONTACT : PointerFlags.NONE);
                pointerTouchInfo.PointerInfo.PtPixelLocation = new PointerTouchPoint {
                    X = x, Y = y
                };
                pointerTouchInfo.ContactArea = new ContactArea
                {
                    Left   = x - CONTACT_AREA_RADIUS,
                    Right  = x + CONTACT_AREA_RADIUS,
                    Top    = y - CONTACT_AREA_RADIUS,
                    Bottom = y + CONTACT_AREA_RADIUS
                };
                _pointerTouchInfos[i] = pointerTouchInfo;

                Trace.WriteLine(string.Format("set cur {0} ({1}) {2} {3} {4} {5}", pid, tuioCursor.getSessionID(), x, y, tuioCursor.getMotionSpeed(), tuioCursor.getMotionAccel()), "TUIO");
            }
        }
Exemplo n.º 3
0
    // Cursor down is for new touch events. we take the TUIO cursor object and convert it
    // into a touch event, and add it to our active list of events
    public virtual void cursorDown(TuioCursor cursor)
    {
        // first, make a new BBTouchEvent, tag it with the unique touch id
        BBTouchEvent newEvent = new BBTouchEvent(cursor.getSessionID());

        // set the initial information
        newEvent.screenPosition = new Vector3(cursor.getX() * cameraPixelWidth, (1.0f - cursor.getY()) * cameraPixelHeight, 0.3f);
        newEvent.eventState     = BBTouchEventState.Began;
        newEvent.didChange      = true;
        // set all the rest of the info
        updateEvent(newEvent, cursor);

        // add it to our active event dictionary so we can retireve it based on it's unique ID
        // some times badness happens and we get an error adding one here for some reason
        // it should not ever be the case that the ID is already there.
        // if it is, then we need to behave
        if (activeEvents.ContainsKey(cursor.getSessionID()))
        {
            // then something is not right.. remove the old one and add a new one
            activeEvents.Remove(cursor.getSessionID());
        }
        activeEvents.Add(cursor.getSessionID(), newEvent);
        // queue it up for processing
        lock (eventQueueLock) eventQueue.Add(newEvent);
    }
Exemplo n.º 4
0
 internal void EnqueueContact(TuioCursor cursor, ContactState state)
 {
     lock (contactsQueue)
     {
         contactsQueue.Enqueue(new TuioContact(cursor, state, monitorSize));
     }
 }
 public void removeTuioCursor(TuioCursor tcur)
 {
     lock (_lockObj)
     {
         _eventQueue.Enqueue(new TuioEvent(ETuioEventType.REMOVE_CURSOR, tcur));
     }
 }
 public void removeTuioCursor(TuioCursor c)
 {
     TUIOTouchDevice.tuioInfoCache.Add(new TUIOINFO()
     {
         action = TUIOAction.Up, cursor = c
     });
 }
 public void updateTuioCursor(TuioCursor tcur)
 {
     lock (_lockObj)
     {
         _eventQueue.Enqueue(new TuioEvent(ETuioEventType.UPDATE_CURSOR, tcur));
     }
 }
Exemplo n.º 8
0
 public void updateTuioCursor(TuioCursor c)
 {
     if (verbose)
     {
         Console.WriteLine("set cur " + c.CursorID + " (" + c.SessionID + ") " + c.X + " " + c.Y + " " + c.MotionSpeed + " " + c.MotionAccel);
     }
 }
Exemplo n.º 9
0
 public void removeTuioCursor(TuioCursor c)
 {
     lock (cursorSync)
     {
         cursorList.Remove(c.SessionID);
     }
     // Debug.Log("del cur " + c.CursorID + " (" + c.SessionID + ")");
 }
Exemplo n.º 10
0
 public void addTuioCursor(TuioCursor c)
 {
     lock (cursorSync)
     {
         cursorList.Add(c.SessionID, c);
     }
     //Debug.Log("add cur " + c.CursorID + " (" + c.SessionID + ") " + c.X + " " + c.Y);
 }
Exemplo n.º 11
0
 public void removeTuioCursor(TuioCursor tcur)
 {
     lock (cursorSync)
     {
         cursorList.Remove(tcur.getSessionID());
     }
     Console.WriteLine("del cur " + tcur.getCursorID() + " (" + tcur.getSessionID() + ")");
 }
Exemplo n.º 12
0
 public void removeTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (eventDelegate)
     {
         eventDelegate.cursorUp(c);
     }
 }
Exemplo n.º 13
0
 public void updateTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (eventDelegate)
     {
         eventDelegate.cursorMove(c);
     }
 }
Exemplo n.º 14
0
 public void addTuioCursor(TuioCursor tcur)
 {
     Console.WriteLine("add cur " + tcur.CursorID + " (" + tcur.SessionID + ") " + tcur.X + " " + tcur.Y);
     if (cursors.FirstOrDefault <TuioCursor>(tmp => tmp.CursorID == tcur.CursorID) == null)
     {
         cursors.Add(tcur);
     }
 }
Exemplo n.º 15
0
 public void addTuioCursor(TuioCursor tcur)
 {
     if (GestureManager != null)
     {
         TouchPoint tp = this.CreateTouchPoint(tcur);
         OnTouchDown(tp);
     }
 }
Exemplo n.º 16
0
 public void removeTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (mtM)
     {
         mtM.removeCursor(c);
     }
 }
Exemplo n.º 17
0
 private void updateEvent(BBTouchEvent anEvent, TuioCursor cursor)
 {
     anEvent.lastScreenPosition = anEvent.screenPosition;
     anEvent.tuioPosition       = new Vector2(cursor.getX(), (1.0f - cursor.getY()));
     anEvent.screenPosition     = new Vector3(cursor.getX() * cameraPixelWidth, (1.0f - cursor.getY()) * cameraPixelHeight, 0.3f);
     anEvent.lastTouchTime      = anEvent.touchTime;
     anEvent.touchTime          = Time.time;
 }
Exemplo n.º 18
0
 // for now we are only interested in cursor objects, ie touch events
 public void addTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (mtM)
     {
         mtM.newCursor(c);
     }
 }
Exemplo n.º 19
0
 public void updateTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (mtM)
     {
         mtM.updateCursor(c);
     }
 }
Exemplo n.º 20
0
 //
 // for now we are only interested in cursor objects, ie touch events
 public void addTuioCursor(TuioCursor c)
 {
     cursorDidChange = true;
     if (eventDelegate)
     {
         eventDelegate.cursorDown(c);
     }
 }
Exemplo n.º 21
0
 public void removeTuioCursor(TuioCursor c)
 {
     lock (objectSync) {
         if (collectEvents)
         {
             activeCursorEvents.Add(new mtCursorEvent(c, mtCursorState.Remove));
         }
     }
 }
Exemplo n.º 22
0
 public void updateTuioCursor(TuioCursor c)
 {
     lock (objectSync) {
         if (collectEvents)
         {
             activeCursorEvents.Add(new BBCursorEvent(c, BBCursorState.Update));
         }
     }
 }
Exemplo n.º 23
0
 public void removeTuioCursor(TuioCursor tuioCursor)
 {
     this.Dispatcher.Invoke(
         DispatcherPriority.Normal,
         (Action)(() =>
     {
         BSQSim.RemoveTouchDevice((int)tuioCursor.getSessionID());
     }));
 }
Exemplo n.º 24
0
        public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize)
            : base(cursor.getFingerID(), state, new Point(0, 0), 20, 20)
        {
            float x = cursor.getScreenX(monitorSize.Width);
            float y = cursor.getScreenY(monitorSize.Height);

            Position    = new Point(x, y);
            Orientation = 0;
        }
Exemplo n.º 25
0
    // enterframe function
    public void ProcessTUIO(List <TrackingPoint> trackingPoints)
    {
        if (this.server == null)
        {
            return;
        }

        // init
        this.server.initFrame(TuioTime.SessionTime);

        // event process
        foreach (TrackingPoint pt in trackingPoints)
        {
            switch (pt.ptEvent)
            {
            case TrackingPoint.POINT_EVENT.DOWN:

                // cursor add
                TuioCursor tcur_new = this.server.addTuioCursor((float)pt.position.X, (float)pt.position.Y);
                break;

            case TrackingPoint.POINT_EVENT.MOVE:

                // cursor update
                foreach (TuioCursor tcur_move in this.server.getTuioCursors())
                {
                    if (tcur_move.getDistance((float)pt.pre_position.X, (float)pt.pre_position.Y) == 0.0)
                    {
                        this.server.updateTuioCursor(tcur_move, (float)pt.position.X, (float)pt.position.Y);
                        break;
                    }
                }
                break;

            case TrackingPoint.POINT_EVENT.UP:

                // cursor remove
                foreach (TuioCursor tcur_del in this.server.getTuioCursors())
                {
                    if (tcur_del.getDistance((float)pt.position.X, (float)pt.position.Y) == 0.0f)
                    {
                        this.server.removeTuioCursor(tcur_del);
                        break;
                    }
                }
                break;

            default: break;
            }
        }

        // commit
        this.server.stopUntouchedMovingCursors();
        this.server.removeUntouchedStoppedCursors();
        this.server.commitFrame();
    }
Exemplo n.º 26
0
        public void addTuioCursor(TuioCursor tcur)
        {
            lock (cursorSync)
            {
                cursorList.Add(tcur.getSessionID(), tcur);
            }

            Console.WriteLine("add cur " + tcur.getCursorID() + " (" + tcur.getSessionID() + ") " + tcur.getX() + " " + tcur.getY());
            //  VisualFeedback.InvalidateVisual();
        }
Exemplo n.º 27
0
        public void updateTuioCursor(TuioCursor tcur)
        {
            Console.WriteLine("set cur " + tcur.CursorID + " (" + tcur.SessionID + ") " + tcur.X + " " + tcur.Y + " " + tcur.MotionSpeed + " " + tcur.MotionAccel);
            TuioCursor cursor = cursors.FirstOrDefault <TuioCursor>(tmp => tmp.CursorID == tcur.CursorID);

            if (cursor != null)
            {
                cursor.update(tcur);
            }
        }
Exemplo n.º 28
0
        public void removeTuioCursor(TuioCursor tcur)
        {
            Console.WriteLine("del cur " + tcur.CursorID + " (" + tcur.SessionID + ")");
            TuioCursor cursor = cursors.FirstOrDefault <TuioCursor>(tmp => tmp.CursorID == tcur.CursorID);

            if (cursors != null)
            {
                cursors.Remove(cursor);
            }
        }
Exemplo n.º 29
0
 public void updateTuioCursor(TuioCursor tuioCursor)
 {
     this.Dispatcher.Invoke(
         DispatcherPriority.Normal,
         (Action)(() =>
     {
         BSQSim.UpdateTouchDevice((int)tuioCursor.getSessionID(),
                                  new Point(tuioCursor.getScreenX(Convert.ToInt32(DISPLAY_W)), tuioCursor.getScreenY(Convert.ToInt32(DISPLAY_H))));
     }));
 }
Exemplo n.º 30
0
 public void removeTuioCursor(TuioCursor c)
 {
     lock (cursorList) {
         cursorList.Remove(c.SessionID);
     }
     if (verbose)
     {
         Console.WriteLine("del cur " + c.CursorID + " (" + c.SessionID + ")");
     }
 }