/// <summary>
        /// Initializes a new instance of the <see cref="UpdatePathForm"/> class.
        /// </summary>
        /// <param name="update">The update command that's driving things (not null).</param>
        /// <exception cref="ArgumentNullException">If the supplied update command is null.</exception>
        internal UpdatePathForm(UpdateUI update)
        {
            InitializeComponent();
            Owner = EditingController.Current.MainForm;

            if (update == null)
                throw new ArgumentNullException();

            m_UpdCmd = update;
            m_CurFaceIndex = -1;
            m_pop = null;

            // Get the object that was selected for update.
            m_pop = (m_UpdCmd.GetOp() as PathOperation);
            if (m_pop == null)
                throw new ArgumentException("Cannot obtain original connection path for update");

            // Get a working copy of the connection path legs
            // TODO - This will not be suitable in a situation where staggered legs have been created
            Leg[] legs = PathParser.CreateLegs(m_pop.EntryString, m_pop.EntryUnit);

            m_Faces = new List<LegFace>();
            foreach (Leg leg in legs)
            {
                m_Faces.Add(leg.PrimaryFace);

                if (leg.AlternateFace != null)
                    m_Faces.Add(leg.AlternateFace);
            }

            m_Edits = new PathEditor(legs);
        }
Exemple #2
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("RadialUI.Run - Command is already running.");
            }

            UpdateUI pup = this.Update;

            if (pup != null)
            {
                m_Dialog = new RadialControl(pup);
            }
            else
            {
                if (m_From == null)
                {
                    RadialOperation recall = (RadialOperation)this.Recall;
                    m_From = recall.From;
                }

                m_Dialog = new RadialControl(this, m_From);
            }

            this.Container.Display(m_Dialog);
            return(true);
        }
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                MessageBox.Show("LineExtensionUI.DialFinish - No dialog!");
                return(false);
            }

            // If we are doing an update, alter the original operation.
            UpdateUI up = this.Update;

            if (up != null)
            {
                // Get the original operation.
                LineExtensionOperation pop = (up.GetOp() as LineExtensionOperation);
                if (pop == null)
                {
                    MessageBox.Show("LineExtensionUI.DialFinish - Unexpected edit type.");
                    return(false);
                }

                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)
                UpdateItemCollection changes = pop.GetUpdateItems(m_Dialog.IsExtendFromEnd, m_Dialog.Length);
                if (!up.AddUpdate(pop, changes))
                {
                    return(false);
                }
            }
            else
            {
                // Get info from the dialog
                m_IsExtendFromEnd = m_Dialog.IsExtendFromEnd;
                m_Length          = m_Dialog.Length;
                IdHandle          idh = m_Dialog.PointId;
                CadastralMapModel map = CadastralMapModel.Current;
                m_LineType = (m_Dialog.WantLine ? map.DefaultLineType : null);

                // Execute the edit
                LineExtensionOperation op = null;

                try
                {
                    op = new LineExtensionOperation(m_ExtendLine, m_IsExtendFromEnd, m_Length);
                    op.Execute(idh, m_LineType);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                    return(false);
                }
            }

            // Destroy the dialog(s).
            KillDialogs();

            // Get the base class to finish up.
            return(FinishCommand());
        }
        /// <summary>
        /// Starts the user interface for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null || m_UpDial != null)
            {
                throw new Exception("LineSubdivisionUI.Run - Command is already running.");
            }

            // Are we doing an update?
            UpdateUI pup = this.Update;

            // Create modeless dialog.
            if (pup != null)
            {
                m_UpDial = new LineSubdivisionUpdateForm(pup);
                m_UpDial.Show();
            }
            else
            {
                Debug.Assert(m_Parent != null);
                m_Dialog = new LineSubdivisionControl(this, m_Parent, this.Recall);
                this.Container.Display(m_Dialog);
            }

            return(true);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LineSubdivisionUpdateForm"/> class.
        /// </summary>
        /// <param name="up">The command that's running things.</param>
        internal LineSubdivisionUpdateForm(UpdateUI up)
        {
            InitializeComponent();

            m_UpdCmd = up;
            this.DialogResult = DialogResult.Cancel;
        }
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                MessageBox.Show("SimpleLineSubdivisionUI.DialFinish - No dialog!");
                return(false);
            }

            // De-select the line that's being split
            Controller.ClearSelection();

            // Get info from the dialog.
            m_Length = m_Dialog.Length;

            // If we are doing an update, alter the original operation.
            UpdateUI up = this.Update;

            if (up != null)
            {
                // Get the original operation.
                SimpleLineSubdivisionOperation pop = (up.GetOp() as SimpleLineSubdivisionOperation);
                if (pop == null)
                {
                    MessageBox.Show("SimpleLineSubdivisionUI.DialFinish - Unexpected edit type.");
                    return(false);
                }

                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)
                UpdateItemCollection changes = pop.GetUpdateItems(m_Length, m_Dialog.IsFromEnd);
                if (!up.AddUpdate(pop, changes))
                {
                    return(false);
                }
            }
            else
            {
                // Execute the edit
                SimpleLineSubdivisionOperation op = null;

                try
                {
                    op = new SimpleLineSubdivisionOperation(m_Line, m_Length, m_Dialog.IsFromEnd);
                    op.Execute();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                    return(false);
                }
            }

            // Destroy the dialog(s).
            KillDialogs();

            // Get the base class to finish up.
            return(FinishCommand());
        }
        internal TerminalControl(UpdateUI updcmd, bool isLast)
        {
            InitializeComponent();

            m_Cmd = updcmd;
            m_IsLast = isLast;
            m_Line = null;
            m_Terminal = null;
        }
