Esempio n. 1
0
        internal void StartCommand(CommandUI cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException();
            }

            if (m_Command != null)
            {
                throw new InvalidOperationException();
            }

            // Disable auto-highlight for the duration of the command
            if (m_IsAutoSelect > 0)
            {
                m_IsAutoSelect = -m_IsAutoSelect;
            }

            // Reserve an item number for any editing operation that gets created (it
            // may not get used if the user quits, but it's convenient to do it here)
            //Operation.CurrentEditSequence = Session.ReserveNextItem();

            m_Command = cmd;
            m_Command.Run();
        }
Esempio n. 2
0
        internal void FinishCommand(CommandUI cmd)
        {
            if (!Object.ReferenceEquals(cmd, m_Command))
            {
                throw new InvalidOperationException();
            }

            /*
             *      if ( pCmd->GetCommandId() == ID_FILE_PRINT_WINDOW )
             *      {
             *              CuiGetRectangle* pRect = dynamic_cast<CuiGetRectangle*>(pCmd);
             *              CeVertex corners[5];
             *              if ( pRect->GetCorners(corners) )
             *                      m_PrintData.SetPrintCorners(corners);
             *              else
             *              {
             *                      m_PrintData.SetPrintCorners(0);
             *                      m_PrintData.SetRotation(0.0);
             *              }
             *      }
             */
            SetNormalCursor();

            // Refresh everything from the model. This may seem a bit of an effort, considering
            // that many edits don't do much to the display (some don't do anything). However,
            // it's fast and keeps things clean in more complex cases. Do it before saving the
            // map model, since it gives the impression that things are more responsive than
            // they actually are!
            RefreshAllDisplays();

            // Notify any check dialog (re-check all potential problems).
            // And repaint immediately to avoid flicker (icons wouldn't otherwise be repainted
            // until the idle handler gets called)
            if (m_Check != null)
            {
                m_Check.OnFinishOp();
                ActiveDisplay.PaintNow();
            }

            // Re-enable auto-highlighting if it was on before.
            if (m_IsAutoSelect < 0)
            {
                m_IsAutoSelect = -m_IsAutoSelect;
            }

            /*
             * if ( pCmd->GetCommandId() == ID_FEATURE_UPDATE )
             *  GetDocument()->OnFinishUpdate();
             * else
             *  FinishEdit((INT4)m_pCommand);
             * // m_pAutoSaver->FinishEdit(edid);
             */

            m_Command.Dispose();
            m_Command = null;
        }
Esempio n. 3
0
        /// <summary>
        /// Starts some sort of update. If the selected item is a polygon that has associated
        /// database attributes, a dialog will be displayed to let the user change the attributes.
        /// For any other spatial feature, the dialog for updating an editing operation will be
        /// displayed.
        /// </summary>
        /// <param name="so">The item selected for update</param>
        internal void RunUpdate(IUserAction action, ISpatialObject so)
        {
            if (so == null)
            {
                return;
            }

            // There can't be any command currently running.
            if (m_Command != null)
            {
                return;
            }

            // If we're currently auto-highlighting, get rid of it.
            AutoSelect = false;

            // If a polygon has been selected, invoke the attribute update dialog. Otherwise
            // start an update command.
            if (so.SpatialType == SpatialType.Polygon)
            {
                m_Main.UpdatePolygon((Polygon)so);
            }
            else
            {
                ClearSelection();
                UpdateUI upui = new UpdateUI(action);
                m_Command = upui;

                // We will have a DividerObject if the user selected a line
                // that has been intersected against other lines. In that case,
                // run the update using the underlying line.
                if (so is DividerObject)
                {
                    upui.Run((so as DividerObject).Divider.Line);
                }
                else
                {
                    upui.Run((Feature)so);
                }
            }
        }
