Exemple #1
0
            public Arc(EntityObject entity)
                : base(EdgeType.Arc)
            {
                if (entity == null)
                {
                    throw new ArgumentNullException(nameof(entity));
                }

                switch (entity.Type)
                {
                case EntityType.Arc:
                    Entities.Arc arc = (Entities.Arc)entity;
                    this.Center             = new Vector2(arc.Center.X, arc.Center.Y);
                    this.Radius             = arc.Radius;
                    this.StartAngle         = arc.StartAngle;
                    this.EndAngle           = arc.EndAngle;
                    this.IsCounterclockwise = true;
                    break;

                case EntityType.Circle:
                    Entities.Circle circle = (Circle)entity;
                    this.Center             = new Vector2(circle.Center.X, circle.Center.Y);
                    this.Radius             = circle.Radius;
                    this.StartAngle         = 0.0;
                    this.EndAngle           = 360.0;
                    this.IsCounterclockwise = true;
                    break;

                default:
                    throw new ArgumentException("The entity is not a Circle or an Arc", nameof(entity));
                }
            }
            public Arc(EntityObject entity)
                : base(EdgeType.Arc)
            {
                if (entity == null)
                {
                    throw new ArgumentNullException("entity");
                }

                if (entity is Entities.Arc)
                {
                    Entities.Arc arc = (Entities.Arc)entity;
                    this.Center             = new Vector2(arc.Center.X, arc.Center.Y);
                    this.Radius             = arc.Radius;
                    this.StartAngle         = arc.StartAngle;
                    this.EndAngle           = arc.EndAngle;
                    this.IsCounterclockwise = true;
                }
                else if (entity is Entities.Circle)
                {
                    Entities.Circle circle = (Circle)entity;
                    this.Center             = new Vector2(circle.Center.X, circle.Center.Y);
                    this.Radius             = circle.Radius;
                    this.StartAngle         = 0.0;
                    this.EndAngle           = 360.0;
                    this.IsCounterclockwise = true;
                }
                else
                {
                    throw new ArgumentException("The entity is not a Circle or an Arc", "entity");
                }
            }
            /// <summary>
            /// Initializes a new instance of the <c>HatchBoundaryPath.Arc</c> class.
            /// </summary>
            /// <param name="entity"><see cref="EntityObject">Entity</see> that represents the edge.</param>
            public Arc(EntityObject entity)
                : base(EdgeType.Arc)
            {
                if (entity == null)
                {
                    throw new ArgumentNullException(nameof(entity));
                }
                Vector3 point;
                Matrix3 trans = MathHelper.ArbitraryAxis(entity.Normal).Transpose();

                switch (entity.Type)
                {
                case EntityType.Arc:
                    Entities.Arc arc = (Entities.Arc)entity;
                    point                   = trans * arc.Center;
                    this.Center             = new Vector2(point.X, point.Y);
                    this.Radius             = arc.Radius;
                    this.StartAngle         = arc.StartAngle;
                    this.EndAngle           = arc.EndAngle;
                    this.IsCounterclockwise = true;
                    break;

                case EntityType.Circle:
                    Entities.Circle circle = (Circle)entity;
                    point                   = trans * circle.Center;
                    this.Center             = new Vector2(point.X, point.Y);
                    this.Radius             = circle.Radius;
                    this.StartAngle         = 0.0;
                    this.EndAngle           = 360.0;
                    this.IsCounterclockwise = true;
                    break;

                default:
                    throw new ArgumentException("The entity is not a Circle or an Arc", nameof(entity));
                }
            }
 //public FormForPolygon(Entities.Polygon polygon)
 //{
 //    this.polygon = polygon;
 //    InitializeComponent();
 //}
 public FormForPolygon(Entities.Circle circle)
 {
     this.circle = circle;
     InitializeComponent();
 }
Exemple #5
0
 public FormForCircle(Entities.Circle circle)
 {
     InitializeComponent();
     this.circle = circle;
 }