Пример #1
0
 public override void Dispose()
 {
     if (m_Dialog != null)
     {
         m_Dialog.Dispose();
         m_Dialog = null;
     }
 }
Пример #2
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window (ignored).</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog == null)
            {
                MessageBox.Show("IntersectUI.DialFinish - No dialog!");
                return(false);
            }

            PointFeature p = m_Dialog.Finish();

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

            // Get the controller to select the intersection point
            ISpatialSelection ss = new SpatialSelection((ISpatialObject)p);

            Controller.SetSelection(ss);

            m_Dialog.Dispose();
            m_Dialog = null;
            return(FinishCommand());
        }
Пример #3
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);
        }
Пример #4
0
 /// <summary>
 /// Initializes this UI (for use by constructors)
 /// </summary>
 void Initialize()
 {
     Debug.Assert(this.EditId != EditingActionId.Null);
     m_Dialog = null;
 }