From: <sv...@ww...> - 2004-09-12 02:40:03
|
Author: mkrose Date: 2004-09-11 19:39:41 -0700 (Sat, 11 Sep 2004) New Revision: 1224 Modified: trunk/CSP/SpatialIndex/QuadTree.h trunk/CSP/SpatialIndex/quadtree/QuadTree.cc Log: Add helper functions for writing Points and Regions to ostreams. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1224 Modified: trunk/CSP/SpatialIndex/QuadTree.h =================================================================== --- trunk/CSP/SpatialIndex/QuadTree.h 2004-09-11 15:15:38 UTC (rev 1223) +++ trunk/CSP/SpatialIndex/QuadTree.h 2004-09-12 02:39:41 UTC (rev 1224) @@ -223,13 +223,12 @@ Point _point; public: - /** Construct a new child, given an id number and <i>signed</i> 32-bit - * coordinates. The coordinates are converted to unsigned values used - * internally. + /** Construct a new child, given an id number and <i>unsigned</i> 32-bit + * coordinates. */ - Child(int id, int32 x, int32 y): + Child(int id, uint32 x, uint32 y): _id(id), - _point(Point::fromSigned(x, y)) { + _point(x, y) { } /** Copy ctor. @@ -369,6 +368,8 @@ }; extern std::ostream & operator << (std::ostream &os, QuadTree const &q); +extern std::ostream & operator << (std::ostream &os, Point const &p); +extern std::ostream & operator << (std::ostream &os, Region const &r); } // namespace IQuadTree Modified: trunk/CSP/SpatialIndex/quadtree/QuadTree.cc =================================================================== --- trunk/CSP/SpatialIndex/quadtree/QuadTree.cc 2004-09-11 15:15:38 UTC (rev 1223) +++ trunk/CSP/SpatialIndex/quadtree/QuadTree.cc 2004-09-12 02:39:41 UTC (rev 1224) @@ -349,7 +349,14 @@ return os; } +std::ostream & operator << (std::ostream &os, Point const &p) { + return os << '(' << p.x() << ',' << p.y() << ')'; +} +std::ostream & operator << (std::ostream &os, Region const &r) { + return os << '{' << r.x0() << ',' << r.y0() << ',' << r.x1() << ',' << r.y1() << '}'; +} + } // namespace IQuadTree } // namespace SpatialIndex |