45 class MapShape :
public Shape
52 public:
virtual ~MapShape();
55 public:
void Update();
62 public:
virtual void Init();
67 public:
void FillMsg(msgs::Geometry &_msg);
71 public:
virtual void ProcessMsg(
const msgs::Geometry &_msg);
75 public: std::string GetURI()
const;
79 public:
double GetScale()
const;
85 public:
int GetThreshold()
const;
91 public:
double GetHeight()
const;
96 public:
int GetGranularity()
const;
100 private:
void BuildTree(QuadNode *_node);
109 private:
void GetPixelCount(
unsigned int _xStart,
unsigned int _yStart,
110 unsigned int _width,
unsigned int _height,
111 unsigned int &_freePixels,
112 unsigned int &_occPixels);
116 private:
void ReduceTree(QuadNode *_node);
121 private:
void Merge(QuadNode *_nodeA, QuadNode *_nodeB);
124 private:
void CreateBox();
128 private:
void CreateBoxes(QuadNode *_node);
131 private: common::Image *mapImage;
134 private: QuadNode *root;
137 private:
bool merged;
141 private:
static unsigned int collisionCounter;
151 public: QuadNode(QuadNode *_parent)
152 : x(0), y(0), width(0), height(0)
163 std::deque<QuadNode*>::iterator iter;
164 for (iter = children.begin(); iter != children.end(); ++iter)
170 public:
void Print(std::string _space)
172 std::deque<QuadNode*>::iterator iter;
174 printf(
"%sXY[%d %d] WH[%d %d] O[%d] L[%d] V[%d]\n",
175 _space.c_str(), x, y, width, height, occupied, leaf, valid);
177 for (iter = children.begin(); iter != children.end(); ++iter)
178 if ((*iter)->occupied)
179 (*iter)->Print(_space);
183 public: uint32_t x, y;
186 public: uint32_t width, height;
189 public: QuadNode *parent;
192 public: std::deque<QuadNode*> children;
195 public:
bool occupied;