Example #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);
 }
Example #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);
 }
Example #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)
     });
 }
Example #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)
     });
 }
Example #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));
        }
Example #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;
 }
Example #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);
        }
Example #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();
 }
Example #11
0
 public FlowChartPoint CloneAndSubtract(FlowChartPoint another)
 {
     return new FlowChartPoint(X - another.X, Y - another.Y);
 }
Example #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)
            });
        }
Example #13
0
 protected void DrawResizePoint(Graphics g, FlowChartPoint p, Pen pen, float width)
 {
     Draw4Arrows(g, p, 10);
 }
Example #14
0
 protected void DrawBoundingBox(Graphics g,
     FlowChartPoint startPoint,
     FlowChartPoint endPoint)
 {
     g.DrawPolygon(ViewFactory.BoundingBoxPen, startPoint.MakePointFArrayWith(endPoint));
 }
Example #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)
     };
 }
Example #16
0
 protected void DrawPoint(Graphics g, FlowChartPoint p, Pen pen, float width)
 {
     DrawPoint(g, p, pen, width, false);
 }
Example #17
0
 public FlowChartPoint CloneAndSubtract(FlowChartPoint another)
 {
     return(new FlowChartPoint(X - another.X, Y - another.Y));
 }
Example #18
0
 internal RectangleF MakeRectangleFTill(FlowChartPoint endPoint)
 {
     return new RectangleF(X, Y, endPoint.X - X, endPoint.Y - Y);
 }
Example #19
0
 internal Rectangle MakeRectangleTill(FlowChartPoint endPoint)
 {
     return(new Rectangle((int)X, (int)Y, (int)(endPoint.X - X), (int)(endPoint.Y - Y)));
 }
Example #20
0
 public FlowChartPoint Add(FlowChartPoint another)
 {
     this.X += another.X;
     this.Y += another.Y;
     return(this);
 }
Example #21
0
 internal static float Distance(FlowChartPoint p1, FlowChartPoint p2)
 {
     return Distance(p1, p2.X, p2.Y);
 }
Example #22
0
 internal static float Distance(FlowChartPoint p1, float x, float y)
 {
     return Distance(p1.X, p1.Y, x, y);
 }
Example #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);
 }
Example #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;
 }
Example #27
0
 internal Rectangle MakeRectangleTill(FlowChartPoint endPoint)
 {
     return new Rectangle((int)X, (int)Y, (int)(endPoint.X - X), (int)(endPoint.Y - Y));
 }
Example #28
0
 public FlowChartPoint Subtract(FlowChartPoint another)
 {
     this.X -= another.X;
     this.Y -= another.Y;
     return(this);
 }
Example #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)
     };
 }
Example #30
0
 public FlowChartPoint CloneAndAdd(FlowChartPoint another)
 {
     return(new FlowChartPoint(X + another.X, Y + another.Y));
 }
Example #31
0
 public FlowChartPoint Add(FlowChartPoint another)
 {
     this.X += another.X;
     this.Y += another.Y;
     return this;
 }
Example #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;
 }