/// <summary> /// Checks whether this selection refers to the same spatial objects as /// another selection, and has the same reference position. /// </summary> /// <param name="that">The selection to compare with</param> /// <returns>True if the two selections refer to the same spatial objects (not /// necessarily in the same order)</returns> public bool Equals(ISpatialSelection that) { // The same spatial objects have to be involved if (!SpatialSelection.Equals(this, that)) return false; // If both selections refer to the same divider (or null), they're the same Selection other = (that as Selection); if (other == null) return false; IDivider d1 = (this.m_Section == null ? null : this.m_Section.Divider); IDivider d2 = (other.m_Section == null ? null : other.m_Section.Divider); return Object.ReferenceEquals(d1, d2); }
/// <summary> /// Application idle handler gives editing commands the opportunity to re-paint /// any command-specific stuff. /// </summary> internal void OnIdle() { bool repaint = false; ISpatialDisplay display = ActiveDisplay; if (m_Inverse != null) { m_Inverse.Draw(); repaint = true; } if (m_Check != null) { m_Check.Render(display, DrawStyle); repaint = true; } if (m_Sel != null) { m_Sel.Render(display); repaint = true; } if (m_Sel != null || m_HasSelectionChanged) { SpatialSelection.Render(display, HighlightStyle); repaint = true; m_HasSelectionChanged = false; } if (m_Command != null && m_Command.PerformsPainting) { // Restoring the last draw here can cause flickering of the command-specific // stuff, so make it the responsibility of the command to call erase stuff. // (the main thing to ensure is that the call to RestoreLastDraw is made // only when the user has really made some sort of change). // m_Command.ActiveDisplay.RestoreLastDraw(); m_Command.Paint(null); repaint = true; } if (repaint) { display.PaintNow(); } }
/// <summary> /// Reacts to selection of the OK button in the dialog. /// </summary> /// <param name="wnd">The dialog window (ignored).</param> /// <returns></returns> internal override bool DialFinish(Control wnd) { if (m_Dialog == null) { MessageBox.Show("IntersectUI.DialFinish - No dialog!"); return(false); } PointFeature p = m_Dialog.Finish(); if (p == null) { return(false); } // Get the controller to select the intersection point ISpatialSelection ss = new SpatialSelection((ISpatialObject)p); Controller.SetSelection(ss); m_Dialog.Dispose(); m_Dialog = null; return(FinishCommand()); }
/// <summary> /// Reacts to selection of the OK button in the dialog. /// </summary> /// <param name="wnd">The dialog window (ignored).</param> /// <returns></returns> internal override bool DialFinish(Control wnd) { if (m_Dialog==null) { MessageBox.Show("IntersectUI.DialFinish - No dialog!"); return false; } PointFeature p = m_Dialog.Finish(); if (p==null) return false; // Get the controller to select the intersection point ISpatialSelection ss = new SpatialSelection((ISpatialObject)p); Controller.SetSelection(ss); m_Dialog.Dispose(); m_Dialog = null; return FinishCommand(); }