Пример #1
0
            public int Compare(IntervalRTreeNode <T> n1, IntervalRTreeNode <T> n2)
            {
                double mid1 = (n1.Min + n1.Max) / 2;
                double mid2 = (n2.Min + n2.Max) / 2;

                if (mid1 < mid2)
                {
                    return(-1);
                }
                if (mid1 > mid2)
                {
                    return(1);
                }
                return(0);
            }
Пример #2
0
 private void Init()
 {
     //1st check
     if (_root != null)
     {
         return;
     }
     lock (_leavesLock)
     {
         //2nd check
         if (_root == null)
         {
             _root = BuildTree();
         }
     }
 }
Пример #3
0
 private void PrintNode(IntervalRTreeNode <T> node, int level)
 {
     Console.WriteLine(WKTWriter.ToLineString(new Coordinate(node.Min, level), new Coordinate(node.Max, level)));
 }
Пример #4
0
 public IntervalRTreeBranchNode(IntervalRTreeNode <T> n1, IntervalRTreeNode <T> n2)
 {
     _node1 = n1;
     _node2 = n2;
     BuildExtent(_node1, _node2);
 }
Пример #5
0
 private void BuildExtent(IntervalRTreeNode <T> n1, IntervalRTreeNode <T> n2)
 {
     Min = Math.Min(n1.Min, n2.Min);
     Max = Math.Max(n1.Max, n2.Max);
 }