Exemple #8
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                MessageBox.Show("NewCircleUI.DialFinish - No dialog!");
                return(false);
            }

            // Get info from the dialog.
            PointFeature center = m_Dialog.Center;
            Observation  radius = m_Dialog.Radius;

            // Both items must be defined (the dialog should have confirmed
            // this in its OnOK handler).
            if (center == null || radius == null)
            {
                MessageBox.Show("NewCircleUI.DialFinish - Insufficient data to add circle.");
                return(false);
            }

            // If we are doing an update, alter the original operation.
            UpdateUI pup = this.Update;

            if (pup != null)
            {
                // Get the original operation.
                NewCircleOperation pop = (pup.GetOp() as NewCircleOperation);
                if (pop == null)
                {
                    MessageBox.Show("NewCircleUI.DialFinish - Unexpected edit type.");
                    return(false);
                }

                pop.Correct(center, radius);
            }
            else
            {
                // Create empty persistent object (adds to current session)
                NewCircleOperation op = null;

                try
                {
                    op = new NewCircleOperation(center, radius);
                    op.Execute();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                    return(false);
                }
            }

            // Get the base class to finish up.
            return(FinishCommand());
        }
        /// <summary>
        /// Constructor for doing an update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command.</param>
        internal LineSubdivisionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
            : base(cc, editId, updcmd)
        {
            // The dialog will be created by Run()
            m_Dialog = null;
            m_UpDial = null;

            // The line being subdivided is known via the update.
            m_Parent = null;
        }
        /// <summary>
        /// Constructor for doing an update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command.</param>
        internal LineSubdivisionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
            : base(cc, editId, updcmd)
        {
            // The dialog will be created by Run()
            m_Dialog = null;
            m_UpDial = null;

            // The line being subdivided is known via the update.
            m_Parent = null;
        }
Exemple #11
0
        /// <summary>
        /// Start update dialog (if applicable).
        /// </summary>
        /// <returns>True if update dialog started.</returns>
        bool StartUpdate()
        {
            // Return if we're not doing an update.
            UpdateUI up = this.Update;

            if (up == null)
            {
                return(false);
            }

            m_DialUp = new UpdatePathForm(up);
            m_DialUp.Show();
            return(true);
        }
