45 #define OVM_PROPERTY_VISUALIZER_VECTOR_CC 47 #include <ACG/Utils/ColorConversion.hh> 48 #include "OVMPropertyVisualizerVector.hh" 51 template <
typename MeshT,
typename VectorT>
55 if (PropertyVisualizer::widget)
delete PropertyVisualizer::widget;
57 w->paramVector->setTitle(QString(
"3D Vector Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
58 PropertyVisualizer::widget = w;
63 w->vectors_edges_rb->hide();
64 this->connect(w->lineWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
65 [
this](
double value) {lineNode->set_line_width(value);});
68 template <
typename MeshT,
typename VectorT>
75 template <
typename MeshT,
typename VectorT>
81 template<
typename MeshT,
typename VectorT>
82 template<
typename PropType,
typename EntityIterator>
85 throw VizException(
"Getting PropHandle from mesh for selected property failed.");
88 for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) {
94 object->colors()[*e_it] =
ACG::Vec4f(v[0], v[1], v[2], 1.0);
98 template <
typename MeshT,
typename VectorT>
102 if (w->vectors_colors_rb->isChecked())
105 visualizeVectorAsColorForEntity(prop,
108 w->normalize_colors->isChecked());
116 else visualizeCellPropAsStrokes();
119 template <
typename MeshT,
typename VectorT>
123 if (w->vectors_colors_rb->isChecked())
126 visualizeVectorAsColorForEntity(prop,
129 w->normalize_colors->isChecked());
137 else visualizeFacePropAsStrokes();
141 template <
typename MeshT,
typename VectorT>
145 if (w->vectors_colors_rb->isChecked())
148 visualizeVectorAsColorForEntity(prop,
151 w->normalize_colors->isChecked());
159 else visualizeHalffacePropAsStrokes();
162 template <
typename MeshT,
typename VectorT>
166 if (w->vectors_colors_rb->isChecked())
169 visualizeVectorAsColorForEntity(prop,
172 w->normalize_colors->isChecked());
180 else visualizeEdgePropAsStrokes();
183 template <
typename MeshT,
typename VectorT>
187 if (w->vectors_colors_rb->isChecked())
190 visualizeVectorAsColorForEntity(prop,
193 w->normalize_colors->isChecked());
201 else visualizeHalfedgePropAsStrokes();
204 template <
typename MeshT,
typename VectorT>
208 if (w->vectors_colors_rb->isChecked())
211 visualizeVectorAsColorForEntity(prop,
214 w->normalize_colors->isChecked());
222 else visualizeVertexPropAsStrokes();
225 template <
typename MeshT,
typename VectorT>
232 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
255 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
258 if(vectorWidget->scale->isChecked())
259 v *= vectorWidget->scaleBox->value();
261 lineNode->add_line( center, (center+v) );
262 lineNode->add_color(color);
266 template <
typename MeshT,
typename VectorT>
273 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
289 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
294 if(vectorWidget->scale->isChecked())
295 v *= vectorWidget->scaleBox->value();
297 lineNode->add_line( start, (start+v) );
298 lineNode->add_color(color);
302 template <
typename MeshT,
typename VectorT>
309 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
326 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
329 if(vectorWidget->scale->isChecked())
330 v *= vectorWidget->scaleBox->value();
332 lineNode->add_line( start, (start+v) );
333 lineNode->add_color(color);
337 template <
typename MeshT,
typename VectorT>
344 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
357 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
360 if(vectorWidget->scale->isChecked())
361 v *= vectorWidget->scaleBox->value();
363 lineNode->add_line( start, (start+v) );
364 lineNode->add_color(color);
368 template <
typename MeshT,
typename VectorT>
375 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
394 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
397 if(vectorWidget->scale->isChecked())
398 v *= vectorWidget->scaleBox->value();
400 lineNode->add_line( center, (center+v) );
401 lineNode->add_color(color);
405 template <
typename MeshT,
typename VectorT>
412 ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
434 if (vectorWidget->normalize->isChecked() && v.
sqrnorm() > 1e-12)
437 if(vectorWidget->scale->isChecked())
438 v *= vectorWidget->scaleBox->value();
440 lineNode->add_line( center, (center+v) );
441 lineNode->add_color(color);
445 template <
typename MeshT,
typename VectorT>
452 template <
typename MeshT,
typename VectorT>
460 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
466 prop[ch] = this->
template strToVec3<VectorT>(text);
469 template <
typename MeshT,
typename VectorT>
477 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
483 prop[fh] = this->
template strToVec3<VectorT>(text);
486 template <
typename MeshT,
typename VectorT>
494 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
500 prop[hfh] = this->
template strToVec3<VectorT>(text);
503 template <
typename MeshT,
typename VectorT>
511 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
517 prop[eh] = this->
template strToVec3<VectorT>(text);
520 template <
typename MeshT,
typename VectorT>
528 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
534 prop[heh] = this->
template strToVec3<VectorT>(text);
537 template <
typename MeshT,
typename VectorT>
545 emit this->log(
LOGERR, QObject::tr(
"Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
551 prop[vh] = this->
template strToVec3<VectorT>(text);
virtual void clear()
Clears a property.
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.
auto normalized() const -> decltype(*this/std::declval< VectorT< S, DIM >>().norm())
Scalar min() const
return the minimal component
QtTranslationManipulatorNode * manipulatorNode()
Cellection of information about a property.
void clear() override
Clears a property.
decltype(std::declval< S >() *std::declval< S >()) sqrnorm() const
compute squared euclidean norm
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
QString getPropertyText(unsigned int index) override
Returns the value of a property in text form.
VectorT< double, 3 > Vec3d