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();
71 template <
typename MeshT,
typename T>
72 template <
typename PropType,
typename EntityIterator>
79 ACG::Vec4f colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
81 std::map< int, ACG::Vec4f> randomColor;
83 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
84 randomColor[ integerWidget->intMapBlackValue->value() ] =
ACG::Vec4f(0.0, 0.0, 0.0, 0.0);
86 T min = mNumericLimitMax;
87 T max = mNumericLimitMin;
89 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it)
91 T value = prop[*e_it];
92 min = std::min( min, value);
93 max = std::max( max, value);
96 if( integerWidget->intFixedRange->isChecked())
98 min = integerWidget->intFixedRangeMin->value();
99 max = integerWidget->intFixedRangeMax->value();
103 integerWidget->intFixedRangeMin->setValue(min);
104 integerWidget->intFixedRangeMax->setValue(max);
109 unsigned int range = max - min;
113 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it)
116 object->colors()[*e_it] = colorMin;
118 T value = prop[*e_it];
119 double pos = (value - min) / (
double) range;
121 if ( integerWidget->intRandom->isChecked() )
124 if ( randomColor.find( value ) == randomColor.end() )
128 randomColor[ value ] = color;
130 color = randomColor[ value ];
134 color = cc->color_float4(pos);
137 object->colors()[*e_it] = color;
145 template <
typename MeshT,
typename T>
151 template <
typename MeshT,
typename T>
157 template <
typename MeshT,
typename T>
165 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
171 prop[ch] = this->strToInt(text);
174 template <
typename MeshT,
typename T>
182 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
188 prop[fh] = this->strToInt(text);
191 template <
typename MeshT,
typename T>
199 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
205 prop[hfh] = this->strToInt(text);
208 template <
typename MeshT,
typename T>
216 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
222 prop[eh] = this->strToInt(text);
225 template <
typename MeshT,
typename T>
233 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
239 prop[heh] = this->strToInt(text);
242 template <
typename MeshT,
typename T>
250 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
256 prop[vh] = this->strToInt(text);
259 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.