Exemple #12
0
        /// <summary>
        /// Constructor for doing an update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command.</param>
        internal LineExtensionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
            : base(cc, editId, updcmd)
        {
            // The dialog will be created by Run().
            m_Dialog = null;

            // The line we extended is known via the update.
            m_ExtendLine = null;

            // And initialize the parameters for the operation's Execute() call.
            m_Length          = null;
            m_IsExtendFromEnd = true;
            m_LineType        = null;
        }
Exemple #13
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("NewPointUI.Run - Command is already running.");
            }

            UpdateUI pup = this.Update;

            // Create the appropriate sort of dialog.
            switch (this.EditId)
            {
            case EditingActionId.NewPoint:
            {
                if (pup != null)
                {
                    m_Dialog = new NewPointForm(pup, "Update Point", null);
                }
                else
                {
                    m_Dialog = new NewPointForm(this, "Define New Point", this.Recall);
                }

                break;
            }

            case EditingActionId.GetControl:
            {
                if (pup != null)
                {
                    m_Dialog = new NewPointForm(pup, "Update Control Point", null);
                    break;
                }

                // Drop through to default if not making an update.
                goto default;
            }

            default:
            {
                throw new Exception("NewPointUI.Run - Unexpected command id.");
            }
            }

            m_Dialog.Show();
            return(true);
        }
Exemple #14
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                throw new Exception("NewPointUI.DialFinish -- No dialog!");
            }

            // Hide the dialog so it doesn't become part of any saved display
            m_Dialog.Visible = false;

            // If we are doing an update, remember the changes
            UpdateUI up = this.Update;

            if (up != null)
            {
                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)

                Operation            revisedEdit = up.GetOp();
                UpdateItemCollection changes     = m_Dialog.GetUpdateItems();
                if (!up.AddUpdate(revisedEdit, changes))
                {
                    return(false);
                }
            }
            else
            {
                // Save the new point.
                PointFeature p = m_Dialog.Save();
                if (p == null)
                {
                    return(false);
                }

                // Ensure the point is on screen, and select it.
                Controller.EnsureVisible(p, true);
            }

            // Get the base class to finish up.
            return(FinishCommand());
        }
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("SimpleLineSubdivisionUI.Run - Command is already running.");
            }

            UpdateUI pup = this.Update;

            if (pup != null)
            {
                m_Dialog = new SimpleLineSubdivisionControl(pup);
            }
            else
            {
                m_Dialog = new SimpleLineSubdivisionControl(this, m_Line, this.Recall);
            }

            this.Container.Display(m_Dialog);
            return(true);
        }
Exemple #16
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("NewCircleUI.Run - Command is already running.");
            }

            // Are we doing an update?
            UpdateUI pup = this.Update;

            if (pup != null)
            {
                m_Dialog = new NewCircleForm(pup);
            }
            else
            {
                m_Dialog = new NewCircleForm(this, this.Recall);
            }

            m_Dialog.Show();
            return(true);
        }
Exemple #17
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("LineExtensionUI.Run - Command is already running.");
            }

            // Are we doing an update?
            UpdateUI pup = this.Update;

            if (pup != null)
            {
                m_Dialog = new LineExtensionControl(pup);
            }
            else
            {
                m_Dialog = new LineExtensionControl(this, m_ExtendLine, this.Recall);
            }

            this.Container.Display(m_Dialog);
            return(true);
        }
