50 #define OM_PROPERTY_VISUALIZER_INTEGER_CC 52 #include "OMPropertyVisualizerInteger.hh" 54 template <
typename MeshT,
typename T>
58 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
60 w->paramInt->setTitle(QString(
"Integer Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
61 PropertyVisualizer::widget = w;
65 w->intAbsolute->setChecked(
false);
66 w->intAbsolute->setCheckable(
false);
70 template <
typename MeshT,
typename T>
76 template <
typename MeshT,
typename T>
88 std::map< int, typename MeshT::Color> randomColor;
90 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
91 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
99 T max = std::numeric_limits<T>::min();
100 T min = std::numeric_limits<T>::max();
103 min = std::min( min, getValue(prop, f_it));
104 max = std::max( max, getValue(prop, f_it));
108 if( integerWidget->intFixedRange->isChecked())
110 min = integerWidget->intFixedRangeMin->value();
111 max = integerWidget->intFixedRangeMax->value();
115 integerWidget->intFixedRangeMin->setValue(min);
116 integerWidget->intFixedRangeMax->setValue(max);
119 unsigned int range = max - min;
130 double pos = (getValue(prop, f_it) - min) / (
double) range;
134 if (integerWidget->intColorCoder->isChecked())
136 color = cc.color_float4(pos);
138 else if ( !integerWidget->intRandom->isChecked() ){
140 color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
141 color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
142 color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
147 if ( randomColor.find( getValue(prop, f_it) ) == randomColor.end() ){
152 randomColor[ getValue(prop, f_it) ] = color;
155 color = randomColor[ getValue(prop, f_it) ];
166 template <
typename MeshT,
typename T>
178 std::map< int, typename MeshT::Color> randomColor;
180 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
181 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
189 T max = std::numeric_limits<T>::min();
190 T min = std::numeric_limits<T>::max();
193 min = std::min( min, getValue(prop, e_it));
194 max = std::max( max, getValue(prop, e_it));
198 if( integerWidget->intFixedRange->isChecked())
200 min = integerWidget->intFixedRangeMin->value();
201 max = integerWidget->intFixedRangeMax->value();
205 integerWidget->intFixedRangeMin->setValue(min);
206 integerWidget->intFixedRangeMax->setValue(max);
209 unsigned int range = max - min;
220 double pos = (getValue(prop, e_it) - min) / (
double) range;
224 if (integerWidget->intColorCoder->isChecked())
226 color = cc.color_float4(pos);
228 else if ( !integerWidget->intRandom->isChecked() ){
230 color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
231 color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
232 color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
237 if ( randomColor.find( getValue(prop, e_it) ) == randomColor.end() ){
242 randomColor[ getValue(prop, e_it) ] = color;
245 color = randomColor[ getValue(prop, e_it) ];
257 template <
typename MeshT,
typename T>
269 std::map< int, typename MeshT::Color> randomColor;
271 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
272 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
280 T max = std::numeric_limits<T>::min();
281 T min = std::numeric_limits<T>::max();
284 min = std::min( min, getValue(prop, he_it));
285 max = std::max( max, getValue(prop, he_it));
289 if( integerWidget->intFixedRange->isChecked())
291 min = integerWidget->intFixedRangeMin->value();
292 max = integerWidget->intFixedRangeMax->value();
296 integerWidget->intFixedRangeMin->setValue(min);
297 integerWidget->intFixedRangeMax->setValue(max);
300 unsigned int range = max - min;
311 double pos = (getValue(prop, he_it) - min) / (
double) range;
315 if (integerWidget->intColorCoder->isChecked())
317 color = cc.color_float4(pos);
319 else if ( !integerWidget->intRandom->isChecked() ){
321 color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
322 color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
323 color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
328 if ( randomColor.find( getValue(prop, he_it) ) == randomColor.end() ){
333 randomColor[ getValue(prop, he_it) ] = color;
336 color = randomColor[ getValue(prop, he_it) ];
347 template <
typename MeshT,
typename T>
359 std::map< int, typename MeshT::Color> randomColor;
361 if ( integerWidget->intRandom->isChecked() && integerWidget->intMapBlack->isChecked() )
362 randomColor[ integerWidget->intMapBlackValue->value() ] =
typename MeshT::Color(0.0, 0.0, 0.0, 1.0);
370 T max = std::numeric_limits<T>::min();
371 T min = std::numeric_limits<T>::max();
374 min = std::min( min, getValue(prop, v_it));
375 max = std::max( max, getValue(prop, v_it));
379 if( integerWidget->intFixedRange->isChecked())
381 min = integerWidget->intFixedRangeMin->value();
382 max = integerWidget->intFixedRangeMax->value();
386 integerWidget->intFixedRangeMin->setValue(min);
387 integerWidget->intFixedRangeMax->setValue(max);
390 unsigned int range = max - min;
401 double pos = (getValue(prop, v_it) - min) / (
double) range;
405 if (integerWidget->intColorCoder->isChecked())
407 color = cc.color_float4(pos);
409 else if ( !integerWidget->intRandom->isChecked() ){
411 color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
412 color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
413 color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
420 if ( randomColor.find( getValue(prop, v_it) ) == randomColor.end() ){
425 randomColor[ getValue(prop, v_it) ] = color;
428 color = randomColor[ getValue(prop, v_it) ];
440 template <
typename MeshT,
typename T>
446 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
447 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
450 typename MeshT::FaceHandle fh = mesh->face_handle(index);
453 mesh->property(prop, fh) = this->strToT(text, dummy);
456 template <
typename MeshT,
typename T>
462 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
463 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
465 typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
468 mesh->property(prop, eh) = this->strToT(text, dummy);
471 template <
typename MeshT,
typename T>
477 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
478 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
481 typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
484 mesh->property(prop, heh) = this->strToT(text, dummy);
487 template <
typename MeshT,
typename T>
493 if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
494 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
497 typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
500 mesh->property(prop, vh) = this->strToT(text, dummy);
503 template<
typename MeshT,
typename T>
509 template<
typename MeshT,
typename T>
Cellection of information about a property.
DrawMode HALFEDGES_COLORED
draw halfedges with colors (without shading)
virtual void removeProperty()
Removes the property.
virtual void duplicateProperty()
Duplicates the property.
virtual QString getPropertyText(unsigned int index)
Returns the value of a property in text form.
DrawMode SOLID_FACES_COLORED
draw colored, but not lighted faces using face colors
DrawMode EDGES_COLORED
draw edges with colors (without shading)
Add colors to mesh item (vertices/faces/edges)
virtual Vec4f generateNextColor()
DrawMode SOLID_POINTS_COLORED
draw colored, but not lighted faces using interpolated vertex colors
Class for generating nice colors for doubles.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .