Commit f86cb9ea authored by Martin Heistermann's avatar Martin Heistermann

Use new ACG::Histogram API, implement support for integral properties

parent ceb6e7fe
......@@ -66,6 +66,9 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh
mNumericLimitMax = std::numeric_limits<T>::max();
mNumericLimitMin = std::numeric_limits<T>::min();
this->connect(w->computeHistogramButton, &QPushButton::clicked,
[this, w](){this->template showHistogram<T>(w->histogram);});
}
template <typename MeshT, typename T>
......
......@@ -403,7 +403,8 @@ void OVMPropertyVisualizer<MeshT>::setVertexPropertyFromText(unsigned int /*inde
template<typename MeshT>
template<typename Type>
void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget) {
void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget)
{
using PV = OVMPropertyVisualizer<MeshT>;
const std::string &prop_name = PV::propertyInfo.propName();
......
......@@ -193,10 +193,9 @@ void PropertyVisualizer::showHistogramT(
ACG::QtWidgets::QtHistogramWidget *widget,
Iterable data)
{
const size_t max_bins = 50; // TODO: expose in GUI?
widget->setMinimumHeight(300);
widget->setColorCoder(buildColorCoder());
widget->setHistogram(ptr::make_unique<ACG::HistogramT<PropType>>(data.begin(), data.end(), max_bins));
widget->setHistogram(ACG::create_histogram_auto(data));
}
#endif /* PROPERTY_VISUALIZER_HH */
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>387</width>
<height>243</height>
<width>443</width>
<height>566</height>
</rect>
</property>
<property name="windowTitle">
......@@ -17,7 +17,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -164,6 +173,35 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="histogramGroupbox">
<property name="title">
<string>Histogram</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="computeHistogramButton">
<property name="text">
<string>Compute Histogram</string>
</property>
</widget>
</item>
<item>
<widget class="ACG::QtWidgets::QtHistogramWidget" name="histogram" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -175,6 +213,12 @@
<extends>QPushButton</extends>
<header>ACG/QtWidgets/QtColorChooserButton.hh</header>
</customwidget>
<customwidget>
<class>ACG::QtWidgets::QtHistogramWidget</class>
<extends>QWidget</extends>
<header>ACG/QtWidgets/QtHistogramWidget.hh</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>intFixedRange</tabstop>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment