Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
OVMPropertyVisualizerVectorT.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
51 
52 #define OVM_PROPERTY_VISUALIZER_VECTOR_CC
53 
54 #include <ACG/Utils/ColorConversion.hh>
55 #include "OVMPropertyVisualizerVector.hh"
56 
57 
58 template <typename MeshT>
59 OVMPropertyVisualizerVector<MeshT>::OVMPropertyVisualizerVector(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
60  : OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
61 {
62  if (PropertyVisualizer::widget) delete PropertyVisualizer::widget;
63  VectorWidget* w = new VectorWidget();
64  w->paramVector->setTitle(QString("3D Vector Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
65  PropertyVisualizer::widget = w;
66 
67  lineNode = new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, dynamic_cast < ACG::SceneGraph::SeparatorNode* >( PluginFunctions::getRootNode() ) );
68 
69  w->vectors_edges_rb->hide();
70 }
71 
72 template <typename MeshT>
73 void OVMPropertyVisualizerVector<MeshT>::clear()
74 {
75  lineNode->clear();
76  OVMPropertyVisualizer<MeshT>::clear();
77 }
78 
79 template <typename MeshT>
80 void OVMPropertyVisualizerVector<MeshT>::duplicateProperty()
81 {
82  OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<ACG::Vec3d>();
83 }
84 
85 template<typename MeshT>
86 template<typename PropType, typename EntityIterator>
87 void OVMPropertyVisualizerVector<MeshT>::visualizeVectorAsColorForEntity(PropType prop, EntityIterator e_begin, EntityIterator e_end) {
88  if (!prop)
89  throw VizException("Getting PropHandle from mesh for selected property failed.");
91  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
92  for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) {
93  ACG::Vec3d v = prop[*e_it].normalized() * .5 + ACG::Vec3d(.5, .5, .5);
94  object->colors()[*e_it] = ACG::Vec4f(v[0], v[1], v[2], 1.0);
95  }
96 }
97 
98 template <typename MeshT>
99 void OVMPropertyVisualizerVector<MeshT>::visualizeCellProp(bool _setDrawMode)
100 {
101  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
102  if (w->vectors_colors_rb->isChecked())
103  {
104  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
105  visualizeVectorAsColorForEntity(prop,
106  OVMPropertyVisualizer<MeshT>::mesh->cells_begin(),
107  OVMPropertyVisualizer<MeshT>::mesh->cells_end());
108  if (_setDrawMode)
109  {
110  VolumeMeshObject<MeshT>* object;
111  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
112  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.cellsColoredPerCell);
113  }
114  }
115  else visualizeCellPropAsStrokes();
116 }
117 
118 template <typename MeshT>
119 void OVMPropertyVisualizerVector<MeshT>::visualizeFaceProp(bool _setDrawMode)
120 {
121  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
122  if (w->vectors_colors_rb->isChecked())
123  {
124  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
125  visualizeVectorAsColorForEntity(prop,
126  OVMPropertyVisualizer<MeshT>::mesh->faces_begin(),
127  OVMPropertyVisualizer<MeshT>::mesh->faces_end());
128  if (_setDrawMode)
129  {
130  VolumeMeshObject<MeshT>* object;
131  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
132  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.facesColoredPerFace);
133  }
134  }
135  else visualizeFacePropAsStrokes();
136 }
137 
138 
139 template <typename MeshT>
140 void OVMPropertyVisualizerVector<MeshT>::visualizeHalffaceProp(bool _setDrawMode)
141 {
142  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
143  if (w->vectors_colors_rb->isChecked())
144  {
145  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
146  visualizeVectorAsColorForEntity(prop,
147  OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin(),
148  OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());
149  if (_setDrawMode)
150  {
151  VolumeMeshObject<MeshT>* object;
152  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
153  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halffacesColoredPerHalfface);
154  }
155  }
156  else visualizeHalffacePropAsStrokes();
157 }
158 
159 template <typename MeshT>
160 void OVMPropertyVisualizerVector<MeshT>::visualizeEdgeProp(bool _setDrawMode)
161 {
162  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
163  if (w->vectors_colors_rb->isChecked())
164  {
165  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
166  visualizeVectorAsColorForEntity(prop,
167  OVMPropertyVisualizer<MeshT>::mesh->edges_begin(),
168  OVMPropertyVisualizer<MeshT>::mesh->edges_end());
169  if (_setDrawMode)
170  {
171  VolumeMeshObject<MeshT>* object;
172  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
173  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.edgesColoredPerEdge);
174  }
175  }
176  else visualizeEdgePropAsStrokes();
177 }
178 
179 template <typename MeshT>
180 void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
181 {
182  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
183  if (w->vectors_colors_rb->isChecked())
184  {
185  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
186  visualizeVectorAsColorForEntity(prop,
187  OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin(),
188  OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());
189  if (_setDrawMode)
190  {
191  VolumeMeshObject<MeshT>* object;
192  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
193  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halfedgesColoredPerHalfedge);
194  }
195  }
196  else visualizeHalfedgePropAsStrokes();
197 }
198 
199 template <typename MeshT>
200 void OVMPropertyVisualizerVector<MeshT>::visualizeVertexProp(bool _setDrawMode)
201 {
202  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
203  if (w->vectors_colors_rb->isChecked())
204  {
205  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
206  visualizeVectorAsColorForEntity(prop,
207  OVMPropertyVisualizer<MeshT>::mesh->vertices_begin(),
208  OVMPropertyVisualizer<MeshT>::mesh->vertices_end());
209  if (_setDrawMode)
210  {
211  VolumeMeshObject<MeshT>* object;
212  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
213  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.verticesColored);
214  }
215  }
216  else visualizeVertexPropAsStrokes();
217 }
218 
219 template <typename MeshT>
220 void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
221 {
222  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
223 
224  lineNode->clear();
225 
226  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
227 
228  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
229 
230  if ( !prop )
231  return;
232 
233  OpenVolumeMesh::FaceIter f_begin(OVMPropertyVisualizer<MeshT>::mesh->faces_begin()), f_end(OVMPropertyVisualizer<MeshT>::mesh->faces_end());
234  for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it){
235 
236  ACG::Vec3d center(0.0, 0.0, 0.0);
237  int vCount = 0;
238 
239  OpenVolumeMesh::HalfFaceHandle hfh = OVMPropertyVisualizer<MeshT>::mesh->halfface_handle(*f_it, 0);
240  for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = OVMPropertyVisualizer<MeshT>::mesh->hfv_iter(hfh); hfv_it; ++hfv_it){
241  vCount++;
242  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*hfv_it);
243  }
244 
245  center /= vCount;
246 
247  ACG::Vec3d v = prop[*f_it];
248 
249  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
250  v.normalize();
251 
252  if(vectorWidget->scale->isChecked())
253  v *= vectorWidget->scaleBox->value();
254 
255  lineNode->add_line( center, (center+v) );
256  lineNode->add_color(color);
257  }
258 }
259 
260 template <typename MeshT>
261 void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
262 {
263  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
264 
265  lineNode->clear();
266 
267  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
268 
269  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
270  if ( !prop )
271  return;
272 
273  OpenVolumeMesh::EdgeIter e_begin(OVMPropertyVisualizer<MeshT>::mesh->edges_begin()), e_end(OVMPropertyVisualizer<MeshT>::mesh->edges_end());
274  for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it){
275 
276  OpenVolumeMesh::OpenVolumeMeshEdge edge = OVMPropertyVisualizer<MeshT>::mesh->edge(*e_it);
277  ACG::Vec3d v1 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.from_vertex());
278  ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
279  ACG::Vec3d start = 0.5*(v1+v2);
280 
281  ACG::Vec3d v = prop[*e_it];
282 
283  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
284  v.normalize();
285 
286 
287 
288  if(vectorWidget->scale->isChecked())
289  v *= vectorWidget->scaleBox->value();
290 
291  lineNode->add_line( start, (start+v) );
292  lineNode->add_color(color);
293  }
294 }
295 
296 template <typename MeshT>
297 void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
298 {
299  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
300 
301  lineNode->clear();
302 
303  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
304 
305  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
306  if ( !prop )
307  return;
308 
309  OpenVolumeMesh::HalfEdgeIter he_begin(OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin()), he_end(OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());
310  for (OpenVolumeMesh::HalfEdgeIter he_it = he_begin; he_it != he_end; ++he_it){
311 
312  OpenVolumeMesh::OpenVolumeMeshEdge edge = OVMPropertyVisualizer<MeshT>::mesh->halfedge(*he_it);
313 
314  ACG::Vec3d v1 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.from_vertex());
315  ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
316  ACG::Vec3d start = (2.0*v1+v2)/3.0;
317 
318  ACG::Vec3d v = prop[*he_it];
319 
320  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
321  v.normalize();
322 
323  if(vectorWidget->scale->isChecked())
324  v *= vectorWidget->scaleBox->value();
325 
326  lineNode->add_line( start, (start+v) );
327  lineNode->add_color(color);
328  }
329 }
330 
331 template <typename MeshT>
332 void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
333 {
334  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
335 
336  lineNode->clear();
337 
338  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
339 
340  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
341  if ( !prop )
342  return;
343 
344  OpenVolumeMesh::VertexIter v_begin(OVMPropertyVisualizer<MeshT>::mesh->vertices_begin()), v_end(OVMPropertyVisualizer<MeshT>::mesh->vertices_end());
345  for (OpenVolumeMesh::VertexIter v_it = v_begin; v_it != v_end; ++v_it){
346 
347  ACG::Vec3d start = OVMPropertyVisualizer<MeshT>::mesh->vertex(*v_it);
348 
349  ACG::Vec3d v = prop[*v_it];
350 
351  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
352  v.normalize();
353 
354  if(vectorWidget->scale->isChecked())
355  v *= vectorWidget->scaleBox->value();
356 
357  lineNode->add_line( start, (start+v) );
358  lineNode->add_color(color);
359  }
360 }
361 
362 template <typename MeshT>
363 void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
364 {
365  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
366 
367  lineNode->clear();
368 
369  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
370 
371  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
372 
373  if ( !prop )
374  return;
375 
376  OpenVolumeMesh::CellIter c_begin(OVMPropertyVisualizer<MeshT>::mesh->cells_begin()), c_end(OVMPropertyVisualizer<MeshT>::mesh->cells_end());
377  for (OpenVolumeMesh::CellIter c_it = c_begin; c_it != c_end; ++c_it){
378 
379  // Compute cell's center
380  ACG::Vec3d center(0.0, 0.0, 0.0);
381  unsigned int vCount = OVMPropertyVisualizer<MeshT>::mesh->n_vertices_in_cell(*c_it);
382  for(OpenVolumeMesh::CellVertexIter cv_it = OVMPropertyVisualizer<MeshT>::mesh->cv_iter(*c_it); cv_it.valid(); ++cv_it) {
383  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*cv_it) / (double)vCount;
384  }
385 
386  ACG::Vec3d v = prop[*c_it];
387 
388  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
389  v.normalize();
390 
391  if(vectorWidget->scale->isChecked())
392  v *= vectorWidget->scaleBox->value();
393 
394  lineNode->add_line( center, (center+v) );
395  lineNode->add_color(color);
396  }
397 }
398 
399 template <typename MeshT>
400 void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
401 {
402  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
403 
404  lineNode->clear();
405 
406  ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
407 
408  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
409 
410  if ( !prop )
411  return;
412 
413  OpenVolumeMesh::HalfFaceIter hf_begin(OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin()), hf_end(OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());
414  for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it){
415 
416  ACG::Vec3d center(0.0, 0.0, 0.0);
417  int vCount = 0;
418 
419  for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = OVMPropertyVisualizer<MeshT>::mesh->hfv_iter(*hf_it); hfv_it; ++hfv_it){
420  vCount++;
421  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*hfv_it);
422  }
423 
424  center /= vCount;
425 
426  ACG::Vec3d v = prop[*hf_it];
427 
428  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
429  v.normalize();
430 
431  if(vectorWidget->scale->isChecked())
432  v *= vectorWidget->scaleBox->value();
433 
434  lineNode->add_line( center, (center+v) );
435  lineNode->add_color(color);
436  }
437 }
438 
439 template <typename MeshT>
440 QString OVMPropertyVisualizerVector<MeshT>::getPropertyText(unsigned int index)
441 {
442  return OVMPropertyVisualizer<MeshT>::template getPropertyText_<ACG::Vec3d>(index);
443 }
444 
445 
446 template <typename MeshT>
447 void OVMPropertyVisualizerVector<MeshT>::setCellPropertyFromText(unsigned int index, QString text)
448 {
449  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
450 
451  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
452  if ( !prop )
453  {
454  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
455  return;
456  }
457 
458  OpenVolumeMesh::CellHandle ch(index);
459 
460  prop[ch] = this->strToVec3d(text);
461 }
462 
463 template <typename MeshT>
464 void OVMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int index, QString text)
465 {
466  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
467 
468  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
469  if ( !prop )
470  {
471  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
472  return;
473  }
474 
475  OpenVolumeMesh::FaceHandle fh(index);
476 
477  prop[fh] = this->strToVec3d(text);
478 }
479 
480 template <typename MeshT>
481 void OVMPropertyVisualizerVector<MeshT>::setHalffacePropertyFromText(unsigned int index, QString text)
482 {
483  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
484 
485  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
486  if ( !prop )
487  {
488  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
489  return;
490  }
491 
493 
494  prop[hfh] = this->strToVec3d(text);
495 }
496 
497 template <typename MeshT>
498 void OVMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int index, QString text)
499 {
500  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
501 
502  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
503  if ( !prop )
504  {
505  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
506  return;
507  }
508 
509  OpenVolumeMesh::EdgeHandle eh(index);
510 
511  prop[eh] = this->strToVec3d(text);
512 }
513 
514 template <typename MeshT>
515 void OVMPropertyVisualizerVector<MeshT>::setHalfedgePropertyFromText(unsigned int index, QString text)
516 {
517  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
518 
519  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
520  if ( !prop )
521  {
522  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
523  return;
524  }
525 
527 
528  prop[heh] = this->strToVec3d(text);
529 }
530 
531 template <typename MeshT>
532 void OVMPropertyVisualizerVector<MeshT>::setVertexPropertyFromText(unsigned int index, QString text)
533 {
534  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
535 
536  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
537  if ( !prop )
538  {
539  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
540  return;
541  }
542 
544 
545  prop[vh] = this->strToVec3d(text);
546 }
547 
548 #endif /* ENABLE_OPENVOLUMEMESH_SUPPORT */
bool getObject(int _identifier, BSplineCurveObject *&_object)
Property classes for the different entity types.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
VectorT< float, 4 > Vec4f
Definition: VectorT.hh:144
VectorT< double, 3 > Vec3d
Definition: VectorT.hh:127
Cellection of information about a property.
Definition: Utils.hh:115