qt_clust.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)qt_clust.h 3.4     1999/11/19      */
00002 /* Copyright (c) Warwick Allison, 1999. */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef clusterizer_H
00006 #define clusterizer_H
00007 
00008 #include <qrect.h>
00009 
00010 class Clusterizer {
00011 public:
00012         Clusterizer(int maxclusters);
00013         ~Clusterizer();
00014 
00015         void add(int x, int y); // 1x1 rectangle (point)
00016         void add(int x, int y, int w, int h);
00017         void add(const QRect& rect);
00018 
00019         void clear();
00020         int clusters() { return count; }
00021         const QRect& operator[](int i);
00022 
00023 private:
00024         QRect* cluster;
00025         int count;
00026         const int max;
00027 };
00028 
00029 #endif