Пример #1
0
        /// <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);
        }
Пример #2
0
 /// <summary>
 /// match handler
 /// </summary>
 internal void MatchHandler(GlyphBase o, MatchingInfo i)
 {
     if (NewGlyphMatch != null)
     {
         NewGlyphMatch(this, new GlyphMatchEventArgs(this, o, i));
     }
 }
Пример #3
0
        /// <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);
                }
            }
        }
Пример #4
0
 /// <summary>
 /// Create a new instance of the GlyphComparatorEventArgs class
 /// </summary>
 /// <param name="matchingInfo"></param>
 public GlyphComparatorEventArgs(MatchingInfo matchingInfo)
 {
     MatchingInfo = matchingInfo;
 }
Пример #5
0
 /// <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;
 }