示例#1
0
 private static void GetAll(RTreeMemoryIndex <T> .Node node, HashSet <T> result)
 {
     if (node.Children is List <RTreeMemoryIndex <T> .Node> )
     {
         List <RTreeMemoryIndex <T> .Node> children = node.Children as List <RTreeMemoryIndex <T> .Node>;
         for (int index = 0; index < children.Count; ++index)
         {
             RTreeMemoryIndex <T> .GetAll(children[index], result);
         }
     }
     else
     {
         List <T> children = node.Children as List <T>;
         if (children == null)
         {
             return;
         }
         for (int index = 0; index < node.Children.Count; ++index)
         {
             result.Add(children[index]);
         }
     }
 }
示例#2
0
 /// <summary>
 /// Fills the collection with data.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="box"></param>
 /// <param name="result"></param>
 private static void Get(Node node, BoxF2D box, HashSet <T> result)
 {
     if (node.Children is List <Node> )
     {
         var children = (node.Children as List <Node>);
         for (int idx = 0; idx < children.Count; idx++)
         {
             if (box.Overlaps(node.Boxes[idx]))
             {
                 if (box.Contains(node.Boxes[idx]))
                 { // add all the data from the child.
                     RTreeMemoryIndex <T> .GetAll(children[idx],
                                                  result);
                 }
                 else
                 { // add the data from the child.
                     RTreeMemoryIndex <T> .Get(children[idx],
                                               box, result);
                 }
             }
         }
     }
     else
     {
         var children = (node.Children as List <T>);
         if (children != null)
         { // the children are of the data type.
             for (int idx = 0; idx < node.Children.Count; idx++)
             {
                 if (node.Boxes[idx].Overlaps(box))
                 {
                     result.Add(children[idx]);
                 }
             }
         }
     }
 }
示例#3
0
 /// <summary>
 /// Fills the collection with data.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="result"></param>
 private static void GetAll(Node node, HashSet <T> result)
 {
     if (node.Children is List <Node> )
     {
         var children = (node.Children as List <Node>);
         for (int idx = 0; idx < children.Count; idx++)
         {
             // add all the data from the child.
             RTreeMemoryIndex <T> .GetAll(children[idx],
                                          result);
         }
     }
     else
     {
         var children = (node.Children as List <T>);
         if (children != null)
         { // the children are of the data type.
             for (int idx = 0; idx < node.Children.Count; idx++)
             {
                 result.Add(children[idx]);
             }
         }
     }
 }
示例#4
0
 private static void Get(RTreeMemoryIndex <T> .Node node, BoxF2D box, HashSet <T> result)
 {
     if (node.Children is List <RTreeMemoryIndex <T> .Node> )
     {
         List <RTreeMemoryIndex <T> .Node> children = node.Children as List <RTreeMemoryIndex <T> .Node>;
         for (int index = 0; index < children.Count; ++index)
         {
             if (box.Overlaps(node.Boxes[index]))
             {
                 if (box.Contains(node.Boxes[index]))
                 {
                     RTreeMemoryIndex <T> .GetAll(children[index], result);
                 }
                 else
                 {
                     RTreeMemoryIndex <T> .Get(children[index], box, result);
                 }
             }
         }
     }
     else
     {
         List <T> children = node.Children as List <T>;
         if (children == null)
         {
             return;
         }
         for (int index = 0; index < node.Children.Count; ++index)
         {
             if (node.Boxes[index].Overlaps(box))
             {
                 result.Add(children[index]);
             }
         }
     }
 }