/// <summary> /// Compares two MatchingInfo based on the error /// </summary> public int CompareTo(object obj) { if (obj == null) { throw new ArgumentNullException("object obj"); } MatchingInfo minf = obj as MatchingInfo; if (minf == null) { throw new Exception("Can't compare different types"); } if (Error < minf.Error) { return(-1); } else if (Error == minf.Error) { return(0); } return(1); }
/// <summary> /// match handler /// </summary> internal void MatchHandler(GlyphBase o, MatchingInfo i) { if (NewGlyphMatch != null) { NewGlyphMatch(this, new GlyphMatchEventArgs(this, o, i)); } }
/// <summary> /// Generates the Bitmap result /// </summary> private void GenerateMatchMap() { _matchMap = (IImageAdapter)Target.Clone(); foreach (GlyphBase glyph in Glyphs) { int nbMatch = glyph.CompareInfo.Matches.Count; for (int i = 0; i < nbMatch; i++) { MatchingInfo matchInfo = (MatchingInfo)(glyph.CompareInfo.Matches[i]); Rectangle rect = matchInfo.BoundingBox; ImageUtility.FillRect(_matchMap, rect, new ColorByte(80, 255, 0, 0)); ImageUtility.DrawRect(_matchMap, rect, (ColorByte)Color.Yellow); } } }
/// <summary> /// Create a new instance of the GlyphComparatorEventArgs class /// </summary> /// <param name="matchingInfo"></param> public GlyphComparatorEventArgs(MatchingInfo matchingInfo) { MatchingInfo = matchingInfo; }
/// <summary> /// 'Ctor /// </summary> /// <param name="glyphModel"></param> /// <param name="glyphBase"></param> /// <param name="matchInfo"></param> public GlyphMatchEventArgs(GlyphModel glyphModel, GlyphBase glyphBase, MatchingInfo matchInfo) { ModelGlyph = glyphModel; BaseGlyph = glyphBase; MatchInfo = matchInfo; }