示例#1
0
 protected void DrawText(Graphics g, Font font, string text, Brush brush, FlowChartPoint point)
 {
     StringFormat sf = new StringFormat(StringFormat.GenericDefault);
     sf.Alignment = StringAlignment.Center;
     sf.LineAlignment = StringAlignment.Center;
     g.DrawString(text, font, brush, point.X, point.Y, sf);
 }
示例#2
0
 protected void DrawPoint(Graphics g, FlowChartPoint p, Pen pen, float width, bool fill)
 {
     if (fill)
     {
         g.FillRectangle(Brushes.AliceBlue, p.X - width / 2, p.Y - width / 2, width, width);
     }
     g.DrawRectangle(pen, p.X - width / 2, p.Y - width / 2, width, width);
 }
示例#3
0
 internal PointF[] MakePointFArrayWith(FlowChartPoint endPoint)
 {
     return(new PointF[] {
         new PointF(X, Y),
         new PointF(endPoint.X, Y),
         new PointF(endPoint.X, endPoint.Y),
         new PointF(X, endPoint.Y)
     });
 }
示例#4
0
 internal FlowChartPoint[] MakeFlowChartPointArrayWith(FlowChartPoint endPoint)
 {
     return(new FlowChartPoint[] {
         new FlowChartPoint(X, Y),
         new FlowChartPoint(endPoint.X, Y),
         new FlowChartPoint(endPoint.X, endPoint.Y),
         new FlowChartPoint(X, endPoint.Y)
     });
 }
示例#5
0
        internal static float DistanceToLine(FlowChartPoint StartPoint, FlowChartPoint EndPoint, int x, int y)
        {
            float A = x - StartPoint.X;
            float B = y - StartPoint.Y;
            float C = EndPoint.X - StartPoint.X;
            float D = EndPoint.Y - StartPoint.Y;

            return (float)(Math.Abs(A * D - C * B) / Math.Sqrt(C * C + D * D));
        }
示例#6
0
 internal static bool HasPoint(FlowChartPoint[] points, float testx, float testy)
 {
     int i, j;
     bool c = false;
     for (i = 0, j = points.Length - 1; i < points.Length; j = i++)
     {
         if (((points[i].Y > testy) != (points[j].Y > testy)) &&
          (testx < (points[j].X - points[i].X) * (testy - points[i].Y) / (points[j].Y - points[i].Y) + points[i].X))
             c = !c;
     }
     return c;
 }
示例#7
0
        protected void Draw4Arrows(Graphics g, FlowChartPoint p, float length)
        {
            /*   ^
             * <-|->
             *   v
             */

            DrawArrow(g, p.CloneAndAdd(0, -length), p, Brushes.YellowGreen, Pens.Red, length);
            DrawArrow(g, p.CloneAndAdd(0, length), p, Brushes.YellowGreen, Pens.Red, length);
            DrawArrow(g, p.CloneAndAdd(-length, 0), p, Brushes.YellowGreen, Pens.Red, length);
            DrawArrow(g, p.CloneAndAdd(length, 0), p, Brushes.YellowGreen, Pens.Red, length);
        }
示例#8
0
 protected void DrawBoundingBox(Graphics g,
     FlowChartPoint p1,
     FlowChartPoint p2,
     FlowChartPoint p3,
     FlowChartPoint p4)
 {
     g.DrawPolygon(
         ViewFactory.BoundingBoxPen,
         new PointF[] 
         { 
             p1.MakePointF(), 
             p2.MakePointF(), 
             p3.MakePointF(), 
             p4.MakePointF()
         });
 }
        void LinePointMovedTo(BaseLineComponent lineCmp, FlowChartPoint point)
        {
            if (lineCmp.StartPoint == point)
            {
                lineCmp.ConnectionStart = null;
            }
            else if (lineCmp.EndPoint == point)
            {
                lineCmp.ConnectionEnd = null;
            }

            foreach (BaseComponent drawableCmp in model.Items)
            {
                drawableCmp.Accept(new LinePointMovedVisitor(lineCmp, point));                
            }
        }
 private PointF Bezier(FlowChartPoint a, FlowChartPoint b, FlowChartPoint c, FlowChartPoint d, float t)
 {
     FlowChartPoint
         ab = new FlowChartPoint(),
         bc = new FlowChartPoint(),
         cd = new FlowChartPoint(),
         abbc = new FlowChartPoint(),
         bccd = new FlowChartPoint(),
         dest = new FlowChartPoint();
     Lerp( ab,  a,  b, t);           // point between a and b (green)
     Lerp( bc,  b,  c, t);           // point between b and c (green)
     Lerp( cd,  c,  d, t);           // point between c and d (green)
     Lerp( abbc,  ab,  bc, t);       // point between ab and bc (blue)
     Lerp( bccd,  bc,  cd, t);       // point between bc and cd (blue)
     Lerp( dest,  abbc,  bccd, t);   // point on the bezier-curve (black)
     return dest.MakePointF();
 }
示例#11
0
 public FlowChartPoint CloneAndSubtract(FlowChartPoint another)
 {
     return new FlowChartPoint(X - another.X, Y - another.Y);
 }