Exemple #18
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns>True if command finished ok</returns>
        internal override bool DialFinish(Control wnd)
        {
            // If it's the offset dialog that's just finished, grab info
            // from it, delete it, and go to the dialog for the first
            // terminal line.

            ISpatialDisplay view = ActiveDisplay;
            UpdateUI        up   = this.Update;

            if (m_ParDial != null)
            {
                // Get info from dialog (it'll be ONE of the two). The dialog
                // should only call this function after validating that one
                // of them is defined.
                m_OffsetPoint = m_ParDial.OffsetPoint;
                if (m_OffsetPoint == null)
                {
                    m_Offset = m_ParDial.OffsetDistance;
                }

                // Destroy the dialog.
                KillDialogs();

                // Calculate the positions for the parallel points.
                Calculate();

                // Repaint what we know about.
                Draw();

                // And start the dialog for the first terminal line.
                if (up != null)
                {
                    m_TermDial1 = new TerminalControl(up, false);
                }
                else
                {
                    m_TermDial1 = new TerminalControl(this, false);
                }

                //m_TermDial1.Show();
                this.Container.Display(m_TermDial1);
                return(true);
            }

            if (m_TermDial1 != null)
            {
                // Get the first terminal line (if any). And the position.
                m_TermLine1 = m_TermDial1.TerminalLine;
                m_Term1     = m_TermDial1.TerminalPosition;

                // And move on to the 2nd terminal dialog.
                KillDialogs();

                // Repaint what we know about.

                Draw();
                // And start the dialog for the first terminal line.
                if (up != null)
                {
                    m_TermDial2 = new TerminalControl(up, true);
                }
                else
                {
                    m_TermDial2 = new TerminalControl(this, true);
                }

                this.Container.Display(m_TermDial2);
                //m_TermDial2.Show();
                return(true);
            }

            if (m_TermDial2 == null)
            {
                throw new Exception("ParallelLineUI.DialFinish - No dialog!");
            }

            // Get the nortthern terminal line (if any). And the position.
            m_TermLine2 = m_TermDial2.TerminalLine;
            m_Term2     = m_TermDial2.TerminalPosition;

            // Erase everything special that we've drawn.
            ErasePainting();

            // And ensure the view has nothing selected (sometimes the line
            // last selected had been unhighlighted, although it's end points
            // stay highlighted for some reason).
            EditingController.Current.ClearSelection();

            // If we are doing an update, remember the changes
            if (up != null)
            {
                // Get the original operation.
                ParallelLineOperation op = (ParallelLineOperation)up.GetOp();
                if (op == null)
                {
                    throw new Exception("ParallelLineUI.DialFinish - Unexpected edit type.");
                }

                // Note the offset (it SHOULD be defined)
                Observation offset = null;

                if (m_Offset != null)
                {
                    offset = m_Offset;
                }
                else if (m_OffsetPoint != null)
                {
                    offset = new OffsetPoint(m_OffsetPoint);
                }

                Debug.Assert(offset != null);

                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)

                UpdateItemCollection changes = op.GetUpdateItems(m_Line, offset, m_TermLine1, m_TermLine2, m_IsReversed);
                if (!up.AddUpdate(op, changes))
                {
                    return(false);
                }
            }
            else
            {
                Observation offset = m_Offset;
                if (offset == null && m_OffsetPoint != null)
                {
                    offset = new OffsetPoint(m_OffsetPoint);
                }
                Debug.Assert(offset != null);

                // Execute the edit
                ParallelLineOperation op = null;

                try
                {
                    op = new ParallelLineOperation(m_Line, offset, m_TermLine1, m_TermLine2, m_IsReversed);
                    op.Execute();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                    return(false);
                }
            }

            // Destroy the dialog(s).
            KillDialogs();

            // Get the base class to finish up.
            return(FinishCommand());
        }
Exemple #19
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialogs</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal ParallelLineUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     // Just set zero values for everything (we'll pick up stuff in Run).
     SetZeroValues();
 }
