3DScene volume selection methods moved to c++

This commit is contained in:
Enrico Turri 2018-05-25 09:03:55 +02:00
parent f121817501
commit bdbc86167c
10 changed files with 96 additions and 22 deletions

View file

@ -1792,6 +1792,16 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas)
s_canvas_mgr.reset_volumes(canvas);
}
void _3DScene::deselect_volumes(wxGLCanvas* canvas)
{
s_canvas_mgr.deselect_volumes(canvas);
}
void _3DScene::select_volume(wxGLCanvas* canvas, unsigned int id)
{
s_canvas_mgr.select_volume(canvas, id);
}
DynamicPrintConfig* _3DScene::get_config(wxGLCanvas* canvas)
{
return s_canvas_mgr.get_config(canvas);

View file

@ -556,6 +556,8 @@ public:
static GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
static void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
static void reset_volumes(wxGLCanvas* canvas);
static void deselect_volumes(wxGLCanvas* canvas);
static void select_volume(wxGLCanvas* canvas, unsigned int id);
static DynamicPrintConfig* get_config(wxGLCanvas* canvas);
static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);

View file

@ -992,6 +992,28 @@ void GLCanvas3D::reset_volumes()
}
}
void GLCanvas3D::deselect_volumes()
{
if (m_volumes != nullptr)
{
for (GLVolume* vol : m_volumes->volumes)
{
if (vol != nullptr)
vol->selected = false;
}
}
}
void GLCanvas3D::select_volume(unsigned int id)
{
if ((m_volumes != nullptr) && (id < (unsigned int)m_volumes->volumes.size()))
{
GLVolume* vol = m_volumes->volumes[id];
if (vol != nullptr)
vol->selected = true;
}
}
DynamicPrintConfig* GLCanvas3D::get_config()
{
return m_config;

View file

@ -285,6 +285,8 @@ public:
GLVolumeCollection* get_volumes();
void set_volumes(GLVolumeCollection* volumes);
void reset_volumes();
void deselect_volumes();
void select_volume(unsigned int id);
DynamicPrintConfig* get_config();
void set_config(DynamicPrintConfig* config);

View file

@ -200,6 +200,20 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas)
it->second->reset_volumes();
}
void GLCanvas3DManager::deselect_volumes(wxGLCanvas* canvas)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->deselect_volumes();
}
void GLCanvas3DManager::select_volume(wxGLCanvas* canvas, unsigned int id)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->select_volume(id);
}
DynamicPrintConfig* GLCanvas3DManager::get_config(wxGLCanvas* canvas)
{
CanvasesMap::const_iterator it = _get_canvas(canvas);

View file

@ -64,6 +64,8 @@ public:
GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
void reset_volumes(wxGLCanvas* canvas);
void deselect_volumes(wxGLCanvas* canvas);
void select_volume(wxGLCanvas* canvas, unsigned int id);
DynamicPrintConfig* get_config(wxGLCanvas* canvas);
void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);