Commit 938b9d3a authored by Sylvain Thery's avatar Sylvain Thery

bug selector remove, selection of polygonal faces

parent 4c937c0e
...@@ -105,6 +105,7 @@ private slots: ...@@ -105,6 +105,7 @@ private slots:
// slots called from MapHandler signals // slots called from MapHandler signals
void vboAdded(Utils::VBO* vbo); void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo); void vboRemoved(Utils::VBO* vbo);
void selectedMapBoundingBoxModified();
void schnappsClosing(); void schnappsClosing();
......
...@@ -18,13 +18,13 @@ bool Surface_Render_Plugin::enable() ...@@ -18,13 +18,13 @@ bool Surface_Render_Plugin::enable()
m_schnapps->addPluginDockTab(this, m_dockTab, "Surface_Render"); m_schnapps->addPluginDockTab(this, m_dockTab, "Surface_Render");
m_flatShader = new CGoGN::Utils::ShaderFlat(); m_flatShader = new CGoGN::Utils::ShaderFlat();
//m_flatShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f)); m_flatShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f));
m_flatShader->setExplode(1.0f); m_flatShader->setExplode(1.0f);
m_phongShader = new CGoGN::Utils::ShaderPhong(); m_phongShader = new CGoGN::Utils::ShaderPhong();
//m_phongShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f)); m_phongShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f));
//m_phongShader->setSpecular(CGoGN::Geom::Vec4f(0.9f, 0.9f, 0.9f, 1.0f)); m_phongShader->setSpecular(CGoGN::Geom::Vec4f(0.9f, 0.9f, 0.9f, 1.0f));
//m_phongShader->setShininess(80.0f); m_phongShader->setShininess(80.0f);
m_colorPerVertexShader = new CGoGN::Utils::ShaderColorPerVertex(); m_colorPerVertexShader = new CGoGN::Utils::ShaderColorPerVertex();
...@@ -153,6 +153,13 @@ void Surface_Render_Plugin::selectedViewChanged(View *prev, View *cur) ...@@ -153,6 +153,13 @@ void Surface_Render_Plugin::selectedViewChanged(View *prev, View *cur)
void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur) void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur)
{ {
DEBUG_SLOT(); DEBUG_SLOT();
if (prev)
disconnect(prev, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
if (cur)
connect(cur, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
m_dockTab->updateMapParameters(); m_dockTab->updateMapParameters();
} }
...@@ -161,6 +168,7 @@ void Surface_Render_Plugin::mapAdded(MapHandlerGen *map) ...@@ -161,6 +168,7 @@ void Surface_Render_Plugin::mapAdded(MapHandlerGen *map)
DEBUG_SLOT(); DEBUG_SLOT();
connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
connect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*))); connect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
connect(map, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
} }
void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map) void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map)
...@@ -168,6 +176,7 @@ void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map) ...@@ -168,6 +176,7 @@ void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map)
DEBUG_SLOT(); DEBUG_SLOT();
disconnect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*))); disconnect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
disconnect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*))); disconnect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
disconnect(map, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
} }
...@@ -235,6 +244,18 @@ void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo) ...@@ -235,6 +244,18 @@ void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo)
} }
void Surface_Render_Plugin::selectedMapBoundingBoxModified()
{
MapHandlerGen* m = m_schnapps->getSelectedMap();
QList<View*> views = m->getLinkedViews();
if (m)
foreach(View* v, views)
{
if (h_viewParameterSet.contains(v))
h_viewParameterSet[v][m].basePSradius = m->getBBdiagSize() / (2 * std::sqrt(m->getNbOrbits(EDGE)));
}
}
......
...@@ -53,9 +53,12 @@ void Surface_Render_DockTab::positionVBOChanged(int index) ...@@ -53,9 +53,12 @@ void Surface_Render_DockTab::positionVBOChanged(int index)
MapHandlerGen* map = m_schnapps->getSelectedMap(); MapHandlerGen* map = m_schnapps->getSelectedMap();
if (view && map) if (view && map)
{ {
m_plugin->h_viewParameterSet[view][map].basePSradius = map->getBBdiagSize() / (2 * std::sqrt(map->getNbOrbits(EDGE)));
m_plugin->h_viewParameterSet[view][map].positionVBO = map->getVBO(combo_positionVBO->currentText()); m_plugin->h_viewParameterSet[view][map].positionVBO = map->getVBO(combo_positionVBO->currentText());
view->updateGL(); view->updateGL();
m_plugin->pythonRecording("changePositionVBO", "", view->getName(), map->getName(), combo_positionVBO->currentText()); m_plugin->pythonRecording("changePositionVBO", "", view->getName(), map->getName(), combo_positionVBO->currentText());
// TODO write this slot ?
// m_plugin->pythonRecording("changeVerticesBaseSize", "",view->getName(), map->getName(), h_viewParameterSet[view][map].basePSradius);
} }
} }
} }
......
...@@ -70,6 +70,8 @@ private slots: ...@@ -70,6 +70,8 @@ private slots:
// slots called from SCHNApps signals // slots called from SCHNApps signals
void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur); void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
void updateSelectedCellsRendering(); void updateSelectedCellsRendering();
void updateRemovedSelector(unsigned int orbit, const QString& name);
// slots called from MapHandler signals // slots called from MapHandler signals
void selectedMapAttributeAdded(unsigned int orbit, const QString& name); void selectedMapAttributeAdded(unsigned int orbit, const QString& name);
......
...@@ -134,13 +134,8 @@ void Surface_Selection_DockTab::colorChanged(int i) ...@@ -134,13 +134,8 @@ void Surface_Selection_DockTab::colorChanged(int i)
View* view = m_schnapps->getSelectedView(); View* view = m_schnapps->getSelectedView();
MapHandlerGen* map = m_schnapps->getSelectedMap(); MapHandlerGen* map = m_schnapps->getSelectedMap();
std::cout << "colorChanged: " << combo_color->color().name().toStdString() << std::endl;
std::cout << "colorChanged: " << i << std::endl;
if (view && map ) if (view && map )
{ {
// MapParameters& p = m_plugin->h_parameterSet[map];
QColor& col = m_plugin->h_parameterSet[map].color; QColor& col = m_plugin->h_parameterSet[map].color;
if (col != combo_color->color()) if (col != combo_color->color())
{ {
......
...@@ -297,6 +297,8 @@ void ControlDock_MapTab::removeSelector() ...@@ -297,6 +297,8 @@ void ControlDock_MapTab::removeSelector()
} }
if (!items.empty()) if (!items.empty())
{ {
if (m_selectedSelector[orbit]->getName() == items[0]->text())
m_selectedSelector[orbit] = NULL;
m_selectedMap->removeCellSelector(orbit, items[0]->text()); m_selectedMap->removeCellSelector(orbit, items[0]->text());
// RECORDING // RECORDING
QTextStream* rec = m_schnapps->pythonStreamRecorder(); QTextStream* rec = m_schnapps->pythonStreamRecorder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment