Ejemplo n.º 1
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_ParDial!=null || m_TermDial1!=null || m_TermDial2!=null)
                throw new Exception("ParallelLineUI.Run - Command is already running.");

            // If we're doing an update, get the reference line from the original op.
            ParallelLineOperation op = null;
            UpdateUI up = this.Update;

            if (up!=null)
            {
                op = (up.GetOp() as ParallelLineOperation);
                if (op==null)
                    throw new Exception("ParallelLineUI.Run - Unexpected edit type.");

                // Pick up the line that acted as the reference line.
                m_Line = op.ReferenceLine;
            }

            // If it wasn't an update, we might be recalling an old op.
            if (op==null)
                op = (this.Recall as ParallelLineOperation);

            // Get old observations if necessary.
            if (op!=null)
            {
                // Pick up the offset.
                Observation offset = op.Offset;

                // Is it an observed distance?
                Distance dist = (offset as Distance);
                if (dist!=null)
                    m_Offset = new Distance(dist);
                else
                {
                    // The only other thing it could be is an offset point.
                    OffsetPoint offPoint = (offset as OffsetPoint);
                    if (offPoint!=null)
                        m_OffsetPoint = offPoint.Point;
                }

                m_IsReversed = op.IsArcReversed;
                m_TermLine1 = op.Terminal1;
                m_TermLine2 = op.Terminal2;

                // Ensure the reference line has been selected/highlighted (this may end up
                // calling OnSelectLine)
                EditingController.Current.Select(m_Line);

                // Calculate stuff & paint what we've got.
                Calculate();
                Paint(null);
            }

            // Create modeless dialog.

            if (up!=null)
                m_ParDial = new ParallelControl(up);
            else
                m_ParDial = new ParallelControl(this);

            this.Container.Display(m_ParDial);
            return true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Destroys any dialogs that are currently displayed.
        /// </summary>
        void KillDialogs()
        {
            this.Container.Clear();

            if (m_ParDial!=null)
            {
                m_ParDial.Dispose();
                m_ParDial = null;
            }

            if (m_TermDial1!=null)
            {
                m_TermDial1.Dispose();
                m_TermDial1 = null;
            }

            if (m_TermDial2!=null)
            {
                m_TermDial2.Dispose();
                m_TermDial2 = null;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes everything with null values. For used by constructors.
 /// </summary>
 void SetZeroValues()
 {
     m_Line = null;
     m_ParDial = null;
     m_Offset = null;
     m_OffsetPoint = null;
     m_IsReversed = false;
     m_TermDial1 = null;
     m_TermLine1 = null;
     m_TermDial2 = null;
     m_TermLine2 = null;
     m_Par1 = null;
     m_Par2 = null;
     m_Term1 = null;
     m_Term2 = null;
 }