Esempio n. 1
0
 private void EraseLine(Graphics g, MergeLineInfo mline, List <Rectangle> Regions)
 {
     foreach (Rectangle reg in Regions)
     {
         Rectangle?nearRect = GetNearRegion(mline, reg);
         if (nearRect.HasValue)
         {
             g.FillRectangle(Brushes.White, nearRect.Value);
         }
     }
 }
Esempio n. 2
0
        private Rectangle?GetNearRegion(MergeLineInfo mline, Rectangle rect)
        {
            Rectangle border1;
            Rectangle border2;
            Rectangle mlineRect = mline.GetRect();

            if (!mline.IsLine)
            {
                return(null);
            }
            if (mline.LineType == LineDirction.Horizontal)
            {
                border1 = new Rectangle(rect.X - Env.BorderRegion, rect.Y - Env.BorderRegion, rect.Width + Env.BorderRegion * 2, Env.BorderRegion * 2);
                border2 = new Rectangle(rect.X - Env.BorderRegion, rect.Y + rect.Height - Env.BorderRegion, rect.Width + Env.BorderRegion * 2, Env.BorderRegion * 2);
            }
            else
            {
                border1 = new Rectangle(rect.X - Env.BorderRegion, rect.Y - Env.BorderRegion, Env.BorderRegion * 2, rect.Height + Env.BorderRegion * 2);
                border2 = new Rectangle(rect.X + rect.Width - Env.BorderRegion, rect.Y - Env.BorderRegion, Env.BorderRegion * 2, rect.Height + Env.BorderRegion * 2);
            }
            if (mlineRect.IntersectsWith(border1))
            {
                mlineRect.Intersect(border1);
                return(mlineRect);
            }
            else if (mlineRect.IntersectsWith(border2))
            {
                mlineRect.Intersect(border2);
                return(mlineRect);
            }
            if (rect.IntersectsWith(mlineRect))
            {
                if (mline.LineType == LineDirction.Horizontal && mlineRect.Width >= rect.Width)
                {
                    mlineRect.Intersect(rect);
                    return(mlineRect);
                }
                else if (mline.LineType == LineDirction.Vertical && mlineRect.Height >= rect.Height)
                {
                    mlineRect.Intersect(rect);
                    return(mlineRect);
                }
            }
            return(null);
        }
Esempio n. 3
0
        private List <MergeLineInfo> GetMergeLines(List <LineInfo> lines)
        {
            Counter counter = new Counter(outputHanler);

            counter.Start("GetMergeLines");
            List <MergeLineInfo> mlines = new List <MergeLineInfo>();

            foreach (LineInfo line in lines)
            {
                MergeLineInfo mline = mlines.Find(x => x.CanMerge(line));
                if (mline != null)
                {
                    mline.Merge(line);
                }
                else
                {
                    mlines.Add(new MergeLineInfo(line));
                }
            }
            counter.End();
            return(mlines);
        }