Ejemplo n.º 1
0
        private void ConvertShapes()
        {
            IReadOnlyList <IInkAnalysisNode> drawings = AnalyzerShape.AnalysisRoot.FindNodes(InkAnalysisNodeKind.InkDrawing);

            foreach (IInkAnalysisNode drawing in drawings)
            {
                var shape = (InkAnalysisInkDrawing)drawing;
                if (shape.DrawingKind == InkAnalysisDrawingKind.Drawing)
                {
                    continue;
                }

                if (shape.DrawingKind == InkAnalysisDrawingKind.Circle || shape.DrawingKind == InkAnalysisDrawingKind.Ellipse)
                {
                    continue;
                    //DrawEllipseTest(shape);
                }
                else
                {
                    DrawPolygon(shape);
                }

                foreach (var strokeId in shape.GetStrokeIds())
                {
                    InkStroke stroke = CurrentInkCanvas.InkPresenter.StrokeContainer.GetStrokeById(strokeId);
                    stroke.Selected = true;
                }

                AnalyzerShape.RemoveDataForStrokes(shape.GetStrokeIds());
            }
            CurrentInkCanvas.InkPresenter.StrokeContainer.DeleteSelected();
        }
Ejemplo n.º 2
0
 public void CollectStrokes(IReadOnlyList <InkStroke> strokes)
 {
     if (IsOn)
     {
         DispatcherTimer.Stop();
         AnalyzerShape.AddDataForStrokes(strokes);
         CurrentDrawingAttributes = strokes[0].DrawingAttributes;
         DispatcherTimer.Start();
     }
 }
Ejemplo n.º 3
0
 public void EraseStrokes(IReadOnlyList <InkStroke> strokes)
 {
     if (IsOn)
     {
         DispatcherTimer.Stop();
         foreach (var stroke in strokes)
         {
             AnalyzerShape.RemoveDataForStroke(stroke.Id);
         }
         DispatcherTimer.Start();
     }
 }
Ejemplo n.º 4
0
        private async void DispatcherTimer_Tick(object sender, object e)
        {
            if (IsOn)
            {
                DispatcherTimer.Stop();
                if (!AnalyzerShape.IsAnalyzing)
                {
                    InkAnalysisResult results = await AnalyzerShape.AnalyzeAsync();

                    if (results.Status == InkAnalysisStatus.Updated)
                    {
                        ConvertShapes();
                    }
                }
                else
                {
                    // Ink analyzer is busy. Wait a while and try again.
                    DispatcherTimer.Start();
                }
            }
        }