/// <summary>
        /// The overview rectangle should only appear selected if the <see cref="T:Northwoods.Go.GoOverview" />
        /// supports resizing (i.e. <see cref="P:Northwoods.Go.GoView.AllowSelect" /> and <see cref="P:Northwoods.Go.GoView.AllowResize" /> are true),
        /// and even then the handles will not be seen since their <see cref="T:Northwoods.Go.GoHandle" />.<see cref="T:Northwoods.Go.GoHandleStyle" />
        /// is <see cref="F:Northwoods.Go.GoHandleStyle.None" />.
        /// </summary>
        /// <param name="sel"></param>
        /// <param name="selectedObj"></param>
        public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj)
        {
            GoView view = sel.View;

            if (view != null && view.CanSelectObjects() && view.CanResizeObjects())
            {
                view.ResizeHandleSize = new SizeF(4f / view.DocScale, 4f / view.DocScale);
                RemoveSelectionHandles(sel);
                RectangleF bounds   = Bounds;
                GoHandle   goHandle = sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Top), 2, filled: true) as GoHandle;
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Top), 4, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Bottom), 8, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Bottom), 16, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
            }
        }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Return the appropriate resize cursor name for the handle ID's corresponding to
        /// the standard spots, but return null if the object cannot be resized.
        /// </summary>
        /// <param name="view"></param>
        /// <returns>
        /// null if <see cref="M:Northwoods.Go.GoView.CanResizeObjects" /> is false or if
        /// <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>CanResize</c> and <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>CanReshape</c> are both false;
        /// otherwise the value of <see cref="P:Northwoods.Go.GoHandle.CursorName" /> if it is non-null;
        /// finally a cursor name depending on the <see cref="P:Northwoods.Go.GoHandle.HandleID" />,
        /// such as "se-resize" for <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>BottomRight</c> or
        /// "hand" for <see cref="F:Northwoods.Go.GoLink.RelinkableToHandle" />, or "move"
        /// for most other handles, or finally null if the <see cref="P:Northwoods.Go.GoHandle.HandleID" />
        /// is <see cref="P:Northwoods.Go.GoHandle.GoObject" />.<c>NoHandle</c>.
        /// </returns>
        public override string GetCursorName(GoView view)
        {
            GoObject handledObject = HandledObject;

            if (handledObject == null || (view != null && !view.CanResizeObjects()) || (!handledObject.CanResize() && !handledObject.CanReshape()))
            {
                return(null);
            }
            string text = CursorName;

            if (text == null)
            {
                text = GetCursorNameForHandleID(HandleID);
            }
            return(text);
        }
Esempio n. 4
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);
                }
            }
        }