X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fquadtree.h;h=4fd4b2d6b8decdfd90ade563871b746d44d7db27;hp=61f0a1be8d967e5bc8c2407eb6903f8ef4f8aab0;hb=f28146cf72fc68c8d3690814b1f89d47b8c4e7b9;hpb=b2d6929dfb8cd94c0447b350c9bafaa573a4a834 diff --git a/src/quadtree.h b/src/quadtree.h index 61f0a1b..4fd4b2d 100644 --- a/src/quadtree.h +++ b/src/quadtree.h @@ -13,6 +13,7 @@ namespace IPDF typedef int QuadTreeIndex; static const QuadTreeIndex QUADTREE_EMPTY = -1; + class Document; enum QuadTreeNodeChildren { @@ -39,6 +40,10 @@ namespace IPDF unsigned object_begin; // Last object in the node. unsigned object_end; + // Linked list of "extra" nodes + QuadTreeIndex next_overlay; + // First object which has not yet been propagated to extant children/parent. + unsigned object_dirty; }; struct QuadTree @@ -46,10 +51,15 @@ namespace IPDF QuadTree() : root_id(QUADTREE_EMPTY) {} QuadTreeIndex root_id; std::vector nodes; + + QuadTreeIndex GetNeighbour(QuadTreeIndex start, int xdir, int ydir, Document *doc) const; + void GetCanonicalCoords(QuadTreeIndex& start, Real& x, Real& y, Document *doc); + }; Rect TransformToQuadChild(const Rect& src, QuadTreeNodeChildren child_type); Rect TransformFromQuadChild(const Rect& src, QuadTreeNodeChildren child_type); + bool IntersectsQuadChild(const Rect& src, QuadTreeNodeChildren child_type); bool ContainedInQuadChild(const Rect& src, QuadTreeNodeChildren child_type); }