Ejemplo n.º 1
0
        public static bool Insert(CKNode node, MKAnnotation annotation)
        {
            var point = MKMapPoint.FromCoordinate(annotation.Coordinate);

            if (!node.Bound.Contains(point))
            {
                return(false);
            }

            if (node.Count < node.Capacity)
            {
                CKPoint tPoint = new CKPoint();
                tPoint.Annotation = annotation;
                tPoint.Point      = point;
                CKNode.Add(node, tPoint);
                return(true);
            }

            if (node.NW == null)
            {
                CKNode.Subdivide(node);
            }

            if (CKNode.Insert(node.NW, annotation))
            {
                return(true);
            }

            if (CKNode.Insert(node.NE, annotation))
            {
                return(true);
            }

            if (CKNode.Insert(node.SW, annotation))
            {
                return(true);
            }

            if (CKNode.Insert(node.SE, annotation))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 public static void Insert(CKTree tree, MKAnnotation annotation)
 {
     CKNode.Insert(tree.Root, annotation);
 }