diff --git a/SCHNApps/forms/mapsDialog.ui b/SCHNApps/forms/mapsDialog.ui
index 6c65fe08c9f4ac0d1b51d914b81adf1d63b161a4..3e75d2ed6c2e5915b0711593537d6b56cbff7ac2 100644
--- a/SCHNApps/forms/mapsDialog.ui
+++ b/SCHNApps/forms/mapsDialog.ui
@@ -6,8 +6,8 @@
0
0
- 683
- 659
+ 457
+ 374
@@ -19,7 +19,7 @@
-
-
+
0
0
@@ -38,13 +38,37 @@
-
- 0
+ 4
DART
-
+
+
-
+
+
-
+
+
+ Nb orbits :
+
+
+
+ -
+
+
+ -
+
+
+ Nb cells :
+
+
+
+ -
+
+
+
+
-
@@ -54,7 +78,31 @@
VERTEX
-
+
+ -
+
+
-
+
+
+ Nb orbits :
+
+
+
+ -
+
+
+ -
+
+
+ Nb cells :
+
+
+
+ -
+
+
+
+
-
@@ -65,6 +113,30 @@
EDGE
+ -
+
+
-
+
+
+ Nb orbits :
+
+
+
+ -
+
+
+ -
+
+
+ Nb cells :
+
+
+
+ -
+
+
+
+
-
@@ -75,6 +147,30 @@
FACE
+ -
+
+
-
+
+
+ Nb orbits :
+
+
+
+ -
+
+
+ -
+
+
+ Nb cells :
+
+
+
+ -
+
+
+
+
-
@@ -85,6 +181,30 @@
VOLUME
+ -
+
+
-
+
+
+ Nb orbits :
+
+
+
+ -
+
+
+ -
+
+
+ Nb cells :
+
+
+
+ -
+
+
+
+
-
diff --git a/SCHNApps/include/dialogs/mapsDialog.h b/SCHNApps/include/dialogs/mapsDialog.h
index c759a28e2969118f6dcf8a6df5e5b274fa63a19a..b055dc29633957abe9e27c6ddaff85de3c117ba4 100644
--- a/SCHNApps/include/dialogs/mapsDialog.h
+++ b/SCHNApps/include/dialogs/mapsDialog.h
@@ -23,6 +23,8 @@ public:
private:
Window* m_window;
+ void clearInfo();
+
public slots:
void cb_removeMap();
void cb_selectedMapChanged();
diff --git a/SCHNApps/include/dialogs/pluginsDialog.h b/SCHNApps/include/dialogs/pluginsDialog.h
index db192b10437ce27b8a5897a2dd587ec593b25189..1d9060c4087d4d9a41da18c1b0c8dc53b267a2c1 100644
--- a/SCHNApps/include/dialogs/pluginsDialog.h
+++ b/SCHNApps/include/dialogs/pluginsDialog.h
@@ -40,6 +40,8 @@ protected:
// bool restoreState();
+ void addPluginsDirectory(const QString& dir);
+
private:
bool init;
diff --git a/SCHNApps/include/window.h b/SCHNApps/include/window.h
index 61d3823d9b393267bd0c5eb0eaaafcab85dd790e..a39fa9adec26639523d86274cc06fdd1dc35e9ab 100644
--- a/SCHNApps/include/window.h
+++ b/SCHNApps/include/window.h
@@ -31,7 +31,7 @@ public:
*
* \param parent the parent of the window
*/
- Window(QWidget* parent = NULL);
+ Window(const QString& appPath, QWidget* parent = NULL);
/**
* \fn ~Window()
@@ -40,7 +40,6 @@ public:
~Window();
const QString& getAppPath() { return m_appPath; }
- void setAppPath(const QString& path) { m_appPath = path; }
/*********************************************************
* MANAGE DOCK
diff --git a/SCHNApps/src/dialogs/mapsDialog.cpp b/SCHNApps/src/dialogs/mapsDialog.cpp
index 3336ffd1802d571d71a1f1f558e0232d873d5a99..5eb324233343e55cbe4b8f7c5025ea1861aa0ffc 100644
--- a/SCHNApps/src/dialogs/mapsDialog.cpp
+++ b/SCHNApps/src/dialogs/mapsDialog.cpp
@@ -30,6 +30,23 @@ MapsDialog::MapsDialog(Window* window) :
MapsDialog::~MapsDialog()
{}
+void MapsDialog::clearInfo()
+{
+ dartAttributes->clear();
+ vertexAttributes->clear();
+ edgeAttributes->clear();
+ faceAttributes->clear();
+ volumeAttributes->clear();
+ lineEdit_dart_orbits->setText("");
+ lineEdit_dart_cells->setText("");
+ lineEdit_vertex_orbits->setText("");
+ lineEdit_vertex_cells->setText("");
+ lineEdit_edge_orbits->setText("");
+ lineEdit_edge_cells->setText("");
+ lineEdit_face_orbits->setText("");
+ lineEdit_face_cells->setText("");
+}
+
void MapsDialog::cb_removeMap()
{
QList currentItems = mapList->selectedItems();
@@ -38,7 +55,10 @@ void MapsDialog::cb_removeMap()
const QString& name = currentItems[0]->text();
MapHandlerGen* m = m_window->getMap(name);
if(!m->isUsed())
+ {
m_window->removeMap(name);
+ cb_selectedMapChanged();
+ }
else
QMessageBox::warning(this, tr("Warning"), "Map is currently used");
}
@@ -46,45 +66,50 @@ void MapsDialog::cb_removeMap()
void MapsDialog::cb_selectedMapChanged()
{
+ clearInfo();
+
QList currentItems = mapList->selectedItems();
if(!currentItems.empty())
{
QListWidgetItem* current = currentItems[0];
- dartAttributes->clear();
- vertexAttributes->clear();
- edgeAttributes->clear();
- faceAttributes->clear();
- volumeAttributes->clear();
-
const QString& name = current->text();
MapHandlerGen* mh = m_window->getMap(name);
- CGoGN::GenericMap* m = mh->getGenericMap();
- for(unsigned int orbit = CGoGN::DART; orbit <= CGoGN::VOLUME; ++orbit)
+ GenericMap* m = mh->getGenericMap();
+ for(unsigned int orbit = DART; orbit <= FACE; ++orbit)
{
+ unsigned int nbc = m->getNbCells(orbit);
+ switch(orbit)
+ {
+ case DART : {
+ unsigned int nb = m->getNbDarts();
+ lineEdit_dart_orbits->setText(QString::number(nb));
+ lineEdit_dart_cells->setText(QString::number(nbc));
+ break;
+ }
+ case VERTEX : {
+ unsigned int nb = m->getNbOrbits();
+ lineEdit_vertex_orbits->setText(QString::number(nb));
+ lineEdit_vertex_cells->setText(QString::number(nbc));
+ break;
+ }
+ case EDGE : {
+ unsigned int nb = m->getNbOrbits();
+ lineEdit_edge_orbits->setText(QString::number(nb));
+ lineEdit_edge_cells->setText(QString::number(nbc));
+ break;
+ }
+ case FACE : {
+ unsigned int nb = m->getNbOrbits();
+ lineEdit_face_orbits->setText(QString::number(nb));
+ lineEdit_face_cells->setText(QString::number(nbc));
+ break;
+ }
+ }
+
if(m->isOrbitEmbedded(orbit))
{
-// unsigned int nb = 0;
-// switch(orbit)
-// {
-// case CGoGN::DART :
-// nb = m->getNbOrbits();
-// break;
-// case CGoGN::VERTEX :
-// nb = m->getNbOrbits();
-// break;
-// case CGoGN::EDGE :
-// nb = m->getNbOrbits();
-// break;
-// case CGoGN::FACE :
-// nb = m->getNbOrbits();
-// break;
-// case CGoGN::VOLUME :
-// nb = m->getNbOrbits();
-// break;
-// }
-
- CGoGN::AttributeContainer& cont = m->getAttributeContainer(orbit);
+ AttributeContainer& cont = m->getAttributeContainer(orbit);
std::vector names;
std::vector types;
cont.getAttributesNames(names);
@@ -95,11 +120,11 @@ void MapsDialog::cb_selectedMapChanged()
QString type = QString::fromStdString(types[i]);
switch(orbit)
{
- case CGoGN::DART : dartAttributes->addItem(name + "(" + type + ")"); break;
- case CGoGN::VERTEX : vertexAttributes->addItem(name + "(" + type + ")"); break;
- case CGoGN::EDGE : edgeAttributes->addItem(name + "(" + type + ")"); break;
- case CGoGN::FACE : faceAttributes->addItem(name + "(" + type + ")"); break;
- case CGoGN::VOLUME : volumeAttributes->addItem(name + "(" + type + ")"); break;
+ case DART : dartAttributes->addItem(name + " (" + type + ")"); break;
+ case VERTEX : vertexAttributes->addItem(name + " (" + type + ")"); break;
+ case EDGE : edgeAttributes->addItem(name + " (" + type + ")"); break;
+ case FACE : faceAttributes->addItem(name + " (" + type + ")"); break;
+ case VOLUME : volumeAttributes->addItem(name + " (" + type + ")"); break;
}
}
diff --git a/SCHNApps/src/dialogs/pluginsDialog.cpp b/SCHNApps/src/dialogs/pluginsDialog.cpp
index bd28b275bd065e9882c637c80ddcc7102c959f5c..f8b107ef6e85daf7366a79b2bc6703c00c3bfe69 100644
--- a/SCHNApps/src/dialogs/pluginsDialog.cpp
+++ b/SCHNApps/src/dialogs/pluginsDialog.cpp
@@ -44,6 +44,8 @@ PluginsDialog::PluginsDialog(Window* window) :
// restoreState();
+ addPluginsDirectory(m_window->getAppPath() + QString("/../Plugins/"));
+
if (System::Error::code != System::Error::SUCCESS)
System::Error::showError(this);
@@ -156,6 +158,48 @@ PluginsDialog::~PluginsDialog()
// return true;
//}
+void PluginsDialog::addPluginsDirectory(const QString& dir)
+{
+ QDir directory(dir);
+
+ if (!directory.exists())
+ System::Error::code = System::Error::BAD_PLUGIN_PATH_IN_FILE_f(directory.absolutePath());
+
+ QTreeWidgetItem *dirItem = new QTreeWidgetItem(treeWidget, DIR);
+ dirItem->setText(1, directory.path());
+
+ QStringList filters;
+ filters << "lib*.so";
+ filters << "lib*.dylib";
+
+ QStringList dirFiles;
+ dirFiles = directory.entryList(filters, QDir::Files);
+
+ const PluginHash& activePlugins = m_window->getPluginsHash();
+
+ foreach(QString pluginPath, dirFiles)
+ {
+ QFileInfo pfi(pluginPath);
+ QString pluginName = pfi.baseName().remove(0, 3);
+ PluginInfo pinfo(directory.absoluteFilePath(pluginPath), pluginName);
+
+ QTreeWidgetItem *item = new QTreeWidgetItem(dirItem, FILE_DIR);
+ item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
+
+ if (activePlugins.contains(pluginName))
+ item->setCheckState(0, Qt::Checked);
+ else
+ item->setCheckState(0, Qt::Unchecked);
+
+ item->setText(1, pluginName);
+
+ m_listedPlugins[item] = pinfo;
+ }
+
+ if (dirFiles.isEmpty())
+ System::Error::code = System::Error::NO_PLUGIN_IN_DIR_f(directory.absolutePath());
+}
+
void PluginsDialog::cb_addPlugins()
{
init = true;
@@ -163,7 +207,7 @@ void PluginsDialog::cb_addPlugins()
QStringList files = QFileDialog::getOpenFileNames(
this,
"Select one or more plugins",
- m_window->getAppPath() + QString("/../Plugins/"),
+ m_window->getAppPath(),
"Plugins (lib*.so lib*.dylib)"
);
@@ -202,46 +246,7 @@ void PluginsDialog::cb_addPluginsDirectory()
);
if (!dir.isEmpty())
- {
- QDir directory(dir);
-
- if (!directory.exists())
- System::Error::code = System::Error::BAD_PLUGIN_PATH_IN_FILE_f(directory.absolutePath());
-
- QTreeWidgetItem *dirItem = new QTreeWidgetItem(treeWidget, DIR);
- dirItem->setText(1, directory.path());
-
- QStringList filters;
- filters << "lib*.so";
- filters << "lib*.dylib";
-
- QStringList dirFiles;
- dirFiles = directory.entryList(filters, QDir::Files);
-
- const PluginHash& activePlugins = m_window->getPluginsHash();
-
- foreach(QString pluginPath, dirFiles)
- {
- QFileInfo pfi(pluginPath);
- QString pluginName = pfi.baseName().remove(0, 3);
- PluginInfo pinfo(directory.absoluteFilePath(pluginPath), pluginName);
-
- QTreeWidgetItem *item = new QTreeWidgetItem(dirItem, FILE_DIR);
- item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
-
- if (activePlugins.contains(pluginName))
- item->setCheckState(0, Qt::Checked);
- else
- item->setCheckState(0, Qt::Unchecked);
-
- item->setText(1, pluginName);
-
- m_listedPlugins[item] = pinfo;
- }
-
- if (dirFiles.isEmpty())
- System::Error::code = System::Error::NO_PLUGIN_IN_DIR_f(directory.absolutePath());
- }
+ addPluginsDirectory(dir);
if (System::Error::code != System::Error::SUCCESS)
System::Error::showError(this);
diff --git a/SCHNApps/src/main.cpp b/SCHNApps/src/main.cpp
index b87920e6a899f1328ace435da20d9f9d56de063f..e37fba053a915c10d7209b3607783f92f9633ed7 100644
--- a/SCHNApps/src/main.cpp
+++ b/SCHNApps/src/main.cpp
@@ -9,8 +9,7 @@ int main(int argc, char* argv[])
splash->show();
splash->showMessage("Welcome to SCHNApps", Qt::AlignBottom | Qt::AlignCenter);
- CGoGN::SCHNApps::Window window;
- window.setAppPath(app.applicationDirPath());
+ CGoGN::SCHNApps::Window window(app.applicationDirPath());
window.show();
splash->finish(&window);
diff --git a/SCHNApps/src/window.cpp b/SCHNApps/src/window.cpp
index eda3c894385f6a67b9f95cd1b8dcc173b5c670f3..96f35d5c7f528c0ecbefd458c8b4c505f5686892 100644
--- a/SCHNApps/src/window.cpp
+++ b/SCHNApps/src/window.cpp
@@ -24,8 +24,9 @@ namespace CGoGN
namespace SCHNApps
{
-Window::Window(QWidget *parent) :
+Window::Window(const QString& appPath, QWidget *parent) :
QMainWindow(parent),
+ m_appPath(appPath),
m_firstView(NULL),
m_currentView(NULL)
{
diff --git a/include/Topology/generic/attribmap.h b/include/Topology/generic/attribmap.h
index c5912b45895760a31d62bb9b4a47565ef90408d1..42643392bfb3c8515a407bc193cb48afaf33e1dc 100644
--- a/include/Topology/generic/attribmap.h
+++ b/include/Topology/generic/attribmap.h
@@ -84,12 +84,6 @@ public:
template
bool copyAttribute(AttributeHandler& dst, AttributeHandler& src) ;
- /**
- * get the number of cell in the attribute container of an orbit
- * @param orb the orbit to get number of cells
- */
- unsigned int getNbCells(unsigned int orbit);
-
/****************************************
* UTILITIES *
diff --git a/include/Topology/generic/attribmap.hpp b/include/Topology/generic/attribmap.hpp
index 40e7c5be5d8ae8690ad9505534d27b136654535c..670f7cf9a1c907b6b818178cd574c8e08b2a1a6f 100644
--- a/include/Topology/generic/attribmap.hpp
+++ b/include/Topology/generic/attribmap.hpp
@@ -83,11 +83,6 @@ inline bool AttribMap::copyAttribute(AttributeHandler& dst, AttributeH
return false ;
}
-inline unsigned int AttribMap::getNbCells(unsigned int orbit)
-{
- return this->m_attribs[orbit].size() ;
-}
-
/****************************************
* UTILITIES *
****************************************/
diff --git a/include/Topology/generic/genericmap.h b/include/Topology/generic/genericmap.h
index f6e71877961108f49ff829211a494fe934d8e50d..7326f5cc1c50c3171f58917d266654b211a57589 100644
--- a/include/Topology/generic/genericmap.h
+++ b/include/Topology/generic/genericmap.h
@@ -466,6 +466,12 @@ public:
* ATTRIBUTES MANAGEMENT *
****************************************/
+ /**
+ * get the number of cell in the attribute container of an orbit
+ * @param orb the orbit to get number of cells
+ */
+ unsigned int getNbCells(unsigned int orbit);
+
/**
* get the attrib container of a given orbit
* @param orbit the orbit !!! (bilbo the orbit !)
diff --git a/include/Topology/generic/genericmap.hpp b/include/Topology/generic/genericmap.hpp
index 68841fe66481b73f4b3b4b82a54f3ded8d576c8e..e0e7ef55d376ce584cabfc988039fe5ccfc5eb23 100644
--- a/include/Topology/generic/genericmap.hpp
+++ b/include/Topology/generic/genericmap.hpp
@@ -489,6 +489,11 @@ inline void GenericMap::disableQuickTraversal()
* ATTRIBUTES MANAGEMENT *
****************************************/
+inline unsigned int GenericMap::getNbCells(unsigned int orbit)
+{
+ return m_attribs[orbit].size() ;
+}
+
template
inline AttributeContainer& GenericMap::getAttributeContainer()
{