예제 #1
0
        private void TuioChannelHelper_OnIncomingTuioCursor(TuioCursor c, IncomingType type)
        {
            switch (type)
            {
            case IncomingType.New:
                lock (cursorSync)
                    CursorList.Add(c.SessionID, new TuioCursorContainer(c, type));
                break;

            case IncomingType.Update:
                lock (cursorSync)
                {
                    CursorList[c.SessionID].TuioCursor.update(c);
                    CursorList[c.SessionID].Type = type;
                }
                break;

            case IncomingType.Remove:
                lock (cursorSync)
                    CursorList[c.SessionID].Type = type;
                break;
            }
        }
예제 #2
0
        private void TuioChannelHelper_OnIncomingTuioObject(TuioObject o, IncomingType type)
        {
            switch (type)
            {
            case IncomingType.New:
                lock (objectSync)
                    ObjectList.Add(o.getSessionID(), new TuioObjectContainer(o, type));
                break;

            case IncomingType.Update:
                lock (objectSync)
                {
                    ObjectList[o.getSessionID()].TuioObject.update(o);
                    ObjectList[o.getSessionID()].Type = type;
                }
                break;

            case IncomingType.Remove:
                lock (objectSync)
                    ObjectList[o.getSessionID()].Type = type;    //the one who produces the touch input is responsible for removing items
                break;
            }
        }
예제 #3
0
        private void TuioChannel_OnTuioRefresh(TuioTime t)
        {
            //TODO: re-enable frequent screen monitoring
            //if (frameCount % checkScreenEvery == 0)
            //    ScanScreens();
            //loop through the TuioObjects
            List <PointerTouchInfo> toFire     = new List <PointerTouchInfo>();
            List <long>             removeList = new List <long>();

            foreach (var kvp in channel.CursorList)
            {
                TuioCursor   cur  = kvp.Value.TuioCursor;
                IncomingType type = kvp.Value.Type;
                int[]        injectionCoordinates = ToInjectionCoordinates(cur.X, cur.Y);
                int          radius = 12;
                //make a new pointertouchinfo with all neccessary information
                PointerTouchInfo contact = new PointerTouchInfo();
                contact.PointerInfo.pointerType = PointerInputType.TOUCH;
                contact.TouchFlags = TouchFlags.NONE;
                //contact.Orientation = (uint)cur.getAngleDegrees();//this is only valid for TuioObjects
                contact.Pressure   = 1024;
                contact.TouchMasks = TouchMask.CONTACTAREA | TouchMask.ORIENTATION | TouchMask.PRESSURE;
                contact.PointerInfo.PtPixelLocation.X = injectionCoordinates[0];
                contact.PointerInfo.PtPixelLocation.Y = injectionCoordinates[1];
                contact.PointerInfo.PointerId         = (uint)cur.CursorID;

                contact.ContactArea.left   = injectionCoordinates[0] - radius;
                contact.ContactArea.right  = injectionCoordinates[0] + radius;
                contact.ContactArea.top    = injectionCoordinates[1] - radius;
                contact.ContactArea.bottom = injectionCoordinates[1] + radius;
                //contact.PointerInfo.FrameId = frameCount;

                //set the right flags
                if (type == IncomingType.New)
                {
                    contact.PointerInfo.PointerFlags = PointerFlags.DOWN | PointerFlags.INRANGE | PointerFlags.INCONTACT;
                    kvp.Value.Type = IncomingType.Update;
                }
                else if (type == IncomingType.Update)
                {
                    contact.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE | PointerFlags.INCONTACT;
                }
                else if (type == IncomingType.Remove)
                {
                    contact.PointerInfo.PointerFlags = PointerFlags.UP;
                    removeList.Add(kvp.Key);
                }

                //add it to 'toFire'
                toFire.Add(contact);
            }

            //fire the events
            bool success = TCD.System.TouchInjection.TouchInjector.InjectTouchInput(toFire.Count, toFire.ToArray());

            //remove those with type == IncomingType.Remove
            foreach (long key in removeList)
            {
                channel.CursorList.Remove(key);//remove from the tuio channel
            }
            //count up
            frameCount++;
        }
 public TuioCursorContainer(TuioCursor cur, IncomingType type)
 {
     TuioCursor = cur;
     Type       = type;
 }
 public TuioObjectContainer(TuioObject obj, IncomingType type)
 {
     TuioObject = obj;
     Type       = type;
 }
예제 #6
0
 public static void OnIncomingTuioCursorEvent(TuioCursor cur, IncomingType type)
 {
     try { OnIncomingTuioCursor(cur, type); }
     catch { }
 }
예제 #7
0
 public static void OnIncomingTuioObjectEvent(TuioObject obj, IncomingType type)
 {
     try { OnIncomingTuioObject(obj, type); }
     catch { }
 }
예제 #8
0
 public IncomingProxy(IncomingType type)
 {
     this._type = type;
 }
예제 #9
0
        private void CreateLandFeeders()
        {
            DataRow[] feederRows = this.MvProject.FeederTable.Select("GroupID = '" + this.GroupID + "'");
            foreach (DataRow feederRow in feederRows)
            {
                this.MvProject.FeederTable.Rows.Remove(feederRow);
            }

            //string location = Data.Location.Front(this.MvProject.IsShip, this.MvProject.ModelName, this.MvProject.LandInfo.Rating);
            //Util.CompositeFactory reader = new Util.CompositeFactory(location, "EMA");

            //Util.Composite feeder = reader.List.FindLast(item => item.Name.StartsWith("F"));
            string defaultFeederType = this.GetDefaultFeeder("Feeder");

            if (this.IncomingType.StartsWith("1"))
            {
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT");
                for (int i = 0; i < this.FeederQty; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }
            }
            else if (IncomingType.StartsWith("2"))
            {
                int half = FeederQty / 2;
                for (int i = 0; i < half; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }

                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus Tie A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT B");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg B");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT B");

                for (int i = half; i < this.FeederQty; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }
            }
            else
            {
                int oneThird = this.FeederQty / 3;
                for (int i = 0; i < oneThird; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }

                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus Tie A");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg B");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT B");

                int twoThird = this.FeederQty * 2 / 3;
                for (int i = oneThird; i < twoThird; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }

                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus Tie B");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Bus PT");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg B");
                CreateLandFeeder(this.GroupID, this.GroupNo, "Incomg PT B");

                for (int i = twoThird; i < this.FeederQty; i++)
                {
                    CreateLandFeeder(this.GroupID, this.GroupNo, defaultFeederType);
                }
            }
        }