Path Tracer
Object3DGroup.h
Go to the documentation of this file.
1 #ifndef DEF_OBJECT3DGROUP
2 #define DEF_OBJECT3DGROUP
3 
4 #include <vector>
5 
6 #include "InterfaceCreation.h"
7 
123 private:
124  static const unsigned int MIN_OBJECTS_HIDE = 20;
125  bool hide = false;
126 
127  std::string name;
128  std::vector<Object3D*> objects;
129  DoubleVec3D center;
130 
131 public:
132  Object3DGroup();
133  Object3DGroup(const std::string& name, std::vector<Object3D*> objects = {});
134  Object3DGroup(const Object3DGroup& group);
135  ~Object3DGroup();
136 
137  std::string getName() const;
138  std::vector<Object3D*> getObjects() const;
139  DoubleVec3D getCenter() const;
140 
141  void setName(const std::string& name);
142  void setObjects(const std::vector<Object3D*>& newObjects);
143 
144  void addObject(Object3D* object);
145  void addObjects(const std::vector<Object3D*>& newObjects);
146  void merge(const Object3DGroup& group);
147  void resetObjects();
148  void resetAndDeleteObjects();
149 
150  static Object3DGroup create();
151  void printAll() const;
152  void modify();
153 };
154 
155 std::ostream& operator<<(std::ostream& stream, const Object3DGroup& group);
156 
157 std::vector<Object3D*> split(const std::vector<Object3DGroup>& groups);
158 
159 void to_json(json& j, const Object3DGroup& group);
160 void from_json(const json& j, Object3DGroup& group);
161 
162 #endif
Defines functions that are used to ask for values to the user, and to interactively create 3D objects...
nlohmann::json json
Definition: InterfaceGestion.h:14
std::ostream & operator<<(std::ostream &stream, const Object3DGroup &group)
Ostream operator.
Definition: Object3DGroup.cpp:201
void to_json(json &j, const Object3DGroup &group)
Conversion to json.
Definition: Object3DGroup.cpp:232
std::vector< Object3D * > split(const std::vector< Object3DGroup > &groups)
Takes the std::vector of each object group and merge them.
Definition: Object3DGroup.cpp:219
void from_json(const json &j, Object3DGroup &group)
Conversion from json.
Definition: Object3DGroup.cpp:242
A three-dimensional vector using double values.
Definition: DoubleVec3D.h:190
Group of objects.
Definition: Object3DGroup.h:122
void modify()
Interactive modification of this object group.
Definition: Object3DGroup.cpp:97
void addObjects(const std::vector< Object3D * > &newObjects)
Add multiple objects to the current ones.
Definition: Object3DGroup.cpp:43
void setName(const std::string &name)
Setter for the name.
Definition: Object3DGroup.cpp:28
std::vector< Object3D * > getObjects() const
Getter for the objects.
Definition: Object3DGroup.cpp:23
void setObjects(const std::vector< Object3D * > &newObjects)
Setter for the objects.
Definition: Object3DGroup.cpp:30
DoubleVec3D getCenter() const
Getter for the center.
Definition: Object3DGroup.cpp:24
void resetObjects()
Resets all objects of this object group.
Definition: Object3DGroup.cpp:56
void resetAndDeleteObjects()
Deletes all pointers to the objects of this object group, then reset its objects.
Definition: Object3DGroup.cpp:60
std::string getName() const
Getter for the name.
Definition: Object3DGroup.cpp:22
~Object3DGroup()
Destructor.
Definition: Object3DGroup.cpp:16
void merge(const Object3DGroup &group)
Merge with an other object group.
Definition: Object3DGroup.cpp:54
static Object3DGroup create()
Interactive creation of an object group.
Definition: Object3DGroup.cpp:68
void printAll() const
Prints the whole page.
Definition: Object3DGroup.cpp:74
void addObject(Object3D *object)
Adds an object to the current ones.
Definition: Object3DGroup.cpp:37
Object3DGroup()
Default constructor.
Definition: Object3DGroup.cpp:4
Abstract class for a three-dimentional object.
Definition: Object3D.h:121