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 ...@@ -66,6 +66,9 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh
mNumericLimitMax = std::numeric_limits<T>::max(); mNumericLimitMax = std::numeric_limits<T>::max();
mNumericLimitMin = std::numeric_limits<T>::min(); 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> template <typename MeshT, typename T>
......
...@@ -403,7 +403,8 @@ void OVMPropertyVisualizer<MeshT>::setVertexPropertyFromText(unsigned int /*inde ...@@ -403,7 +403,8 @@ void OVMPropertyVisualizer<MeshT>::setVertexPropertyFromText(unsigned int /*inde
template<typename MeshT> template<typename MeshT>
template<typename Type> template<typename Type>
void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget) { void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget)
{
using PV = OVMPropertyVisualizer<MeshT>; using PV = OVMPropertyVisualizer<MeshT>;
const std::string &prop_name = PV::propertyInfo.propName(); const std::string &prop_name = PV::propertyInfo.propName();
......
...@@ -193,10 +193,9 @@ void PropertyVisualizer::showHistogramT( ...@@ -193,10 +193,9 @@ void PropertyVisualizer::showHistogramT(
ACG::QtWidgets::QtHistogramWidget *widget, ACG::QtWidgets::QtHistogramWidget *widget,
Iterable data) Iterable data)
{ {
const size_t max_bins = 50; // TODO: expose in GUI?
widget->setMinimumHeight(300); widget->setMinimumHeight(300);
widget->setColorCoder(buildColorCoder()); 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 */ #endif /* PROPERTY_VISUALIZER_HH */
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>387</width> <width>443</width>
<height>243</height> <height>566</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -17,7 +17,16 @@ ...@@ -17,7 +17,16 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </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> <number>0</number>
</property> </property>
<item> <item>
...@@ -164,6 +173,35 @@ ...@@ -164,6 +173,35 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </item>
...@@ -175,6 +213,12 @@ ...@@ -175,6 +213,12 @@
<extends>QPushButton</extends> <extends>QPushButton</extends>
<header>ACG/QtWidgets/QtColorChooserButton.hh</header> <header>ACG/QtWidgets/QtColorChooserButton.hh</header>
</customwidget> </customwidget>
<customwidget>
<class>ACG::QtWidgets::QtHistogramWidget</class>
<extends>QWidget</extends>
<header>ACG/QtWidgets/QtHistogramWidget.hh</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>intFixedRange</tabstop> <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