コード例 #1
0
 /// <summary>
 /// Relational equality test.
 /// </summary>
 /// <param name="that">The offset to compare with</param>
 /// <returns>True if the offset distance (and direction) match (the units used
 /// to express the distance may be different).</returns>
 public bool Equals(OffsetDistance that)
 {
     return(m_IsLeft == that.m_IsLeft &&
            Math.Abs(m_Offset.Meters - that.m_Offset.Meters) < Constants.TINY);
 }
コード例 #2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="copy">The offset to copy</param>
 internal OffsetDistance(OffsetDistance copy)
 {
     m_Offset = new Distance(copy.m_Offset);
     m_IsLeft = copy.m_IsLeft;
 }
コード例 #3
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="copy">The offset to copy</param>
 internal OffsetDistance(OffsetDistance copy)
 {
     m_Offset = new Distance(copy.m_Offset);
     m_IsLeft = copy.m_IsLeft;
 }
コード例 #4
0
        /// <summary>
        /// Uses the currently displayed information to try to construct a
        /// direction object.
        /// </summary>
        /// <returns>The constructed direction (null if a direction cannot be created
        /// based on the information that's currently displayed)</returns>
        Direction GetCurrentDirection()
        {
            Direction result = null;

            // Get signed direction
            double srad = (m_IsClockwise ? m_Radians : -m_Radians);
            IAngle dir = new RadianValue(srad);

            if (m_Backsight!=null)
            {
                // If we have a backsight, we could either have a regular
                // angle or a deflection. To construct either, we need a
                // from-point as well.

                // Note that an angle of zero (passing through the backsight
                // or foresight) is fine.

                if (m_From!=null)
                {
                    if (m_IsDeflection)
                        result = new DeflectionDirection(m_Backsight, m_From, dir);
                    else
                        result = new AngleDirection(m_Backsight, m_From, dir);
                }
            }
            else if (m_From!=null)
            {
                // No backsight, so we could have either a bearing,
                // or a direction defined using 2 parallel points.
                // Since a bearing of zero is quite valid, we check
                // the dialog field to see if this is an entered value,
                // or just the initial value.

                if (m_Par1!=null && m_Par2!=null)
                    result = new ParallelDirection(m_From, m_Par1, m_Par2);
                else if (m_Radians > Constants.TINY || directionTextBox.Text.Length>0)
                    result = new BearingDirection(m_From, dir);
            }

            // If we haven't formed a direction, ignore any offset
            if (result==null)
                return null;

            // An offset could have been specified by a point, or by
            // entering a distance left or right of the direction.

            Offset offset = null;

            if (m_OffsetPoint!=null)
                offset = new OffsetPoint(m_OffsetPoint);
            else if (m_OffsetDistance!=null)
                offset = new OffsetDistance(m_OffsetDistance, !m_IsRight);

            // If we got an offset, include it in the direction.
            if (offset!=null)
                result.Offset = offset;

            return result;
        }
コード例 #5
0
 /// <summary>
 /// Relational equality test. 
 /// </summary>
 /// <param name="that">The offset to compare with</param>
 /// <returns>True if the offset distance (and direction) match (the units used
 /// to express the distance may be different).</returns>
 public bool Equals(OffsetDistance that)
 {
     return (m_IsLeft == that.m_IsLeft &&
             Math.Abs(m_Offset.Meters - that.m_Offset.Meters) < Constants.TINY);
 }