コード例 #1
0
                internal static void smethod_0(
                    IInteractorWinFormsDrawable drawable,
                    DxfEntity entity,
                    PaintEventArgs e,
                    GraphicsHelper graphicsHelper,
                    InteractionContext context)
                {
                    DxfLine  dxfLine             = (DxfLine)entity;
                    Matrix4D projectionTransform = context.ProjectionTransform;
                    PointF   pointF1             = projectionTransform.TransformToPointF(dxfLine.point3D_0);
                    PointF   pointF2             = projectionTransform.TransformToPointF(dxfLine.End);

                    if ((double)pointF1.Y == (double)pointF2.Y)
                    {
                        return;
                    }
                    PointF pointF3 = projectionTransform.TransformToPointF(WW.Math.Point3D.GetMidPoint(dxfLine.point3D_0, dxfLine.point3D_1));
                    double num     = System.Math.Atan2((double)pointF2.Y - (double)pointF1.Y, (double)pointF2.X - (double)pointF1.X);

                    if (context.ProjectionFlipsOrientation)
                    {
                        num = -num;
                    }
                    e.Graphics.DrawString((num * (180.0 / System.Math.PI)).ToString(context.AngleFormatString) + "°", graphicsHelper.DefaultFont, graphicsHelper.DefaultBrush, pointF3);
                }
コード例 #2
0
            public override bool TryCommit()
            {
                if (this.ClickCount <= 0)
                {
                    return(false);
                }
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                DxfLine.EditInteractor.Class590 class590 = new DxfLine.EditInteractor.Class590();
                // ISSUE: reference to a compiler-generated field
                class590.editInteractor_0 = this;
                // ISSUE: reference to a compiler-generated field
                class590.int_0 = this.ControlPointIndexAtFirstMouseDown;
                // ISSUE: reference to a compiler-generated field
                class590.point3D_0 = this.ControlPointValueAtFirstMouseDown;
                DxfLine entity = (DxfLine)this.Entity;

                // ISSUE: reference to a compiler-generated field
                class590.point3D_1 = this.ControlPointIndexAtFirstMouseDown != 0 ? entity.point3D_1 : entity.point3D_0;
                // ISSUE: reference to a compiler-generated method
                // ISSUE: reference to a compiler-generated method
                this.OnCommandCreated(new CommandEventArgs((ICommand) new WW.Actions.Command((object)this.Entity, new System.Action(class590.method_0), new System.Action(class590.method_1))));
                this.Deactivate();
                return(true);
            }
コード例 #3
0
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfLine dxfLine = (DxfLine)from;

            this.point3D_0  = dxfLine.point3D_0;
            this.point3D_1  = dxfLine.point3D_1;
            this.vector3D_0 = dxfLine.vector3D_0;
            this.double_1   = dxfLine.double_1;
        }
コード例 #4
0
        public override IGraphCloneable Clone(CloneContext cloneContext)
        {
            DxfLine dxfLine = (DxfLine)cloneContext.GetExistingClone((IGraphCloneable)this);

            if (dxfLine == null)
            {
                dxfLine = new DxfLine();
                cloneContext.RegisterClone((IGraphCloneable)this, (IGraphCloneable)dxfLine);
                dxfLine.CopyFrom((DxfHandledObject)this, cloneContext);
            }
            return((IGraphCloneable)dxfLine);
        }
コード例 #5
0
 protected override WW.Math.Point3D ProcessWcsPosition(
     InteractionContext context,
     WW.Math.Point3D p)
 {
     p = base.ProcessWcsPosition(context, p);
     if (this.ControlPointIndex == 1 && this.nullable_1.HasValue && this.nullable_1.Value > 0.0)
     {
         DxfLine entity = (DxfLine)this.Entity;
         if (p != entity.point3D_0)
         {
             Vector3D unit = (p - entity.point3D_0).GetUnit();
             p = entity.point3D_0 + unit * this.nullable_1.Value;
         }
     }
     return(p);
 }
コード例 #6
0
            public void ApplyLength()
            {
                if (!this.nullable_1.HasValue)
                {
                    return;
                }
                DxfLine entity = (DxfLine)this.Entity;

                if (!(entity.point3D_0 != entity.point3D_1))
                {
                    return;
                }
                Vector3D unit = (entity.point3D_1 - entity.point3D_0).GetUnit();

                entity.point3D_1 = entity.point3D_0 + this.nullable_1.Value * unit;
                this.OnEntityChanged(new EntityEventArgs(this.Entity));
            }
