public CoreInk.AI.Quadrant getQuadrants() { CoreInk.AI.Quadrant q = new AI.Quadrant(); foreach (Point p in points) { if (p.Y < first - (first / 2)) { q.first = true; } if (p.Y > first + (first / 3) && p.Y < second - (first / 3)) { q.second = true; } if (p.Y > second + (first / 2)) { q.third = true; } } if (!q.first && !q.second && !q.third) { if (points.Count > 0) { Point p = points[0]; if (p.Y < first) { q.first = true; } if (p.Y > first && p.Y < second) { q.second = true; } if (p.Y > second) { q.third = true; } } } return(q); }
public bool OnWritten(List <Point> points, List <int> dirs, AI.Quadrant q, int AttachMode) { eventInitiated = true; string strstk = ""; bool matched = false; foreach (int d in dirs) { strstk += d.ToString(); } if (dirs.Count == 1 && dirs[0] == AI.Direction.W) { //textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1); pop(1); temp = new List <Stroke>(); return(true); } else if (dirs.Count == 1 && dirs[0] == AI.Direction.E && q.first == false) { Push(" "); temp = new List <Stroke>(); return(true); } List <Stroke> matching_strokes = Manager.MatchStroke(strstk, q, language); List <Stroke> attached_matches = StrokesAttached(temp, matching_strokes); if (attached_matches.Count == 0) { Stroke s = GetBestStroke(matching_strokes); if (s != null) { String strokeresult = Manager.MatchCharacter(s.cid).charx; if (q.second == true && q.third == false) { if (s.quadrant == "C") { strokeresult = getStacked(strokeresult); } } if (strokeresult == "\u1001") { int a = Math.Abs(points[0].Y - writingPad1.first); int b = Math.Abs(points[0].Y - writingPad1.second); if (b < a) { strokeresult = "ေ"; } } Push(strokeresult); laststrokeresult = strokeresult; } else { laststrokeresult = ""; } temp = StrokesNeedAttach(matching_strokes); } else { Stroke s = GetEndStroke(attached_matches); if (s != null) { String strokeresult = Manager.MatchCharacter(s.cid).charx; pop(laststrokeresult.Length); Push(strokeresult); laststrokeresult = strokeresult; } else { laststrokeresult = ""; } temp = GetEndStrokeNeedsAttach(matching_strokes, attached_matches); } return(matched); }