mirror of https://github.com/CGAL/cgal
Statistics is now an html table.
This commit is contained in:
parent
aca6a0a161
commit
d33ec35b97
|
|
@ -2,204 +2,25 @@
|
|||
<ui version="4.0">
|
||||
<class>Polyhedron_demo_statistics_on_polyhedron_dialog</class>
|
||||
<widget class="QDialog" name="Polyhedron_demo_statistics_on_polyhedron_dialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>698</height>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Statistics on Polyhedron</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="AnglesGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Angles</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>351</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Minimum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_minangle">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Average</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_maxangle">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_averageangle">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="EdgesGroupBox">
|
||||
<property name="title">
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>351</width>
|
||||
<height>122</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Nb. Edges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Minimum Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_maxlength">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Maximum Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_minlength">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_midlength">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Median Length</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_nbedges">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_meanlength">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Mean Length</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Nb. Null Length</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_nulllength">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QDialogButtonBox" name="okButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
|
|
@ -207,171 +28,27 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="PropertiesGroupBox">
|
||||
<property name="title">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>351</width>
|
||||
<height>164</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_htmltab">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_nbconnectedcomponents">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Nb. Connected Components</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_nbborderedges">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_nbfacets">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Nb. Vertices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_area">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Nb. Facets</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Area</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_nbvertices">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_degenfaces">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Nb. border edges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_volume">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Nb. Degenerated Faces</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Self-Intersecting :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_selfintersect">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QToolButton" name="updateButton">
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Polyhedron_demo_statistics_on_polyhedron_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>177</x>
|
||||
<y>123</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>53</x>
|
||||
<y>125</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>okButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
|
|
@ -388,5 +65,21 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>okButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Polyhedron_demo_statistics_on_polyhedron_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>177</x>
|
||||
<y>123</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>53</x>
|
||||
<y>125</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -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<double>::infinity())
|
||||
ui.label_volume->setText(QString::number(volume));
|
||||
else
|
||||
ui.label_volume->setText(QString("Inifinite"));
|
||||
if (area!=-std::numeric_limits<double>::infinity())
|
||||
ui.label_area->setText(QString::number(area));
|
||||
else
|
||||
ui.label_area->setText(QString("Infinite"));
|
||||
typedef boost::graph_traits<Polyhedron>::face_descriptor face_descriptor;
|
||||
int i = 0;
|
||||
BOOST_FOREACH(face_descriptor f, faces(*poly)){
|
||||
f->id() = i++;
|
||||
}
|
||||
boost::vector_property_map<int,
|
||||
boost::property_map<Polyhedron, boost::face_index_t>::type>
|
||||
fccmap(get(boost::face_index, *poly));
|
||||
ui.label_nbconnectedcomponents->setText(
|
||||
QString::number(PMP::connected_components(*poly, fccmap)));
|
||||
boost::property_map<Polyhedron, boost::face_index_t>::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<double>::infinity())
|
||||
s_area = QString::number(area);
|
||||
else
|
||||
s_area = QString("Infinite");
|
||||
if (volume!=-std::numeric_limits<double>::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("<html> <table border=1> "
|
||||
"<tr><td colspan = 2></td><td>%18</td>"
|
||||
"<tr><th rowspan=8> Properties </th>"
|
||||
"<td>Nb. Vertices</td> <td>%1</td> "
|
||||
"</tr>"
|
||||
"<tr><td> Nb. Facets </td><td>%2</td></tr>"
|
||||
"<tr><td>Nb. Connected Components</td> <td>%3</td> </tr> "
|
||||
"<tr><td>Nb. border edges</td><td>%4</td></tr> "
|
||||
"<tr><td>Nb. Degenerated Faces</td><td>%5</td></tr>"
|
||||
"<tr><td>Area</td><td>%6</td></tr>"
|
||||
"<tr><td>Volume</td><td>%7</td></tr>"
|
||||
"<tr><td>Self-Intersecting</td><td>%8</td></tr> "
|
||||
|
||||
dlg.exec();
|
||||
"<tr><th rowspan=6> Edges </th>"
|
||||
"<td>Nb. Edges</td><td>%9</td>"
|
||||
"</tr> "
|
||||
"<tr><td> Minimum Length </td><td>%10</td></tr>"
|
||||
"<tr><td> Maximum Length </td><td>%11</td></tr>"
|
||||
"<tr><td> Median Length </td><td>%12</td></tr>"
|
||||
"<tr><td> Mean Length </td><td>%13</td></tr>"
|
||||
"<tr><td> Nb. Null Length</td><td>%14</td></tr>"
|
||||
"<tr><th rowspan=3>Angles </th>"
|
||||
"<td>Minimum</td><td>%15</td>"
|
||||
"</tr>"
|
||||
"<tr><td> Maximum</td><td>%16</td></tr>"
|
||||
"<tr><td> Average</td><td>%17</td></tr>"
|
||||
"</tr>"
|
||||
"</table></html>")
|
||||
.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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue