예제 #1
0
        public List <CKAnnotation> AnnotationsInRect(MKMapRect rect)
        {
            var result = new List <CKAnnotation>();

            if (rect.Spans180thMeridian)
            {
                CKTree.FindInRange(this.Tree, rect.Remainder(), (IMKAnnotation annotation) =>
                {
                    if (this.Delegate.AnnotationTree(this, (CKAnnotation)annotation))
                    {
                        result.Add((CKAnnotation)annotation);
                    }
                });

                rect = MKMapRect.Intersection(rect, new MKMapRect().World);
            }

            CKTree.FindInRange(this.Tree, rect, (IMKAnnotation annotation) =>
            {
                if (this.Delegate.AnnotationTree(this, (CKAnnotation)annotation))
                {
                    result.Add((CKAnnotation)annotation);
                }
            });

            return(result);
        }
예제 #2
0
        public static CKTree New(MKMapRect rect, int capacity)
        {
            CKTree tree = new CKTree();

            tree.Root = CKNode.New(rect, capacity);
            return(tree);
        }
예제 #3
0
        public static void Cleart(CKTree tree)
        {
            var bound    = tree.Root.Bound;
            var capacity = tree.Root.Capacity;

            CKNode.NodeFree(tree.Root);
            tree.Root = CKNode.New(bound, capacity);
        }
예제 #4
0
 public static void Free(CKTree tree)
 {
     if (tree.Root != null)
     {
         CKNode.NodeFree(tree.Root);
         tree = null;
     }
 }
예제 #5
0
        public CKQuadTree(List <CKAnnotation> annotations)
        {
            this.Annotations = annotations;
            this.Tree        = CKTree.New(new MKMapRect().World, 4);

            foreach (var annotation in this.Annotations)
            {
                CKTree.Insert(this.Tree, annotation);
            }
        }
예제 #6
0
 public static void FindInRange(CKTree tree, MKMapRect range, Action <IMKAnnotation> find)
 {
     CKNode.GetInRange(tree.Root, range, find);
 }
예제 #7
0
 public static void Remove(CKTree tree, MKAnnotation annotation)
 {
     CKNode.Remove(tree.Root, annotation);
 }
예제 #8
0
 public static void Insert(CKTree tree, MKAnnotation annotation)
 {
     CKNode.Insert(tree.Root, annotation);
 }