Exemple #20
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_ParDial != null || m_TermDial1 != null || m_TermDial2 != null)
            {
                throw new Exception("ParallelLineUI.Run - Command is already running.");
            }

            // If we're doing an update, get the reference line from the original op.
            ParallelLineOperation op = null;
            UpdateUI up = this.Update;

            if (up != null)
            {
                op = (up.GetOp() as ParallelLineOperation);
                if (op == null)
                {
                    throw new Exception("ParallelLineUI.Run - Unexpected edit type.");
                }

                // Pick up the line that acted as the reference line.
                m_Line = op.ReferenceLine;
            }

            // If it wasn't an update, we might be recalling an old op.
            if (op == null)
            {
                op = (this.Recall as ParallelLineOperation);
            }

            // Get old observations if necessary.
            if (op != null)
            {
                // Pick up the offset.
                Observation offset = op.Offset;

                // Is it an observed distance?
                Distance dist = (offset as Distance);
                if (dist != null)
                {
                    m_Offset = new Distance(dist);
                }
                else
                {
                    // The only other thing it could be is an offset point.
                    OffsetPoint offPoint = (offset as OffsetPoint);
                    if (offPoint != null)
                    {
                        m_OffsetPoint = offPoint.Point;
                    }
                }

                m_IsReversed = op.IsArcReversed;
                m_TermLine1  = op.Terminal1;
                m_TermLine2  = op.Terminal2;

                // Ensure the reference line has been selected/highlighted (this may end up
                // calling OnSelectLine)
                EditingController.Current.Select(m_Line);

                // Calculate stuff & paint what we've got.
                Calculate();
                Paint(null);
            }

            // Create modeless dialog.

            if (up != null)
            {
                m_ParDial = new ParallelControl(up);
            }
            else
            {
                m_ParDial = new ParallelControl(this);
            }

            this.Container.Display(m_ParDial);
            return(true);
        }
        /// <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);
            }
        }
Exemple #22
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal NewPointUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     m_Dialog = null;
 }
Exemple #23
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">Object for holding any displayed dialogs</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal NewCircleUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     m_Dialog = null;
 }
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialogs</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal SimpleLineSubdivisionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     SetInitialValues();
 }
Exemple #25
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog != null)
            {
                throw new InvalidOperationException("IntersectUI.Run - Command is already running.");
            }

            // Are we doing an update?
            UpdateUI pup = this.Update;

            // Create the appropriate sort of dialog.
            EditingActionId edid = this.EditId;

            if (edid == EditingActionId.DirIntersect)
            {
                if (pup == null)
                {
                    m_Dialog = new IntersectTwoDirectionsForm(this, "Intersect two directions");
                }
                else
                {
                    m_Dialog = new IntersectTwoDirectionsForm(pup, "Update (intersect two directions)");
                }
            }
            else if (edid == EditingActionId.DirDistIntersect)
            {
                if (pup == null)
                {
                    m_Dialog = new IntersectDirectionAndDistanceForm(this, "Intersect direction and distance");
                }
                else
                {
                    m_Dialog = new IntersectDirectionAndDistanceForm(pup, "Update (intersect direction and distance)");
                }
            }
            else if (edid == EditingActionId.LineIntersect)
            {
                if (pup == null)
                {
                    m_Dialog = new IntersectTwoLinesForm(this, "Intersect two lines");
                }
                else
                {
                    m_Dialog = new IntersectTwoLinesForm(pup, "Update (intersect two lines)");
                }
            }
            else if (edid == EditingActionId.DistIntersect)
            {
                if (pup == null)
                {
                    m_Dialog = new IntersectTwoDistancesForm(this, "Intersect two distances");
                }
                else
                {
                    m_Dialog = new IntersectTwoDistancesForm(pup, "Update (intersect two distances)");
                }
            }
            else if (edid == EditingActionId.DirLineIntersect)
            {
                if (pup == null)
                {
                    m_Dialog = new IntersectDirectionAndLineForm(this, "Intersect direction and line");
                }
                else
                {
                    m_Dialog = new IntersectDirectionAndLineForm(pup, "Update (intersect direction and line)");
                }
            }
            else
            {
                throw new Exception("IntersectUI.Run - Unexpected command id.");
            }

            m_Dialog.Show();
            return(true);
        }
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialogs</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal SimpleLineSubdivisionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     SetInitialValues();
 }
