44#define OVM_PROPERTY_VISUALIZER_DOUBLE_CC
46#include "OVMPropertyVisualizerDouble.hh"
48#include <ACG/Utils/IColorCoder.hh>
49#include <ACG/Utils/LinearTwoColorCoder.hh>
50#include <ACG/Utils/ColorConversion.hh>
54template <
typename MeshT>
58 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
60 w->paramDouble->setTitle(QString(
"Double Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
61 PropertyVisualizer::widget = w;
63 this->connect(w->computeHistogramButton, &QPushButton::clicked,
64 [
this, w](){this->template showHistogram<double>(w->histogram);});
68template <
typename MeshT>
69template <
typename PropType,
typename HandleIterable>
72 using Handle =
decltype(*begin(handles));
79 bool abs = doubleWidget->doubleAbsolute->isChecked();
80 auto transform_value = [abs](
double v) {
88 auto get_value = [&](Handle handle)
90 return transform_value(prop[handle]);
94 if( doubleWidget->doubleFixedRange->isChecked())
96 min = doubleWidget->doubleFixedRangeMin->value();
97 max = doubleWidget->doubleFixedRangeMax->value();
101 min = std::numeric_limits<double>::infinity();
102 max = -std::numeric_limits<double>::infinity();
103 for (
const Handle &h: handles) {
104 auto value = get_value(h);
105 min = std::min(
min, value);
106 max = std::max(
max, value);
108 doubleWidget->doubleFixedRangeMin->setValue(
min);
109 doubleWidget->doubleFixedRangeMax->setValue(
max);
112 const double range =
max -
min;
116 for (
const Handle &h: handles)
118 double value = get_value(h);
119 double t = (value -
min) / range;
120 object->colors()[h] = cc->color_float4(t);
125template <
typename MeshT>
131template <
typename MeshT>
137template <
typename MeshT>
145 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
151 prop[ch] = this->strToDouble(text);
154template <
typename MeshT>
162 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
168 prop[fh] = this->strToDouble(text);
171template <
typename MeshT>
179 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
185 prop[hfh] = this->strToDouble(text);
188template <
typename MeshT>
196 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
202 prop[eh] = this->strToDouble(text);
205template <
typename MeshT>
213 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
219 prop[heh] = this->strToDouble(text);
222template <
typename MeshT>
230 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
236 prop[vh] = this->strToDouble(text);
239template <
typename MeshT>
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.
void duplicateProperty() override
Duplicates a property.
VectorT< Scalar, DIM > min(const VectorT< Scalar, DIM > &_v1, const VectorT< Scalar, DIM > &_v2)
VectorT< Scalar, DIM > max(const VectorT< Scalar, DIM > &_v1, const VectorT< Scalar, DIM > &_v2)
Cellection of information about a property.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.