public N_Dollar_Form() { InitializeComponent(); m_Ink = new InkOverlay(inkPanel); m_Ink.Enabled = true; m_Recognizer = new NDollar(); m_ReadJnt = new ReadJnt(); }
/// <summary> /// Removes stroke data from a Microsoft Ink object and converts it into a sketch /// friendly format /// </summary> /// <param name="ink">A Microsoft Ink object</param> /// <returns>An ArrayList containing Sketch stroke data</returns> private List <Sketch.Stroke> CreateConvertedStrokes(Ink ink) { List <Sketch.Stroke> strokes = new List <Sketch.Stroke>(); ReadJnt readJnt = new ReadJnt(); //Goes through the ink object, converts each stroke to a sketch stroke and adds //it to the List of strokes foreach (Microsoft.Ink.Stroke istroke in ink.Strokes) { strokes.Add(readJnt.InkStroke2SketchStroke(istroke, null, false)); } return(strokes); }
/// <summary> /// Constructor helper. If both arguments are null, an empty /// instance of this class is created. If Ink or Sketch /// is null, then one object is synchronized to the other /// (e.g. if ink is null, an empty Ink will be created and /// synchronized with Sketch). If neither argument is null, then /// Sketch will be synchronized with Ink. Subscribes to Ink events /// after any synchronization. /// </summary> /// <param name="ink">The Ink with which to (possibly) synchronize</param> /// <param name="sketch">The Sketch with which to (possibly) synchronize</param> protected virtual void init(Microsoft.Ink.Ink ink, FeatureSketch featureSketch) { // Instantiate new Ink and/or Sketch where necessary if (ink == null) { mInk = new Microsoft.Ink.Ink(); } else { mInk = ink; } if (featureSketch == null) { mFeatureSketch = new FeatureSketch(); Sketch.XmlAttrs.Id = System.Guid.NewGuid(); Sketch.XmlAttrs.Units = DefaultSketchUnits; } else { mFeatureSketch = featureSketch; } // Intialize other fields mReadJnt = new ReadJnt(); ink2sketchStr = new Dictionary <int, Guid?>(); sketchStr2ink = new Dictionary <Guid?, int>(); substrokeIdMap = new Dictionary <Guid?, Substroke>(); // Synchronize Ink or Sketch as necessary if (ink == null && featureSketch != null) { LoadFeatureSketch(featureSketch); } else // (ink != null && featureSketch == null) { LoadInk(ink); } subscribeToInk(); }