Exemple #27
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window. If this matches the dialog that
        /// this command knows about, the command will be executed (and, on success,
        /// the dialog will be destroyed). If it's some other window, it must
        /// be a sub-dialog created by our guy, so let it handle the request.</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                MessageBox.Show("RadialUI.DialFinish - No dialog!");
                return(false);
            }

            // Handle any sub-dialog request.
            if (m_Dialog != wnd)
            {
                return(m_Dialog.DialFinish(wnd));
            }

            // If we are doing an update, remember the changes
            UpdateUI up = this.Update;

            if (up != null)
            {
                RadialOperation pop = (up.GetOp() as RadialOperation);
                if (pop == null)
                {
                    MessageBox.Show("RadialUI.DialFinish - Unexpected edit type.");
                    return(false);
                }

                // Get info from the dialog.
                Direction   dir = m_Dialog.Direction;
                Observation len = m_Dialog.Length;

                // The direction and length must both be defined.
                if (dir == null || len == null)
                {
                    MessageBox.Show("Missing parameters for sideshot update.");
                    return(false);
                }

                // Remember the changes as part of the UI object (the original edit remains
                // unchanged for now)
                UpdateItemCollection changes = pop.GetUpdateItems(dir, len);
                if (!up.AddUpdate(pop, changes))
                {
                    return(false);
                }
            }
            else
            {
                // Get info from the dialog.
                Direction   dir = m_Dialog.Direction;
                Observation len = m_Dialog.Length;
                IdHandle    idh = m_Dialog.PointId;

                IEntity lineEnt = null;
                if (m_Dialog.WantLine)
                {
                    lineEnt = CadastralMapModel.Current.DefaultLineType;
                    if (lineEnt == null)
                    {
                        throw new InvalidOperationException("No default entity type for lines");
                    }
                }

                // The direction, length, and point entity type must all be defined.
                if (dir == null || len == null || idh.Entity == null)
                {
                    MessageBox.Show("Missing parameters for sideshot creation.");
                    return(false);
                }

                RadialOperation pop = null;

                try
                {
                    pop = new RadialOperation(dir, len);
                    pop.Execute(idh, lineEnt);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace, ex.Message);
                }
            }

            // Get the base class to finish up.
            return(FinishCommand());
        }
Exemple #28
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal RadialUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     m_Dialog = null;
     m_From   = null;
 }
 internal LineExtensionControl(UpdateUI updcmd)
 {
     InitializeComponent();
     Zero();
     m_Cmd = updcmd;
 }
 /// <summary>
 /// Creates new <c>SimpleCommandUI</c> for use during an editing update. This doesn't refer to
 /// the UpdateUI itself, it refers to a command that is the subject of the update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command (not null) that is controlling this command.</param>
 protected SimpleCommandUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
 }
Exemple #31
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialog controls</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal PathUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     Zero();
 }
        /// <summary>
        /// Constructor for doing an update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command.</param>
        internal LineExtensionUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
            : base(cc, editId, updcmd)
        {
            // The dialog will be created by Run().
            m_Dialog = null;

            // The line we extended is known via the update.
            m_ExtendLine = null;

            // And initialize the parameters for the operation's Execute() call.
            m_Length = null;
            m_IsExtendFromEnd = true;
            m_LineType = null;
        }
Exemple #33
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal RadialUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     m_Dialog = null;
     m_From = null;
 }
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialogs</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal ParallelLineUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     // Just set zero values for everything (we'll pick up stuff in Run).
     SetZeroValues();
 }
Exemple #35
0
        /// <summary>
        /// Creates new <c>CommandUI</c> for use during an editing update. This doesn't refer to
        /// the UpdateUI itself, it refers to a command that is the subject of the update.
        /// </summary>
        /// <param name="editId">The ID of the edit this command deals with.</param>
        /// <param name="updcmd">The update command (not null) that is controlling this command.</param>
        protected CommandUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
        {
            if (updcmd==null)
                throw new ArgumentNullException();

            m_Container = cc;
            m_EditId = editId;
            m_UpdCmd = updcmd;
            m_Draw = updcmd.ActiveDisplay;
            //m_Update = updcmd.SelectedObject;
            m_Recall = null;
            /*
            this.Update = update;

            if (update==null)
            {
                m_Draw = EditingController.Current.ActiveDisplay;
                m_Recall = null;
            }
             */

            Debug.Assert(m_Draw!=null);
        }
