Commit 22b6e6b6 authored by Pierre Kraemer's avatar Pierre Kraemer

orbit as template...

parent 3128828e
...@@ -65,18 +65,17 @@ add_executable( tuto_oper3 tuto_oper3.cpp ${tuto_oper3_ui} ${tuto_oper3_moc}) ...@@ -65,18 +65,17 @@ add_executable( tuto_oper3 tuto_oper3.cpp ${tuto_oper3_ui} ${tuto_oper3_moc})
target_link_libraries( tuto_oper3 target_link_libraries( tuto_oper3
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ) ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_UI( tuto_orbits_ui tuto_orbits.ui )
QT4_WRAP_UI( tuto_orbits_ui tuto_orbits.ui ) #QT4_WRAP_CPP(tuto_orbits_moc tuto_orbits.h)
QT4_WRAP_CPP(tuto_orbits_moc tuto_orbits.h) #add_executable( tuto_orbits tuto_orbits.cpp ${tuto_orbits_ui} ${tuto_orbits_moc})
add_executable( tuto_orbits tuto_orbits.cpp ${tuto_orbits_ui} ${tuto_orbits_moc}) #target_link_libraries( tuto_orbits
target_link_libraries( tuto_orbits # ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_UI( show_traversors_ui show_traversors.ui )
QT4_WRAP_UI( show_traversors_ui show_traversors.ui ) #QT4_WRAP_CPP(show_traversors_moc show_traversors.h)
QT4_WRAP_CPP(show_traversors_moc show_traversors.h) #add_executable( show_traversors show_traversors.cpp ${show_traversors_ui} ${show_traversors_moc})
add_executable( show_traversors show_traversors.cpp ${show_traversors_ui} ${show_traversors_moc}) #target_link_libraries( show_traversors
target_link_libraries( show_traversors # ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
add_executable( tuto_subdivision tuto_subdivision.cpp) add_executable( tuto_subdivision tuto_subdivision.cpp)
target_link_libraries( tuto_subdivision target_link_libraries( tuto_subdivision
...@@ -93,8 +92,8 @@ target_link_libraries( tp_master ...@@ -93,8 +92,8 @@ target_link_libraries( tp_master
# exemple: BOOST_LIBS(boost_lib_lists "boost_thread-mt;boost_iostreams-mt") # exemple: BOOST_LIBS(boost_lib_lists "boost_thread-mt;boost_iostreams-mt")
#BOOST_LIBS(boost_lib_lists "boost_thread-mt") #BOOST_LIBS(boost_lib_lists "boost_thread-mt")
QT4_WRAP_CPP(tuto_mt_moc tuto_mt.h) #QT4_WRAP_CPP(tuto_mt_moc tuto_mt.h)
add_executable( tuto_mt tuto_mt.cpp ${tuto_mt_moc}) #add_executable( tuto_mt tuto_mt.cpp ${tuto_mt_moc})
target_link_libraries( tuto_mt #target_link_libraries( tuto_mt
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ${Boost_THREAD_LIBRARY}) # ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ${Boost_THREAD_LIBRARY})
...@@ -22,11 +22,9 @@ ...@@ -22,11 +22,9 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include "show_traversors.h" #include "show_traversors.h"
#include <iostream> #include <iostream>
#include "Algo/Modelisation/primitives3d.h" #include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/polyhedron.h" #include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h" #include "Algo/Modelisation/subdivision.h"
...@@ -40,12 +38,10 @@ ...@@ -40,12 +38,10 @@
#include "Algo/Render/GL2/drawerCells.h" #include "Algo/Render/GL2/drawerCells.h"
PFP::MAP myMap; MAP myMap;
PFP::TVEC3 position ; AttributeHandler<VEC3, VERTEX> position ;
Dart dglobal; Dart dglobal;
void MyQT::cb_checkTopo(bool b) void MyQT::cb_checkTopo(bool b)
{ {
m_showTopo = b; m_showTopo = b;
...@@ -126,7 +122,6 @@ void MyQT::cb_initGL() ...@@ -126,7 +122,6 @@ void MyQT::cb_initGL()
SelectorDartNoBoundary<PFP::MAP> nb(myMap); SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, nb); m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, nb);
m_dm_topo = new DartMarker(myMap); m_dm_topo = new DartMarker(myMap);
} }
void MyQT::cb_redraw() void MyQT::cb_redraw()
...@@ -145,7 +140,6 @@ void MyQT::cb_redraw() ...@@ -145,7 +140,6 @@ void MyQT::cb_redraw()
} }
m_drawer.callList(); m_drawer.callList();
} }
void MyQT::cb_mousePress(int button, int x, int y) void MyQT::cb_mousePress(int button, int x, int y)
...@@ -153,17 +147,16 @@ void MyQT::cb_mousePress(int button, int x, int y) ...@@ -153,17 +147,16 @@ void MyQT::cb_mousePress(int button, int x, int y)
if (Shift()) if (Shift())
{ {
SelectorDartNoBoundary<PFP::MAP> nb(myMap); SelectorDartNoBoundary<PFP::MAP> nb(myMap);
Dart d = m_render_topo->picking<PFP>(myMap, x,y, nb); Dart d = m_render_topo->picking<PFP>(myMap, x, y, nb);
if (d != Dart::nil()) if (d != Dart::nil())
{ {
CGoGNout << "Dart "<< d << " clicked" << CGoGNendl; CGoGNout << "Dart " << d << " clicked" << CGoGNendl;
m_selected = d; m_selected = d;
} }
updateGL(); updateGL();
} }
} }
void MyQT::cb_Save() void MyQT::cb_Save()
{ {
// std::string filename = selectFileSave("Export SVG file ",".","(*.svg)"); // std::string filename = selectFileSave("Export SVG file ",".","(*.svg)");
...@@ -171,13 +164,13 @@ void MyQT::cb_Save() ...@@ -171,13 +164,13 @@ void MyQT::cb_Save()
// m_drawer.toSVG(svg); // m_drawer.toSVG(svg);
// m_render_topo->toSVG(svg); // m_render_topo->toSVG(svg);
Utils::SVG::SVGOut svg1(modelViewMatrix(),projectionMatrix()); Utils::SVG::SVGOut svg1(modelViewMatrix(), projectionMatrix());
m_drawer.toSVG(svg1); m_drawer.toSVG(svg1);
svg1.addOpacityAnimation(1.0f); svg1.addOpacityAnimation(1.0f);
svg1.addOpacityAnimation(1.0f); svg1.addOpacityAnimation(1.0f);
svg1.addOpacityAnimation(0.0f); svg1.addOpacityAnimation(0.0f);
Utils::SVG::SVGOut svg2(modelViewMatrix(),projectionMatrix()); Utils::SVG::SVGOut svg2(modelViewMatrix(), projectionMatrix());
m_render_topo->toSVG(svg2); m_render_topo->toSVG(svg2);
svg2.addOpacityAnimation(1.0f); svg2.addOpacityAnimation(1.0f);
svg2.addOpacityAnimation(0.0f); svg2.addOpacityAnimation(0.0f);
...@@ -191,18 +184,16 @@ void MyQT::cb_Save() ...@@ -191,18 +184,16 @@ void MyQT::cb_Save()
std::string filename = selectFileSave("Export SVG file ",".","(*.svg)"); std::string filename = selectFileSave("Export SVG file ",".","(*.svg)");
anim.write(filename, 2.0f); anim.write(filename, 2.0f);
} }
void MyQT::colorizeCell(Dart d, unsigned int orbit, float r,float g, float b) template <unsigned int ORBIT>
void MyQT::colorizeCell(Dart d, float r,float g, float b)
{ {
TraversorDartsOfOrbit<PFP::MAP>doo (myMap,orbit,d); TraversorDartsOfOrbit<PFP::MAP, ORBIT>doo (myMap, d);
for (Dart e = doo.begin(); e!=doo.end(); e = doo.next()) for (Dart e = doo.begin(); e != doo.end(); e = doo.next())
m_render_topo->setDartColor(e,r,g,b); m_render_topo->setDartColor(e, r, g, b);
} }
void MyQT::traverse2() void MyQT::traverse2()
{ {
if (m_selected == NIL) if (m_selected == NIL)
...@@ -220,36 +211,33 @@ void MyQT::traverse2() ...@@ -220,36 +211,33 @@ void MyQT::traverse2()
if (m_ajd_or_inci2 == 0) // incident if (m_ajd_or_inci2 == 0) // incident
{ {
Algo::Render::drawerCell<PFP>(VERTEX+m_second2, m_drawer,myMap,m_selected,position,m_expl); Algo::Render::drawerCell<PFP>(VERTEX+m_second2, m_drawer, myMap, m_selected, position, m_expl);
m_drawer.color3f(1.0f,0.0f,0.0f); m_drawer.color3f(1.0f,0.0f,0.0f);
Traversor2<PFP::MAP>* tra = Traversor2<PFP::MAP>::createIncident(myMap,m_selected,VERTEX+m_second2,VERTEX+m_first2); Traversor2<PFP::MAP>* tra = Traversor2<PFP::MAP>::createIncident(myMap, m_selected, VERTEX+m_second2, VERTEX+m_first2);
for (Dart d=tra->begin(); d != tra->end(); d= tra->next()) for (Dart d=tra->begin(); d != tra->end(); d= tra->next())
m_affDarts.push_back(d); m_affDarts.push_back(d);
Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap,m_affDarts,position,m_expl); Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap, m_affDarts, position, m_expl);
} }
else // adjacent else // adjacent
{ {
Algo::Render::drawerCell<PFP>(VERTEX+m_first2, m_drawer,myMap,m_selected,position,m_expl); Algo::Render::drawerCell<PFP>(VERTEX+m_first2, m_drawer, myMap, m_selected, position, m_expl);
m_drawer.color3f(1.0f,0.0f,0.0f); m_drawer.color3f(1.0f,0.0f,0.0f);
Traversor2<PFP::MAP>* tra = Traversor2<PFP::MAP>::createAdjacent(myMap,m_selected,VERTEX+m_first2,VERTEX+m_second2); Traversor2<PFP::MAP>* tra = Traversor2<PFP::MAP>::createAdjacent(myMap, m_selected, VERTEX+m_first2, VERTEX+m_second2);
for (Dart d=tra->begin(); d != tra->end(); d= tra->next()) for (Dart d = tra->begin(); d != tra->end(); d = tra->next())
m_affDarts.push_back(d); m_affDarts.push_back(d);
Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap,m_affDarts,position,m_expl); Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap, m_affDarts, position, m_expl);
} }
m_drawer.endList(); m_drawer.endList();
SelectorMarked sm(*m_dm_topo); SelectorMarked sm(*m_dm_topo);
m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, sm ); m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, sm);
updateGL(); updateGL();
} }
void MyQT::traverse3() void MyQT::traverse3()
{ {
if (m_selected == NIL) if (m_selected == NIL)
...@@ -268,35 +256,34 @@ void MyQT::traverse3() ...@@ -268,35 +256,34 @@ void MyQT::traverse3()
m_dm_topo->unmarkAll(); m_dm_topo->unmarkAll();
SelectorMarked sm(*m_dm_topo); SelectorMarked sm(*m_dm_topo);
if (m_ajd_or_inci3 == 0) // incident if (m_ajd_or_inci3 == 0) // incident
{ {
Algo::Render::drawerCell<PFP>(VERTEX+m_second3, m_drawer,myMap,m_selected,position,m_expl); Algo::Render::drawerCell<PFP>(VERTEX+m_second3, m_drawer,myMap,m_selected,position,m_expl);
m_dm_topo->markOrbit(VERTEX+m_second3,m_selected); m_dm_topo->markOrbit<VERTEX+m_second3>(m_selected);
m_drawer.color3f(1.0f,0.0f,0.0f); m_drawer.color3f(1.0f,0.0f,0.0f);
Traversor3XY<PFP::MAP> tra(myMap,m_selected,VERTEX+m_second3,VERTEX+m_first3); Traversor3XY<PFP::MAP, VERTEX+m_second3, VERTEX+m_first3> tra(myMap, m_selected);
for (Dart d=tra.begin(); d != tra.end(); d= tra.next()) for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{ {
m_affDarts.push_back(d); m_affDarts.push_back(d);
m_dm_topo->markOrbit(VERTEX+m_first3,d); m_dm_topo->markOrbit<VERTEX+m_first3>(d);
} }
Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap,m_affDarts,position,m_expl); Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap, m_affDarts, position, m_expl);
m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, sm); m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f, sm);
for (std::vector<Dart>::iterator id=m_affDarts.begin(); id != m_affDarts.end(); ++id) for (std::vector<Dart>::iterator id = m_affDarts.begin(); id != m_affDarts.end(); ++id)
m_render_topo->setDartColor(*id,0.7f,0.0f,0.0f); m_render_topo->setDartColor(*id,0.7f,0.0f,0.0f);
m_render_topo->setDartColor(m_selected,0.0f,0.7f,0.0f); m_render_topo->setDartColor(m_selected,0.0f,0.7f,0.0f);
} }
else // adjacent else // adjacent
{ {
Algo::Render::drawerCell<PFP>(VERTEX+m_first3, m_drawer,myMap,m_selected,position,m_expl); Algo::Render::drawerCell<PFP>(VERTEX+m_first3, m_drawer, myMap, m_selected, position, m_expl);
m_dm_topo->markOrbit(VERTEX+m_first3,m_selected); m_dm_topo->markOrbit<VERTEX+m_first3>(m_selected);
m_drawer.color3f(1.0f,0.0f,0.0f); m_drawer.color3f(1.0f,0.0f,0.0f);
Traversor3XXaY<PFP::MAP> tra(myMap,m_selected,VERTEX+m_first3,VERTEX+m_second3); Traversor3XXaY<PFP::MAP, VERTEX+m_first3, VERTEX+m_second3> tra(myMap,m_selected);
for (Dart d=tra.begin(); d != tra.end(); d= tra.next()) for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{ {
m_affDarts.push_back(d); m_affDarts.push_back(d);
m_dm_topo->markOrbit(VERTEX+m_first3,d); m_dm_topo->markOrbit<VERTEX+m_first3>(d);
} }
Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap,m_affDarts,position,m_expl); Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap,m_affDarts,position,m_expl);
...@@ -308,16 +295,12 @@ void MyQT::traverse3() ...@@ -308,16 +295,12 @@ void MyQT::traverse3()
m_drawer.endList(); m_drawer.endList();
updateGL(); updateGL();
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position"); position = myMap.addAttribute<VEC3, VERTEX>( "position");
Algo::Modelisation::Primitive3D<PFP> prim(myMap, position); Algo::Modelisation::Primitive3D<PFP> prim(myMap, position);
dglobal = prim.hexaGrid_topo(4,4,4); dglobal = prim.hexaGrid_topo(4,4,4);
...@@ -334,8 +317,6 @@ int main(int argc, char **argv) ...@@ -334,8 +317,6 @@ int main(int argc, char **argv)
// message d'aide // message d'aide
sqt.setHelpMsg("shit click to select a dart\nand select a traversor\nif keyboard focus problem\nundock"); sqt.setHelpMsg("shit click to select a dart\nand select a traversor\nif keyboard focus problem\nundock");
// bounding box // bounding box
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position); Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2)); float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
...@@ -359,7 +340,6 @@ int main(int argc, char **argv) ...@@ -359,7 +340,6 @@ int main(int argc, char **argv)
sqt.show(); sqt.show();
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
} }
...@@ -71,8 +71,8 @@ struct PFP: public PFP_STANDARD ...@@ -71,8 +71,8 @@ struct PFP: public PFP_STANDARD
#endif #endif
}; };
typedef PFP::MAP MAP ;
using namespace CGoGN ; typedef PFP::VEC3 VEC3 ;
/** /**
...@@ -89,7 +89,6 @@ class MyQT: public Utils::QT::SimpleQT ...@@ -89,7 +89,6 @@ class MyQT: public Utils::QT::SimpleQT
Algo::Render::GL2::Topo3Render* m_render_topo; Algo::Render::GL2::Topo3Render* m_render_topo;
bool m_showTopo; bool m_showTopo;
unsigned int m_first3; unsigned int m_first3;
unsigned int m_ajd_or_inci3; unsigned int m_ajd_or_inci3;
unsigned int m_second3; unsigned int m_second3;
...@@ -112,7 +111,6 @@ public: ...@@ -112,7 +111,6 @@ public:
m_last(2), m_last(2),
m_selected(NIL), m_selected(NIL),
m_dm_topo(NULL) m_dm_topo(NULL)
{} {}
Dart m_selected; Dart m_selected;
...@@ -133,7 +131,8 @@ protected: ...@@ -133,7 +131,8 @@ protected:
void cb_mousePress(int button, int x, int y); void cb_mousePress(int button, int x, int y);
void colorizeCell(Dart d, unsigned int orbit, float r,float g, float b); template <unsigned int ORBIT>
void colorizeCell(Dart d, float r,float g, float b);
void traverse2(); void traverse2();
void traverse3(); void traverse3();
...@@ -149,7 +148,6 @@ public slots: ...@@ -149,7 +148,6 @@ public slots:
void cb_combo6(int x); void cb_combo6(int x);
void cb_checkTopo(bool b); void cb_checkTopo(bool b);
void cb_explode(int x); void cb_explode(int x);
}; };
#endif #endif
...@@ -62,9 +62,9 @@ typedef PFP::VEC3 Point3D; ...@@ -62,9 +62,9 @@ typedef PFP::VEC3 Point3D;
// Variables pour la gestion des plongements // Variables pour la gestion des plongements
// handler d'attribut de position par sommet // handler d'attribut de position par sommet
AttributeHandler<Point3D> position; AttributeHandler<Point3D, VERTEX> position;
// handler d'attribut de normale par sommet // handler d'attribut de normale par sommet
AttributeHandler<PFP::VEC3> normal; AttributeHandler<PFP::VEC3, VERTEX> normal;
/// Fonctions a connaitre: /// Fonctions a connaitre:
...@@ -92,7 +92,7 @@ private: ...@@ -92,7 +92,7 @@ private:
// Assigne un nouveau plongement au sommet. Les anciens plongements sont libérés. // Assigne un nouveau plongement au sommet. Les anciens plongements sont libérés.
void newVertex(Dart d) { void newVertex(Dart d) {
embedNewCell(VERTEX,d); embedNewCell<VERTEX>(d);
} }
public: public:
...@@ -522,7 +522,7 @@ void MyQT::cb_keyPress(int keycode) ...@@ -522,7 +522,7 @@ void MyQT::cb_keyPress(int keycode)
if (!d_vertices.empty()) if (!d_vertices.empty())
{ {
std::stringstream ss; std::stringstream ss;
ss << "Sommet: dart: " << d_vertices[0].index << ": " << position[d_vertices[0]]<< "( id emb:"<< myMap.getEmbedding(VERTEX,d_vertices[0])<<")"<< std::endl; ; ss << "Sommet: dart: " << d_vertices[0].index << ": " << position[d_vertices[0]]<< "( id emb:"<< myMap.getEmbedding<VERTEX>(d_vertices[0])<<")"<< std::endl;
statusMsg(ss.str().c_str()); statusMsg(ss.str().c_str());
} }
break; break;
...@@ -600,13 +600,13 @@ int main(int argc, char **argv) ...@@ -600,13 +600,13 @@ int main(int argc, char **argv)
if (argc == 2) { if (argc == 2) {
std::vector<std::string> attrNames ; std::vector<std::string> attrNames ;
Algo::Import::importMesh<PFP>(myMap, argv[1], attrNames) ; Algo::Import::importMesh<PFP>(myMap, argv[1], attrNames) ;
position = myMap.getAttribute<Point3D>(VERTEX, attrNames[0]) ; position = myMap.getAttribute<Point3D, VERTEX>(attrNames[0]) ;
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal"); normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal");
Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ; Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
} }
else { else {
position = myMap.addAttribute<Point3D>(VERTEX, "position"); position = myMap.addAttribute<Point3D, VERTEX>("position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal"); normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal");
myMap.createMap(); myMap.createMap();
Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ; Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
} }
......
...@@ -36,10 +36,9 @@ ...@@ -36,10 +36,9 @@
#include "Algo/Import/import.h" #include "Algo/Import/import.h"
PFP::MAP myMap; MAP myMap;
PFP::TVEC3 position ; AttributeHandler<VEC3, VERTEX> position ;
PFP::TVEC3 middleDarts; AttributeHandler<VEC3, DART> middleDarts;
void MyQT::text_onoff(bool x) void MyQT::text_onoff(bool x)
...@@ -49,14 +48,12 @@ void MyQT::text_onoff(bool x) ...@@ -49,14 +48,12 @@ void MyQT::text_onoff(bool x)
CGoGNerr << " text_onoff " << CGoGNflush; CGoGNerr << " text_onoff " << CGoGNflush;
} }
void MyQT::slider_text(int x) void MyQT::slider_text(int x)
{ {
m_strings->setScale(0.02f*x); m_strings->setScale(0.02f*x);
updateGL(); updateGL();
} }
void MyQT::orbit_list(int x) void MyQT::orbit_list(int x)
{ {
storeVerticesInfo<int>(m_att_orbits[x]); storeVerticesInfo<int>(m_att_orbits[x]);
...@@ -64,11 +61,11 @@ void MyQT::orbit_list(int x) ...@@ -64,11 +61,11 @@ void MyQT::orbit_list(int x)
if (m_clicked != Dart::nil()) if (m_clicked != Dart::nil())
{ {
unsigned int orbs[9] ={VERTEX,EDGE,FACE,VOLUME,PFP::MAP::ORBIT_IN_PARENT(VERTEX),PFP::MAP::ORBIT_IN_PARENT(EDGE),PFP::MAP::ORBIT_IN_PARENT(FACE),PFP::MAP::ORBIT_IN_PARENT2(VERTEX),PFP::MAP::ORBIT_IN_PARENT2(EDGE)}; unsigned int orbs[9] = {VERTEX,EDGE,FACE,VOLUME,PFP::MAP::ORBIT_IN_PARENT(VERTEX),PFP::MAP::ORBIT_IN_PARENT(EDGE),PFP::MAP::ORBIT_IN_PARENT(FACE),PFP::MAP::ORBIT_IN_PARENT2(VERTEX),PFP::MAP::ORBIT_IN_PARENT2(EDGE)};
m_selected.clear(); m_selected.clear();
// easy way to traverse darts of orbit // easy way to traverse darts of orbit
TraversorDartsOfOrbit<PFP::MAP> tra(myMap,orbs[current_orbit],m_clicked); TraversorDartsOfOrbit<MAP> tra(myMap, orbs[current_orbit], m_clicked);
for (Dart e = tra.begin(); e != tra.end(); e = tra.next()) for (Dart e = tra.begin(); e != tra.end(); e = tra.next())
m_selected.push_back(e); m_selected.push_back(e);
} }
...@@ -77,21 +74,20 @@ void MyQT::orbit_list(int x) ...@@ -77,21 +74,20 @@ void MyQT::orbit_list(int x)
updateGL(); updateGL();
} }
template<typename T, unsigned int ORBIT>
template<typename T> void MyQT::storeVerticesInfo(const AttributeHandler<T, ORBIT>& attrib)
void MyQT::storeVerticesInfo(const AttributeHandler<T>& attrib)
{ {
SelectorDartNoBoundary<PFP::MAP> nb(myMap); SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render_topo->computeDartMiddlePositions<PFP>(myMap,middleDarts,nb); m_render_topo->computeDartMiddlePositions<PFP>(myMap, middleDarts, nb);
m_strings->clear(); m_strings->clear();
for (Dart d=myMap.begin(); d!=myMap.end(); myMap.next(d)) for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{ {
if (nb(d)) if (nb(d))
{ {
std::stringstream ss; std::stringstream ss;
ss << attrib[d]; ss << attrib[d];
m_strings->addString(ss.str(),middleDarts[d]); m_strings->addString(ss.str(), middleDarts[d]);
} }
} }
m_strings->sendToVBO(); m_strings->sendToVBO();
...@@ -109,10 +105,7 @@ void MyQT::cb_initGL() ...@@ -109,10 +105,7 @@ void MyQT::cb_initGL()
m_strings = new Utils::Strings3D(true, Geom::Vec3f(0.1f,0.0f,0.3f)); m_strings = new Utils::Strings3D(true, Geom::Vec3f(0.1f,0.0f,0.3f));
registerShader(m_strings); registerShader(m_strings);