internal void Draw() { ISpatialDisplay display = m_Cmd.ActiveDisplay; // If we're doing an update, draw the original split point in grey. SimpleLineSubdivisionOperation pop = UpdateOp; if (pop != null) { PointFeature point = pop.NewPoint; if (point != null) { point.Draw(display, Color.Gray); } } // Ensure the line that's being subdivided is still highlighted IDrawStyle style = EditingController.Current.HighlightStyle; m_Line.Render(display, style); // Calculate the position of the split point. IPosition splitpos = SimpleLineSubdivisionOperation.Calculate(m_Line, m_Length, m_IsFromEnd); if (splitpos != null) { style = EditingController.Current.Style(Color.Magenta); style.Render(display, splitpos); } }
/// <summary> /// Reacts to selection of the OK button in the dialog. /// </summary> /// <param name="wnd">The dialog window. If this matches the dialog that /// this command knows about, the command will be executed (and, on success, /// the dialog will be destroyed). If it's some other window, it must /// be a sub-dialog created by our guy, so let it handle the request.</param> /// <returns></returns> internal override bool DialFinish(Control wnd) { if (m_Dialog == null) { MessageBox.Show("SimpleLineSubdivisionUI.DialFinish - No dialog!"); return(false); } // De-select the line that's being split Controller.ClearSelection(); // Get info from the dialog. m_Length = m_Dialog.Length; // If we are doing an update, alter the original operation. UpdateUI up = this.Update; if (up != null) { // Get the original operation. SimpleLineSubdivisionOperation pop = (up.GetOp() as SimpleLineSubdivisionOperation); if (pop == null) { MessageBox.Show("SimpleLineSubdivisionUI.DialFinish - Unexpected edit type."); return(false); } // Remember the changes as part of the UI object (the original edit remains // unchanged for now) UpdateItemCollection changes = pop.GetUpdateItems(m_Length, m_Dialog.IsFromEnd); if (!up.AddUpdate(pop, changes)) { return(false); } } else { // Execute the edit SimpleLineSubdivisionOperation op = null; try { op = new SimpleLineSubdivisionOperation(m_Line, m_Length, m_Dialog.IsFromEnd); op.Execute(); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); return(false); } } // Destroy the dialog(s). KillDialogs(); // Get the base class to finish up. return(FinishCommand()); }
bool InitUpdate() { // Get the creating op. SimpleLineSubdivisionOperation pop = this.UpdateOp; if (pop == null) { return(false); } Form parent = ParentForm; parent.Text = "Update Line Subdivision"; m_Line = pop.Line; m_Length = new Distance(pop.Distance); m_IsFromEnd = pop.IsFromEnd; return(true); }
internal SimpleLineSubdivisionControl(SimpleLineSubdivisionUI cmd, LineFeature line, Operation recall) { InitializeComponent(); m_Cmd = cmd; m_Line = line; m_MaxLength = 0.0; SimpleLineSubdivisionOperation op = (recall as SimpleLineSubdivisionOperation); if (op != null) { m_Length = new Distance(op.Distance); m_IsFromEnd = op.IsFromEnd; } else { m_Length = new Distance(); m_IsFromEnd = false; } }