示例#12
0
        protected void DrawArrow(Graphics g, FlowChartPoint dst, FlowChartPoint src, Brush b, Pen p, float length)
        {
            float angle = (float)Math.Atan2(dst.Y - src.Y, dst.X - src.X);
            float x1 = dst.X - (float)(0.5 * length * Math.Cos(angle + Math.PI / 6.0f));
            float y1 = dst.Y - (float)(0.5 * length * Math.Sin(angle + Math.PI / 6.0f));

            float x2 = dst.X - (float)(0.5 * length * Math.Cos(angle - Math.PI / 6.0f));
            float y2 = dst.Y - (float)(0.5 * length * Math.Sin(angle - Math.PI / 6.0f));

            g.FillPolygon(b, new PointF[] { 
                new PointF(dst.X, dst.Y),
                new PointF(x1, y1),
                new PointF(x2, y2)
            });
            g.DrawPolygon(p, new PointF[] { 
                new PointF(dst.X, dst.Y),
                new PointF(x1, y1),
                new PointF(x2, y2)
            });
        }
示例#13
0
 protected void DrawResizePoint(Graphics g, FlowChartPoint p, Pen pen, float width)
 {
     Draw4Arrows(g, p, 10);
 }
示例#14
0
 protected void DrawBoundingBox(Graphics g,
     FlowChartPoint startPoint,
     FlowChartPoint endPoint)
 {
     g.DrawPolygon(ViewFactory.BoundingBoxPen, startPoint.MakePointFArrayWith(endPoint));
 }
示例#15
0
 internal PointF[] MakePointFArrayWith(FlowChartPoint endPoint)
 {
     return new PointF[] { 
         new PointF(X, Y),
         new PointF(endPoint.X, Y),
         new PointF(endPoint.X, endPoint.Y),
         new PointF(X, endPoint.Y)
     };
 }
示例#16
0
 protected void DrawPoint(Graphics g, FlowChartPoint p, Pen pen, float width)
 {
     DrawPoint(g, p, pen, width, false);
 }
示例#17
0
 public FlowChartPoint CloneAndSubtract(FlowChartPoint another)
 {
     return(new FlowChartPoint(X - another.X, Y - another.Y));
 }
示例#18
0
 internal RectangleF MakeRectangleFTill(FlowChartPoint endPoint)
 {
     return new RectangleF(X, Y, endPoint.X - X, endPoint.Y - Y);
 }
示例#19
0
 internal Rectangle MakeRectangleTill(FlowChartPoint endPoint)
 {
     return(new Rectangle((int)X, (int)Y, (int)(endPoint.X - X), (int)(endPoint.Y - Y)));
 }
示例#20
0
 public FlowChartPoint Add(FlowChartPoint another)
 {
     this.X += another.X;
     this.Y += another.Y;
     return(this);
 }
示例#21
0
 internal static float Distance(FlowChartPoint p1, FlowChartPoint p2)
 {
     return Distance(p1, p2.X, p2.Y);
 }
示例#22
0
 internal static float Distance(FlowChartPoint p1, float x, float y)
 {
     return Distance(p1.X, p1.Y, x, y);
 }
示例#23
0
 public FlowChartPoint CloneAndAdd(FlowChartPoint another)
 {
     return new FlowChartPoint(X + another.X, Y + another.Y);
 }
 public override void SetComponent(FlowChartComponent component)
 {            
     ControlPoint1 = component.Points[2];
     ControlPoint2 = component.Points[3];
     base.SetComponent(component);
 }
示例#25
0
 public FlowChartPoint Subtract(FlowChartPoint another)
 {
     this.X -= another.X;
     this.Y -= another.Y;
     return this;
 }
 void Lerp(FlowChartPoint dest, FlowChartPoint a, FlowChartPoint b, float t)
 {
     dest.X = a.X + (b.X - a.X) * t;
     dest.Y = a.Y + (b.Y - a.Y) * t;
 }
示例#27
0
 internal Rectangle MakeRectangleTill(FlowChartPoint endPoint)
 {
     return new Rectangle((int)X, (int)Y, (int)(endPoint.X - X), (int)(endPoint.Y - Y));
 }
示例#28
0
 public FlowChartPoint Subtract(FlowChartPoint another)
 {
     this.X -= another.X;
     this.Y -= another.Y;
     return(this);
 }
示例#29
0
 internal FlowChartPoint[] MakeFlowChartPointArrayWith(FlowChartPoint endPoint)
 {
     return new FlowChartPoint[] { 
         new FlowChartPoint(X, Y),
         new FlowChartPoint(endPoint.X, Y),
         new FlowChartPoint(endPoint.X, endPoint.Y),
         new FlowChartPoint(X, endPoint.Y)
     };
 }
示例#30
0
 public FlowChartPoint CloneAndAdd(FlowChartPoint another)
 {
     return(new FlowChartPoint(X + another.X, Y + another.Y));
 }
示例#31
0
 public FlowChartPoint Add(FlowChartPoint another)
 {
     this.X += another.X;
     this.Y += another.Y;
     return this;
 }
示例#32
0
 internal RectangleF MakeRectangleFTill(FlowChartPoint endPoint)
 {
     return(new RectangleF(X, Y, endPoint.X - X, endPoint.Y - Y));
 }
 public LinePointMovedVisitor(BaseLineComponent lineCmp, FlowChartPoint linePoint)
 {
     this.lineCmp = lineCmp;
     this.linePoint = linePoint;
 }