private static void _setParentAndChildrenNodes(RecognitionRoot root)
        {
            var recoUnits = root.GetInkRecognitionUnits();

            foreach (var recoUnit in recoUnits)
            {
                // Set parent node and children nodes for Ink Recognition units
                _setParentNode(root, recoUnit);
                _setChildrenNodes(root, recoUnit);
            }
        }
Exemple #2
0
        private void TestRootForDrawing(RecognitionRoot root)
        {
            Assert.IsNotNull(root);
            //Assert.IsTrue(root.Id == 0);
            //Assert.IsTrue(root.Kind == InkRecognitionUnitKind.RecognizedRoot);
            //Assert.IsNull(root.Parent);
            //Assert.IsTrue(root.Children.Count() == 1);
            //Assert.IsTrue(root.Children.ElementAt(0).Kind == InkRecognitionUnitKind.InkDrawing);

            var strokeIds = new List <long>()
            {
                95
            };
            //Assert.IsTrue(root.StrokeIds.SequenceEqual(strokeIds));

            var boundingRect = new RectangleF();

            boundingRect.Height = 120.4f;
            boundingRect.X      = 47.8f;
            boundingRect.Y      = 18.2f;
            boundingRect.Width  = 207.5f;
            //Assert.IsTrue(root.BoundingBox.Equals(boundingRect));

            var point1 = new PointF(47.8f, 18.2f);
            var point2 = new PointF(254.5f, 18.25f);
            var point3 = new PointF(254.5f, 138.6f);
            var point4 = new PointF(47.8f, 138.6f);
            var rotatedBoundingRect = new List <PointF> {
                point1, point2, point3, point4
            };

            //Assert.IsTrue(root.RotatedBoundingBox.SequenceEqual(rotatedBoundingRect));

            // Returns 1 InkRecognition unit: Drawing
            Assert.IsTrue(root.GetInkRecognitionUnits().Count() == 1);
            Assert.IsTrue(root.GetWords().Count() == 0);
            Assert.IsTrue(root.GetDrawings().Count() == 1);

            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedRoot).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedWritingRegion).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedParagraph).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedLine).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkWord).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkDrawing).Count() == 1);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkBullet).Count() == 0);
        }
Exemple #3
0
        private void TestRootForWriting(RecognitionRoot root)
        {
            Assert.IsNotNull(root);
            //Assert.IsTrue(root.Id == 0);
            //Assert.IsTrue(root.Kind == InkRecognitionUnitKind.RecognizedRoot);
            //Assert.IsNull(root.Parent);
            //Assert.IsTrue(root.Children.Count() == 1);
            //Assert.IsTrue(root.Children.ElementAt(0).Kind == InkRecognitionUnitKind.RecognizedWritingRegion);

            var strokeIds = new List <long>()
            {
                95, 96, 97
            };
            //Assert.IsTrue(root.StrokeIds.SequenceEqual(strokeIds));

            var boundingRect = new RectangleF();

            boundingRect.Height = 33.8f;
            boundingRect.X      = 37.9f;
            boundingRect.Y      = 16.7f;
            boundingRect.Width  = 34.8f;
            //Assert.IsTrue(root.BoundingBox.Equals(boundingRect));

            var point1 = new PointF(40.1f, 12.8f);
            var point2 = new PointF(77.5f, 33.4f);
            var point3 = new PointF(66.8f, 53.6f);
            var point4 = new PointF(29.2f, 32.4f);
            var rotatedBoundingRect = new List <PointF> {
                point1, point2, point3, point4
            };

            //Assert.IsTrue(root.RotatedBoundingBox.SequenceEqual(rotatedBoundingRect));

            // Returns 4 InkRecognition units: WritingRegion, Paragraph, Line, InkWord
            Assert.IsTrue(root.GetInkRecognitionUnits().Count() == 4);
            Assert.IsTrue(root.GetWords().Count() == 1);
            Assert.IsTrue(root.GetDrawings().Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkDrawing).Count() == 0);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedWritingRegion).Count() == 1);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedParagraph).Count() == 1);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedLine).Count() == 1);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkWord).Count() == 1);
            Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.InkBullet).Count() == 0);
        }