Exemple #36
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal IntersectUI(EditingActionId editId, UpdateUI updcmd)
     : base(null, editId, updcmd)
 {
     Initialize();
 }
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal IntersectUI(EditingActionId editId, UpdateUI updcmd)
     : base(null, editId, updcmd)
 {
     Initialize();
 }
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null && m_UpDial == null)
            {
                throw new Exception("LineSubdivisionUI.DialFinish - No dialog!");
            }

            UpdateUI up      = this.Update;
            bool     doAbort = false;

            if (up != null)
            {
                // Get the original operation.
                LineSubdivisionOperation pop = (up.GetOp() as LineSubdivisionOperation);
                if (pop == null)
                {
                    MessageBox.Show("LineSubdivisionUI.DialFinish - Unexpected edit type.");
                    return(false);
                }

                // Ensure we've got the edit for the primary face
                if (!pop.IsPrimaryFace)
                {
                    pop = pop.OtherSide;
                    Debug.Assert(pop != null);
                    Debug.Assert(pop.IsPrimaryFace);
                }

                // Package up any changes to the primary face
                UpdateItemCollection changes = pop.GetUpdateItems(m_UpDial.WorkingFace1);
                if (changes.Count > 0)
                {
                    up.AddUpdate(pop, changes);
                }

                // If a second face has just been defined, append a new edit.
                LineSubdivisionFace face2 = m_UpDial.WorkingFace2;
                if (face2 != null)
                {
                    if (pop.OtherSide == null)
                    {
                        AddOtherSide(pop, face2);
                    }
                    else
                    {
                        changes = pop.OtherSide.GetUpdateItems(face2);
                        if (changes.Count > 0)
                        {
                            up.AddUpdate(pop.OtherSide, changes);
                        }
                    }
                }

                // If all we've done is add a new face, UpdateUI.AddUpdate wouldn't have been
                // called, which will later lead to an exception from UpdateUI.FinishCommand (via
                // the FinishCommand done below). So remember to abort in that case.
                doAbort = (up.HasRevisions == false);
            }
            else
            {
                // Ensure that the parent line has been de-selected by the view.
                Controller.ClearSelection();

                // Get the dialog to save.
                m_Dialog.Save();
            }

            // Destroy the dialog(s).
            KillDialogs();

            // Get the base class to finish up.
            if (doAbort)
            {
                return(AbortCommand());
            }
            else
            {
                return(FinishCommand());
            }
        }
 internal RadialControl(UpdateUI updcmd)
 {
     InitializeComponent();
     Zero();
     m_Cmd = updcmd;
     InitUpdate();
 }
Exemple #40
0
 /// <summary>
 /// Constructor for doing an update.
 /// </summary>
 /// <param name="cc">The container for any dialog controls</param>
 /// <param name="editId">The ID of the edit this command deals with.</param>
 /// <param name="updcmd">The update command.</param>
 internal PathUI(IControlContainer cc, EditingActionId editId, UpdateUI updcmd)
     : base(cc, editId, updcmd)
 {
     Zero();
 }
Exemple #41
0
        /// <summary>
        /// Creates new <c>CommandUI</c> that isn't an update.
        /// </summary>
        /// <param name="cc">The container that may be used to display any sort of
        /// user dialog (null if no dialog is involved)</param>
        /// <param name="cmdId">The item used to invoke the command.</param>
        /// <param name="update">The object (if any) that was selected for update</param>
        /// <param name="recall">An operation that is being recalled (null if this is an update).</param>
        protected CommandUI(IControlContainer cc, IUserAction cmdId, ISpatialObject update, Operation recall)
        {
            m_Container = cc;
            m_Draw = EditingController.Current.ActiveDisplay;
            //m_Update = update;
            m_UpdCmd = null;
            m_Recall = recall;

            if (cmdId is EditingAction)
                m_EditId = (cmdId as EditingAction).EditId;
            else
                m_EditId = EditingActionId.Null;

            if (cmdId is RecalledEditingAction)
                m_Recall = (cmdId as RecalledEditingAction).RecalledEdit;

            Debug.Assert(m_Draw!=null);
        }