Exemplo n.º 1
0
 /// <summary>
 /// Closes the shape if needed.
 /// </summary>
 protected void closeShapeIfNeeded()
 {
     if (!IsClosedShape(_polyline))
     {
         _polyline.AddLastPoint(_polyline.FirstPoint());
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether [is any point on segment and not ends] [the specified polyline].
        /// </summary>
        /// <param name="polyline">The polyline.</param>
        /// <returns><c>true</c> if [is any point on segment and not ends] [the specified polyline]; otherwise, <c>false</c>.</returns>
        public static bool IsJoiningPointOnAnotherSegment(PolyLine polyline)
        {
            CartesianCoordinate firstPoint = polyline.FirstPoint();
            CartesianCoordinate lastPoint  = polyline.LastPoint();

            for (int i = 1; i < polyline.CountSegments - 1; i++)
            {   // Loop is skipping first and last segments
                if (polyline[i] is LineSegment)
                {
                    LineSegment segment = (LineSegment)polyline[i];
                    if ((segment.IncludesCoordinate(firstPoint) &&
                         !PointIntersection.IsOnPoint(firstPoint, segment.I) &&
                         !PointIntersection.IsOnPoint(firstPoint, segment.J)) ||
                        (segment.IncludesCoordinate(lastPoint) &&
                         !PointIntersection.IsOnPoint(lastPoint, segment.I) &&
                         !PointIntersection.IsOnPoint(lastPoint, segment.J)))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Determines whether [is closed shape].
 /// </summary>
 /// <returns>System.Boolean.</returns>
 public static bool IsClosedShape(PolyLine polyline)
 {
     return(polyline.FirstPoint() == polyline.LastPoint());
 }