Ejemplo n.º 1
0
        /// <summary>
        /// Tries to calculate the position of the parallel line.
        /// </summary>
        /// <returns>True if parallel positions calculated ok.</returns>
        bool Calculate()
        {
            // Ensure any previously defined end positions have been reset.
            m_Par1 = m_Par2 = null;

            // Can't do nothing if the reference line is undefined.
            if (m_Line == null)
            {
                return(false);
            }

            // Calculate the parallel points, depending on what sort of
            // observation we've got.
            IPosition sres = null;
            IPosition eres = null;
            bool      ok   = false;

            if (m_Offset != null)
            {
                ok = ParallelLineUI.Calculate(m_Line, m_Offset, out sres, out eres);
            }
            else if (m_OffsetPoint != null)
            {
                ok = ParallelLineUI.Calculate(m_Line, m_OffsetPoint, out sres, out eres);
            }

            // If the calculation succeeded, allocate vertices to hold the results we got.
            if (ok)
            {
                m_Par1 = sres;
                m_Par2 = eres;
            }

            return(ok);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates positions that are parallel to a line.
        /// </summary>
        /// <param name="line">The reference line.</param>
        /// <param name="offset">The observed offset (either a <c>Distance</c> or an <c>OffsetPoint</c>).</param>
        /// <param name="sres">The position of the start of the parallel.</param>
        /// <param name="eres">The position of the end of the parallel.</param>
        /// <returns>True if positions calculated ok</returns>
        internal static bool Calculate(LineFeature line, Observation offset, out IPosition sres, out IPosition eres)
        {
            sres = eres = null;

            // Can't calculate if there is insufficient data.
            if (line == null || offset == null)
            {
                return(false);
            }

            // Is it an observed distance?
            Distance dist = (offset as Distance);

            if (dist != null)
            {
                return(ParallelLineUI.Calculate(line, dist, out sres, out eres));
            }

            // The only other thing it could be is an offset point.
            OffsetPoint offPoint = (offset as OffsetPoint);

            if (offPoint != null)
            {
                PointFeature point = offPoint.Point;
                return(ParallelLineUI.Calculate(line, point, out sres, out eres));
            }

            MessageBox.Show("ParallelLineUI.Calculate - Unexpected sort of observation");
            return(false);
        }
Ejemplo n.º 3
0
        internal TerminalControl(ParallelLineUI cmd, bool isLast)
        {
            InitializeComponent();

            m_Cmd = cmd;
            m_IsLast = isLast;
            m_Line = null;
            m_Terminal = null;
        }
Ejemplo n.º 4
0
        private void LineParallel(IUserAction action)
        {
            try
            {
                IControlContainer cc = CreateContainer(action);
                CommandUI cmd = new ParallelLineUI(cc, action);
                m_Controller.StartCommand(cmd);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }