Example #1
0
        void inqCanvas_StroqCollected(object sender, InqCanvas.StroqCollectedEventArgs e)
        {
            /* filter out gestures before taking everything else as math */

            /* If we get here, it's a real stroke (not movement), so deselect any selection */
            Deselect();

            #region Scribble Gesture Recognition

            StroqCollection stroqCollection;
            /* check for scribble delete */
            if (ScribbleDelete(e.Stroq, out stroqCollection))
            {
                _mathStroqs.Remove(stroqCollection);
                return;
            }

            #endregion

            /* check for lassos/circles around stuff */
            if (LassoSelect(e.Stroq))
            {
                return;
            }

            _mathStroqs.Add(e.Stroq);
        }
Example #2
0
        /// <summary>
        /// Create a selection of inq strokes
        /// </summary>
        /// <param name="contents">The set of stroqs to be selected.</param>
        /// <param name="outline">The outline to be used for the selection; can be null.</param>
        /// <param name="stroq2char">Delegate taking a Stroq as input and returns the (character) Recognition record the stroke is a part of.</param>
        /// <param name="char2stroqs">Given a Recognition, return the Stroqs that compose it.</param>
        /// <param name="dispstrs">A StroqCollection controlling what Stroqs are displayed; the outline is automatically removed from here on deselection.
        /// Can be null.</param>
        public StroqSel(IEnumerable <Stroq> contents, Stroq outline, Func <Stroq, Recognition> stroq2char, Func <Recognition, IEnumerable <Stroq> > char2stroqs,
                        StroqCollection dispstrs) // sc would be Charreco.Classification(s); sqs the mapping of r.strokes
        {
            AllStroqs   = new StroqCollection(contents); Outline = outline;
            ReRecStroqs = new StroqCollection();
            HashSet <Stroq> additional = new HashSet <Stroq>();

            foreach (Stroq ss in AllStroqs)
            {
                Recognition r = stroq2char(ss);
                if (r == null || r.levelsetby != 0)
                {
                    ReRecStroqs.Add(ss);
                }
                else
                {
                    additional.UnionWith(char2stroqs(r));
                }
            }
            AllStroqs.Add(additional);
            _displayedStrokes = dispstrs;
        }
Example #3
0
 /// <summary>
 /// Create a selection of inq strokes
 /// </summary>
 /// <param name="contents">The set of stroqs to be selected.</param>
 /// <param name="outline">The outline to be used for the selection; can be null.</param>
 /// <param name="stroq2char">Delegate taking a Stroq as input and returns the (character) Recognition record the stroke is a part of.</param>
 /// <param name="char2stroqs">Given a Recognition, return the Stroqs that compose it.</param>
 /// <param name="dispstrs">A StroqCollection controlling what Stroqs are displayed; the outline is automatically removed from here on deselection.
 /// Can be null.</param>
 public StroqSel(IEnumerable<Stroq> contents, Stroq outline, Func<Stroq, Recognition> stroq2char, Func<Recognition, IEnumerable<Stroq>> char2stroqs,
     StroqCollection dispstrs)
 { // sc would be Charreco.Classification(s); sqs the mapping of r.strokes
     AllStroqs = new StroqCollection(contents); Outline = outline;
     ReRecStroqs = new StroqCollection();
     HashSet<Stroq> additional = new HashSet<Stroq>();
     foreach (Stroq ss in AllStroqs)
     {
         Recognition r = stroq2char(ss);
         if (r == null || r.levelsetby != 0)
             ReRecStroqs.Add(ss);
         else additional.UnionWith(char2stroqs(r));
     }
     AllStroqs.Add(additional);
     _displayedStrokes = dispstrs;
 }