X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fquadtree.h;h=9a7b8f97673dd7b3c4a45b09fd59981727236d08;hp=d5eddd8600660df7acb16345434d462d0c6e15d9;hb=d68c91a7a2a3a4b3a312a50cbab5a7539d4cd7d5;hpb=85e08223a33439f9b4911129b48ee45ff65869eb diff --git a/src/quadtree.h b/src/quadtree.h index d5eddd8..9a7b8f9 100644 --- a/src/quadtree.h +++ b/src/quadtree.h @@ -6,12 +6,14 @@ #include "common.h" +#include "ipdf.h" namespace IPDF { typedef int QuadTreeIndex; static const QuadTreeIndex QUADTREE_EMPTY = -1; + class Document; enum QuadTreeNodeChildren { @@ -38,6 +40,11 @@ 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; + bool render_dirty; }; struct QuadTree @@ -45,7 +52,16 @@ 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); } #else