/// <summary> /// Initializes important things and adds our step to the pipeline. /// </summary> public override void start() { _pipeline = new RecognitionManager.RecognitionPipeline(); _results = new List <Dictionary <ShapeType, MutablePair <int, int> > >(); RecognitionInterfaces.Recognizer recognizer = RecognitionManager.RecognitionPipeline.createDefaultGateRecognizer(); recognizer.reset(); _pipeline.addStep(recognizer); }
public MainWindow(ref InkToSketchWPF.InkCanvasSketch sketch, ref RecognitionInterfaces.Recognizer recog) { try { InitializeComponent(); } catch (Exception ex) { // Log error System.Console.WriteLine(ex.InnerException.Message); } // Set up inkSketch this.inkSketch = sketch; // Set up practice panel this.inkCanvas = inkSketch.InkCanvas; this.inkCanvas.Height = practiceDock.ActualHeight; this.inkCanvas.Width = practiceDock.ActualWidth; if (!practiceDock.Children.Contains(this.inkCanvas)) { practiceDock.Children.Add(this.inkCanvas); } inkCanvas.Strokes.StrokesChanged += new System.Windows.Ink.StrokeCollectionChangedEventHandler(Strokes_StrokesChanged); inkCanvas.StrokeCollected += new InkCanvasStrokeCollectedEventHandler(Strokes_StrokesCollected); inkCanvas.StrokeErasing += new InkCanvasStrokeErasingEventHandler(Strokes_StrokesErasing); // Set up gate drawing gateDrawer = new GateDrawing.GateDrawing(); gateDrawer.LockDrawingRatio = false; recognizer = recog; // Set up the list of gates defaultChoice = new ComboBoxItem(); defaultChoice.Content = "Choose a gate"; gateChooser.Items.Add(defaultChoice); gateChooser.SelectedItem = defaultChoice; foreach (ShapeType gate in LogicDomain.Gates) { if (gate == LogicDomain.SUBCIRCUIT) { continue; } ComboBoxItem item = new ComboBoxItem(); item.Content = gate.Name; gateChooser.Items.Add(item); } ComboBoxItem free = new ComboBoxItem(); free.Content = freehandString; gateChooser.Items.Add(free); }