Beispiel #1
0
 public Curve( float x,  float y,  float width,  float height,  Angle angle = default(Angle),  float startAngle = 0,  float endAngle = 0,
      CurveType type = CurveType.Pie,  bool assignID = true) : this()
 {
     EllipseData data = new EllipseData(x, y, width, height, angle);
     if (type.SweepAngle())
         Initialize(startAngle, endAngle + startAngle, data, type, assignID, default(PointF), null);
     else
         Initialize(startAngle, endAngle, data, type, assignID, default(PointF), null);
 }
Beispiel #2
0
            void Initialize(float x, float y, float width, float height, float arcstart, float arcEnd, bool isArc, Angle angle = default(Angle))
            {
                Bounds = Factory.newRectangleF(x, y, width, height);

                StartAngle = arcstart;
                EndAngle = arcEnd;
                ei = new EllipseData(x, y, width, height, angle);

                IsArc = isArc;
                points = GetBezierArcPoints(this);
                ID = Factory.NewID(Name);
            }
Beispiel #3
0
            void Initialize(float startAngle, float endAngle, EllipseData data, CurveType type, bool assignID, PointF c = default(PointF), ICurve attachedCurve = null)
            {
                AttachedCurve = attachedCurve;
                this.data = data;
                List1 = new HashSet<float>();
                List2 = new HashSet<float>();

                if (assignID)
                    ID = Factory.NewID(Name);

                if (startAngle == 0 && endAngle == 0)
                    return;

                var StartAngle = startAngle;
                var EndAngle = endAngle;
                var autoCenter = !c.Valid;
                var eAngle = autoCenter ? data.Angle : default(Angle);
                if (autoCenter)
                    c = new PointF(data.Cx, data.Cy);

                if (!autoCenter && data.Angle.Valid)
                    c = data.Angle.Rotate(c, true);

                var a = Geometry.GetEllipsePoint(StartAngle, c.X, c.Y, data.Rx, data.Ry, eAngle, true);
                var b = Geometry.GetEllipsePoint(EndAngle, c.X, c.Y, data.Rx, data.Ry, eAngle, true);

                PointF m, p;
                var move = -Math.Max(data.Rx, data.Ry);
                p = Geometry.MoveLine(a, c, move);
                if (this.EllipseInterception(p, c, out _, out m, false))
                    a = m.Valid ? m : a;

                p = Geometry.MoveLine(b, c, move);
                if (this.EllipseInterception(p, c, out _, out m, false))
                    b = m.Valid ? m : b;

                ai = Factory.newArcCut(type, startAngle, endAngle, a, b, c, UseArcLine, AttachedCurve);
            }
Beispiel #4
0
 public EllipseData(IRectangleF rc, EllipseData original) :
     this(rc.X, rc.Y, rc.Width, rc.Height, original.Angle)
 {
 }
Beispiel #5
0
 void Initialize(int x, int y, int width, int height, Angle angle = default(Angle))
 {
     ei = new EllipseData(x, y, width, height, angle);
     Bounds = Factory.newRectangleF(x, y, width, height);
     ID = Factory.NewID(Name);
 }