Пример #1
0
        public override void DoOffsetOther(float offsetX, float offsetY, DUIAnyBounds anyBounds)
        {
            DUIAnyBoundsPolygon anyBoundsPolygon = (DUIAnyBoundsPolygon)anyBounds;
            DUIMatrix           m = new DUIMatrix();

            m.Rotate(this.Rotate);
            PointF p = MatrixTools.PointAfterMatrix(new PointF(offsetX, offsetY), m);

            anyBoundsPolygon.Polygon = this.Polygon.Select(pl => new PointF(pl.X + p.X, pl.Y + p.Y)).ToArray();
            RectangleF bounds = PolygonTools.GetPolygonRect(anyBoundsPolygon.Polygon);
        }
Пример #2
0
        public override void DoOffsetPoint(float offsetX, float offsetY, DUIAnyBounds anyBounds)
        {
            offsetX = GetLimitPolygonPointLeftOffset(offsetX);
            offsetY = GetLimitPolygonPointTopOffset(offsetY);
            DUIAnyBoundsPolygon anyBoundsPolygon  = (DUIAnyBoundsPolygon)anyBounds;
            RectangleF          lastPolygonBounds = PolygonTools.GetPolygonRect(this.Polygon);

            PointF[] polygon = this.Polygon.Select(p => new PointF(p.X, p.Y)).ToArray();
            polygon[this.hoverPointIndex].X += offsetX;
            polygon[this.hoverPointIndex].Y += offsetY;
            RectangleF polygonBounds = PolygonTools.GetPolygonRect(polygon);
            DUIMatrix  m             = new DUIMatrix();

            m.Rotate(this.Rotate);
            PointF offset = MatrixTools.PointAfterMatrix(new PointF(polygonBounds.X - lastPolygonBounds.X, polygonBounds.Y - lastPolygonBounds.Y), m);

            anyBoundsPolygon.Polygon = polygon.Select(pl => new PointF(pl.X + offset.X - (polygonBounds.X - lastPolygonBounds.X), pl.Y + offset.Y - (polygonBounds.Y - lastPolygonBounds.Y))).ToArray();
        }
Пример #3
0
        protected internal override void SetCenterChanged(PointF center)
        {
            float     lastX  = this.x;
            float     lastY  = this.y;
            PointF    p      = this.ClientBounds.Location;
            DUIMatrix matrix = new DUIMatrix();

            matrix.Translate(this.ClientBounds.X + this.CenterX, this.ClientBounds.Y + this.CenterY);
            matrix.Rotate(this.Rotate);
            matrix.Skew(this.SkewX, this.SkewY);
            matrix.Scale(this.ScaleX, this.ScaleY);
            matrix.Translate(-(this.ClientBounds.X + this.CenterX), -(this.ClientBounds.Y + this.CenterY));
            p = MatrixTools.PointAfterMatrix(p, matrix);
            matrix.Reset();
            matrix.Translate(center.X, center.Y);
            matrix.Scale(1 / this.ScaleX, 1 / this.ScaleY);
            matrix.Skew(-this.SkewX, -this.SkewY);
            var s = (float)(Math.Tan(-this.SkewX) * Math.Tan(this.SkewY) + 1);

            matrix.Scale(1 / s, 1 / s);
            matrix.Rotate(-this.Rotate);
            matrix.Translate(-center.X, -center.Y);
            p = MatrixTools.PointAfterMatrix(p, matrix);
            float x       = p.X - this.BorderWidth;
            float y       = p.Y - this.BorderWidth;
            var   polygon = this.Polygon.Select(pl => new PointF(pl.X + x - lastX, pl.Y + y - lastY)).ToArray();

            this.SetBoundsChanged(
                center.X - p.X
                , center.Y - p.Y
                , this.Rotate
                , 0
                , 0
                , 0
                , 0
                , polygon
                , DUIBoundsPolygonSpecified.Center
                | DUIBoundsPolygonSpecified.Polygon
                | DUIBoundsPolygonSpecified.RotateAngle);
        }