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> 54 template <
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);});
68 template <
typename MeshT>
69 template <
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);
125 template <
typename MeshT>
131 template <
typename MeshT>
137 template <
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);
154 template <
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);
171 template <
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);
188 template <
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);
205 template <
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);
222 template <
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);
239 template <
typename MeshT>
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
Cellection of information about a property.
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.
void duplicateProperty() override
Duplicates a property.