Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public EllipseElement(float x, float y, float width, float height) : base()
        {
            this.ElementCursor      = RectElement.ElementDefaultCursor;
            this.leftTopPoint       = new TractionPoint(this);
            this.leftBottomPoint    = new TractionPoint(this);
            this.rightTopPoint      = new TractionPoint(this);
            this.rightBottomPoint   = new TractionPoint(this);
            keyPoint1               = new KeyPoint(0, 0, this);
            keyPoint2               = new KeyPoint(0, 0, this);
            keyPoint1.tractionPoint = leftTopPoint;
            keyPoint2.tractionPoint = rightBottomPoint;

            this.leftTopPoint.ElementCursor     = Cursors.SizeNWSE;
            this.leftBottomPoint.ElementCursor  = Cursors.SizeNESW;
            this.rightBottomPoint.ElementCursor = Cursors.SizeNWSE;
            this.rightTopPoint.ElementCursor    = Cursors.SizeNESW;

            this.X      = x;
            Y           = y;
            Z           = CIRCLE_DEFAULT_Z;
            this.Width  = width;
            this.Height = height;

            this.leftTopPoint.OnTractionEventHandler     += OnLeftTopPointTraction;
            this.leftBottomPoint.OnTractionEventHandler  += OnLeftBottomPointTraction;
            this.rightTopPoint.OnTractionEventHandler    += OnRightTopPointTraction;
            this.rightBottomPoint.OnTractionEventHandler += OnRightBottomPointTraction;
            Visible       = true;
            ParentElement = null;
        }
Ejemplo n.º 2
0
 public void OnTraction(TractionPoint elemant, float x, float y)
 {
     if (KeyPointChangeEventHandler != null)
     {
         KeyPointChangeEventHandler(this, X, Y);
     }
 }
Ejemplo n.º 3
0
        public KeyPoint(float x, float y, Element parent)
        {
            this.Parent                    = parent;
            this.tractionPoint             = new TractionPoint(x, y, parent);
            tractionPoint.ParentCoordinate = parent.ParentCoordinate;
            tractionPoint.ParentElement    = parent;
            tractionPoint.ElementCursor    = Cursors.SizeAll;
            tractionPoint.Z                = tractionPoint.ParentElement.Z - 0.01f;
            tractionPoint.Visible          = true;

            this.tractionPoint.OnTractionEventHandler += OnTraction;
        }
Ejemplo n.º 4
0
 public void OnRightBottomPointTraction(TractionPoint element, float x, float y)
 {
     leftBottomPoint.Y = y;
     rightTopPoint.X   = x;
     if (this.Width < 0)
     {
         FlipHorizontal();
     }
     if (this.Height < 0)
     {
         FlipVertical();
     }
     OnElementChange(this);
 }
Ejemplo n.º 5
0
        public void OnLinePointTraction(TractionPoint tp, float x, float y)
        {
            switch (tp.Name)
            {
            case "tractionPoint0":
                this.X = x;
                this.Y = y;
                break;

            case "tractionPoint1":
                this.X2 = x;
                this.Y2 = y;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
        public void FlipHorizontal()
        {
            this.leftTopPoint.OnTractionEventHandler     -= OnLeftTopPointTraction;
            this.leftBottomPoint.OnTractionEventHandler  -= OnLeftBottomPointTraction;
            this.rightTopPoint.OnTractionEventHandler    -= OnRightTopPointTraction;
            this.rightBottomPoint.OnTractionEventHandler -= OnRightBottomPointTraction;
            System.Console.WriteLine("hFlip");
            TractionPoint tmp = leftTopPoint;

            leftTopPoint     = rightTopPoint;
            rightTopPoint    = tmp;
            tmp              = leftBottomPoint;
            leftBottomPoint  = rightBottomPoint;
            rightBottomPoint = tmp;

            this.leftTopPoint.OnTractionEventHandler     += OnLeftTopPointTraction;
            this.leftBottomPoint.OnTractionEventHandler  += OnLeftBottomPointTraction;
            this.rightTopPoint.OnTractionEventHandler    += OnRightTopPointTraction;
            this.rightBottomPoint.OnTractionEventHandler += OnRightBottomPointTraction;
            this.leftTopPoint.ElementCursor     = Cursors.SizeNWSE;
            this.leftBottomPoint.ElementCursor  = Cursors.SizeNESW;
            this.rightBottomPoint.ElementCursor = Cursors.SizeNWSE;
            this.rightTopPoint.ElementCursor    = Cursors.SizeNESW;
        }
Ejemplo n.º 7
0
        public void FlipVertical()
        {
            this.leftTopPoint.OnTractionEventHandler     -= OnLeftTopPointTraction;
            this.leftBottomPoint.OnTractionEventHandler  -= OnLeftBottomPointTraction;
            this.rightTopPoint.OnTractionEventHandler    -= OnRightTopPointTraction;
            this.rightBottomPoint.OnTractionEventHandler -= OnRightBottomPointTraction;
            System.Console.WriteLine("vFlip");
            TractionPoint tmp = leftTopPoint;

            leftTopPoint     = leftBottomPoint;
            leftBottomPoint  = tmp;
            tmp              = rightTopPoint;
            rightTopPoint    = rightBottomPoint;
            rightBottomPoint = tmp;
            this.leftTopPoint.OnTractionEventHandler     += OnLeftTopPointTraction;
            this.leftBottomPoint.OnTractionEventHandler  += OnLeftBottomPointTraction;
            this.rightTopPoint.OnTractionEventHandler    += OnRightTopPointTraction;
            this.rightBottomPoint.OnTractionEventHandler += OnRightBottomPointTraction;
            this.leftTopPoint.ElementCursor     = Cursors.SizeNWSE;
            this.leftBottomPoint.ElementCursor  = Cursors.SizeNESW;
            this.rightBottomPoint.ElementCursor = Cursors.SizeNWSE;
            this.rightTopPoint.ElementCursor    = Cursors.SizeNESW;
            System.Console.WriteLine("lt==lb:" + object.ReferenceEquals(leftTopPoint, leftBottomPoint));
        }