Exemplo n.º 1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            if (m_Line != null && m_Length.IsDefined)
            {
                // The observed length can't be too long.
                if (m_Length.Meters > m_MaxLength)
                {
                    MessageBox.Show("Observed distance is longer than the length of the line.");
                    return;
                }

                m_Cmd.DialFinish(this);
            }
            else
            {
                if (m_Line == null)
                {
                    MessageBox.Show("The line to subdivide has not been specified.");
                }
                else
                {
                    MessageBox.Show("The distance to the split point has not been specified.");
                }
            }
        }
Exemplo n.º 2
0
        private void okButton_Click(object sender, EventArgs e)
        {
            // The offset may not be defined (user may be trying to get rid
            // of a previously defined offset).

            m_Cmd.DialFinish(this);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Handles click on the wizard Finish button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void wizard_Finish(object sender, EventArgs e)
 {
     // The call to IntersectUI.DialFinish will usually lead to a call
     // to the Finish method below. It won't if we're doing an update.
     if (m_Cmd != null && m_Cmd.DialFinish(null))
     {
         m_Cmd = null;
     }
 }
Exemplo n.º 4
0
        private void nextButton_Click(object sender, EventArgs e)
        {
            // An offset distance or offset point must be defined.

            if (m_Offset != null || m_Point != null)
            {
                // Finish the command.
                m_Cmd.DialFinish(this);
            }
            else
            {
                MessageBox.Show("The parallel offset has not been specified.");
                offsetTextBox.Focus();
            }
        }
Exemplo n.º 5
0
 private void okButton_Click(object sender, EventArgs e)
 {
     if (m_Center != null && m_Radius != null)
     {
         m_Cmd.DialFinish(this);
     }
     else
     {
         if (m_Center == null)
         {
             MessageBox.Show("Center point has not been specified.");
         }
         else
         {
             MessageBox.Show("Radius has not been specified.");
         }
     }
 }
Exemplo n.º 6
0
 private void okButton_Click(object sender, EventArgs e)
 {
     if (m_ExtendLine != null && m_Length.IsDefined)
     {
         m_Cmd.DialFinish(this);
     }
     else
     {
         if (m_ExtendLine == null)
         {
             MessageBox.Show("The line to extend has not been specified.");
         }
         else
         {
             MessageBox.Show("The length of the extension has not been specified.");
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog. This will forward to
        /// the current update command if one is running (otherwise it does nothing).
        /// </summary>
        /// <param name="wnd">The dialog window</param>
        /// <returns>True if an update command was in progress and it finished ok.</returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Cmd == null)
            {
                return(false);
            }
            else
            {
                try
                {
                    m_IsFinishing = true; // see comment in OnSelectPoint
                    return(m_Cmd.DialFinish(wnd));
                }

                finally
                {
                    m_IsFinishing = false;
                }
            }
        }
Exemplo n.º 8
0
 private void okButton_Click(object sender, EventArgs e)
 {
     m_Cmd.DialFinish(this);
 }
Exemplo n.º 9
0
        private void okButton_Click(object sender, EventArgs e)
        {
            // Get the northing & easting.
            double y;

            if (!Double.TryParse(northingTextBox.Text, out y))
            {
                MessageBox.Show("Bad northing");
                northingTextBox.Focus();
                return;
            }

            double x;

            if (!Double.TryParse(eastingTextBox.Text, out x))
            {
                MessageBox.Show("Bad easting");
                eastingTextBox.Focus();
                return;
            }

            if (Math.Abs(x) < Double.Epsilon || Math.Abs(y) < Double.Epsilon)
            {
                MessageBox.Show("Position has not been specified.");
                return;
            }

            // See if there is an elevation (get 0.0 if not).
            double z = 0.0;

            if (elevationTextBox.Text.Length > 0)
            {
                if (!Double.TryParse(elevationTextBox.Text, out z))
                {
                    MessageBox.Show("Bad elevation");
                    elevationTextBox.Focus();
                    return;
                }
            }

            m_Position  = new Position(x, y);
            m_Elevation = z;

            // Check whether the position is on screen. If not, issue a warning
            // message, and let the user cancel if desired.
            ISpatialDisplay display = EditingController.Current.ActiveDisplay;
            IWindow         extent  = display.Extent;

            if (extent == null || !extent.IsOverlap(m_Position))
            {
                if (MessageBox.Show("Specified position does not overlap current draw window. Continue?",
                                    "Off screen", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }

            // Are we doing an update?
            PointFeature pupt = this.UpdatePoint;

            // Confirm that there is no selectable point already at the specified position. Allow
            // a tolerance of 1cm on the ground. Only check in 2D.
            // The seatch should be restricted to those points that are currently visible.

            CadastralMapModel map   = CadastralMapModel.Current;
            ILength           tol   = new Length(0.01);
            PointFeature      close = (PointFeature)map.QueryClosest(m_Position, tol, SpatialType.Point);

            if (close != null)
            {
                // Get the ground distance between the existing point & the new one.
                double dist = Geom.Distance(m_Position, close);

                // Confirm if the points are coincident. Unless we're doing an update,
                // and it's the one we're doing.

                if (pupt == null || !Object.ReferenceEquals(close, pupt))
                {
                    if (dist < Constants.TINY)
                    {
                        string msg = String.Format("Specified position coincides with existing point {0}. Continue?",
                                                   close.FormattedKey);
                        if (MessageBox.Show(msg, "Coincident point", MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }
                    else
                    {
                        string msg = String.Format("Specified position is only {0:0.000} metres away from point {1}. Continue?",
                                                   dist, close.FormattedKey);

                        if (MessageBox.Show(msg, "Very near another point", MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
            }

            // If we're updating a 3D position, update ONLY the elevation
            // now. We must leave the planimetric change to NewPointUI,
            // since it is in charge of controlling rollforward.

            if (pupt != null)
            {
                // For the time being, we do not provide the ability to change
                // a 2D location into a 3D one. Would need to modify the location,
                // thereby changing its address (or possibly create a duplicate
                // location in XY, although that could cause problems elsewhere).


                if (m_Elevation > Constants.TINY && !(pupt is IEditPosition3D))
                {
                    MessageBox.Show("Cannot convert a 2D point into 3D");
                    return;
                }

                // The point MUST be associated with a creating operation (either
                // a eNewPoint or a GetControl operation).
                Operation creator = (Operation)pupt.Creator;
                if (creator == null)
                {
                    MessageBox.Show("Point cannot be updated because it has no associated edit.");
                    return;
                }

                if (!(creator.EditId == EditingActionId.NewPoint ||
                      creator.EditId == EditingActionId.GetControl))
                {
                    MessageBox.Show("Unexpected editing operation");
                    return;
                }

                // Define new elevation if we have a 3D location.
                if (m_Elevation > Constants.TINY)
                {
                    IEditPosition3D p3D = (pupt as IEditPosition3D);
                    if (p3D == null)
                    {
                        MessageBox.Show("Unable to assign elevation");
                    }
                    else
                    {
                        p3D.Z = m_Elevation;
                    }
                }
            }

            m_Cmd.DialFinish(this);
        }