diff --git a/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h b/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h index 8f43b4a2d6734fe67e8882da585d66c4dfcb32a3..23199d841119992bf372e8bd0658d9b187bdecbc 100644 --- a/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h +++ b/SCHNApps/Plugins/differentialProperties/include/differentialProperties.h @@ -6,26 +6,11 @@ #include "computeNormalDialog.h" #include "computeCurvatureDialog.h" -#include "Topology/generic/functor.h" -#include "Topology/generic/parameters.h" -#include "Topology/map/embeddedMap2.h" -#include "Topology/generic/attributeHandler.h" - using namespace CGoGN; using namespace SCHNApps; -struct PFP: public PFP_STANDARD -{ - typedef EmbeddedMap2 MAP; -}; - -typedef PFP::MAP MAP; -typedef PFP::REAL REAL; -typedef PFP::VEC3 VEC3; - - class DifferentialPropertiesPlugin : public Plugin { Q_OBJECT diff --git a/SCHNApps/Plugins/differentialProperties/src/computeCurvatureDialog.cpp b/SCHNApps/Plugins/differentialProperties/src/computeCurvatureDialog.cpp index 896e0c43099ea9c8f40c7e3f4e6e1ba6034d7d73..b7b8f44dd0a9b737abfd66f4a5077e49eb5ee803 100644 --- a/SCHNApps/Plugins/differentialProperties/src/computeCurvatureDialog.cpp +++ b/SCHNApps/Plugins/differentialProperties/src/computeCurvatureDialog.cpp @@ -52,8 +52,8 @@ void ComputeCurvatureDialog::cb_selectedMapChanged() std::vector types; cont.getAttributesNames(names); cont.getAttributesTypes(types); - std::string vec3TypeName = nameOfType(VEC3()); - std::string realTypeName = nameOfType(REAL()); + std::string vec3TypeName = nameOfType(typename PFP2::VEC3()); + std::string realTypeName = nameOfType(typename PFP2::REAL()); unsigned int j = 0; unsigned int k = 0; for(unsigned int i = 0; i < names.size(); ++i) diff --git a/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp b/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp index f56e110f62669703153cd1c42855665c7fdf7e1a..41e5608dcf5dc1753c57d085009107b48257cb8f 100644 --- a/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp +++ b/SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp @@ -43,7 +43,7 @@ void ComputeNormalDialog::cb_selectedMapChanged() std::vector types; cont.getAttributesNames(names); cont.getAttributesTypes(types); - std::string vec3TypeName = nameOfType(VEC3()); + std::string vec3TypeName = nameOfType(typename PFP2::VEC3()); unsigned int j = 0; for(unsigned int i = 0; i < names.size(); ++i) { diff --git a/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp b/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp index b7416f6c26893e6314fa1090ceb2104fa12420db..54434dde4684a16fd604e960dcaef0c6d4e5ee63 100644 --- a/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp +++ b/SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp @@ -47,8 +47,8 @@ void DifferentialPropertiesPlugin::cb_computeNormal() if(!currentItems.empty()) { const QString& mapname = currentItems[0]->text(); - MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); - MAP* map = mh->getMap(); + MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); + typename PFP2::MAP* map = mh->getMap(); std::string positionName = m_computeNormalDialog->combo_positionAttribute->currentText().toUtf8().constData(); std::string normalName; @@ -56,12 +56,12 @@ void DifferentialPropertiesPlugin::cb_computeNormal() normalName = m_computeNormalDialog->combo_normalAttribute->currentText().toUtf8().constData(); else normalName = m_computeNormalDialog->normalAttributeName->text().toUtf8().constData(); - VertexAttribute position = map->getAttribute(positionName); - VertexAttribute normal = map->getAttribute(normalName); + VertexAttribute position = map->getAttribute(positionName); + VertexAttribute normal = map->getAttribute(normalName); if(!normal.isValid()) - normal = map->addAttribute(normalName); + normal = map->addAttribute(normalName); - Algo::Surface::Geometry::computeNormalVertices(*map, position, normal); + Algo::Surface::Geometry::computeNormalVertices(*map, position, normal); if(m_computeNormalDialog->check_createVBO->checkState() == Qt::Checked) mh->createVBO(normal); @@ -81,66 +81,66 @@ void DifferentialPropertiesPlugin::cb_computeCurvature() if(!currentItems.empty()) { const QString& mapname = currentItems[0]->text(); - MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); - MAP* map = mh->getMap(); + MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); + typename PFP2::MAP* map = mh->getMap(); std::string positionName = m_computeCurvatureDialog->combo_positionAttribute->currentText().toUtf8().constData(); std::string normalName = m_computeCurvatureDialog->combo_normalAttribute->currentText().toUtf8().constData(); - VertexAttribute position = map->getAttribute(positionName); - VertexAttribute normal = map->getAttribute(normalName); + VertexAttribute position = map->getAttribute(positionName); + VertexAttribute normal = map->getAttribute(normalName); std::string KmaxName; if(m_computeCurvatureDialog->KmaxAttributeName->text().isEmpty()) KmaxName = m_computeCurvatureDialog->combo_KmaxAttribute->currentText().toUtf8().constData(); else KmaxName = m_computeCurvatureDialog->KmaxAttributeName->text().toUtf8().constData(); - VertexAttribute Kmax = map->getAttribute(KmaxName); + VertexAttribute Kmax = map->getAttribute(KmaxName); if(!Kmax.isValid()) - Kmax = map->addAttribute(KmaxName); + Kmax = map->addAttribute(KmaxName); std::string kmaxName; if(m_computeCurvatureDialog->kmaxAttributeName->text().isEmpty()) kmaxName = m_computeCurvatureDialog->combo_kmaxAttribute->currentText().toUtf8().constData(); else kmaxName = m_computeCurvatureDialog->kmaxAttributeName->text().toUtf8().constData(); - VertexAttribute kmax = map->getAttribute(kmaxName); + VertexAttribute kmax = map->getAttribute(kmaxName); if(!kmax.isValid()) - kmax = map->addAttribute(kmaxName); + kmax = map->addAttribute(kmaxName); std::string KminName; if(m_computeCurvatureDialog->KminAttributeName->text().isEmpty()) KminName = m_computeCurvatureDialog->combo_KminAttribute->currentText().toUtf8().constData(); else KminName = m_computeCurvatureDialog->KminAttributeName->text().toUtf8().constData(); - VertexAttribute Kmin = map->getAttribute(KminName); + VertexAttribute Kmin = map->getAttribute(KminName); if(!Kmin.isValid()) - Kmin = map->addAttribute(KminName); + Kmin = map->addAttribute(KminName); std::string kminName; if(m_computeCurvatureDialog->kminAttributeName->text().isEmpty()) kminName = m_computeCurvatureDialog->combo_kminAttribute->currentText().toUtf8().constData(); else kminName = m_computeCurvatureDialog->kminAttributeName->text().toUtf8().constData(); - VertexAttribute kmin = map->getAttribute(kminName); + VertexAttribute kmin = map->getAttribute(kminName); if(!kmin.isValid()) - kmin = map->addAttribute(kminName); + kmin = map->addAttribute(kminName); std::string KnormalName; if(m_computeCurvatureDialog->KnormalAttributeName->text().isEmpty()) KnormalName = m_computeCurvatureDialog->combo_KnormalAttribute->currentText().toUtf8().constData(); else KnormalName = m_computeCurvatureDialog->KnormalAttributeName->text().toUtf8().constData(); - VertexAttribute Knormal = map->getAttribute(KnormalName); + VertexAttribute Knormal = map->getAttribute(KnormalName); if(!Knormal.isValid()) - Knormal = map->addAttribute(KnormalName); + Knormal = map->addAttribute(KnormalName); - EdgeAttribute edgeAngle = map->getAttribute("edgeAngle"); + EdgeAttribute edgeAngle = map->getAttribute("edgeAngle"); if(!edgeAngle.isValid()) - edgeAngle = map->addAttribute("edgeAngle"); - Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges(*map, position, edgeAngle); + edgeAngle = map->addAttribute("edgeAngle"); + Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges(*map, position, edgeAngle); - Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles_Projected(*map, 0.01f * mh->getBBdiagSize(), position, normal, edgeAngle, kmax, kmin, Kmax, Kmin, Knormal); + Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles_Projected(*map, 0.01f * mh->getBBdiagSize(), position, normal, edgeAngle, kmax, kmin, Kmax, Kmin, Knormal); if(m_computeCurvatureDialog->check_KmaxCreateVBO->checkState() == Qt::Checked) mh->createVBO(Kmax); diff --git a/SCHNApps/Plugins/importSurface/importSurface.cpp b/SCHNApps/Plugins/importSurface/importSurface.cpp index 752ca506320970401179e84f649005b3e0d0f0c1..66b2cae0a99e331ec2d7a34d4ac110fb109f65c6 100644 --- a/SCHNApps/Plugins/importSurface/importSurface.cpp +++ b/SCHNApps/Plugins/importSurface/importSurface.cpp @@ -22,14 +22,16 @@ void ImportSurfacePlugin::cb_import() if(fi.exists()) { - MAP* m = new MAP(); - MapHandler* h = new MapHandler(fi.baseName(), m_window, m); +// typename PFP2::MAP* m = new typename PFP2::MAP(); + GenericMap* m = m_window->createMap(2); + typename PFP2::MAP* map = static_cast(m); + MapHandler* h = new MapHandler(fi.baseName(), m_window, map); std::vector attrNames ; - Algo::Surface::Import::importMesh(*m, fileName.toUtf8().constData(), attrNames); + Algo::Surface::Import::importMesh(*map, fileName.toUtf8().constData(), attrNames); // get vertex position attribute - VertexAttribute position = m->getAttribute(attrNames[0]); + VertexAttribute position = map->getAttribute(attrNames[0]); // create VBO for vertex position attribute h->createVBO(position); diff --git a/SCHNApps/Plugins/importSurface/importSurface.h b/SCHNApps/Plugins/importSurface/importSurface.h index 0bd15b62fbd00d92cced8b0ae4ce5fc4fadff795..dacc9a7f66ef82b216c3af64e17f9b69345004d5 100644 --- a/SCHNApps/Plugins/importSurface/importSurface.h +++ b/SCHNApps/Plugins/importSurface/importSurface.h @@ -3,23 +3,11 @@ #include "plugin.h" -#include "Topology/generic/functor.h" -#include "Topology/generic/parameters.h" -#include "Topology/map/embeddedMap2.h" - using namespace CGoGN; using namespace SCHNApps; -struct PFP: public PFP_STANDARD -{ - typedef EmbeddedMap2 MAP; -}; - -typedef PFP::MAP MAP; -typedef PFP::VEC3 VEC3; - class ImportSurfacePlugin : public Plugin { Q_OBJECT diff --git a/SCHNApps/Plugins/renderVector/renderVector.cpp b/SCHNApps/Plugins/renderVector/renderVector.cpp index 8fc5e89336efe046535ffe244fb8326be2589db0..e0498ee89bda97c48c1fc7044853d7e65b80836d 100644 --- a/SCHNApps/Plugins/renderVector/renderVector.cpp +++ b/SCHNApps/Plugins/renderVector/renderVector.cpp @@ -216,6 +216,7 @@ void RenderVectorDockTab::refreshUI(ParameterSet* params) PerMapParameterSet& p = params->perMap[map->getName()]; QList vbos = map->getVBOList(); + unsigned int j = 0; for(int i = 0; i < vbos.count(); ++i) { combo_positionVBO->addItem(QString::fromStdString(vbos[i]->name())); @@ -230,9 +231,13 @@ void RenderVectorDockTab::refreshUI(ParameterSet* params) else if(vbos[i] == p.positionVBO) combo_positionVBO->setCurrentIndex(i); - list_vectorVBO->addItem(QString::fromStdString(vbos[i]->name())); - if(std::find(p.vectorVBO.begin(), p.vectorVBO.end(), vbos[i]) != p.vectorVBO.end()) - list_vectorVBO->item(i)->setSelected(true); + if(vbos[i]->dataSize() == 3) + { + list_vectorVBO->addItem(QString::fromStdString(vbos[i]->name())); + if(std::find(p.vectorVBO.begin(), p.vectorVBO.end(), vbos[i]) != p.vectorVBO.end()) + list_vectorVBO->item(j)->setSelected(true); + ++j; + } } if(p.positionVBO == NULL && vbos.count() > 0) diff --git a/SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp b/SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp index 5d74398e81e27a1d7867148b9459f8ee21e45627..95773abf87c2c3e5af5f921de11354184eebd84b 100644 --- a/SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp +++ b/SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp @@ -56,7 +56,7 @@ void SubdivideSurfacePlugin::cb_selectedMapChanged() std::vector types; cont.getAttributesNames(names); cont.getAttributesTypes(types); - std::string vec3TypeName = VEC3::CGoGNnameOfType(); + std::string vec3TypeName = nameOfType(PFP2::VEC3()); unsigned int j = 0; for(unsigned int i = 0; i < names.size(); ++i) { @@ -77,12 +77,12 @@ void SubdivideSurfacePlugin::cb_loopSubdivision() if(!currentItems.empty()) { const QString& mapname = currentItems[0]->text(); - MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); - MAP* map = mh->getMap(); + MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); + typename PFP2::MAP* map = mh->getMap(); std::string positionName = m_dockTab->combo_positionAttribute->currentText().toUtf8().constData(); - VertexAttribute position = map->getAttribute(positionName); + VertexAttribute position = map->getAttribute(positionName); - Algo::Surface::Modelisation::LoopSubdivision(*map, position); + Algo::Surface::Modelisation::LoopSubdivision(*map, position); mh->updatePrimitives(Algo::Render::GL2::POINTS); mh->updatePrimitives(Algo::Render::GL2::LINES); @@ -104,12 +104,12 @@ void SubdivideSurfacePlugin::cb_CCSubdivision() if(!currentItems.empty()) { const QString& mapname = currentItems[0]->text(); - MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); - MAP* map = mh->getMap(); + MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); + typename PFP2::MAP* map = mh->getMap(); std::string positionName = m_dockTab->combo_positionAttribute->currentText().toUtf8().constData(); - VertexAttribute position = map->getAttribute(positionName); + VertexAttribute position = map->getAttribute(positionName); - Algo::Surface::Modelisation::CatmullClarkSubdivision(*map, position); + Algo::Surface::Modelisation::CatmullClarkSubdivision(*map, position); mh->updatePrimitives(Algo::Render::GL2::POINTS); mh->updatePrimitives(Algo::Render::GL2::LINES); @@ -131,12 +131,12 @@ void SubdivideSurfacePlugin::cb_trianguleFaces() if(!currentItems.empty()) { const QString& mapname = currentItems[0]->text(); - MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); - MAP* map = mh->getMap(); + MapHandler* mh = reinterpret_cast*>(m_window->getMap(mapname)); + typename PFP2::MAP* map = mh->getMap(); std::string positionName = m_dockTab->combo_positionAttribute->currentText().toUtf8().constData(); - VertexAttribute position = map->getAttribute(positionName); + VertexAttribute position = map->getAttribute(positionName); - Algo::Surface::Modelisation::trianguleFaces(*map, position); + Algo::Surface::Modelisation::trianguleFaces(*map, position); mh->updatePrimitives(Algo::Render::GL2::POINTS); mh->updatePrimitives(Algo::Render::GL2::LINES); diff --git a/SCHNApps/Plugins/subdivideSurface/subdivideSurface.h b/SCHNApps/Plugins/subdivideSurface/subdivideSurface.h index 09769757118d4a3a159365afa4434a11ea7a2c8b..31389f7222b210b8e1ad636cb42632335a351d42 100644 --- a/SCHNApps/Plugins/subdivideSurface/subdivideSurface.h +++ b/SCHNApps/Plugins/subdivideSurface/subdivideSurface.h @@ -4,25 +4,11 @@ #include "plugin.h" #include "ui_subdivideSurface.h" -#include "Topology/generic/functor.h" -#include "Topology/generic/parameters.h" -#include "Topology/map/embeddedMap2.h" -#include "Topology/generic/attributeHandler.h" - using namespace CGoGN; using namespace SCHNApps; -struct PFP: public PFP_STANDARD -{ - typedef EmbeddedMap2 MAP; -}; - -typedef PFP::MAP MAP; -typedef PFP::VEC3 VEC3; - - class SubdivideSurfaceDockTab : public QWidget, public Ui::SubdivideSurfaceWidget { public: diff --git a/SCHNApps/include/types.h b/SCHNApps/include/types.h index 89ced8892c3023243b4d362ba2360b9af59f4082..4cadd9f9d16feaba146ec0dff0fcc2beea85a46b 100644 --- a/SCHNApps/include/types.h +++ b/SCHNApps/include/types.h @@ -5,6 +5,10 @@ #include #include +#include "Topology/generic/parameters.h" +#include "Topology/map/embeddedMap2.h" +#include "Topology/map/embeddedMap3.h" + namespace CGoGN { @@ -14,6 +18,16 @@ class VBO; class GLSLShader; } +struct PFP2: public PFP_STANDARD +{ + typedef EmbeddedMap2 MAP; +}; + +struct PFP3: public PFP_STANDARD +{ + typedef EmbeddedMap3 MAP; +}; + namespace SCHNApps { diff --git a/SCHNApps/include/window.h b/SCHNApps/include/window.h index 418c59865ff7f841eb24381bebd9155e0893a2a6..91a502385c89d395af9e55d9bf2b331032e90a79 100644 --- a/SCHNApps/include/window.h +++ b/SCHNApps/include/window.h @@ -252,6 +252,7 @@ public: * MANAGE MAPS *********************************************************/ + GenericMap* createMap(unsigned int dim); bool addMap(MapHandlerGen* map); void removeMap(const QString& name); MapHandlerGen* getMap(const QString& name) const; diff --git a/SCHNApps/src/window.cpp b/SCHNApps/src/window.cpp index 63925e67500482b35b7e970149df97f119e03a8f..9fa0693c8a6205d45188ec6b6c6f85629b6247a0 100644 --- a/SCHNApps/src/window.cpp +++ b/SCHNApps/src/window.cpp @@ -507,6 +507,21 @@ Plugin* Window::checkPluginDependencie(QString name, Plugin* dependantPlugin) * MANAGE MAPS *********************************************************/ +GenericMap* Window::createMap(unsigned int dim) +{ + GenericMap* map = NULL; + switch(dim) + { + case 2 : + map = new PFP2::MAP(); + break; + case 3 : + map = new PFP3::MAP(); + break; + } + return map; +} + bool Window::addMap(MapHandlerGen* map) { if (h_maps.contains(map->getName()))