Esempio n. 4
0
        internal void AbortCommand(CommandUI cmd)
        {
            if (!Object.ReferenceEquals(cmd, m_Command))
            {
                throw new InvalidOperationException();
            }

            // Make sure the normal cursor is on screen.
            SetNormalCursor();

            cmd.ActiveDisplay.RestoreLastDraw();
            RedrawSelection();

            // Re-enable auto-highlighting if it was on before.
            if (m_IsAutoSelect < 0)
            {
                m_IsAutoSelect = -m_IsAutoSelect;
            }

            cmd.ActiveDisplay.PaintNow();
            m_Command.Dispose();
            m_Command = null;
        }
        /// <summary>
        /// Starts some sort of update. If the selected item is a polygon that has associated
        /// database attributes, a dialog will be displayed to let the user change the attributes.
        /// For any other spatial feature, the dialog for updating an editing operation will be
        /// displayed.
        /// </summary>
        /// <param name="so">The item selected for update</param>
        internal void RunUpdate(IUserAction action, ISpatialObject so)
        {
            if (so==null)
                return;

            // There can't be any command currently running.
            if (m_Command != null)
                return;

            // If we're currently auto-highlighting, get rid of it.
            AutoSelect = false;

            // If a polygon has been selected, invoke the attribute update dialog. Otherwise
            // start an update command.
            if (so.SpatialType == SpatialType.Polygon)
            {
                m_Main.UpdatePolygon((Polygon)so);
            }
            else
            {
                ClearSelection();
                UpdateUI upui = new UpdateUI(action);
                m_Command = upui;

                // We will have a DividerObject if the user selected a line
                // that has been intersected against other lines. In that case,
                // run the update using the underlying line.
                if (so is DividerObject)
                    upui.Run((so as DividerObject).Divider.Line);
                else
                    upui.Run((Feature)so);
            }
        }
        internal void FinishCommand(CommandUI cmd)
        {
            if (!Object.ReferenceEquals(cmd, m_Command))
                throw new InvalidOperationException();

            /*
            if ( pCmd->GetCommandId() == ID_FILE_PRINT_WINDOW )
            {
                CuiGetRectangle* pRect = dynamic_cast<CuiGetRectangle*>(pCmd);
                CeVertex corners[5];
                if ( pRect->GetCorners(corners) )
                    m_PrintData.SetPrintCorners(corners);
                else
                {
                    m_PrintData.SetPrintCorners(0);
                    m_PrintData.SetRotation(0.0);
                }
            }
             */
            SetNormalCursor();

            // Refresh everything from the model. This may seem a bit of an effort, considering
            // that many edits don't do much to the display (some don't do anything). However,
            // it's fast and keeps things clean in more complex cases. Do it before saving the
            // map model, since it gives the impression that things are more responsive than
            // they actually are!
            RefreshAllDisplays();

            // Notify any check dialog (re-check all potential problems).
            // And repaint immediately to avoid flicker (icons wouldn't otherwise be repainted
            // until the idle handler gets called)
            if (m_Check!=null)
            {
                m_Check.OnFinishOp();
                ActiveDisplay.PaintNow();
            }

            // Re-enable auto-highlighting if it was on before.
            if (m_IsAutoSelect<0)
                m_IsAutoSelect = -m_IsAutoSelect;

            /*
            if ( pCmd->GetCommandId() == ID_FEATURE_UPDATE )
                GetDocument()->OnFinishUpdate();
            else
                FinishEdit((INT4)m_pCommand);
            // m_pAutoSaver->FinishEdit(edid);
            */

            m_Command.Dispose();
            m_Command = null;
        }
        internal void AbortCommand(CommandUI cmd)
        {
            if (!Object.ReferenceEquals(cmd, m_Command))
                throw new InvalidOperationException();

            // Make sure the normal cursor is on screen.
            SetNormalCursor();

            cmd.ActiveDisplay.RestoreLastDraw();
            RedrawSelection();

            // Re-enable auto-highlighting if it was on before.
            if (m_IsAutoSelect<0)
                m_IsAutoSelect = -m_IsAutoSelect;

            cmd.ActiveDisplay.PaintNow();
            m_Command.Dispose();
            m_Command = null;
        }
        internal void StartCommand(CommandUI cmd)
        {
            if (cmd==null)
                throw new ArgumentNullException();

            if (m_Command!=null)
                throw new InvalidOperationException();

            // Disable auto-highlight for the duration of the command
            if (m_IsAutoSelect>0)
                m_IsAutoSelect = -m_IsAutoSelect;

            // Reserve an item number for any editing operation that gets created (it
            // may not get used if the user quits, but it's convenient to do it here)
            //Operation.CurrentEditSequence = Session.ReserveNextItem();

            m_Command = cmd;
            m_Command.Run();
        }