00001
00002
00003 #ifndef _included_BBoxList_h
00004 #define _included_BBoxList_h
00005
00011 #include "DAGHDefaults.h"
00012
00013 #include "BucketType.h"
00014 #include "BBox.h"
00015 #include "Coords.h"
00016 #include "ObjectCounter.h"
00017
00018 #include <iosfwd>
00019 #include <cstdlib>
00020
00021 #ifndef DefBBoxListSize
00022 #define DefBBoxListSize (128)
00023 #endif
00024
00030 class BBoxList : public Bucket<BBox>, public ObjectCounter
00031 {
00032 public:
00033
00034
00035
00036 inline BBoxList()
00037 : Bucket<BBox>(DefBBoxListSize) {}
00038
00039
00040 explicit BBoxList(const unsigned int maxnum)
00041 : Bucket<BBox>(maxnum) {}
00042
00043 inline BBoxList(const void *package, const unsigned int size, const int n)
00044 : Bucket<BBox>(package, size, n) {}
00045
00046 inline BBoxList(const BBoxList &other)
00047 : Bucket<BBox>(other) {}
00048
00049 BBoxList& operator=(const BBoxList&);
00050
00051
00052
00053
00054 inline ~BBoxList(void) {}
00055
00056
00057
00058
00059 inline BBoxList* alias()
00060 { return dynamic_cast<BBoxList*>(ObjectCounter::alias()); }
00061
00062
00063
00064
00065 int difference(BBoxList& bbl, const BBox& lhs, const BBox& rhs);
00066 int intersection(BBoxList& bbl, const BBox& lhs, const BBox& rhs);
00067 void operator -= (const BBoxList &rhs);
00068 void operator -= (const BBox &rhs);
00069 void operator *= (const BBoxList &rhs);
00070 void operator *= (const BBox &rhs);
00071
00072 private:
00073
00074
00075
00076 void nest(const BBoxList &rhs);
00077
00078 public:
00079
00080
00081
00082 void mergeboxes(const short* olap);
00083
00084
00085
00086
00087 void combine(const BBoxList &rhs);
00088
00089
00090
00091
00092 BBox reduce();
00093 };
00094
00095
00096 std::ostream& operator<<(std::ostream&, const BBoxList&);
00097 std::ofstream& operator<<(std::ofstream&, const BBoxList&);
00098 std::ifstream& operator>>(std::ifstream&, BBoxList&);
00099 std::stringstream& operator<<(std::stringstream&, const BBoxList&);
00100 std::stringstream& operator>>(std::stringstream&, BBoxList&);
00101
00102
00103
00104
00105 inline BBox* first(BBoxList &bbl) { return bbl.first(); }
00106 inline BBox* last(BBoxList &bbl) { return bbl.last(); }
00107 inline BBox* next(BBoxList &bbl) { return bbl.next(); }
00108 inline BBox* prev(BBoxList &bbl) { return bbl.prev(); }
00109 inline BBox* current(BBoxList &bbl) { return bbl.current(); }
00110
00111 inline void add(BBoxList &bbl, const BBox &bb) { bbl.add(bb); }
00112 inline void insert(BBoxList &bbl, const BBox &bb) { bbl.insert(bb); }
00113 inline void remove(BBoxList &bbl) { bbl.remove(); }
00114
00115 inline int number(const BBoxList &bbl) { return bbl.number(); }
00116 inline bool isempty(const BBoxList &bbl) { return bbl.isempty(); }
00117
00118 inline void empty(BBoxList &bbl) { bbl.empty(); }
00119
00120 #endif