Include cleanup: Selection.hpp

It does not need 3DScene.hpp and Model.hpp
And it does not to be included by GLGizmoBase.hpp
This commit is contained in:
Lukas Matena 2020-05-26 11:48:09 +02:00
parent c2cd430941
commit 94b0ab603f
18 changed files with 117 additions and 33 deletions

View file

@ -3,8 +3,8 @@
#include <set>
#include "libslic3r/Geometry.hpp"
#include "libslic3r/Model.hpp"
#include "3DScene.hpp"
//#include "libslic3r/Model.hpp"
//#include "3DScene.hpp"
#if ENABLE_RENDER_SELECTION_CENTER
@ -13,7 +13,19 @@ typedef class GLUquadric GLUquadricObj;
#endif // ENABLE_RENDER_SELECTION_CENTER
namespace Slic3r {
class Shader;
class Model;
class ModelObject;
class GLVolume;
class GLArrow;
class GLCurvedArrow;
class DynamicPrintConfig;
using GLVolumePtrs = std::vector<GLVolume*>;
using ModelObjectPtrs = std::vector<ModelObject*>;
namespace GUI {
class TransformationType
{
@ -147,18 +159,23 @@ public:
class Clipboard
{
Model m_model;
// Model is stored through a pointer to avoid including heavy Model.hpp.
// It is created in constructor.
std::unique_ptr<Model> m_model;
Selection::EMode m_mode;
public:
void reset() { m_model.clear_objects(); }
bool is_empty() const { return m_model.objects.empty(); }
Clipboard();
void reset();
bool is_empty() const;
bool is_sla_compliant() const;
ModelObject* add_object() { return m_model.add_object(); }
ModelObject* get_object(unsigned int id) { return (id < (unsigned int)m_model.objects.size()) ? m_model.objects[id] : nullptr; }
const ModelObjectPtrs& get_objects() const { return m_model.objects; }
ModelObject* add_object();
ModelObject* get_object(unsigned int id);
const ModelObjectPtrs& get_objects() const;
Selection::EMode get_mode() const { return m_mode; }
void set_mode(Selection::EMode mode) { m_mode = mode; }
@ -202,8 +219,11 @@ private:
#if ENABLE_RENDER_SELECTION_CENTER
GLUquadricObj* m_quadric;
#endif // ENABLE_RENDER_SELECTION_CENTER
mutable GLArrow m_arrow;
mutable GLCurvedArrow m_curved_arrow;
// Arrows are saved through pointers to avoid including 3DScene.hpp.
// It also allows mutability.
std::unique_ptr<GLArrow> m_arrow;
std::unique_ptr<GLCurvedArrow> m_curved_arrow;
mutable float m_scale_factor;