* Add map characteristics in the status bar

* Add a creation of two volumes 3-sewn
This commit is contained in:
Guillaume Damiand 2010-03-26 14:10:06 +00:00
parent 112cadf35e
commit e24fa2e64e
4 changed files with 75 additions and 25 deletions

View File

@ -37,14 +37,14 @@ MainWindow::connectActions()
QObject::connect(this->actionSubdivide, SIGNAL(triggered()),
this, SLOT(subdivide()));
QObject::connect(this->actionCreateCube, SIGNAL(triggered()),
this, SLOT(create_cube()));
QObject::connect(this->actionCreate3Cubes, SIGNAL(triggered()),
this, SLOT(create_3cubes()));
QObject::connect(this->actionCreate2Volumes, SIGNAL(triggered()),
this, SLOT(create_2volumes()));
QObject::connect(this, SIGNAL(sceneChanged()),
this->viewer, SLOT(sceneChanged()));
QObject::connect(this->actionDisplayInfo, SIGNAL(triggered()),
this, SLOT(display_info()));
this, SLOT(onSceneChanged()));
QObject::connect(this->actionClear, SIGNAL(triggered()),
this, SLOT(clear()));
@ -52,11 +52,32 @@ MainWindow::connectActions()
}
void
MainWindow::display_info()
MainWindow::onSceneChanged()
{
scene.map.display_characteristics(std::cout)<<std::endl;
std::cout<<"Nb vertices:"<< scene.map.size_of_vertices()<<std::endl
<<"Nb Darts:"<< scene.map.size_of_darts()<<std::endl;
std::cout<<"[BEGIN] MainWindow::onSceneChanged()"<<std::endl;
int mark = scene.map.get_new_mark();
scene.map.negate_mask_mark(mark);
unsigned int nb0, nb1, nb2, nb3, nb4;
scene.map.count_cells(mark, &nb0, &nb1, &nb2, &nb3, &nb4, NULL);
std::ostringstream os;
os<<"Darts: "<< scene.map.size_of_darts()
<<", Vertices:"<<nb0
<<", Edges:"<<nb1
<<", Faces:"<<nb2
<<", Volumes:"<<nb3
<<", Connected components:"<<nb4;
scene.map.free_mark(mark);
viewer->sceneChanged();
statusBar()->showMessage(os.str().c_str());
std::cout<<"[END] MainWindow::onSceneChanged()"<<std::endl;
}
void
@ -138,7 +159,7 @@ MainWindow::load_3DTDS(const QString& fileName, bool clear)
}
void
MainWindow::create_cube()
MainWindow::create_3cubes()
{
Dart_handle d1=make_cube(scene.map, Point_3(nbcube, nbcube, nbcube), 1);
Dart_handle d2=make_cube(scene.map, Point_3(nbcube+1, nbcube, nbcube), 1);
@ -152,9 +173,31 @@ MainWindow::create_cube()
emit (sceneChanged());
}
void
MainWindow::create_2volumes()
{
Dart_handle d1=make_cube(scene.map, Point_3(nbcube, nbcube, nbcube), 1);
Dart_handle d2=make_cube(scene.map, Point_3(nbcube+1, nbcube, nbcube), 1);
Dart_handle d3=make_cube(scene.map, Point_3(nbcube, nbcube+1, nbcube), 1);
Dart_handle d4=make_cube(scene.map, Point_3(nbcube+1, nbcube+1, nbcube), 1);
scene.map.sew3(d1->beta(1,1)->beta(2),d2->beta(2));
scene.map.sew3(d1->beta(2)->beta(1,1)->beta(2),d3);
scene.map.sew3(d3->beta(1,1)->beta(2),d4->beta(2));
scene.map.sew3(d2->beta(2)->beta(1,1)->beta(2),d4);
remove_face_3(scene.map,d3);
remove_face_3(scene.map,d2->beta(2));
++nbcube;
emit (sceneChanged());
}
void
MainWindow::subdivide()
{
{
subdivide_map_3(scene.map);
emit (sceneChanged());
}

View File

@ -29,16 +29,18 @@ public slots:
void import_3DTDS();
void load_3DTDS(const QString& fileName, bool clear=true);
void subdivide();
void create_cube();
void display_info();
void clear();
void subdivide();
void create_3cubes();
void create_2volumes();
void onSceneChanged();
signals:
void sceneChanged();
private:
unsigned int nbcube;
};

View File

@ -33,7 +33,7 @@
<x>0</x>
<y>0</y>
<width>635</width>
<height>28</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -54,8 +54,8 @@
<string>Operations</string>
</property>
<addaction name="actionSubdivide"/>
<addaction name="actionCreateCube"/>
<addaction name="actionDisplayInfo"/>
<addaction name="actionCreate3Cubes"/>
<addaction name="actionCreate2Volumes"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuOperations"/>
@ -81,9 +81,9 @@
<string>Subdivide</string>
</property>
</action>
<action name="actionCreateCube">
<action name="actionCreate3Cubes">
<property name="text">
<string>Create cube</string>
<string>Create 3 cubes</string>
</property>
</action>
<action name="actionImport3DTDS">
@ -101,6 +101,11 @@
<string>Clear</string>
</property>
</action>
<action name="actionCreate2Volumes">
<property name="text">
<string>Create 2 volumes</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -21,7 +21,7 @@ public:
int degree=0;
bool open = false;
Map::Edge_iterator_of_vertex it(mmap, d);
for ( ; it!=mmap.edge_iterator_of_vertex_end(d); ++it )
{