コード例 #7
0
 private void method_1(object sender, InteractorMouseEventArgs e)
 {
     if (!((DxfLine.ILineInteractor) this.Interactor).EnteredLength.HasValue)
     {
         this.bool_0 = true;
         try
         {
             DxfLine entity = (DxfLine)this.Interactor.Entity;
             this.fieldEditControl_0.TextBox.Text = (entity.point3D_1 - entity.point3D_0).GetLength().ToString(e.InteractionContext.LengthFormatString);
             this.fieldEditControl_0.TextBox.SelectAll();
         }
         finally
         {
             this.bool_0 = false;
         }
     }
     this.fieldEditControl_0.TextBox.Focus();
 }
コード例 #8
0
            public void ApplyLength()
            {
                if (!this.nullable_1.HasValue || this.ClickCount <= 0)
                {
                    return;
                }
                DxfLine entity = (DxfLine)this.Entity;

                if (!(entity.point3D_0 != entity.point3D_1))
                {
                    return;
                }
                Vector3D unit = (entity.point3D_1 - entity.point3D_0).GetUnit();

                if (this.ControlPointIndexAtFirstMouseDown == 0)
                {
                    entity.point3D_0 = entity.point3D_1 - this.nullable_1.Value * unit;
                }
                else
                {
                    entity.point3D_1 = entity.point3D_0 + this.nullable_1.Value * unit;
                }
                this.OnEntityChanged(new EntityEventArgs(this.Entity));
            }
コード例 #9
0
 protected override WW.Math.Point3D ProcessWcsPosition(
     InteractionContext context,
     WW.Math.Point3D p)
 {
     p = base.ProcessWcsPosition(context, p);
     p = DxfLine.CreateInteractor.SnapHorizontalOrVertical((DxfEntity.Interactor) this, p, context, this.ControlPointIndexAtFirstMouseDown);
     if (this.ClickCount > 0 && this.nullable_1.HasValue)
     {
         DxfLine entity = (DxfLine)this.Entity;
         if (this.ControlPointIndexAtFirstMouseDown == 0)
         {
             Vector3D u = entity.point3D_1 - p;
             if (Vector3D.AreApproxEqual(u, Vector3D.Zero))
             {
                 u = entity.point3D_1 - entity.point3D_0;
             }
             if (!Vector3D.AreApproxEqual(u, Vector3D.Zero))
             {
                 p = entity.point3D_1 - this.nullable_1.Value * u.GetUnit();
             }
         }
         else
         {
             Vector3D u = p - entity.point3D_0;
             if (Vector3D.AreApproxEqual(u, Vector3D.Zero))
             {
                 u = entity.point3D_1 - entity.point3D_0;
             }
             if (!Vector3D.AreApproxEqual(u, Vector3D.Zero))
             {
                 p = entity.point3D_0 + this.nullable_1.Value * u.GetUnit();
             }
         }
     }
     return(p);
 }
コード例 #10
0
            public static WW.Math.Point3D SnapHorizontalOrVertical(
                DxfEntity.Interactor interactor,
                WW.Math.Point3D p,
                InteractionContext context,
                int controlPointIndex)
            {
                bool flag = InputUtil.IsShiftPressed();
                CadInteractionContext interactionContext = context as CadInteractionContext;

                if (interactionContext != null)
                {
                    flag ^= interactionContext.DefaultNonDiagonalLines;
                }
                if (interactor.IsActive && flag)
                {
                    DxfLine         entity   = (DxfLine)interactor.Entity;
                    WW.Math.Point2D point2D1 = context.ProjectionTransform.TransformTo2D(controlPointIndex == 0 ? entity.point3D_1 : entity.point3D_0);
                    WW.Math.Point3D point3D  = p;
                    WW.Math.Point2D point2D2 = context.ProjectionTransform.TransformTo2D((WW.Math.Point2D)point3D);
                    Vector2D        vector2D = point2D2 - point2D1;
                    p = System.Math.Abs(vector2D.X) >= System.Math.Abs(vector2D.Y) ? context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D2.X, point2D1.Y)) : context.InverseProjectionTransform.TransformTo3D(new WW.Math.Point2D(point2D1.X, point2D2.Y));
                }
                return(p);
            }
コード例 #11
0
 public virtual void Visit(DxfLine line)
 {
 }
コード例 #12
0
 public virtual void Visit(DxfLine line)
 {
     this.VisitEntity((DxfEntity)line);
 }