public void EnumerateAnnotationsInBox(FBBoundingBox box, FBQuadTreeNode withNode, AnnotationEnumDelegate enumFunc) { if (!FBUtils.FBBoundingBoxIntersectsBoundingBox(withNode.BoundingBox, box)) { return; } List <IMKAnnotation> tempArray = new List <IMKAnnotation>(withNode.Annotations); foreach (IMKAnnotation annotation in tempArray) { if (FBUtils.FBBoundingBoxContainsCoordinate(box, annotation.Coordinate)) { enumFunc(annotation); } } if (withNode.IsLeaf()) { return; } EnumerateAnnotationsInBox(box, withNode.NorthEast, enumFunc); EnumerateAnnotationsInBox(box, withNode.NorthWest, enumFunc); EnumerateAnnotationsInBox(box, withNode.SouthEast, enumFunc); EnumerateAnnotationsInBox(box, withNode.SouthWest, enumFunc); }
public bool InsertAnnotation(IMKAnnotation annotation, FBQuadTreeNode toNode) { if (!FBUtils.FBBoundingBoxContainsCoordinate(toNode.BoundingBox, annotation.Coordinate)) { return(false); } if (toNode.Count < FBConsts.kNodeCapacity) { toNode.Annotations.Add(annotation); toNode.Count++; return(true); } if (toNode.IsLeaf()) { toNode.Subdivide(); } if (InsertAnnotation(annotation, toNode.NorthEast)) { return(true); } if (InsertAnnotation(annotation, toNode.NorthWest)) { return(true); } if (InsertAnnotation(annotation, toNode.SouthEast)) { return(true); } if (InsertAnnotation(annotation, toNode.SouthWest)) { return(true); } return(false); }
public bool InsertAnnotation(IMKAnnotation annotation, FBQuadTreeNode toNode) { if (!FBUtils.FBBoundingBoxContainsCoordinate(toNode.BoundingBox, annotation.Coordinate)) { return false; } if (toNode.Count < FBConsts.kNodeCapacity) { toNode.Annotations.Add(annotation); toNode.Count++; return true; } if (toNode.IsLeaf()) { toNode.Subdivide(); } if (InsertAnnotation(annotation, toNode.NorthEast)) return true; if (InsertAnnotation(annotation, toNode.NorthWest)) return true; if (InsertAnnotation(annotation, toNode.SouthEast)) return true; if (InsertAnnotation(annotation, toNode.SouthWest)) return true; return false; }
public void EnumerateAnnotationsInBox(FBBoundingBox box, FBQuadTreeNode withNode, AnnotationEnumDelegate enumFunc) { if (!FBUtils.FBBoundingBoxIntersectsBoundingBox(withNode.BoundingBox, box)) { return; } List<IMKAnnotation> tempArray = new List<IMKAnnotation>(withNode.Annotations); foreach (IMKAnnotation annotation in tempArray) { if (FBUtils.FBBoundingBoxContainsCoordinate(box, annotation.Coordinate)) { enumFunc(annotation); } } if (withNode.IsLeaf()) { return; } EnumerateAnnotationsInBox(box, withNode.NorthEast, enumFunc); EnumerateAnnotationsInBox(box, withNode.NorthWest, enumFunc); EnumerateAnnotationsInBox(box, withNode.SouthEast, enumFunc); EnumerateAnnotationsInBox(box, withNode.SouthWest, enumFunc); }