示例#1
0
        /// <summary>
        /// Method that sets <see cref="holeType"/> based on the distance between the top and the bottom of the hole.<para />
        /// Note: The difference between the hole's coordinates is found using <see cref="Math.Abs(double)"/> which will throw an exception if applied to <see cref="Int32.MinValue"/> as the number is
        /// outside the range of possible positive numbers.<para />
        ///
        /// Assumption: Type is given by the difference of either the X or Y coordinates<para />
        /// Assumption: Let the difference betwen the holes X or Y coordinate be d. If d &lt;=1 hole is Vertical, if 1 &lt; d &lt; 5 hole is Slanted, otherwise it's Horizontal<para />
        /// </summary>
        /// <param name="top">The Point defining the top of the hole</param>
        /// <param name="bottom">The Point defining the bottom of the hole</param>
        public void SetHoleType(Point top, Point bottom)
        {
            int difX = Math.Abs(top.x - bottom.x); //Will fail if on Int32.MinValue
            int difY = Math.Abs(top.y - bottom.y); //Will fail if on Int32.MinValue

            if (difX >= 5 || difY >= 5)
            {
                holeType = HoleTypes.Horizontal;
            }
            else if ((difX > 1 && difX < 5) || (difY > 1 && difY < 5))
            {
                holeType = HoleTypes.Slanted;
            }
            else
            {
                holeType = HoleTypes.Vertical;
            }
        }
示例#2
0
 void set_hole_type(HoleTypes value)
 {
     hole_type = value; mark_dirty(true, true);
 }