ChirpSim
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
wall.h
Go to the documentation of this file.
1 #ifndef WALL_H
2 #define WALL_H
3 
4 #include <QJsonObject>
5 #include <QGraphicsItem>
6 #include <QRectF>
7 #include <QPainter>
8 #include <Box2D/Box2D.h>
9 
10 #include "physicalobject.h"
11 #include "world.h"
12 
13 class Wall;
14 
21 PhysicalObject *wallFactory(World *world, const QJsonObject &obj);
22 
31 class Wall : public PhysicalObject, public QGraphicsItem
32 {
33 public:
44  explicit Wall(b2World *world, QList< QList< QPointF > > hulls, QPointF position = QPointF(0,0), float angle = 0);
45  ~Wall();
46 
51  QRectF boundingRect() const;
52 
56  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
57 
62  b2Body *body() const { return _body; }
63 
68  QGraphicsItem *item() const { return const_cast<Wall*>(this); }
69 private:
70  friend PhysicalObject *wallFactory(World *world, const QJsonObject &obj);
71  void ComputeBoundingRect();
72 
73 private:
74  b2Body* _body;
75 
76  QRectF _boundingRect;
77 
78 };
79 
80 #endif // WALL_H