Example #1
0
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface.
        /// Add new packet data into the packet array for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
        {
            int        stylusId = data.Stylus.Id;
            List <int> collected;

            if (!this.m_PacketsTable.TryGetValue(stylusId, out collected))
            {
                // If ink collection was disabled on StylusDown or if the user is erasing,
                // then ignore these packets.
                return;
            }

            int strokeId = this.m_StrokeIdTable[stylusId];

            int[] packets = data.GetData();

            // Use the stylus id as a key to retrieve the packet array for the
            // stylus.  Insert the new packet data into this array.
            collected.AddRange(packets);

            using (Synchronizer.Lock(this)) {
                if (this.RealTimeInkSheetModel != null)
                {
                    // Send the packets to anybody who's listening to the RealTimeInk.
                    this.RealTimeInkSheetModel.OnPackets(stylusId, strokeId, packets);
                }
            }
        }
Example #2
0
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
     if (data.Count >= 3)
     {
         mParent.Pressure = data[2];
     }
 }
Example #3
0
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
        {
            int stylusId = data.Stylus.Id;

            // Add the packets to the stroke
            if (this.collectedPacketsTable.ContainsKey(stylusId))
            {
                List <int> collected = new List <int>(data.GetData());
                this.collectedPacketsTable[stylusId].AddRange(collected);
            }
        }
Example #4
0
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     if (_touch.TouchMove != null)
     {
         _form.BeginInvoke((Action)(() =>
         {
             foreach (var arg in GetEvents(data))
             {
                 _touch.TouchMove(sender, arg);
             }
         }));
     }
 }
Example #5
0
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface.
        /// Use this notification to draw a small circle around each
        /// new packet received.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void Packets(RealTimeStylus sender, PacketsData data)
        {
            // For each new packet received, extract the x,y data
            // and draw a small circle around the result.
            for (int i = 0; i < data.Count; i += data.PacketPropertyCount)
            {
                // Packet data always has x followed by y followed by the rest
                Point point = new Point(data[i], data[i + 1]);

                // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
                point.X = (int)Math.Round((float)point.X * (float)myGraphics.DpiX / 2540.0F);
                point.Y = (int)Math.Round((float)point.Y * (float)myGraphics.DpiY / 2540.0F);

                // Draw a circle corresponding to the packet
                myGraphics.DrawEllipse(Pens.Green, point.X - 2, point.Y - 2, 4, 4);
            }
        }
Example #6
0
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.HandlePackets(sender, data);
 }
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.m_Core.Packets(data.Stylus.Id, 0, data.GetData());
 }
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface.
        /// Add new packet data into the packet array for this stylus.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusAsyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
        {
            int stylusId = data.Stylus.Id;
            List<int> collected;
            if (!this.m_PacketsTable.TryGetValue(stylusId, out collected)) {
                // If ink collection was disabled on StylusDown or if the user is erasing,
                // then ignore these packets.
                return;
            }

            int strokeId = this.m_StrokeIdTable[stylusId];
            int[] packets = data.GetData();

            // Use the stylus id as a key to retrieve the packet array for the
            // stylus.  Insert the new packet data into this array.
            collected.AddRange(packets);

            using(Synchronizer.Lock(this)) {
                if(this.RealTimeInkSheetModel != null) {
                    // Send the packets to anybody who's listening to the RealTimeInk.
                    this.RealTimeInkSheetModel.OnPackets(stylusId, strokeId, packets);
                }
            }
        }
Example #9
0
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.m_Core.Packets(data.Stylus.Id, 0, data.GetData());
 }
Example #10
0
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// Add new packet data into the packet array for this stylus.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.ModifyPacketData(data);
 }
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// Add new packet data into the packet array for this stylus.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
     // Use the stylus id as a key to retrieve the packet array for the
     // stylus.  Insert the new packet data into this array.
     ((ArrayList)(myPackets[data.Stylus.Id])).AddRange(data.GetData());
 }
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// Add new packet data into the packet array for this stylus.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.ModifyPacketData(data);
 }
Example #13
0
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
 }
Example #14
0
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
 }
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
 }
 public void Packets( RealTimeStylus sender, PacketsData data )
 {
     lock ( StylusStrokes ) {
         Debug.Assert( PendingStylusStroke != null );
         for ( int i=0 ; i<data.Count ; i += data.PacketPropertyCount ) {
             var point = new PointF(data[i+0]*FormDpiX/2540f, data[i+1]*FormDpiY/2540f);
             if ( point != PendingStylusStroke.Points.LastOrDefault() ) PendingStylusStroke.Points.Add(point);
         }
     }
     Form.Invalidate();
 }
 // Pen-move notification handler
 // In this case, does nothing, but likely to be used in a more complex application.
 // RTS framework does stroke collection and rendering for us.
 //      sender      RTS event sender object
 //      data        event arguments
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
 }
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface. 
        /// Use this notification to draw a small circle around each
        /// new packet received.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        public void Packets(RealTimeStylus sender,  PacketsData data)
        {
            // For each new packet received, extract the x,y data
            // and draw a small circle around the result.
            for (int i = 0; i < data.Count; i += data.PacketPropertyCount)
            {
                // Packet data always has x followed by y followed by the rest
                Point point = new Point(data[i], data[i+1]);

                // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
                point.X = (int)Math.Round((float)point.X * (float)myGraphics.DpiX/2540.0F);
                point.Y = (int)Math.Round((float)point.Y * (float)myGraphics.DpiY/2540.0F);

                // Draw a circle corresponding to the packet
                myGraphics.DrawEllipse(Pens.Green, point.X - 2, point.Y - 2, 4, 4);
            }
        }
        /// <summary>
        /// Occurs when the stylus moves on the digitizer surface.
        /// </summary>
        /// <param name="sender">The real time stylus associated with the notification</param>
        /// <param name="data">The notification data</param>
        void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
        {
            int stylusId = data.Stylus.Id;

            // Add the packets to the stroke
            if (this.collectedPacketsTable.ContainsKey(stylusId)) {
                List<int> collected = new List<int>(data.GetData());
                this.collectedPacketsTable[stylusId].AddRange(collected);
            }
        }
