Exemplo n.º 1
0
        public static void AddRectangleHandles(GoObject myObject, RectangleF rect, PointF center, float angle, GoSelection sel, GoObject selectedObj)
        {
            GoView view  = sel.View;
            bool   flag  = view?.CanResizeObjects() ?? true;
            bool   flag2 = view?.CanReshapeObjects() ?? true;

            if (myObject.CanResize() && flag)
            {
                float  x      = rect.X;
                float  x2     = rect.X + rect.Width / 2f;
                float  x3     = rect.X + rect.Width;
                float  y      = rect.Y;
                float  y2     = rect.Y + rect.Height / 2f;
                float  y3     = rect.Y + rect.Height;
                double num    = (double)angle * Math.PI / 180.0;
                double cosine = Math.Cos(num);
                double sine   = Math.Sin(num);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y), center, cosine, sine), 2, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y), center, cosine, sine), 4, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y3), center, cosine, sine), 8, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y3), center, cosine, sine), 16, filled: true), angle);
                if (myObject.CanReshape() && flag2)
                {
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y), center, cosine, sine), 32, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y2), center, cosine, sine), 64, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y3), center, cosine, sine), 128, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y2), center, cosine, sine), 256, filled: true), angle);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Display the appropriate selected appearance, normally, resize selection handles
        /// at each point of the polygon.
        /// </summary>
        /// <param name="sel"></param>
        /// <param name="selectedObj"></param>
        /// <remarks>
        /// If this polygon is resizable and reshapable, we add resize selection
        /// handles at each polygon point, with handle IDs equal to
        /// <see cref="F:Northwoods.Go.GoObject.LastHandle" /> plus the index of the point.
        /// </remarks>
        public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj)
        {
            GoView view  = sel.View;
            bool   flag  = view?.CanResizeObjects() ?? true;
            bool   flag2 = view?.CanReshapeObjects() ?? true;

            if (!(CanResize() && flag) || !(CanReshape() && flag2))
            {
                base.AddSelectionHandles(sel, selectedObj);
                return;
            }
            sel.RemoveHandles(this);
            checked
            {
                int num = PointsCount - 1;
                for (int i = 0; i <= num; i++)
                {
                    PointF point = GetPoint(i);
                    sel.CreateResizeHandle(this, selectedObj, point, 8192 + i, filled: true);
                }
            }
        }