public StrokeShedRefiner(Recognizer sketchRecognizer, Connector connector, double thresholdProbability) { _connector = connector; _domain = _connector.Domain; _sketchRecognizer = sketchRecognizer; _thresholdProbability = thresholdProbability; }
/// <summary> /// Create a Recognition Manager for the given sketch panel with default settings. /// Settings are loaded from "settings.txt". /// </summary> /// <param name="p">a sketch panel to manage</param> public RecognitionManager() { // Load settings from text file string directory = AppDomain.CurrentDomain.BaseDirectory; string SettingsFilename = directory + "//settings.txt"; _filenames = Files.SettingsReader.readSettings(SettingsFilename); // Initialize the recognition machines _domain = ContextDomain.CircuitDomain.GetInstance(); _strokeClassifier = RecognitionPipeline.createDefaultClassifier(); _strokeGrouper = RecognitionPipeline.createDefaultGrouper(); _sketchRecognizer = RecognitionPipeline.createDefaultRecognizer(); _connector = RecognitionPipeline.createDefaultConnector(); _refinement = RecognitionPipeline.createDefaultRefiner(); }
/// <summary> /// Create a new context refiner that uses the given domain for context /// assessment, and the given recognizer for recognition. /// </summary> /// <param name="domain"></param> /// <param name="recognizer"></param> public ContextRefiner(ContextDomain.ContextDomain domain, Recognizer recognizer) { _domain = domain; _sketchRecognizer = recognizer; }
/// <summary> /// Goes through every shape in the sketch and creates a text box for it /// </summary> private void MakeTextBlocks() { //System.Console.WriteLine("Making Text Boxes"); toolTips.Clear(); foreach (Sketch.Shape shape in sketchPanel.Sketch.Shapes) { if (shape.Substrokes.Length == 0) { return; } // Set Content and Color Popup newTextBlock = new Popup(); ContextDomain.ContextDomain contextDomain = ContextDomain.CircuitDomain.GetInstance(); // Make text box. Feel free to change FontWeight, FontSize, etc. TextBlock newChild = new TextBlock(); if (debug) { newChild.Text = shape.Name + " (" + shape.Type.Name + ")"; newChild.Text += "\nOrientation: " + shape.Orientation; newChild.Text += "\nTemplate: " + shape.TemplateName; //newChild.Text += "\nConnected shapes: "; //foreach (Sketch.Shape connectedShape in shape.ConnectedShapes) //newChild.Text += connectedShape.Name + ", "; newChild.Text += "\nProperly Connected: " + (contextDomain.IsProperlyConnected(shape) ? "yes" : "no"); } else { newChild.Text = shape.Type.Name; } newChild.Background = Brushes.Transparent; newChild.FontWeight = System.Windows.FontWeights.Bold; newTextBlock.Child = newChild; newTextBlock.IsOpen = false; newTextBlock.AllowsTransparency = true; newTextBlock.Visibility = System.Windows.Visibility.Visible; newTextBlock.PlacementTarget = sketchPanel.InkCanvas; newTextBlock.Placement = PlacementMode.RelativePoint; // Find strokes StrokeCollection strokes = new StrokeCollection(); foreach (Sketch.Substroke sub in shape.Substrokes) { strokes.Add(sketchPanel.InkSketch.GetInkStrokeBySubstroke(sub)); } // Set Position and Add to Canvas and our collection newTextBlock.VerticalOffset = strokes.GetBounds().Top + strokes.GetBounds().Height / 2; newTextBlock.HorizontalOffset = strokes.GetBounds().Left + strokes.GetBounds().Width / 2; subscribed = true; //sketchPanel.InkCanvas.Children.Add(newTextBlock); toolTips.Add(shape, newTextBlock); } }
/// <summary> /// Create a new connector in the specified domain /// </summary> /// <param name="domain">the domain to use</param> public Connector(ContextDomain.ContextDomain domain) { _domain = domain; }
public StrokeStealRefiner(Recognizer recognizer, Connector connector) { _sketchRecognizer = recognizer; _connector = connector; _domain = _connector.Domain; }