internal override int getSegmentIndex(PointF p)
    {
      int Value = -1;

      for (int i = 0; i < shapeSegments.Count; ++i)
      {
        Segment s = (Segment)shapeSegments[i];
        if (s.distanceToPoint(p) < distanceToLine)
        {
          saveSegment = s;
          saveStartPoint = s.GetStartPoint();
          saveEndPoint = s.GetEndPoint();
          saveIndex = i;
          Value = i;
          break;
        }
      }
      return Value;
    }
Exemple #2
0
// Constructor
		public PolyLine(Segment init)
		{
            shapeSegments = new ArrayList();
            shapeSegments.Add(init);
        }
 internal override bool hitTest(PointF p)
 {
   for (int i = 0; i < shapeSegments.Count; ++i)
   {
     Segment s1 = (Segment)shapeSegments[i];
     Segment s2 = (Segment)shapeSegments[(i + 1) % shapeSegments.Count];
     if (s1.hitTest(p))
     {
       if (!s1.checkCommonPointStart() && !s1.checkCommonPointEnd() && showPoints)
       {
         currSegment = s1;
         belongSegment = null;
         return true;
       }
       else
         if (s1.checkCommonPointEnd() && s2.hitTest(p) && showPoints)
         {
           currSegment = s1;
           belongSegment = s2;
           return true;
         }
     }
   }
   return false;
 }