Example #20
0
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 void IStylusSyncPlugin.Packets(RealTimeStylus sender, PacketsData data)
 {
     this.HandlePackets(sender, data);
 }
Example #21
0
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// Use this notification to constrain the packet data within a
 /// specified rectangle.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
     ModifyPacketData(data);
 }
Example #22
0
        public void Packets(RealTimeStylus sender, PacketsData data)
        {
            //((ArrayList)(myPackets[data.Stylus.Id])).AddRange(data.GetData());
            Tablet tablet = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);
            if (previousnumber == data.Stylus.Id)
            {
               // Console.WriteLine(data.Stylus.Id);
            }
            previousnumber = data.Stylus.Id;
            switch (tablet.DeviceKind)
            {
                case TabletDeviceKind.Mouse:

                case TabletDeviceKind.Pen:
                    TRPoint point = new TRPoint();
                    point.x = data[0]; point.y = data[1];
                    // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
                    point.x = (int)Math.Round((float)point.x * (float)graphics.DpiX / 2540.0F);
                    point.y = (int)Math.Round((float)point.y * (float)graphics.DpiY / 2540.0F);
                    if(TangibleRecognizerTab.SelectedTab.Equals(LearningPhaseTab))
                    {
                        if (prevPoint == null)
                            return;
                        if (Math.Abs(leftLineX - prevPoint.x) <= 10)
                        {
                            leftLineX = (int)point.x;
                            prevPoint = point;
                            this.glLearningView.Invalidate();
                        }else if (Math.Abs(rightLineX - prevPoint.x) <= 10)
                        {
                            rightLineX = (int)point.x;
                            prevPoint = point;
                            this.glLearningView.Invalidate();
                        }
                        else if (Math.Abs(topLineY - prevPoint.y) <= 10)
                        {
                            topLineY = (int)point.y;
                            prevPoint = point;
                            this.glLearningView.Invalidate();
                        }
                        else if (Math.Abs(bottomLineY - prevPoint.y) <= 10)
                        {
                            bottomLineY = (int)point.y;
                            prevPoint = point;
                            this.glLearningView.Invalidate();
                        }
                    }
                    break;
                case TabletDeviceKind.Touch:
                    TRPoint touchPoint = new TRPoint();
                    touchPoint.x = data[0];
                    touchPoint.y = data[1];

                    if (TangibleRecognizerTab.SelectedTab.Equals(DrawingTab))
                    {
                        if (previousnumber == data.Stylus.Id)
                        {
                   //         return;
                        }
                        counter++;
                        if (counter % 5 == 0)
                        {
                            //Console.WriteLine(touchPoint.x + ":" + touchPoint.y);
                            recognizer.touchMoved(data.Stylus.Id, touchPoint);
                            VectorInt recognizedIndex = recognizer.getRecognizedObject();
                            if (recognizedIndex.Count > 0)
                            {
                                drawRecognizedObject(recognizedIndex);

                            }
                        }
                    }
                    break;
            }
               /* Tablet t = sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId);
            if (sender.GetTabletFromTabletContextId(data.Stylus.TabletContextId).DeviceKind == TabletDeviceKind.Mouse)
            {
                Point point = new Point(data[0], data[1]);
                graphics.DrawEllipse(Pens.Red, point.X / 26, point.Y / 28, 10, 10);

            }*/
        }
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface.
 /// Add new packet data into the packet array for this stylus.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void Packets(RealTimeStylus sender, PacketsData data)
 {
     // Use the stylus id as a key to retrieve the packet array for the
     // stylus.  Insert the new packet data into this array.
     ((ArrayList)(myPackets[data.Stylus.Id])).AddRange(data.GetData());
 }
 /// <summary>
 /// Occurs when the stylus moves on the digitizer surface. 
 /// Use this notification to constrain the packet data within a 
 /// specified rectangle.
 /// </summary>
 /// <param name="sender">The real time stylus associated with the notification</param>
 /// <param name="data">The notification data</param>
 public void Packets(RealTimeStylus sender,  PacketsData data)
 {
     ModifyPacketData(data);
 }