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); }
public static CKTree New(MKMapRect rect, int capacity) { CKTree tree = new CKTree(); tree.Root = CKNode.New(rect, capacity); return(tree); }
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); }
public static void Free(CKTree tree) { if (tree.Root != null) { CKNode.NodeFree(tree.Root); tree = null; } }
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); } }
public static void FindInRange(CKTree tree, MKMapRect range, Action <IMKAnnotation> find) { CKNode.GetInRange(tree.Root, range, find); }
public static void Remove(CKTree tree, MKAnnotation annotation) { CKNode.Remove(tree.Root, annotation); }
public static void Insert(CKTree tree, MKAnnotation annotation) { CKNode.Insert(tree.Root, annotation); }