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 "OVMPropertyVisualizerVector.hh"
55 
56 
57 template <typename MeshT>
58 OVMPropertyVisualizerVector<MeshT>::OVMPropertyVisualizerVector(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
59  : OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
60 {
61  if (PropertyVisualizer::widget) delete PropertyVisualizer::widget;
62  VectorWidget* w = new VectorWidget();
63  w->paramVector->setTitle(QString("3D Vector Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
64  PropertyVisualizer::widget = w;
65 
66  lineNode = new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, dynamic_cast < ACG::SceneGraph::SeparatorNode* >( PluginFunctions::getRootNode() ) );
67 
68  w->vectors_edges_rb->hide();
69 }
70 
71 template <typename MeshT>
72 void OVMPropertyVisualizerVector<MeshT>::clear()
73 {
74  lineNode->clear();
75  OVMPropertyVisualizer<MeshT>::clear();
76 }
77 
78 template <typename MeshT>
79 void OVMPropertyVisualizerVector<MeshT>::duplicateProperty()
80 {
81  OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<ACG::Vec3d>();
82 }
83 
84 template<typename MeshT>
85 template<typename PropType, typename EntityIterator>
86 void OVMPropertyVisualizerVector<MeshT>::visualizeVectorAsColorForEntity(PropType prop, EntityIterator e_begin, EntityIterator e_end) {
87  if (!prop)
88  throw VizException("Getting PropHandle from mesh for selected property failed.");
90  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
91  for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) {
92  ACG::Vec3d v = prop[*e_it].normalized() * .5 + ACG::Vec3d(.5, .5, .5);
93  object->colors()[*e_it] = ACG::Vec4f(v[0], v[1], v[2], 1.0);
94  }
95 }
96 
97 template <typename MeshT>
98 void OVMPropertyVisualizerVector<MeshT>::visualizeCellProp(bool _setDrawMode)
99 {
100  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
101  if (w->vectors_colors_rb->isChecked())
102  {
103  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
104  visualizeVectorAsColorForEntity(prop,
105  OVMPropertyVisualizer<MeshT>::mesh->cells_begin(),
106  OVMPropertyVisualizer<MeshT>::mesh->cells_end());
107  if (_setDrawMode)
108  {
109  VolumeMeshObject<MeshT>* object;
110  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
111  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.cellsColoredPerCell);
112  }
113  }
114  else visualizeCellPropAsStrokes();
115 }
116 
117 template <typename MeshT>
118 void OVMPropertyVisualizerVector<MeshT>::visualizeFaceProp(bool _setDrawMode)
119 {
120  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
121  if (w->vectors_colors_rb->isChecked())
122  {
123  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
124  visualizeVectorAsColorForEntity(prop,
125  OVMPropertyVisualizer<MeshT>::mesh->faces_begin(),
126  OVMPropertyVisualizer<MeshT>::mesh->faces_end());
127  if (_setDrawMode)
128  {
129  VolumeMeshObject<MeshT>* object;
130  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
131  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.facesColoredPerFace);
132  }
133  }
134  else visualizeFacePropAsStrokes();
135 }
136 
137 
138 template <typename MeshT>
139 void OVMPropertyVisualizerVector<MeshT>::visualizeHalffaceProp(bool _setDrawMode)
140 {
141  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
142  if (w->vectors_colors_rb->isChecked())
143  {
144  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
145  visualizeVectorAsColorForEntity(prop,
146  OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin(),
147  OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());
148  if (_setDrawMode)
149  {
150  VolumeMeshObject<MeshT>* object;
151  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
152  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halffacesColoredPerHalfface);
153  }
154  }
155  else visualizeHalffacePropAsStrokes();
156 }
157 
158 template <typename MeshT>
159 void OVMPropertyVisualizerVector<MeshT>::visualizeEdgeProp(bool _setDrawMode)
160 {
161  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
162  if (w->vectors_colors_rb->isChecked())
163  {
164  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
165  visualizeVectorAsColorForEntity(prop,
166  OVMPropertyVisualizer<MeshT>::mesh->edges_begin(),
167  OVMPropertyVisualizer<MeshT>::mesh->edges_end());
168  if (_setDrawMode)
169  {
170  VolumeMeshObject<MeshT>* object;
171  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
172  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.edgesColoredPerEdge);
173  }
174  }
175  else visualizeEdgePropAsStrokes();
176 }
177 
178 template <typename MeshT>
179 void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
180 {
181  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
182  if (w->vectors_colors_rb->isChecked())
183  {
184  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
185  visualizeVectorAsColorForEntity(prop,
186  OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin(),
187  OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());
188  if (_setDrawMode)
189  {
190  VolumeMeshObject<MeshT>* object;
191  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
192  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halfedgesColoredPerHalfedge);
193  }
194  }
195  else visualizeHalfedgePropAsStrokes();
196 }
197 
198 template <typename MeshT>
199 void OVMPropertyVisualizerVector<MeshT>::visualizeVertexProp(bool _setDrawMode)
200 {
201  VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
202  if (w->vectors_colors_rb->isChecked())
203  {
204  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
205  visualizeVectorAsColorForEntity(prop,
206  OVMPropertyVisualizer<MeshT>::mesh->vertices_begin(),
207  OVMPropertyVisualizer<MeshT>::mesh->vertices_end());
208  if (_setDrawMode)
209  {
210  VolumeMeshObject<MeshT>* object;
211  PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
212  object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.verticesColored);
213  }
214  }
215  else visualizeVertexPropAsStrokes();
216 }
217 
218 template <typename MeshT>
219 void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
220 {
221  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
222 
223  lineNode->clear();
224 
225  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
226 
227  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
228 
229  if ( !prop )
230  return;
231 
232  OpenVolumeMesh::FaceIter f_begin(OVMPropertyVisualizer<MeshT>::mesh->faces_begin()), f_end(OVMPropertyVisualizer<MeshT>::mesh->faces_end());
233  for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it){
234 
235  ACG::Vec3d center(0.0, 0.0, 0.0);
236  int vCount = 0;
237 
238  OpenVolumeMesh::HalfFaceHandle hfh = OVMPropertyVisualizer<MeshT>::mesh->halfface_handle(*f_it, 0);
239  for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = OVMPropertyVisualizer<MeshT>::mesh->hfv_iter(hfh); hfv_it; ++hfv_it){
240  vCount++;
241  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*hfv_it);
242  }
243 
244  center /= vCount;
245 
246  ACG::Vec3d v = prop[*f_it];
247 
248  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
249  v.normalize();
250 
251  if(vectorWidget->scale->isChecked())
252  v *= vectorWidget->scaleBox->value();
253 
254  lineNode->add_line( center, (center+v) );
255  lineNode->add_color(color);
256  }
257 }
258 
259 template <typename MeshT>
260 void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
261 {
262  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
263 
264  lineNode->clear();
265 
266  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
267 
268  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
269  if ( !prop )
270  return;
271 
272  OpenVolumeMesh::EdgeIter e_begin(OVMPropertyVisualizer<MeshT>::mesh->edges_begin()), e_end(OVMPropertyVisualizer<MeshT>::mesh->edges_end());
273  for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it){
274 
275  OpenVolumeMesh::OpenVolumeMeshEdge edge = OVMPropertyVisualizer<MeshT>::mesh->edge(*e_it);
276  ACG::Vec3d v1 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.from_vertex());
277  ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
278  ACG::Vec3d start = 0.5*(v1+v2);
279 
280  ACG::Vec3d v = prop[*e_it];
281 
282  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
283  v.normalize();
284 
285 
286 
287  if(vectorWidget->scale->isChecked())
288  v *= vectorWidget->scaleBox->value();
289 
290  lineNode->add_line( start, (start+v) );
291  lineNode->add_color(color);
292  }
293 }
294 
295 template <typename MeshT>
296 void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
297 {
298  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
299 
300  lineNode->clear();
301 
302  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
303 
304  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
305  if ( !prop )
306  return;
307 
308  OpenVolumeMesh::HalfEdgeIter he_begin(OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin()), he_end(OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());
309  for (OpenVolumeMesh::HalfEdgeIter he_it = he_begin; he_it != he_end; ++he_it){
310 
311  OpenVolumeMesh::OpenVolumeMeshEdge edge = OVMPropertyVisualizer<MeshT>::mesh->halfedge(*he_it);
312 
313  ACG::Vec3d v1 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.from_vertex());
314  ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
315  ACG::Vec3d start = (2.0*v1+v2)/3.0;
316 
317  ACG::Vec3d v = prop[*he_it];
318 
319  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
320  v.normalize();
321 
322  if(vectorWidget->scale->isChecked())
323  v *= vectorWidget->scaleBox->value();
324 
325  lineNode->add_line( start, (start+v) );
326  lineNode->add_color(color);
327  }
328 }
329 
330 template <typename MeshT>
331 void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
332 {
333  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
334 
335  lineNode->clear();
336 
337  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
338 
339  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
340  if ( !prop )
341  return;
342 
343  OpenVolumeMesh::VertexIter v_begin(OVMPropertyVisualizer<MeshT>::mesh->vertices_begin()), v_end(OVMPropertyVisualizer<MeshT>::mesh->vertices_end());
344  for (OpenVolumeMesh::VertexIter v_it = v_begin; v_it != v_end; ++v_it){
345 
346  ACG::Vec3d start = OVMPropertyVisualizer<MeshT>::mesh->vertex(*v_it);
347 
348  ACG::Vec3d v = prop[*v_it];
349 
350  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
351  v.normalize();
352 
353  if(vectorWidget->scale->isChecked())
354  v *= vectorWidget->scaleBox->value();
355 
356  lineNode->add_line( start, (start+v) );
357  lineNode->add_color(color);
358  }
359 }
360 
361 template <typename MeshT>
362 void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
363 {
364  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
365 
366  lineNode->clear();
367 
368  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
369 
370  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
371 
372  if ( !prop )
373  return;
374 
375  OpenVolumeMesh::CellIter c_begin(OVMPropertyVisualizer<MeshT>::mesh->cells_begin()), c_end(OVMPropertyVisualizer<MeshT>::mesh->cells_end());
376  for (OpenVolumeMesh::CellIter c_it = c_begin; c_it != c_end; ++c_it){
377 
378  // Compute cell's center
379  ACG::Vec3d center(0.0, 0.0, 0.0);
380  unsigned int vCount = OVMPropertyVisualizer<MeshT>::mesh->n_vertices_in_cell(*c_it);
381  for(OpenVolumeMesh::CellVertexIter cv_it = OVMPropertyVisualizer<MeshT>::mesh->cv_iter(*c_it); cv_it.valid(); ++cv_it) {
382  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*cv_it) / (double)vCount;
383  }
384 
385  ACG::Vec3d v = prop[*c_it];
386 
387  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
388  v.normalize();
389 
390  if(vectorWidget->scale->isChecked())
391  v *= vectorWidget->scaleBox->value();
392 
393  lineNode->add_line( center, (center+v) );
394  lineNode->add_color(color);
395  }
396 }
397 
398 template <typename MeshT>
399 void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
400 {
401  VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
402 
403  lineNode->clear();
404 
405  ACG::Vec4f color = OVMPropertyVisualizer<MeshT>::convertColor(vectorWidget->lineColor->color());
406 
407  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
408 
409  if ( !prop )
410  return;
411 
412  OpenVolumeMesh::HalfFaceIter hf_begin(OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin()), hf_end(OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());
413  for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it){
414 
415  ACG::Vec3d center(0.0, 0.0, 0.0);
416  int vCount = 0;
417 
418  for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = OVMPropertyVisualizer<MeshT>::mesh->hfv_iter(*hf_it); hfv_it; ++hfv_it){
419  vCount++;
420  center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*hfv_it);
421  }
422 
423  center /= vCount;
424 
425  ACG::Vec3d v = prop[*hf_it];
426 
427  if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
428  v.normalize();
429 
430  if(vectorWidget->scale->isChecked())
431  v *= vectorWidget->scaleBox->value();
432 
433  lineNode->add_line( center, (center+v) );
434  lineNode->add_color(color);
435  }
436 }
437 
438 template <typename MeshT>
439 QString OVMPropertyVisualizerVector<MeshT>::getPropertyText(unsigned int index)
440 {
441  return OVMPropertyVisualizer<MeshT>::template getPropertyText_<ACG::Vec3d>(index);
442 }
443 
444 
445 template <typename MeshT>
446 void OVMPropertyVisualizerVector<MeshT>::setCellPropertyFromText(unsigned int index, QString text)
447 {
448  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
449 
450  OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
451  if ( !prop )
452  {
453  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
454  return;
455  }
456 
457  OpenVolumeMesh::CellHandle ch(index);
458 
459  prop[ch] = this->strToVec3d(text);
460 }
461 
462 template <typename MeshT>
463 void OVMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int index, QString text)
464 {
465  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
466 
467  OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
468  if ( !prop )
469  {
470  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
471  return;
472  }
473 
474  OpenVolumeMesh::FaceHandle fh(index);
475 
476  prop[fh] = this->strToVec3d(text);
477 }
478 
479 template <typename MeshT>
480 void OVMPropertyVisualizerVector<MeshT>::setHalffacePropertyFromText(unsigned int index, QString text)
481 {
482  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
483 
484  OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
485  if ( !prop )
486  {
487  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
488  return;
489  }
490 
492 
493  prop[hfh] = this->strToVec3d(text);
494 }
495 
496 template <typename MeshT>
497 void OVMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int index, QString text)
498 {
499  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
500 
501  OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
502  if ( !prop )
503  {
504  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
505  return;
506  }
507 
508  OpenVolumeMesh::EdgeHandle eh(index);
509 
510  prop[eh] = this->strToVec3d(text);
511 }
512 
513 template <typename MeshT>
514 void OVMPropertyVisualizerVector<MeshT>::setHalfedgePropertyFromText(unsigned int index, QString text)
515 {
516  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
517 
518  OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
519  if ( !prop )
520  {
521  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
522  return;
523  }
524 
526 
527  prop[heh] = this->strToVec3d(text);
528 }
529 
530 template <typename MeshT>
531 void OVMPropertyVisualizerVector<MeshT>::setVertexPropertyFromText(unsigned int index, QString text)
532 {
533  MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
534 
535  OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
536  if ( !prop )
537  {
538  emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
539  return;
540  }
541 
543 
544  prop[vh] = this->strToVec3d(text);
545 }
546 
547 #endif /* ENABLE_OPENVOLUMEMESH_SUPPORT */
bool getObject(int _identifier, BSplineCurveObject *&_object)
VectorT< float, 4 > Vec4f
Definition: VectorT.hh:144
VectorT< double, 3 > Vec3d
Definition: VectorT.hh:127
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
Property classes for the different entity types.
Cellection of information about a property.
Definition: Utils.hh:115