public void process(InkAnalyzer inkAnalyzer)
        {
            ContextNodeCollection contextNodeCollection = inkAnalyzer.FindLeafNodes();
            List <Stroke>         horizontalLines       = InkUtils.findLines(contextNodeCollection);

            findAndDeleteStrikethrough(inkAnalyzer, canvas, horizontalLines, contextNodeCollection);
        }
        public void process(InkAnalyzer inkAnalyzer)
        {
            ContextNodeCollection contextNodeCollection = inkAnalyzer.FindLeafNodes();
            List<Stroke> horizontalLines = InkUtils.findLines(contextNodeCollection);

            findAndDeleteStrikethrough(inkAnalyzer, canvas, horizontalLines, contextNodeCollection);
        }
Example #3
0
        public void insertStrokes(InkAnalyzer analyzer, InkCanvas mainInkCanvas, InkCanvas insertionCanvas)
        {
            double      bestY        = -10000;
            ContextNode selectedNode = null;

            foreach (ContextNode node in analyzer.FindLeafNodes())
            {
                double y1 = strokeToBeReplaced.GetBounds().Y;
                double y2 = node.Strokes.GetBounds().Y;
                if (y1 - y2 > 0 && y1 - y2 < y1 - bestY)
                {
                    bestY        = y2;
                    selectedNode = node;
                }
            }
            if (bestY == -10000)
            {
                bestY = strokeToBeReplaced.GetBounds().Y;
            }
            StrokeCollection strokeCollection = insertionCanvas.Strokes.Clone();

            insertionCanvas.Strokes.Clear();
            double bestX        = strokeToBeReplaced.GetBounds().X;
            double strokeX      = strokeCollection.GetBounds().X;
            double strokeY      = strokeCollection.GetBounds().Y;
            Matrix inkTransform = new Matrix();

            inkTransform.Translate(bestX - strokeX + 20, bestY - strokeY);
            strokeCollection.Transform(inkTransform, false);
            double width     = strokeCollection.GetBounds().Width + Constants.SPACING;
            double startX    = strokeCollection.GetBounds().X;
            Matrix transform = new Matrix();

            transform.Translate(width, 0);
            if (selectedNode != null)
            {
                for (int i = 0; i < selectedNode.ParentNode.SubNodes.Count; i++)
                {
                    ContextNode siblingNode = selectedNode.ParentNode.SubNodes[i];
                    for (int j = 0; j < siblingNode.Strokes.Count; j++)
                    {
                        Stroke stroke  = siblingNode.Strokes[j];
                        double offsetX = stroke.GetBounds().X;

                        if (offsetX > startX)
                        {
                            stroke.Transform(transform, false);
                        }
                    }
                }
            }
            mainInkCanvas.Strokes.Add(strokeCollection);
            mainInkCanvas.Strokes.Remove(strokeToBeReplaced);
        }
Example #4
0
        public void process(InkAnalyzer inkAnalyzer)
        {
            ContextNodeCollection contextNodeCollection = inkAnalyzer.FindLeafNodes();

            List <Stroke> horizontalLines = InkUtils.findLines(contextNodeCollection);

            List <HeadingItem> headings = findHeadings(horizontalLines, contextNodeCollection);

            //Here is the end result of the headings
            mainHeading.headings = headings;
            //Invalidate and render the headings to the side panel
            mainHeading.invalidate();
        }
Example #5
0
        public void process(InkAnalyzer inkAnalyzer)
        {
            ContextNodeCollection contextNodeCollection = inkAnalyzer.FindLeafNodes();

            List<Stroke> horizontalLines = InkUtils.findLines(contextNodeCollection);

            List<HeadingItem> headings = findHeadings(horizontalLines, contextNodeCollection);

            //Here is the end result of the headings
            mainHeading.headings = headings;
            //Invalidate and render the headings to the side panel
            mainHeading.invalidate();
        }
Example #6
0
        public void insertStrokes(InkAnalyzer analyzer, InkCanvas mainInkCanvas, InkCanvas insertionCanvas)
        {
            double bestY = -10000;
            ContextNode selectedNode = null;
            foreach (ContextNode node in analyzer.FindLeafNodes())
            {
                double y1 = strokeToBeReplaced.GetBounds().Y;
                double y2 = node.Strokes.GetBounds().Y;
                if (y1 - y2 > 0 && y1 - y2 < y1 - bestY)
                {
                    bestY = y2;
                    selectedNode = node;
                }
            }
            if (bestY == -10000)
            {
                bestY = strokeToBeReplaced.GetBounds().Y;
            }
            StrokeCollection strokeCollection = insertionCanvas.Strokes.Clone();
            insertionCanvas.Strokes.Clear();
            double bestX = strokeToBeReplaced.GetBounds().X;
            double strokeX = strokeCollection.GetBounds().X;
            double strokeY = strokeCollection.GetBounds().Y;
            Matrix inkTransform = new Matrix();
            inkTransform.Translate(bestX - strokeX + 20, bestY - strokeY);
            strokeCollection.Transform(inkTransform, false);
            double width = strokeCollection.GetBounds().Width + Constants.SPACING;
            double startX = strokeCollection.GetBounds().X;
            Matrix transform = new Matrix();
            transform.Translate(width, 0);
            if (selectedNode != null) {
                for (int i = 0; i < selectedNode.ParentNode.SubNodes.Count; i++)
                {
                    ContextNode siblingNode = selectedNode.ParentNode.SubNodes[i];
                    for (int j = 0; j < siblingNode.Strokes.Count; j++)
                    {
                        Stroke stroke = siblingNode.Strokes[j];
                        double offsetX = stroke.GetBounds().X;

                        if (offsetX > startX)
                        {
                            stroke.Transform(transform, false);
                        } 
                    }
                }
            }
            mainInkCanvas.Strokes.Add(strokeCollection);
            mainInkCanvas.Strokes.Remove(strokeToBeReplaced);
        }
Example #7
0
 public void process(InkAnalyzer inkAnalyzer)
 {
     ContextNodeCollection nodeCollection = inkAnalyzer.FindLeafNodes();
     foreach (ContextNode childNodes in nodeCollection)
     {
         foreach (Stroke stroke in childNodes.Strokes)
         {
             if (strokeIsCaret(stroke))
             {
                 insertionBox.Visibility = Visibility.Visible;
                 Canvas.SetLeft(insertionBox, stroke.StylusPoints[0].X - 140);
                 Canvas.SetTop(insertionBox, stroke.StylusPoints[1].Y);
                 inkAnalyzer.RemoveStroke(stroke);
                 strokeToBeReplaced = stroke;
             }
         }
     }
 }
Example #8
0
        public void process(InkAnalyzer inkAnalyzer)
        {
            ContextNodeCollection nodeCollection = inkAnalyzer.FindLeafNodes();

            foreach (ContextNode childNodes in nodeCollection)
            {
                foreach (Stroke stroke in childNodes.Strokes)
                {
                    if (strokeIsCaret(stroke))
                    {
                        insertionBox.Visibility = Visibility.Visible;
                        Canvas.SetLeft(insertionBox, stroke.StylusPoints[0].X - 140);
                        Canvas.SetTop(insertionBox, stroke.StylusPoints[1].Y);
                        inkAnalyzer.RemoveStroke(stroke);
                        strokeToBeReplaced = stroke;
                    }
                }
            }
        }