private void TestRootForDrawing(RecognitionRoot root) { Assert.IsNotNull(root); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Id == 0); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Kind == InkRecognitionUnitKind.RecognizedRoot); Assert.IsNull(root.GetInkRecognitionUnits().ElementAt(0).Parent); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Children.Count() == 1); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Children.ElementAt(0).Kind == InkRecognitionUnitKind.InkDrawing); var strokeIds = new List <long>() { 95 }; Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).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.GetInkRecognitionUnits().ElementAt(0).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.GetInkRecognitionUnits().ElementAt(0).RotatedBoundingBox.SequenceEqual(rotatedBoundingRect)); // Returns two InkRecognition units: Root and Drawing Assert.IsTrue(root.GetInkRecognitionUnits().Count() == 2); Assert.IsTrue(root.GetWords().Count() == 0); Assert.IsTrue(root.GetDrawings().Count() == 1); Assert.IsTrue(root.GetInkRecognitionUnits(InkRecognitionUnitKind.RecognizedRoot).Count() == 1); 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); }
private void TestRootForWriting(RecognitionRoot root) { Assert.IsNotNull(root); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Id == 0); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Kind == InkRecognitionUnitKind.RecognizedRoot); Assert.IsNull(root.GetInkRecognitionUnits().ElementAt(0).Parent); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Children.Count() == 1); Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).Children.ElementAt(0).Kind == InkRecognitionUnitKind.RecognizedWritingRegion); var strokeIds = new List <long>() { 95, 96, 97 }; Assert.IsTrue(root.GetInkRecognitionUnits().ElementAt(0).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.GetInkRecognitionUnits().ElementAt(0).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.GetInkRecognitionUnits().ElementAt(0).RotatedBoundingBox.SequenceEqual(rotatedBoundingRect)); // Returns 5 InkRecognition units: Root, WritingRegion, Paragraph, Line, InkWord Assert.IsTrue(root.GetInkRecognitionUnits().Count() == 5); 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); }
// <PrintWords> public static string PrintWords(RecognitionRoot root) { var words = root.GetWords(); return(PrintRecoUnits(root, words)); }