Beispiel #1
0
 public DefaultCreateInteractor(
     DxfEntity entity,
     ITransaction transaction,
     IControlPointCollection controlPoints)
     : base(entity)
 {
     this.itransaction_0            = transaction;
     this.itransaction_0.Completed += new EventHandler(this.itransaction_0_Completed);
     this.icontrolPointCollection_0 = controlPoints;
 }
Beispiel #2
0
            private int method_1(InteractionContext context, WW.Math.Point2D mousePosition)
            {
                double tolerance = 0.5 * context.EditHandleSize;
                int    num       = -1;
                IControlPointCollection interactionControlPoints = this.Entity.InteractionControlPoints;
                Matrix4D matrix4D = context.ProjectionTransform * this.Entity.Transform;

                for (int index = 0; index < interactionControlPoints.Count; ++index)
                {
                    if (WW.Math.Point2D.AreApproxEqual((WW.Math.Point2D)matrix4D.Transform(interactionControlPoints.Get(index)), mousePosition, tolerance))
                    {
                        num = index;
                        break;
                    }
                }
                return(num);
            }
Beispiel #3
0
                public override void Draw(
                    PaintEventArgs e,
                    GraphicsHelper graphicsHelper,
                    InteractionContext context)
                {
                    base.Draw(e, graphicsHelper, context);
                    IControlPointCollection controlPoints = this.Interactor.ControlPoints;
                    Matrix4D matrix4D1 = context.ProjectionTransform * this.Interactor.Entity.Transform;

                    for (int index = 0; index < controlPoints.Count; ++index)
                    {
                        graphicsHelper.DrawEditHandle(e.Graphics, graphicsHelper.DefaultPen, matrix4D1.TransformTo2D(controlPoints.Get(index)));
                    }
                    DxfEntity.Interactor interactor = this.Interactor;
                    if (!interactor.MouseWcsPosition.HasValue)
                    {
                        return;
                    }
                    Matrix4D matrix4D2 = context.ProjectionTransform * this.Interactor.Entity.Transform;

                    graphicsHelper.DrawEditHandle(e.Graphics, interactor.PositionIsSnapped ? graphicsHelper.HighlightPen : graphicsHelper.DefaultPen, matrix4D2.TransformTo2D(interactor.MouseWcsPosition.Value));
                }
Beispiel #4
0
        public static bool IsInPolygon(IControlPointCollection pts2Test, IControlPointCollection polyPts)
        {
            PointF[] pts = new PointF[polyPts.Count];
            for (int i = 0; i < polyPts.Count; i++)
            {
                var pt3D = polyPts.Get(i);
                pts[i] = new PointF((float)pt3D.X, (float)pt3D.Y);
            }

            bool isInside = false;
            for (int i = 0; i < pts2Test.Count; i++)
            {
                var pt3D = pts2Test.Get(i);
                PointF ptF = new PointF((float)pt3D.X, (float)pt3D.Y);
                if (IsInPolygon(pts, ptF))
                {
                    isInside = true;
                    break;
                }
            }
            return isInside;

        }
Beispiel #5
0
                public override void Draw(
                    PaintEventArgs e,
                    GraphicsHelper graphicsHelper,
                    InteractionContext context)
                {
                    base.Draw(e, graphicsHelper, context);
                    IControlPointCollection controlPoints = this.Interactor.ControlPoints;
                    Matrix4D matrix4D = context.ProjectionTransform * this.Interactor.Entity.Transform;

                    for (int index = 0; index < controlPoints.Count; ++index)
                    {
                        WW.Math.Point2D position = matrix4D.TransformTo2D(controlPoints.Get(index));
                        switch (controlPoints.GetDisplayType(index))
                        {
                        case PointDisplayType.Default:
                            int x = (int)System.Math.Round(position.X);
                            int y = (int)System.Math.Round(position.Y);
                            Class735.smethod_3(e.Graphics, graphicsHelper.DefaultPen.Color, x, y);
                            break;

                        case PointDisplayType.EditHandle:
                            GdiDrawUtil.DrawEditHandle(e.Graphics, graphicsHelper.DefaultPen, position, context.EditHandleSize);
                            break;

                        case PointDisplayType.CrossHair:
                            int num1 = (int)System.Math.Round(position.X);
                            int num2 = (int)System.Math.Round(position.Y);
                            int x1   = (int)System.Math.Round((double)num1 - 0.5 * context.CrossHairSize);
                            int y1   = (int)System.Math.Round((double)num2 - 0.5 * context.CrossHairSize);
                            int x2   = (int)System.Math.Round((double)num1 + 0.5 * context.CrossHairSize);
                            int y2   = (int)System.Math.Round((double)num2 + 0.5 * context.CrossHairSize);
                            e.Graphics.DrawLine(graphicsHelper.DefaultPen, x1, num2, x2, num2);
                            e.Graphics.DrawLine(graphicsHelper.DefaultPen, num1, y1, num1, y2);
                            break;
                        }
                    }
                }