44 #define OM_PROPERTY_VISUALIZER_INTEGER_CC 46 #include <ACG/Utils/IColorCoder.hh> 47 #include <ACG/Utils/ColorConversion.hh> 48 #include "OMPropertyVisualizerInteger.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);
64 this->connect(w->computeHistogramButton, &QPushButton::clicked,
65 [
this, w](){this->template showHistogram<T>(w->histogram);});
68 template <
typename MeshT,
typename T>
74 template <
typename MeshT,
typename T>
79 typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
82 std::map< int, typename MeshT::Color> randomColor;
84 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
85 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
93 T max = std::numeric_limits<T>::min();
94 T min = std::numeric_limits<T>::max();
97 min = std::min( min, getValue(prop, f_it));
98 max = std::max( max, getValue(prop, f_it));
102 if( integerWidget->intFixedRange->isChecked())
104 min = integerWidget->intFixedRangeMin->value();
105 max = integerWidget->intFixedRangeMax->value();
109 integerWidget->intFixedRangeMin->setValue(min);
110 integerWidget->intFixedRangeMax->setValue(max);
113 unsigned int range = max - min;
124 double pos = (getValue(prop, f_it) - min) / (
double) range;
128 if (integerWidget->intRandom->isChecked() ){
129 if ( randomColor.find( getValue(prop, f_it) ) == randomColor.end() ){
134 randomColor[ getValue(prop, f_it) ] = color;
137 color = randomColor[ getValue(prop, f_it) ];
139 color = cc->color_float4(pos);
150 template <
typename MeshT,
typename T>
155 typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
158 std::map< int, typename MeshT::Color> randomColor;
160 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
161 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
169 T max = std::numeric_limits<T>::min();
170 T min = std::numeric_limits<T>::max();
173 min = std::min( min, getValue(prop, e_it));
174 max = std::max( max, getValue(prop, e_it));
178 if( integerWidget->intFixedRange->isChecked())
180 min = integerWidget->intFixedRangeMin->value();
181 max = integerWidget->intFixedRangeMax->value();
185 integerWidget->intFixedRangeMin->setValue(min);
186 integerWidget->intFixedRangeMax->setValue(max);
189 unsigned int range = max - min;
200 double pos = (getValue(prop, e_it) - min) / (
double) range;
204 if (integerWidget->intRandom->isChecked() ){
205 if ( randomColor.find( getValue(prop, e_it) ) == randomColor.end() ){
210 randomColor[ getValue(prop, e_it) ] = color;
213 color = randomColor[ getValue(prop, e_it) ];
215 color = cc->color_float4(pos);
227 template <
typename MeshT,
typename T>
232 typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
235 std::map< int, typename MeshT::Color> randomColor;
237 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
238 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
246 T max = std::numeric_limits<T>::min();
247 T min = std::numeric_limits<T>::max();
250 min = std::min( min, getValue(prop, he_it));
251 max = std::max( max, getValue(prop, he_it));
255 if( integerWidget->intFixedRange->isChecked())
257 min = integerWidget->intFixedRangeMin->value();
258 max = integerWidget->intFixedRangeMax->value();
262 integerWidget->intFixedRangeMin->setValue(min);
263 integerWidget->intFixedRangeMax->setValue(max);
266 unsigned int range = max - min;
277 double pos = (getValue(prop, he_it) - min) / (
double) range;
281 if (integerWidget->intRandom->isChecked() ){
282 if ( randomColor.find( getValue(prop, he_it) ) == randomColor.end() ){
287 randomColor[ getValue(prop, he_it) ] = color;
290 color = randomColor[ getValue(prop, he_it) ];
292 color = cc->color_float4(pos);
303 template <
typename MeshT,
typename T>
308 typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
311 std::map< int, typename MeshT::Color> randomColor;
313 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
314 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
322 T max = std::numeric_limits<T>::min();
323 T min = std::numeric_limits<T>::max();
326 min = std::min( min, getValue(prop, v_it));
327 max = std::max( max, getValue(prop, v_it));
331 if( integerWidget->intFixedRange->isChecked())
333 min = integerWidget->intFixedRangeMin->value();
334 max = integerWidget->intFixedRangeMax->value();
338 integerWidget->intFixedRangeMin->setValue(min);
339 integerWidget->intFixedRangeMax->setValue(max);
342 unsigned int range = max - min;
353 double pos = (getValue(prop, v_it) - min) / (
double) range;
357 if (integerWidget->intRandom->isChecked() ){
358 if ( randomColor.find( getValue(prop, v_it) ) == randomColor.end() ){
363 randomColor[ getValue(prop, v_it) ] = color;
366 color = randomColor[ getValue(prop, v_it) ];
368 color = cc->color_float4(pos);
380 template <
typename MeshT,
typename T>
386 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
387 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
390 typename MeshT::FaceHandle fh = mesh->face_handle(index);
393 mesh->property(prop, fh) = this->strToT(text, dummy);
396 template <
typename MeshT,
typename T>
402 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
403 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
405 typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
408 mesh->property(prop, eh) = this->strToT(text, dummy);
411 template <
typename MeshT,
typename T>
417 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
418 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
421 typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
424 mesh->property(prop, heh) = this->strToT(text, dummy);
427 template <
typename MeshT,
typename T>
433 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
434 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
437 typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
440 mesh->property(prop, vh) = this->strToT(text, dummy);
443 template<
typename MeshT,
typename T>
449 template<
typename MeshT,
typename T>
void duplicateProperty() override
Duplicates the property.
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.
virtual Vec4f generateNextColor()
Add colors to mesh item (vertices/faces/edges)
void removeProperty() override
Removes the property.
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
Cellection of information about a property.
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
DrawMode EDGES_COLORED
draw edges with colors (without shading)