diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_statistics_on_polyhedron_dialog.ui b/Polyhedron/demo/Polyhedron/Polyhedron_demo_statistics_on_polyhedron_dialog.ui index 8cde2d47477..02ea517cd17 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_statistics_on_polyhedron_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_statistics_on_polyhedron_dialog.ui @@ -2,204 +2,25 @@ Polyhedron_demo_statistics_on_polyhedron_dialog + + Qt::NonModal + 0 0 412 - 698 + 429 Statistics on Polyhedron + + false + - - - - - 0 - 0 - - - - Angles - - - - - 10 - 50 - 351 - 101 - - - - - QLayout::SetMinimumSize - - - - - Minimum - - - - - - - Maximum - - - - - - - TextLabel - - - - - - - Average - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - - - - - GroupBox - - - - - 10 - 30 - 351 - 122 - - - - - QLayout::SetMaximumSize - - - - - Nb. Edges - - - - - - - Minimum Length - - - - - - - TextLabel - - - - - - - Maximum Length - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - Median Length - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - Mean Length - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Nb. Null Length - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - - - - + QDialogButtonBox::Ok @@ -207,171 +28,27 @@ - - - Properties - - - - - 10 - 30 - 351 - 164 - - - - - QLayout::SetMaximumSize + + + + + TextLabel - - - - TextLabel - - - - - - - Nb. Connected Components - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - Volume - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Nb. Vertices - - - - - - - TextLabel - - - - - - - Nb. Facets - - - - - - - Area - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - - - TextLabel - - - - - - - Nb. border edges - - - - - - - TextLabel - - - - - - - Nb. Degenerated Faces - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Self-Intersecting : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - TextLabel - - - - - + + + + + + + + Update + - - okButtonBox - accepted() - Polyhedron_demo_statistics_on_polyhedron_dialog - accept() - - - 177 - 123 - - - 53 - 125 - - - okButtonBox rejected() @@ -388,5 +65,21 @@ + + okButtonBox + accepted() + Polyhedron_demo_statistics_on_polyhedron_dialog + accept() + + + 177 + 123 + + + 53 + 125 + + + diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp index 140a03e39e6..2f0adb5113c 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp @@ -1144,59 +1144,106 @@ void Scene_polyhedron_item::invalidate_aabb_tree() { delete_aabb_tree(this); } - -void Scene_polyhedron_item::statistics_on_polyhedron() +QString Scene_polyhedron_item::compute_stats() { - QDialog dlg; - Ui::Polyhedron_demo_statistics_on_polyhedron_dialog ui; - ui.setupUi(&dlg); - connect(ui.okButtonBox, SIGNAL(accepted()), &dlg, SLOT(accept())); - - ui.label_nbvertices->setText(QString::number(poly->size_of_vertices())); - ui.label_nbfacets->setText(QString::number(poly->size_of_facets())); poly->normalize_border(); - ui.label_nbborderedges->setText(QString::number(poly->size_of_border_halfedges())); - ui.label_nbedges->setText(QString::number(poly->size_of_halfedges()/2)); double min, max, mean, mid; edges_length(poly, min, max, mean, mid); - ui.label_minlength->setText(QString::number(min)); - ui.label_maxlength->setText(QString::number(max)); - ui.label_midlength->setText(QString::number(mid)); - ui.label_meanlength->setText(QString::number(mean)); - ui.label_nulllength->setText(QString::number(number_of_null_length_edges)); - if(self_intersect) - ui.label_selfintersect->setText("Yes"); - else - ui.label_selfintersect->setText("No"); - if(is_triangulated) - ui.label_degenfaces->setText(QString::number(number_of_degenerated_faces)); - else - ui.label_degenfaces->setText(QString("Unknown (not triangulated)")); - if (volume!=-std::numeric_limits::infinity()) - ui.label_volume->setText(QString::number(volume)); - else - ui.label_volume->setText(QString("Inifinite")); - if (area!=-std::numeric_limits::infinity()) - ui.label_area->setText(QString::number(area)); - else - ui.label_area->setText(QString("Infinite")); typedef boost::graph_traits::face_descriptor face_descriptor; int i = 0; BOOST_FOREACH(face_descriptor f, faces(*poly)){ f->id() = i++; } boost::vector_property_map::type> - fccmap(get(boost::face_index, *poly)); - ui.label_nbconnectedcomponents->setText( - QString::number(PMP::connected_components(*poly, fccmap))); + boost::property_map::type> + fccmap(get(boost::face_index, *poly)); double mini, maxi, ave; angles(poly, mini, maxi, ave); - ui.label_minangle->setText(QString::number(mini)); - ui.label_maxangle->setText(QString::number(maxi)); - ui.label_averageangle->setText(QString::number(ave)); + QString nb_vertices(QString::number(poly->size_of_vertices())), nb_facets(QString::number(poly->size_of_facets())), + nbborderedges(QString::number(poly->size_of_border_halfedges())), nbedges(QString::number(poly->size_of_halfedges()/2)), + minlength(QString::number(CGAL::sqrt(min))), maxlength(QString::number(CGAL::sqrt(max))),midlength(QString::number(CGAL::sqrt(mid))), meanlength(QString::number(CGAL::sqrt(mean))), + nulllength(QString::number(number_of_null_length_edges)), selfintersect, degenfaces, s_volume, + s_area, nbconnectedcomponents(QString::number(PMP::connected_components(*poly, fccmap))), minangle(QString::number(min)), + maxangle(QString::number(max)), averageangle(QString::number(ave)); + if (area!=-std::numeric_limits::infinity()) + s_area = QString::number(area); + else + s_area = QString("Infinite"); + if (volume!=-std::numeric_limits::infinity()) + s_volume = QString::number(volume); + else + s_volume = QString("Inifinite"); + if(self_intersect) + selfintersect = QString("Yes"); + else + selfintersect = QString("No"); + if(is_triangulated) + degenfaces = QString::number(number_of_degenerated_faces); + else + degenfaces = QString("Unknown (not triangulated)"); + return QString(" " + "" + "" + " " + "" + "" + " " + " " + "" + "" + "" + " " - dlg.exec(); + "" + "" + " " + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
%18
Properties Nb. Vertices %1
Nb. Facets %2
Nb. Connected Components %3
Nb. border edges%4
Nb. Degenerated Faces%5
Area%6
Volume%7
Self-Intersecting%8
Edges Nb. Edges%9
Minimum Length %10
Maximum Length %11
Median Length %12
Mean Length %13
Nb. Null Length%14
Angles Minimum%15
Maximum%16
Average%17
") + .arg(nb_vertices) + .arg(nb_facets) + .arg(nbconnectedcomponents) + .arg(nbborderedges) + .arg(degenfaces) + .arg(s_area) + .arg(s_volume) + .arg(selfintersect) + .arg(nbedges) + .arg(minlength) + .arg(maxlength) + .arg(midlength) + .arg(meanlength) + .arg(nulllength) + .arg(minangle) + .arg(maxangle) + .arg(averageangle) + .arg(name()); +} +void Scene_polyhedron_item::stat_dlg_update() +{ + + statistics_dlg->hide(); + statistics_on_polyhedron(); +} +void Scene_polyhedron_item::statistics_on_polyhedron() +{ + statistics_dlg = new QDialog(); + Ui::Polyhedron_demo_statistics_on_polyhedron_dialog ui; + ui.setupUi(statistics_dlg); + connect(ui.okButtonBox, SIGNAL(accepted()), statistics_dlg, SLOT(accept())); + connect(ui.updateButton, SIGNAL(clicked()), this, SLOT(stat_dlg_update())); + ui.label_htmltab->setText(compute_stats()); + statistics_dlg->show(); + statistics_dlg->raise(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h index 16bda349841..7dbdf2dc895 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.h @@ -91,6 +91,7 @@ public Q_SLOTS: void update_halfedge_indices(); void invalidate_aabb_tree(); void statistics_on_polyhedron(); + void stat_dlg_update(); Q_SIGNALS: void selected_vertex(void*); @@ -105,6 +106,8 @@ private: private: Polyhedron* poly; + QDialog *statistics_dlg; + QString compute_stats(); private: typedef Scene_item Base;