private void LineSubdivisionUpdateForm_Shown(object sender, EventArgs e) { // Get the object that was selected for update. Feature feat = m_UpdCmd.GetUpdate(); if (feat == null) { throw new InvalidOperationException("Unexpected update object"); } // Get the edit that created the primary face m_pop = (feat.Creator as LineSubdivisionOperation); Debug.Assert(m_pop != null); if (!m_pop.IsPrimaryFace) { m_pop = m_pop.OtherSide; Debug.Assert(m_pop != null); Debug.Assert(m_pop.IsPrimaryFace); } // Grab something we throw away if the user decides to cancel m_Face1 = CreateWorkingFace(m_pop.Face, true); m_Face2 = (m_pop.OtherSide == null ? null : CreateWorkingFace(m_pop.OtherSide.Face, false)); // If we have two faces, the "New Face" button means you want to switch to the other face. if (m_Face2 != null) { newFaceButton.Text = "&Other Face"; } // Default to the face containing the initially selected feature m_CurrentFace = (feat.Creator == m_pop ? m_Face1 : m_Face2); // If a line was selected, remember where it is in our working copy (and if it's actually on // the alternate face, make that the initial face for editing). m_SelectedLine = null; LineFeature selectedLine = (feat as LineFeature); if (selectedLine != null) { LineFeature[] sections = (m_CurrentFace == m_Face1 ? m_pop.Face.Sections : m_pop.OtherSide.Face.Sections); int lineIndex = Array.FindIndex <LineFeature>(sections, t => t == selectedLine); if (lineIndex >= 0) { m_SelectedLine = m_CurrentFace.Sections[lineIndex]; } } // Disable the option to flip annotation if annotation is currently invisible if (!EditingController.Current.AreLineAnnotationsDrawn) { flipDistButton.Enabled = false; } // Reload the list and repaint RefreshList(); }
private void UpdatePathForm_Shown(object sender, EventArgs e) { // Initialize radio buttons. insBeforeRadioButton.Checked = true; brkBeforeRadioButton.Checked = true; // Only let the user flip annotations if they're currently visible flipDistButton.Enabled = EditingController.Current.AreLineAnnotationsDrawn; // Display the precision of the connection path. PathInfo p = new PathInfo(m_pop.StartPoint, m_pop.EndPoint, GetLegs()); ShowPrecision(p); // A feature on the connection path should have been selected - determine which leg face it's part of LegFace face = null; Feature f = m_UpdCmd.GetUpdate(); if (f != null) { face = m_pop.GetLegFace(f); int faceIndex = GetFaceIndex(face.Sequence); SetCurrentFace(faceIndex); } if (m_CurFaceIndex < 0) { SetCurrentFace(0); } if (face == null) { Refresh(-1); } else { Refresh(face.GetIndex(f)); } }