Add() public method

public Add ( HPoint p ) : HPoint
p HPoint
return HPoint
Beispiel #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);
 }
Beispiel #2
0
 protected override void VisitPenRelative(PenRelative item)
 {
     ContainsRelative = true;
     foreach (var rpt in item.Points)
     {
         var pt = current.Add(rpt);
         MoveTo(pt);
     }
 }
Beispiel #3
0
 private static void DrawRectangle(List<HpglItem> result, HPoint pt, int w, int h)
 {
     var p1 = pt.Add(new HPoint() { X = w, Y = h });
     var p2 = pt.Add(new HPoint() { X = -w, Y = h });
     var p3 = pt.Add(new HPoint() { X = -w, Y = -h });
     var p4 = pt.Add(new HPoint() { X = w, Y = -h });
     result.Add(new PenUp() { Points = { p1 } });
     result.Add(new PenDown() { Points = { p2, p3, p4, p1 } });
     result.Add(new PenUp() { });
 }
Beispiel #4
0
        private static void DrawCircle(List<HpglItem> result, HPoint pt, int w)
        {
            var q = (int)(w / 1.44);
            var p1 = pt.Add(new HPoint() { X = w, Y = w });
            var p2 = pt.Add(new HPoint() { X = -w, Y = w });
            var p3 = pt.Add(new HPoint() { X = -w, Y = -w });
            var p4 = pt.Add(new HPoint() { X = w, Y = -w });
            /*   .4.
             *  5   3
             * .     .
             * 6     2
             * .     .
             *  7   1
             *   .0.
             */

            result.Add(new PenUp() { Points = { pt.Add(0, w) } });
            result.Add(new PenDown()
            {
                Points = {
                           //pt.Add(0,w),
                           pt.Add(q,q),
                           pt.Add(w,0),
                           pt.Add(q,-q),
                           pt.Add(0,-w),
                           pt.Add(-q,-q),
                           pt.Add(-w,0),
                           pt.Add(-q,q),
                           pt.Add(0,w),
                         }
            });
            result.Add(new PenUp() { });
        }