Пример #1
0
 private void SetInViewStatus(RectangleF rect)
 {
     clsCadRect cadRect = new clsCadRect(rect.X, rect.Y, rect.Width, rect.Height);
     foreach (clsDisplayList l in mDisplayLists)
     {
         //Iterate in sets of 2
         for (int r = 0; r <= l.Points.Length - 2; r++)
         {
             l.InView = false;
             if (cadRect.IntersectsLine(l.Points[r], l.Points[r + 1]))
             {
                 l.InView = true;
                 break;
             }
         }
     }
 }
Пример #2
0
 //Returns the number of hits inside the referenced rectangle.
 private void GetSelectionHits(RectangleF rect)
 {
     int maxHits = 0;
     clsCadRect cadRect = new clsCadRect(rect.X, rect.Y, rect.Width, rect.Height);
     mSelectionHits.Clear();
     mSelectionHitLists.Clear();
     if (MotionBlocks.Count > 0)
     {
         foreach (clsDisplayList l in mDisplayLists)
         {
             if (l.InView)
             {
                 //Iterate in sets of 2
                 for (int r = 0; r <= l.Points.Length - 2; r++)
                 {
                     if (maxHits >= INT_MAXHITS) return;
                     if (cadRect.IntersectsLine(l.Points[r], l.Points[r + 1]))
                     {
                         mSelectionHits.Add(MotionBlocks[l.ParentIndex]);
                         mSelectionHitLists.Add(l);
                         maxHits += 1;
                         break; // TODO: might not be correct. Was : Exit For
                     }
                 }
             }
         }
     }
 }