Commit f80538a5 authored by Sylvain Thery's avatar Sylvain Thery

resolve bug of removeMap in schnapps

parent 2e3d2fa2
...@@ -15,6 +15,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11") ...@@ -15,6 +15,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -std=c++11")
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir") SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/.. CACHE STRING "CGoGN root dir")
SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/) SET(CMAKE_MODULE_PATH ${CGoGN_ROOT_DIR}/cmake_modules/)
SET( SLOT_DEBUG_MODE OFF CACHE BOOL "build with slot debugging mode" )
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(Boost COMPONENTS regex system REQUIRED) find_package(Boost COMPONENTS regex system REQUIRED)
...@@ -48,12 +50,15 @@ ELSE() ...@@ -48,12 +50,15 @@ ELSE()
SET(CGoGN_LIBS topology algo container utils) SET(CGoGN_LIBS topology algo container utils)
ENDIF() ENDIF()
IF (DEFINED ASSERTON) IF(DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON}) add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON})
ELSE (DEFINED ASSERTON) ELSE(DEFINED ASSERTON)
add_definitions(-DCGOGN_ASSERT_BOOL=false) add_definitions(-DCGOGN_ASSERT_BOOL=false)
ENDIF (DEFINED ASSERTON) ENDIF (DEFINED ASSERTON)
IF(SLOT_DEBUG_MODE)
add_definitions(-DSLOT_DEBUG_MODE=1)
ENDIF()
# define includes of external libs # define includes of external libs
SET (EXT_INCLUDES SET (EXT_INCLUDES
......
#include "surface_render.h" #include "surface_render.h"
#include "mapHandler.h" #include "mapHandler.h"
#include "slot_debug.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -128,11 +129,13 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -128,11 +129,13 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
void Surface_Render_Plugin::selectedViewChanged(View *prev, View *cur) void Surface_Render_Plugin::selectedViewChanged(View *prev, View *cur)
{ {
DEBUG_SLOT();
m_dockTab->updateMapParameters(); m_dockTab->updateMapParameters();
} }
void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur) void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur)
{ {
DEBUG_SLOT();
m_dockTab->updateMapParameters(); m_dockTab->updateMapParameters();
if (cur==NULL) if (cur==NULL)
m_dockTab->setDisabled(true); m_dockTab->setDisabled(true);
...@@ -142,12 +145,14 @@ void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGe ...@@ -142,12 +145,14 @@ void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGe
void Surface_Render_Plugin::mapAdded(MapHandlerGen *map) void Surface_Render_Plugin::mapAdded(MapHandlerGen *map)
{ {
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*)));
} }
void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map) void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map)
{ {
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*)));
} }
...@@ -158,6 +163,7 @@ void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map) ...@@ -158,6 +163,7 @@ void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map)
void Surface_Render_Plugin::vboAdded(Utils::VBO *vbo) void Surface_Render_Plugin::vboAdded(Utils::VBO *vbo)
{ {
DEBUG_SLOT();
MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender()); MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
if(map == m_schnapps->getSelectedMap()) if(map == m_schnapps->getSelectedMap())
...@@ -172,6 +178,7 @@ void Surface_Render_Plugin::vboAdded(Utils::VBO *vbo) ...@@ -172,6 +178,7 @@ void Surface_Render_Plugin::vboAdded(Utils::VBO *vbo)
void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo) void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo)
{ {
DEBUG_SLOT();
MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender()); MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
if(map == m_schnapps->getSelectedMap()) if(map == m_schnapps->getSelectedMap())
...@@ -213,6 +220,7 @@ void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo) ...@@ -213,6 +220,7 @@ void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo)
void Surface_Render_Plugin::changePositionVBO(const QString& view, const QString& map, const QString& vbo) void Surface_Render_Plugin::changePositionVBO(const QString& view, const QString& map, const QString& vbo)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -229,6 +237,7 @@ void Surface_Render_Plugin::changePositionVBO(const QString& view, const QString ...@@ -229,6 +237,7 @@ void Surface_Render_Plugin::changePositionVBO(const QString& view, const QString
void Surface_Render_Plugin::changeNormalVBO(const QString& view, const QString& map, const QString& vbo) void Surface_Render_Plugin::changeNormalVBO(const QString& view, const QString& map, const QString& vbo)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -245,6 +254,7 @@ void Surface_Render_Plugin::changeNormalVBO(const QString& view, const QString& ...@@ -245,6 +254,7 @@ void Surface_Render_Plugin::changeNormalVBO(const QString& view, const QString&
void Surface_Render_Plugin::changeRenderVertices(const QString& view, const QString& map, bool b) void Surface_Render_Plugin::changeRenderVertices(const QString& view, const QString& map, bool b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -260,6 +270,7 @@ void Surface_Render_Plugin::changeRenderVertices(const QString& view, const QStr ...@@ -260,6 +270,7 @@ void Surface_Render_Plugin::changeRenderVertices(const QString& view, const QStr
void Surface_Render_Plugin::changeVerticesScaleFactor(const QString& view, const QString& map, float f) void Surface_Render_Plugin::changeVerticesScaleFactor(const QString& view, const QString& map, float f)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -275,6 +286,7 @@ void Surface_Render_Plugin::changeVerticesScaleFactor(const QString& view, const ...@@ -275,6 +286,7 @@ void Surface_Render_Plugin::changeVerticesScaleFactor(const QString& view, const
void Surface_Render_Plugin::changeRenderEdges(const QString& view, const QString& map, bool b) void Surface_Render_Plugin::changeRenderEdges(const QString& view, const QString& map, bool b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -290,6 +302,7 @@ void Surface_Render_Plugin::changeRenderEdges(const QString& view, const QString ...@@ -290,6 +302,7 @@ void Surface_Render_Plugin::changeRenderEdges(const QString& view, const QString
void Surface_Render_Plugin::changeRenderFaces(const QString& view, const QString& map, bool b) void Surface_Render_Plugin::changeRenderFaces(const QString& view, const QString& map, bool b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -305,6 +318,7 @@ void Surface_Render_Plugin::changeRenderFaces(const QString& view, const QString ...@@ -305,6 +318,7 @@ void Surface_Render_Plugin::changeRenderFaces(const QString& view, const QString
void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString& map, MapParameters::FaceShadingStyle style) void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString& map, MapParameters::FaceShadingStyle style)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -320,6 +334,7 @@ void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString& ...@@ -320,6 +334,7 @@ void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString&
void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QString& map, bool b) void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QString& map, bool b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -335,6 +350,7 @@ void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QStr ...@@ -335,6 +350,7 @@ void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QStr
void Surface_Render_Plugin::changeFaceColor(const QString& view, const QString& map, float r, float g, float b) void Surface_Render_Plugin::changeFaceColor(const QString& view, const QString& map, float r, float g, float b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -350,6 +366,7 @@ void Surface_Render_Plugin::changeFaceColor(const QString& view, const QString& ...@@ -350,6 +366,7 @@ void Surface_Render_Plugin::changeFaceColor(const QString& view, const QString&
void Surface_Render_Plugin::changeEdgeColor(const QString& view, const QString& map, float r, float g, float b) void Surface_Render_Plugin::changeEdgeColor(const QString& view, const QString& map, float r, float g, float b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
...@@ -365,6 +382,7 @@ void Surface_Render_Plugin::changeEdgeColor(const QString& view, const QString& ...@@ -365,6 +382,7 @@ void Surface_Render_Plugin::changeEdgeColor(const QString& view, const QString&
void Surface_Render_Plugin::changeVertexColor(const QString& view, const QString& map, float r, float g, float b) void Surface_Render_Plugin::changeVertexColor(const QString& view, const QString& map, float r, float g, float b)
{ {
DEBUG_SLOT();
View* v = m_schnapps->getView(view); View* v = m_schnapps->getView(view);
MapHandlerGen* m = m_schnapps->getMap(map); MapHandlerGen* m = m_schnapps->getMap(map);
if(v && m) if(v && m)
......
...@@ -47,7 +47,6 @@ void Surface_RenderTopo_Plugin::disable() ...@@ -47,7 +47,6 @@ void Surface_RenderTopo_Plugin::disable()
void Surface_RenderTopo_Plugin::drawMap(View* view, MapHandlerGen* map) void Surface_RenderTopo_Plugin::drawMap(View* view, MapHandlerGen* map)
{ {
// std::cout << "Surface_RenderTopo_Plugin::drawMap"<< std::endl;
ViewMapParam& p = h_viewParameterSet[view][map]; ViewMapParam& p = h_viewParameterSet[view][map];
map->getTopoRender()->setInitialDartsColor(p.dartsColor.redF(),p.dartsColor.greenF(),p.dartsColor.blueF()); map->getTopoRender()->setInitialDartsColor(p.dartsColor.redF(),p.dartsColor.greenF(),p.dartsColor.blueF());
...@@ -58,7 +57,6 @@ void Surface_RenderTopo_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -58,7 +57,6 @@ void Surface_RenderTopo_Plugin::drawMap(View* view, MapHandlerGen* map)
if (pm.needUpdate) if (pm.needUpdate)
{ {
// std::cout << "NEED UPDATE"<< std::endl;
map->getTopoRender()->setExplodeEdge(pm.edgesScaleFactor); map->getTopoRender()->setExplodeEdge(pm.edgesScaleFactor);
map->getTopoRender()->setExplodeFace(pm.facesScaleFactor); map->getTopoRender()->setExplodeFace(pm.facesScaleFactor);
QString pos = m_dockTab->combo_positionAttribute->currentText(); QString pos = m_dockTab->combo_positionAttribute->currentText();
...@@ -112,7 +110,6 @@ void Surface_RenderTopo_Plugin::mapRemoved(MapHandlerGen* map) ...@@ -112,7 +110,6 @@ void Surface_RenderTopo_Plugin::mapRemoved(MapHandlerGen* map)
void Surface_RenderTopo_Plugin::attributeAdded(unsigned int orbit, const QString& name) void Surface_RenderTopo_Plugin::attributeAdded(unsigned int orbit, const QString& name)
{ {
// std::cout << "attributeAdded"<< std::endl;
MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender()); MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
if(orbit == VERTEX && map == m_schnapps->getSelectedMap()) if(orbit == VERTEX && map == m_schnapps->getSelectedMap())
{ {
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "Topology/generic/genericmap.h" #include "Topology/generic/genericmap.h"
#include "Topology/generic/cellmarker.h" #include "Topology/generic/cellmarker.h"
#include "slot_debug.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -38,6 +40,7 @@ public: ...@@ -38,6 +40,7 @@ public:
{ {
if(m_selectionChanged) if(m_selectionChanged)
{ {
DEBUG_EMIT("selectedCellsChanged");
emit(selectedCellsChanged()); emit(selectedCellsChanged());
m_selectionChanged = false; m_selectionChanged = false;
} }
...@@ -92,7 +95,10 @@ public: ...@@ -92,7 +95,10 @@ public:
cs->unselect(c, emitSignal); cs->unselect(c, emitSignal);
} }
if(emitSignal) if(emitSignal)
{
DEBUG_EMIT("selectedCellsChanged");
emit(selectedCellsChanged()); emit(selectedCellsChanged());
}
else else
m_selectionChanged = true; m_selectionChanged = true;
} }
...@@ -128,7 +134,10 @@ public: ...@@ -128,7 +134,10 @@ public:
m_cells[i-1] = m_cells.back(); m_cells[i-1] = m_cells.back();
m_cells.pop_back(); m_cells.pop_back();
if(emitSignal) if(emitSignal)
{
DEBUG_EMIT("selectedCellsChanged");
emit(selectedCellsChanged()); emit(selectedCellsChanged());
}
else else
m_selectionChanged = true; m_selectionChanged = true;
} }
......
...@@ -58,6 +58,7 @@ AttributeHandler<T, ORBIT, typename PFP::MAP> MapHandler<PFP>::addAttribute(cons ...@@ -58,6 +58,7 @@ AttributeHandler<T, ORBIT, typename PFP::MAP> MapHandler<PFP>::addAttribute(cons
if(ah.isValid() && registerAttr) if(ah.isValid() && registerAttr)
{ {
registerAttribute(ah); registerAttribute(ah);
DEBUG_EMIT("attributeAdded");
emit(attributeAdded(ORBIT, nameAttr)); emit(attributeAdded(ORBIT, nameAttr));
} }
return ah; return ah;
...@@ -166,6 +167,7 @@ CellSelectorGen* MapHandler<PFP>::addCellSelector(unsigned int orbit, const QStr ...@@ -166,6 +167,7 @@ CellSelectorGen* MapHandler<PFP>::addCellSelector(unsigned int orbit, const QStr
return NULL; return NULL;
m_cellSelectors[orbit].insert(name, cs); m_cellSelectors[orbit].insert(name, cs);
DEBUG_EMIT("cellSelectorAdded");
emit(cellSelectorAdded(orbit, name)); emit(cellSelectorAdded(orbit, name));
connect(cs, SIGNAL(selectedCellsChanged()), this, SLOT(selectedCellsChanged())); connect(cs, SIGNAL(selectedCellsChanged()), this, SLOT(selectedCellsChanged()));
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "types.h" #include "types.h"
#include "PythonQt/PythonQt.h" #include "PythonQt/PythonQt.h"
#include "PythonQt/gui/PythonQtScriptingConsole.h" #include "PythonQt/gui/PythonQtScriptingConsole.h"
#include "slot_debug.h"
class QVBoxLayout; class QVBoxLayout;
class QSplitter; class QSplitter;
...@@ -95,11 +96,11 @@ public slots: ...@@ -95,11 +96,11 @@ public slots:
MapHandlerGen* getMap(const QString& name) const; MapHandlerGen* getMap(const QString& name) const;
const MapSet& getMapSet() const { return m_maps; } const MapSet& getMapSet() const { return m_maps; }
void notifySelectedMapChanged(MapHandlerGen* old, MapHandlerGen* cur) { emit(selectedMapChanged(old, cur)); } void notifySelectedMapChanged(MapHandlerGen* old, MapHandlerGen* cur) { DEBUG_EMIT("selectedMapChanged"); emit(selectedMapChanged(old, cur)); }
MapHandlerGen* getSelectedMap() const; MapHandlerGen* getSelectedMap() const;
unsigned int getCurrentOrbit() const; unsigned int getCurrentOrbit() const;
void notifySelectedCellSelectorChanged(CellSelectorGen* cs) { emit(selectedCellSelectorChanged(cs)); } void notifySelectedCellSelectorChanged(CellSelectorGen* cs) { DEBUG_EMIT("selectedCellSelectorChanged"); emit(selectedCellSelectorChanged(cs)); }
CellSelectorGen* getSelectedSelector(unsigned int orbit) const; CellSelectorGen* getSelectedSelector(unsigned int orbit) const;
const StaticPointers& getStaticPointers() const {return m_sp;} const StaticPointers& getStaticPointers() const {return m_sp;}
......
#ifndef _SLOT_DBG_H_
#define _SLOT_DBG_H_
#include <iostream>
namespace CGoGN
{
namespace SCHNApps
{
// TO USE DEBUGGING INFO ON SLOT
// USE cmake .. -DSLOT_DEBUG_MODE=1
class PrettyPrintShiftMessage
{
protected:
static unsigned int s_nb;
std::string m_msg;
public:
PrettyPrintShiftMessage(const char *fname);
~PrettyPrintShiftMessage();
static void shift();
};
} // namespace SCHNApps
} // namespace CGoGN
//#define SLOT_DBG_MODE 1
#ifdef SLOT_DEBUG_MODE
#define DEBUG_SLOT() PrettyPrintShiftMessage ppslots(__PRETTY_FUNCTION__);
#define DEBUG_EMIT(SIGNALS) PrettyPrintShiftMessage::shift(); std::cout << "Emitting signal " << SIGNALS << " from " << __PRETTY_FUNCTION__ << std::endl;
#else
#define DEBUG_SLOT()
#define DEBUG_EMIT(SIGNALS)
#endif
#endif
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
const QString& getName() const { return m_name; } const QString& getName() const { return m_name; }
MapHandlerGen* lastSelectedMap() { return m_lastSelectedMap;} MapHandlerGen* lastSelectedMap() { return m_lastSelectedMap;}
void setLastSelectedMap(MapHandlerGen* m); void setLastSelectedMap(MapHandlerGen* m) { m_lastSelectedMap=m; }
public slots: public slots:
QString getName() { return m_name; } QString getName() { return m_name; }
......
...@@ -24,6 +24,7 @@ Camera::~Camera() ...@@ -24,6 +24,7 @@ Camera::~Camera()
void Camera::setProjectionType(int t) void Camera::setProjectionType(int t)
{ {
setType(qglviewer::Camera::Type(t)); setType(qglviewer::Camera::Type(t));
DEBUG_EMIT("projectionTypeChanged");
emit(projectionTypeChanged(t)); emit(projectionTypeChanged(t));
foreach(View* view, m_schnapps->getViewSet().values()) foreach(View* view, m_schnapps->getViewSet().values())
view->updateGL(); view->updateGL();
...@@ -32,6 +33,7 @@ void Camera::setProjectionType(int t) ...@@ -32,6 +33,7 @@ void Camera::setProjectionType(int t)
void Camera::setDraw(bool b) void Camera::setDraw(bool b)
{ {
m_draw = b; m_draw = b;
DEBUG_EMIT("drawChanged");
emit(drawChanged(b)); emit(drawChanged(b));
foreach(View* view, m_schnapps->getViewSet().values()) foreach(View* view, m_schnapps->getViewSet().values())
view->updateGL(); view->updateGL();
...@@ -40,6 +42,7 @@ void Camera::setDraw(bool b) ...@@ -40,6 +42,7 @@ void Camera::setDraw(bool b)
void Camera::setDrawPath(bool b) void Camera::setDrawPath(bool b)
{ {
m_drawPath = b; m_drawPath = b;
DEBUG_EMIT("drawPathChanged");
emit(drawPathChanged(b)); emit(drawPathChanged(b));
foreach(View* view, m_schnapps->getViewSet().values()) foreach(View* view, m_schnapps->getViewSet().values())
view->updateGL(); view->updateGL();
......
...@@ -292,6 +292,35 @@ void ControlDock_MapTab::selectedViewChanged(View* prev, View* cur) ...@@ -292,6 +292,35 @@ void ControlDock_MapTab::selectedViewChanged(View* prev, View* cur)
connect(cur, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(selectedViewMapLinked(MapHandlerGen*))); connect(cur, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(selectedViewMapLinked(MapHandlerGen*)));
connect(cur, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(selectedViewMapUnlinked(MapHandlerGen*))); connect(cur, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(selectedViewMapUnlinked(MapHandlerGen*)));
} }
if( (cur->lastSelectedMap() != NULL) && (cur->isLinkedToMap(cur->lastSelectedMap())))
{
setSelectedMap(cur->lastSelectedMap()->getName());
}
else
{
MapHandlerGen* map = m_schnapps->getSelectedMap();
if ((map == NULL) || (! map->isLinkedToView(cur)))
{
bool changed = false;
const MapSet& ms = m_schnapps->getMapSet();
foreach(MapHandlerGen* mhg, ms)
{
if (mhg->isLinkedToView(cur))
{
setSelectedMap(mhg->getName());
changed = true;
break; // out of the loop, not nice but ...
}
}
if (!changed)// no possibility to selected a map automatically so none
{
setSelectedMap(QString("NONE"));
}
}
}
} }
...@@ -470,19 +499,21 @@ void ControlDock_MapTab::updateSelectedMapInfo() ...@@ -470,19 +499,21 @@ void ControlDock_MapTab::updateSelectedMapInfo()
void ControlDock_MapTab::setSelectedMap(const QString& mapName) void ControlDock_MapTab::setSelectedMap(const QString& mapName)
{ {
QList<QListWidgetItem *> lm = list_maps->findItems(mapName,Qt::MatchExactly); if (mapName == QString("NONE"))
if (!lm.empty())
{
lm[0]->setSelected(true);
}
else
{ {
QList<QListWidgetItem*> items = list_maps->selectedItems(); QList<QListWidgetItem*> items = list_maps->selectedItems();
if(!items.empty()) if(!items.empty())
{ {
m_selectedMap = NULL;
items[0]->setSelected(false); items[0]->setSelected(false);
m_selectedMap = NULL;
} }
return;
}
QList<QListWidgetItem *> lm = list_maps->findItems(mapName,Qt::MatchExactly);
if (!lm.empty())
{
lm[0]->setSelected(true);
} }
} }
......
...@@ -7,13 +7,13 @@ namespace SCHNApps ...@@ -7,13 +7,13 @@ namespace SCHNApps
{ {
MapHandlerGen::MapHandlerGen(const QString& name, SCHNApps* s, GenericMap* map) : MapHandlerGen::MapHandlerGen(const QString& name, SCHNApps* s, GenericMap* map) :
m_topoRender(NULL),
m_name(name), m_name(name),
m_schnapps(s), m_schnapps(s),
m_map(map), m_map(map),
m_frame(NULL), m_frame(NULL),
m_bbDrawer(NULL), m_bbDrawer(NULL),
m_render(NULL), m_render(NULL)
m_topoRender(NULL)
{ {
m_frame = new qglviewer::ManipulatedFrame(); m_frame = new qglviewer::ManipulatedFrame();
...@@ -43,6 +43,7 @@ void MapHandlerGen::notifyAttributeModification(const AttributeHandlerGen& attr) ...@@ -43,6 +43,7 @@ void MapHandlerGen::notifyAttributeModification(const AttributeHandlerGen& attr)
if(m_vbo.contains(nameAttr)) if(m_vbo.contains(nameAttr))
m_vbo[nameAttr]->updateData(attr);