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(); } }
void SetDefaultEntity(SpatialType t) { ILayer layer = ActiveLayer; if (layer==null) return; IEntity e = CadastralMapModel.Current.GetDefaultEntity(t); int entId = (e == null ? 0 : e.Id); GetEntityForm dial = new GetEntityForm(layer, t, entId); if (dial.ShowDialog() == DialogResult.OK) { e = dial.SelectedEntity; CadastralMapModel.Current.SetDefaultEntity(t, e); } dial.Dispose(); }
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(); } }