private void AttachPointForm_Shown(object sender, EventArgs e) { // Load the entity combo box with a list for point features. m_PointType = entityTypeComboBox.Load(SpatialType.Point); // The option to make the selected type the default for // this command is ALWAYS set by default defaultCheckBox.Checked = true; // If there is a default entity for this command (on the // current editing layer), select that instead & disable // the corresponding checkbox int entId = ReadDefaultPointEntityTypeId(); if (entId > 0) { IEntity ent = EnvironmentContainer.FindEntityById(entId); if (ent != null) { entityTypeComboBox.SelectEntity(ent); defaultCheckBox.Enabled = false; m_PointType = ent; } } // Check auto-repeat option (default is to repeat) int repeat = GlobalUserSetting.ReadInt(REPEAT_KEY, 1); m_Repeat = (repeat != 0); repeatCheckBox.Checked = m_Repeat; }
private void addToMapButton_Click(object sender, EventArgs e) { // Return if there is nothing to add. ControlPoint[] cps = GetSavePoints(); if (cps.Length == 0) { MessageBox.Show("There is nothing to add."); return; } try { // Hide this dialog. If you don't, the entity type dialog that's about to get // displayed may be obscured, and there's no way to close it. this.Hide(); // Do we have an entity type for control points? // This was formerly obtained via the environment variable called CED$ControlEntity int entId = GlobalUserSetting.ReadInt("ControlEntityTypeId", 0); // Get the desired entity type. GetEntityForm dial = new GetEntityForm(m_Cmd.ActiveLayer, SpatialType.Point, entId); dial.ShowDialog(); IEntity ent = dial.SelectedEntity; if (ent == null) { throw new Exception("An entity type must be specified"); } // Remember the ID of the selected entity type GlobalUserSetting.WriteInt("ControlEntityTypeId", ent.Id); // Save the control. Save(cps, ent); // Issue a warning message if points are not currently displayed if (!m_Cmd.ArePointsDrawn()) { MessageBox.Show("Points will not be drawn at the current scale."); } m_Cmd.DialFinish(this); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Show(); } }
bool SaveSymbologyPage(CadastralMapModel cmm) { int symScale; if (!Int32.TryParse(symScaleTextBox.Text, out symScale) || symScale < 0) { tabControl.SelectedTab = SymbologyTabPage; symScaleTextBox.Focus(); MessageBox.Show("Threshold scale for symbology is not valid"); return(false); } GlobalUserSetting.WriteInt("SymbologyScale", symScale); return(true); }
private void browseButton_Click(object sender, EventArgs e) { OpenFileDialog dial = new OpenFileDialog(); dial.Filter = "Control files (*.utm)|*.utm|Text files (*.txt)|*.txt|All Files (*.*)|*.*"; dial.DefaultExt = "utm"; dial.Title = "Pick Control File"; // If the user picked a file, display it, and set focus // to the list of control points. if (dial.ShowDialog() == DialogResult.OK) { controlFileTextBox.Text = dial.FileName; controlTextBox.Focus(); GlobalUserSetting.Write("ControlFile", dial.FileName); } }
private void okButton_Click(object sender, EventArgs e) { // Get the selected point type. m_PointType = entityTypeComboBox.SelectedEntityType; // Ensure the currently selected repeat option is saved in the registry if (defaultCheckBox.Checked) { WriteDefaultPointEntityTypeId(m_PointType); } // Ensure the auto-repeat option is saved too m_Repeat = repeatCheckBox.Checked; GlobalUserSetting.WriteInt(REPEAT_KEY, (m_Repeat ? 1 : 0)); this.DialogResult = DialogResult.OK; Close(); }
private void GetControlForm_Shown(object sender, EventArgs e) { // Remember whether the map starts out empty. We do this here because // CadastralMapModel.IsEmpty works by checking whether the map's // window is defined. Since we may also set the extent, we could not // subsequently get a correct answer as to whether the map already // contains data. m_NewMap = CadastralMapModel.Current.IsEmpty; // Initialize the file spec of the control file, based on the corresponding registry entry. // (formerly environment variable CED$ControlFile) string cfile = GlobalUserSetting.Read("ControlFile"); if (!String.IsNullOrEmpty(cfile) && File.Exists(cfile)) { controlFileTextBox.Text = cfile; controlTextBox.Focus(); } }
void ShowSymbologyPage(CadastralMapModel cmm) { int symScale = GlobalUserSetting.ReadInt("SymbologyScale", 5000); symScaleTextBox.Text = String.Format("{0:F0}", symScale); }
void WriteDefaultPointEntityTypeId(IEntity e) { string key = GetDefaultPointEntityTypeIdKey(); GlobalUserSetting.WriteInt(key, e.Id); }
int ReadDefaultPointEntityTypeId() { string key = GetDefaultPointEntityTypeIdKey(); return(GlobalUserSetting.ReadInt(key, 0)); }
private void FileCheckForm_Shown(object sender, EventArgs e) { // Get default options from the registry. string regstr = GlobalUserSetting.Read("FileCheck"); if (String.IsNullOrEmpty(regstr)) { regstr = CheckItem.GetAllCheckLetters(); } // Convert to option flags m_Options = CheckItem.GetOptions(regstr); // Set check marks beside all the selected options. foreach (char c in regstr) { CheckType check = CheckItem.GetOption(c); CheckBox cb = null; if (check == CheckType.SmallLine) { cb = smallLineCheckBox; } else if (check == CheckType.Dangle) { cb = danglingCheckBox; } else if (check == CheckType.Overlap) { cb = overlapCheckBox; } else if (check == CheckType.Floating) { cb = floatingCheckBox; } else if (check == CheckType.Bridge) { cb = bridgeCheckBox; } else if (check == CheckType.SmallPolygon) { cb = smallPolygonCheckBox; } else if (check == CheckType.NotEnclosed) { cb = notEnclosedCheckBox; } else if (check == CheckType.NoLabel) { cb = noLabelCheckBox; } else if (check == CheckType.NoPolygonForLabel) { cb = noPolygonForLabelCheckBox; } else if (check == CheckType.NoAttributes) { cb = noAttributesCheckBox; } else if (check == CheckType.MultiLabel) { cb = multiLabelCheckBox; } if (cb != null) { cb.Checked = true; } } }
private void okButton_Click(object sender, EventArgs e) { // Pick up the checked items. CheckType checks = CheckType.Null; if (smallLineCheckBox.Checked) { checks |= CheckType.SmallLine; } if (danglingCheckBox.Checked) { checks |= CheckType.Dangle; } if (overlapCheckBox.Checked) { checks |= CheckType.Overlap; } if (floatingCheckBox.Checked) { checks |= CheckType.Floating; } if (bridgeCheckBox.Checked) { checks |= CheckType.Bridge; } if (smallPolygonCheckBox.Checked) { checks |= CheckType.SmallPolygon; } if (notEnclosedCheckBox.Checked) { checks |= CheckType.NotEnclosed; } if (noLabelCheckBox.Checked) { checks |= CheckType.NoLabel; } if (noPolygonForLabelCheckBox.Checked) { checks |= CheckType.NoPolygonForLabel; } if (noAttributesCheckBox.Checked) { checks |= CheckType.NoAttributes; } if (multiLabelCheckBox.Checked) { checks |= CheckType.MultiLabel; } // Hold options in the registry. string regstr = CheckItem.GetCheckLetters(checks); GlobalUserSetting.Write("FileCheck", regstr); // Remember the selected options m_Options = checks; this.DialogResult = DialogResult.OK; Close(); }