Пример #1
0
 protected override void MoveTo(HPoint p)
 {
     if (isPenDown)
     {
         if (Numbering && HPoint.LengthAbs(p, lastText) > 20)
         {
             var tp = ToPoint(p);
             g.DrawString(counter + "", SystemFonts.IconTitleFont, Brushes.Black, tp.X, tp.Y);
             counter++;
             lastText = p;
         }
         if (current == p)
         {
             g.DrawLine(currentGPen, ToPoint(p), ToPoint(p.Add(new HPoint(1, 1))));
         }
         else
         {
             g.DrawLine(currentGPen, ToPoint(current), ToPoint(p));
         }
     }
     else
     {
         if (DebugPenUp)
         {
             g.DrawLine(debugPen, ToPoint(current), ToPoint(p));
         }
     }
     base.MoveTo(p);
 }
Пример #2
0
 private bool IsNear(HPoint a, HPoint b, double maxDestination)
 {
     if (maxDestination < 1)
     {
         return(a.X == b.X && a.Y == b.Y);
     }
     else
     {
         //optimalizace
         //if (Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y) > maxDestination)
         //    return false;
         return(HPoint.LengthAbs(a, b) < maxDestination);
     }
 }
Пример #3
0
        protected double GetPenUpLength(List <Line> lines)
        {
            double length = 0;
            var    pos    = new HPoint();

            foreach (var item in lines)
            {
                if (item.P1 != pos)
                {
                    length += HPoint.LengthAbs(pos, item.P1);
                }
                pos = item.P2;
            }
            return(length);
        }