50 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
52 #define OVM_PROPERTY_VISUALIZER_DOUBLE_CC
54 #include "OVMPropertyVisualizerDouble.hh"
56 template <
typename MeshT>
57 OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh,
int objectID,
PropertyInfo _propertyInfo)
58 : OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
60 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
62 w->paramDouble->setTitle(QString(
"Double Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
63 PropertyVisualizer::widget = w;
66 template <
typename MeshT>
67 template <
typename PropType,
typename EntityIterator>
68 void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end)
75 colorMin = OVMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
76 colorMax = OVMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
83 if ( doubleWidget->doubleAbsolute->isChecked() ){
91 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){
92 double value = prop[*e_it];
93 if ( doubleWidget->doubleAbsolute->isChecked() ){
94 min = std::min( min, fabs(value));
95 max = std::max( max, fabs(value));
97 min = std::min( min, value);
98 max = std::max( max, value);
103 if( doubleWidget->doubleFixedRange->isChecked())
105 min = doubleWidget->doubleFixedRangeMin->value();
106 max = doubleWidget->doubleFixedRangeMax->value();
110 doubleWidget->doubleFixedRangeMin->setValue(min);
111 doubleWidget->doubleFixedRangeMax->setValue(max);
114 const double range = max - min;
118 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){
121 object->colors()[*e_it] = colorMin;
124 double value = prop[*e_it];
127 if ( doubleWidget->doubleAbsolute->isChecked())
131 value = std::max(min,value);
132 value = std::min(max,value);
134 double t = (value-min)/range;
138 if( doubleWidget->doubleColorCoder->isChecked())
139 color = cc.color_float4(t);
141 color = (colorMin)*(1.0-t) + (colorMax)*t;
144 if (doubleWidget->doubleMapOutsideRange->isChecked()) {
145 if (prop[*e_it] < min || prop[*e_it] > max)
150 object->colors()[*e_it] = color;
154 CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerDouble<MeshT>,
typename MeshT,
double)
156 template <typename MeshT>
157 void OVMPropertyVisualizerDouble<MeshT>::duplicateProperty()
159 OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<double>();
162 template <
typename MeshT>
163 QString OVMPropertyVisualizerDouble<MeshT>::getPropertyText(
unsigned int index)
165 return OVMPropertyVisualizer<MeshT>::template getPropertyText_<double>(index);
168 template <
typename MeshT>
169 void OVMPropertyVisualizerDouble<MeshT>::setCellPropertyFromText(
unsigned int index, QString text)
171 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
176 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
182 prop[ch] = this->strToDouble(text);
185 template <
typename MeshT>
186 void OVMPropertyVisualizerDouble<MeshT>::setFacePropertyFromText(
unsigned int index, QString text)
188 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
193 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
199 prop[fh] = this->strToDouble(text);
202 template <
typename MeshT>
203 void OVMPropertyVisualizerDouble<MeshT>::setHalffacePropertyFromText(
unsigned int index, QString text)
205 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
210 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
216 prop[hfh] = this->strToDouble(text);
219 template <
typename MeshT>
220 void OVMPropertyVisualizerDouble<MeshT>::setEdgePropertyFromText(
unsigned int index, QString text)
222 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
227 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
233 prop[eh] = this->strToDouble(text);
236 template <
typename MeshT>
237 void OVMPropertyVisualizerDouble<MeshT>::setHalfedgePropertyFromText(
unsigned int index, QString text)
239 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
244 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
250 prop[heh] = this->strToDouble(text);
253 template <
typename MeshT>
254 void OVMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(
unsigned int index, QString text)
256 MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
261 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
267 prop[vh] = this->strToDouble(text);
bool getObject(int _identifier, BSplineCurveObject *&_object)
Class for generating nice colors for doubles.
Property classes for the different entity types.
Cellection of information about a property.