/// <summary> /// Handles the context menu "Specify ID" menuitem. /// </summary> /// <param name="action">The action that initiated this method call</param> internal void SpecifyId(IUserAction action) { // Ask the user for the point ID. GetKeyForm dial = new GetKeyForm("Specify Point ID"); if (dial.ShowDialog() == DialogResult.OK) { // Locate the point with the specified key string keyval = dial.Key; CadastralMapModel map = CadastralMapModel.Current; PointFeature point = new FindPointByIdQuery(map.Index, keyval).Result; if (point == null) { MessageBox.Show("Cannot find point with specified key"); } else { AppendToLine(point); } } dial.Dispose(); }
PointFeature GetPoint(TextBox textBox) { PointFeature point = null; // Return if the field is empty. string str = textBox.Text.Trim(); if (str.Length == 0) { return(null); } // Parse the ID value. uint idnum; if (!UInt32.TryParse(str, out idnum)) { MessageBox.Show("Invalid point ID"); textBox.Focus(); return(null); } // Ask the map to locate the address of the specified point. ISpatialIndex index = CadastralMapModel.Current.Index; point = new FindPointByIdQuery(index, str).Result; if (point == null) { MessageBox.Show("No point with specified key."); textBox.Focus(); return(null); } // Ensure the text is preceded with a "+" character. textBox.Text = String.Format("+{0}", point.FormattedKey); return(point); }
PointFeature GetPoint(TextBox textBox) { PointFeature point = null; // Return if the field is empty. string str = textBox.Text.Trim(); if (str.Length==0) return null; // Parse the ID value. uint idnum; if (!UInt32.TryParse(str, out idnum)) { MessageBox.Show("Invalid point ID"); textBox.Focus(); return null; } // Ask the map to locate the address of the specified point. ISpatialIndex index = CadastralMapModel.Current.Index; point = new FindPointByIdQuery(index, str).Result; if (point==null) { MessageBox.Show("No point with specified key."); textBox.Focus(); return null; } // Ensure the text is preceded with a "+" character. textBox.Text = String.Format("+{0}", point.FormattedKey); return point; }
/// <summary> /// Handles the context menu "Specify ID" menuitem. /// </summary> /// <param name="action">The action that initiated this method call</param> internal void SpecifyId(IUserAction action) { // Ask the user for the point ID. GetKeyForm dial = new GetKeyForm("Specify Point ID"); if (dial.ShowDialog() == DialogResult.OK) { // Locate the point with the specified key string keyval = dial.Key; CadastralMapModel map = CadastralMapModel.Current; PointFeature point = new FindPointByIdQuery(map.Index, keyval).Result; if (point==null) MessageBox.Show("Cannot find point with specified key"); else AppendToLine(point); } dial.Dispose(); }