44 #define OVM_PROPERTY_VISUALIZER_ITEGER_CC 46 #include "OVMPropertyVisualizerInteger.hh" 47 #include <ACG/Utils/ColorConversion.hh> 48 #include <ACG/Utils/LinearTwoColorCoder.hh> 50 template <
typename MeshT,
typename T>
54 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
56 w->paramInt->setTitle(QString(
"Integer Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
57 PropertyVisualizer::widget = w;
61 w->intAbsolute->setChecked(
false);
62 w->intAbsolute->setCheckable(
false);
66 mNumericLimitMax = std::numeric_limits<T>::max();
67 mNumericLimitMin = std::numeric_limits<T>::min();
69 this->connect(w->computeHistogramButton, &QPushButton::clicked,
70 [
this, w](){this->template showHistogram<T>(w->histogram);});
74 template <
typename MeshT,
typename T>
75 template <
typename PropType,
typename HandleIterable>
82 ACG::Vec4f colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
84 std::map< int, ACG::Vec4f> randomColor;
86 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
87 randomColor[ integerWidget->intMapBlackValue->value() ] =
ACG::Vec4f(0.0, 0.0, 0.0, 0.0);
89 T min = mNumericLimitMax;
90 T max = mNumericLimitMin;
92 for (
const auto &h: handles)
95 min = std::min( min, value);
96 max = std::max( max, value);
99 if( integerWidget->intFixedRange->isChecked())
101 min = integerWidget->intFixedRangeMin->value();
102 max = integerWidget->intFixedRangeMax->value();
106 integerWidget->intFixedRangeMin->setValue(min);
107 integerWidget->intFixedRangeMax->setValue(max);
112 unsigned int range = max - min;
116 for (
const auto &h: handles)
119 object->colors()[h] = colorMin;
122 double pos = (value - min) / (
double) range;
124 if ( integerWidget->intRandom->isChecked() )
127 if ( randomColor.find( value ) == randomColor.end() )
131 randomColor[ value ] = color;
133 color = randomColor[ value ];
137 color = cc->color_float4(pos);
140 object->colors()[h] = color;
148 template <
typename MeshT,
typename T>
154 template <
typename MeshT,
typename T>
160 template <
typename MeshT,
typename T>
168 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
174 prop[ch] = this->strToInt(text);
177 template <
typename MeshT,
typename T>
185 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
191 prop[fh] = this->strToInt(text);
194 template <
typename MeshT,
typename T>
202 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
208 prop[hfh] = this->strToInt(text);
211 template <
typename MeshT,
typename T>
219 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
225 prop[eh] = this->strToInt(text);
228 template <
typename MeshT,
typename T>
236 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
242 prop[heh] = this->strToInt(text);
245 template <
typename MeshT,
typename T>
253 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
259 prop[vh] = this->strToInt(text);
262 template <
typename MeshT,
typename T>
void duplicateProperty() override
Duplicates a property.
VectorT< float, 4 > Vec4f
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
virtual Vec4f generateNextColor()
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.
Cellection of information about a property.