50 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
52 #define OVM_PROPERTY_VISUALIZER_DOUBLE_CC
54 #include "OVMPropertyVisualizerDouble.hh"
56 #include <ACG/Utils/IColorCoder.hh>
57 #include <ACG/Utils/LinearTwoColorCoder.hh>
58 #include <ACG/Utils/ColorConversion.hh>
62 template <
typename MeshT>
63 OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh,
int objectID,
PropertyInfo _propertyInfo)
64 : OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
66 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
68 w->paramDouble->setTitle(QString(
"Double Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
69 PropertyVisualizer::widget = w;
71 this->connect(w->computeHistogramButton, &QPushButton::clicked,
72 [
this, w](){this->template showHistogram<double>(w->histogram);});
76 template <
typename MeshT>
77 template <
typename PropType,
typename EntityIterator>
78 void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end)
83 ACG::Vec4f colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
88 if ( doubleWidget->doubleAbsolute->isChecked() ){
96 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){
97 double value = prop[*e_it];
98 if ( doubleWidget->doubleAbsolute->isChecked() ){
99 min = std::min( min, fabs(value));
100 max = std::max( max, fabs(value));
102 min = std::min( min, value);
103 max = std::max( max, value);
108 if( doubleWidget->doubleFixedRange->isChecked())
110 min = doubleWidget->doubleFixedRangeMin->value();
111 max = doubleWidget->doubleFixedRangeMax->value();
115 doubleWidget->doubleFixedRangeMin->setValue(min);
116 doubleWidget->doubleFixedRangeMax->setValue(max);
119 const double range = max - min;
123 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){
126 object->colors()[*e_it] = colorMin;
129 double value = prop[*e_it];
132 if ( doubleWidget->doubleAbsolute->isChecked())
136 value = std::max(min,value);
137 value = std::min(max,value);
139 double t = (value-min)/range;
143 if (doubleWidget->doubleMapOutsideRange->isChecked()) {
144 if (prop[*e_it] < min || prop[*e_it] > max)
149 object->colors()[*e_it] = color;
153 CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerDouble<MeshT>,
typename MeshT,
double)
155 template <typename MeshT>
156 void OVMPropertyVisualizerDouble<MeshT>::duplicateProperty()
158 OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<double>();
161 template <
typename MeshT>
162 QString OVMPropertyVisualizerDouble<MeshT>::getPropertyText(
unsigned int index)
164 return OVMPropertyVisualizer<MeshT>::template getPropertyText_<double>(index);
167 template <
typename MeshT>
168 void OVMPropertyVisualizerDouble<MeshT>::setCellPropertyFromText(
unsigned int index, QString text)
170 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
175 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
181 prop[ch] = this->strToDouble(text);
184 template <
typename MeshT>
185 void OVMPropertyVisualizerDouble<MeshT>::setFacePropertyFromText(
unsigned int index, QString text)
187 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
192 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
198 prop[fh] = this->strToDouble(text);
201 template <
typename MeshT>
202 void OVMPropertyVisualizerDouble<MeshT>::setHalffacePropertyFromText(
unsigned int index, QString text)
204 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
209 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
215 prop[hfh] = this->strToDouble(text);
218 template <
typename MeshT>
219 void OVMPropertyVisualizerDouble<MeshT>::setEdgePropertyFromText(
unsigned int index, QString text)
221 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
226 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
232 prop[eh] = this->strToDouble(text);
235 template <
typename MeshT>
236 void OVMPropertyVisualizerDouble<MeshT>::setHalfedgePropertyFromText(
unsigned int index, QString text)
238 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
243 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
249 prop[heh] = this->strToDouble(text);
252 template <
typename MeshT>
253 void OVMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(
unsigned int index, QString text)
255 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
260 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
266 prop[vh] = this->strToDouble(text);
269 template <
typename MeshT>
270 std::unique_ptr<ACG::IColorCoder> OVMPropertyVisualizerDouble<MeshT>::buildColorCoder()
bool getObject(int _identifier, BSplineCurveObject *&_object)
Property classes for the different entity types.
std::unique_ptr< ACG::IColorCoder > buildColorCoder()
Builds a color coder according to UI settings.
Cellection of information about a property.