コード例 #1
0
ファイル: WordMeta.cs プロジェクト: LowerCode/wpfDataDrive
        public bool IsCloseMode(WordInfo cur, WordInfo other, WordMeta compare, double aveHeight)
        {
            bool closeMode = IsSameFont(compare.WordChars, WordChars) && (int)(Math.Abs(cur.Y - other.Y) - cur.Height - aveHeight) < 5 &&
                             (Math.Abs(cur.Height - other.Height)) < 3 &&
                             (Math.Abs((int)cur.Space - (int)other.Space)) < 5 &&
                             Math.Abs(cur.YSize - other.YSize) < 7
            ;

            if (closeMode == false)
            {
                if (IsSameFont(compare.WordChars, WordChars) && (int)(Math.Abs(cur.Y - other.Y) - cur.Height - aveHeight) < 0 &&
                    (Math.Abs(cur.Height - other.Height)) < 3 &&
                    (Math.Abs((int)cur.Space - (int)other.Space)) < 5 &&
                    cur.YSize > 1000 && other.YSize > 1000 &&
                    Math.Abs(cur.YSize - other.YSize) < 300)
                {
                    return(true);
                }
            }
            ;


            if (closeMode)
            {
                if (cur.X < other.X && cur.Y > other.Y && cur.Height > other.Height && cur.Space > other.Space && cur.YSize > other.YSize)
                {
                    return(false);
                }
                return(true);
            }

            closeMode = IsSameFont(compare.WordChars, WordChars) && (int)(Math.Abs(cur.Y - other.Y) - cur.Height - aveHeight) < 0 &&
                        (Math.Abs(cur.Height - other.Height)) < 2 &&
                        (int)cur.Space == (int)other.Space;

            if (closeMode)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: WordMeta.cs プロジェクト: LowerCode/wpfDataDrive
        public bool IsUpOrDown(WordInfo cur, WordInfo other, WordMeta compare, WordInfo otherLast)
        {
            if (cur.Y < other.Y && (int)(other.Y - cur.Y) <= 20 && WordChars.Count == 1 && WordChars[0].Word.Length == 1)
            {
                return(true);
            }
            if (other.Y < cur.Y && (int)(cur.Y - other.Y) <= 20 && compare.WordChars.Count == 1 && compare.WordChars[0].Word.Length == 1)
            {
                return(true);
            }
            if (other.Y < cur.Y && (int)(cur.Y - other.Y) <= 20 && WordChars.Count == 1 && WordChars[0].Word.Length == 1 && Math.Abs(cur.X - otherLast.X) < 8)
            {
                return(true);
            }
            if (other.Y - cur.Y < 9 && cur.Y < other.Y && other.Y - cur.Y < other.Height)
            {
                return(true);
            }
            if (cur.Y - other.Y < 9 && cur.Y > other.Y && cur.Y - other.Y < cur.Height)
            {
                return(true);
            }

            if (other.Y - cur.Y < 9 && cur.Y < other.Y && Math.Abs((int)cur.Height - (int)other.Height) < 8 && Math.Abs(cur.X - otherLast.X) < 8)
            {
                return(true);
            }
            if (cur.Y - other.Y < 9 && cur.Y > other.Y && Math.Abs((int)cur.Height - (int)other.Height) < 8 && Math.Abs(cur.X - otherLast.X) < 8)
            {
                return(true);
            }


            if (Math.Abs(cur.Y - other.Y) < 5)
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
ファイル: Word.cs プロジェクト: LowerCode/wpfDataDrive
 /// <summary>
 /// 计算当前字符和lastChunk的距离
 /// </summary>
 /// <param name="lastChunk"></param>
 /// <returns></returns>
 public float DistanceFromEndOf(WordInfo lastChunk)
 {
     return(this.X - lastChunk.X - lastChunk.Width);
 }