OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BaseKernel.hh
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
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  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 
50 //=============================================================================
51 //
52 // CLASS BaseKernel
53 //
54 //=============================================================================
55 
56 
57 #ifndef OPENMESH_BASE_KERNEL_HH
58 #define OPENMESH_BASE_KERNEL_HH
59 
60 
61 //== INCLUDES =================================================================
62 
63 
64 #include <OpenMesh/Core/System/config.h>
65 // --------------------
66 #include <vector>
67 #include <string>
68 #include <algorithm>
69 #include <iosfwd>
70 // --------------------
71 #include <OpenMesh/Core/Utils/PropertyContainer.hh>
72 
73 
74 //== NAMESPACES ===============================================================
75 
76 
77 namespace OpenMesh {
78 
79 
80 //== CLASS DEFINITION =========================================================
81 
98 
99 class OPENMESHDLLEXPORT BaseKernel
100 {
101 public: //-------------------------------------------- constructor / destructor
102 
103  BaseKernel() {}
104  virtual ~BaseKernel() {
105  vprops_.clear();
106  eprops_.clear();
107  hprops_.clear();
108  fprops_.clear();
109  }
110 
111 
112 public: //-------------------------------------------------- add new properties
113 
115 
117 
137  template <class T>
138  void add_property( VPropHandleT<T>& _ph, const std::string& _name="<vprop>")
139  {
140  _ph = VPropHandleT<T>( vprops_.add(T(), _name) );
141  vprops_.resize(n_vertices());
142  }
143 
144  template <class T>
145  void add_property( HPropHandleT<T>& _ph, const std::string& _name="<hprop>")
146  {
147  _ph = HPropHandleT<T>( hprops_.add(T(), _name) );
148  hprops_.resize(n_halfedges());
149  }
150 
151  template <class T>
152  void add_property( EPropHandleT<T>& _ph, const std::string& _name="<eprop>")
153  {
154  _ph = EPropHandleT<T>( eprops_.add(T(), _name) );
155  eprops_.resize(n_edges());
156  }
157 
158  template <class T>
159  void add_property( FPropHandleT<T>& _ph, const std::string& _name="<fprop>")
160  {
161  _ph = FPropHandleT<T>( fprops_.add(T(), _name) );
162  fprops_.resize(n_faces());
163  }
164 
165  template <class T>
166  void add_property( MPropHandleT<T>& _ph, const std::string& _name="<mprop>")
167  {
168  _ph = MPropHandleT<T>( mprops_.add(T(), _name) );
169  mprops_.resize(1);
170  }
171 
173 
174 
175 public: //--------------------------------------------------- remove properties
176 
178 
179 
187  template <typename T>
189  {
190  if (_ph.is_valid())
191  vprops_.remove(_ph);
192  _ph.reset();
193  }
194 
195  template <typename T>
197  {
198  if (_ph.is_valid())
199  hprops_.remove(_ph);
200  _ph.reset();
201  }
202 
203  template <typename T>
205  {
206  if (_ph.is_valid())
207  eprops_.remove(_ph);
208  _ph.reset();
209  }
210 
211  template <typename T>
213  {
214  if (_ph.is_valid())
215  fprops_.remove(_ph);
216  _ph.reset();
217  }
218 
219  template <typename T>
221  {
222  if (_ph.is_valid())
223  mprops_.remove(_ph);
224  _ph.reset();
225  }
226 
228 
229 public: //------------------------------------------------ get handle from name
230 
232 
233 
242  template <class T>
244  const std::string& _name) const
245  {
246  return (_ph = VPropHandleT<T>(vprops_.handle(T(), _name))).is_valid();
247  }
248 
249  template <class T>
251  const std::string& _name) const
252  {
253  return (_ph = HPropHandleT<T>(hprops_.handle(T(), _name))).is_valid();
254  }
255 
256  template <class T>
258  const std::string& _name) const
259  {
260  return (_ph = EPropHandleT<T>(eprops_.handle(T(), _name))).is_valid();
261  }
262 
263  template <class T>
265  const std::string& _name) const
266  {
267  return (_ph = FPropHandleT<T>(fprops_.handle(T(), _name))).is_valid();
268  }
269 
270  template <class T>
272  const std::string& _name) const
273  {
274  return (_ph = MPropHandleT<T>(mprops_.handle(T(), _name))).is_valid();
275  }
276 
278 
279 public: //--------------------------------------------------- access properties
280 
282 
283 
293  template <class T>
295  return vprops_.property(_ph);
296  }
297  template <class T>
299  return vprops_.property(_ph);
300  }
301 
302  template <class T>
304  return hprops_.property(_ph);
305  }
306  template <class T>
308  return hprops_.property(_ph);
309  }
310 
311  template <class T>
313  return eprops_.property(_ph);
314  }
315  template <class T>
317  return eprops_.property(_ph);
318  }
319 
320  template <class T>
322  return fprops_.property(_ph);
323  }
324  template <class T>
326  return fprops_.property(_ph);
327  }
328 
329  template <class T>
331  return mprops_.property(_ph);
332  }
333  template <class T>
335  return mprops_.property(_ph);
336  }
337 
339 
340 public: //-------------------------------------------- access property elements
341 
343 
344 
348  template <class T>
349  typename VPropHandleT<T>::reference
351  return vprops_.property(_ph)[_vh.idx()];
352  }
353 
354  template <class T>
355  typename VPropHandleT<T>::const_reference
357  return vprops_.property(_ph)[_vh.idx()];
358  }
359 
360 
361  template <class T>
362  typename HPropHandleT<T>::reference
364  return hprops_.property(_ph)[_hh.idx()];
365  }
366 
367  template <class T>
368  typename HPropHandleT<T>::const_reference
370  return hprops_.property(_ph)[_hh.idx()];
371  }
372 
373 
374  template <class T>
375  typename EPropHandleT<T>::reference
377  return eprops_.property(_ph)[_eh.idx()];
378  }
379 
380  template <class T>
381  typename EPropHandleT<T>::const_reference
383  return eprops_.property(_ph)[_eh.idx()];
384  }
385 
386 
387  template <class T>
388  typename FPropHandleT<T>::reference
390  return fprops_.property(_ph)[_fh.idx()];
391  }
392 
393  template <class T>
394  typename FPropHandleT<T>::const_reference
396  return fprops_.property(_ph)[_fh.idx()];
397  }
398 
399 
400  template <class T>
401  typename MPropHandleT<T>::reference
403  return mprops_.property(_ph)[0];
404  }
405 
406  template <class T>
407  typename MPropHandleT<T>::const_reference
409  return mprops_.property(_ph)[0];
410  }
411 
413 
414 
415 public: //------------------------------------------------ copy property
416 
423  template <class T>
425  if(_vh_from.is_valid() && _vh_to.is_valid())
426  vprops_.property(_ph)[_vh_to.idx()] = vprops_.property(_ph)[_vh_from.idx()];
427  }
428 
435  template <class T>
437  if(_hh_from.is_valid() && _hh_to.is_valid())
438  hprops_.property(_ph)[_hh_to.idx()] = hprops_.property(_ph)[_hh_from.idx()];
439  }
440 
447  template <class T>
448  void copy_property(EPropHandleT<T> _ph, EdgeHandle _eh_from, EdgeHandle _eh_to) {
449  if(_eh_from.is_valid() && _eh_to.is_valid())
450  eprops_.property(_ph)[_eh_to.idx()] = eprops_.property(_ph)[_eh_from.idx()];
451  }
452 
459  template <class T>
460  void copy_property(FPropHandleT<T> _ph, FaceHandle _fh_from, FaceHandle _fh_to) {
461  if(_fh_from.is_valid() && _fh_to.is_valid())
462  fprops_.property(_ph)[_fh_to.idx()] = fprops_.property(_ph)[_fh_from.idx()];
463  }
464 
465 
466 public:
467  //------------------------------------------------ copy all properties
468 
476  void copy_all_properties(VertexHandle _vh_from, VertexHandle _vh_to, bool _copyBuildIn = false) {
477 
478  for( PropertyContainer::iterator p_it = vprops_.begin();
479  p_it != vprops_.end(); ++p_it) {
480 
481  // Copy all properties, if build in is true
482  // Otherwise, copy only properties without build in specifier
483  if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "v:" ) )
484  (*p_it)->copy(_vh_from.idx(), _vh_to.idx());
485 
486  }
487  }
488 
495  void copy_all_properties(HalfedgeHandle _hh_from, HalfedgeHandle _hh_to, bool _copyBuildIn = false) {
496 
497  for( PropertyContainer::iterator p_it = hprops_.begin();
498  p_it != hprops_.end(); ++p_it) {
499 
500  // Copy all properties, if build in is true
501  // Otherwise, copy only properties without build in specifier
502  if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "h:") )
503  (*p_it)->copy(_hh_from.idx(), _hh_to.idx());
504 
505  }
506  }
507 
514  void copy_all_properties(EdgeHandle _eh_from, EdgeHandle _eh_to, bool _copyBuildIn = false) {
515  for( PropertyContainer::iterator p_it = eprops_.begin();
516  p_it != eprops_.end(); ++p_it) {
517 
518  // Copy all properties, if build in is true
519  // Otherwise, copy only properties without build in specifier
520  if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "e:") )
521  (*p_it)->copy(_eh_from.idx(), _eh_to.idx());
522 
523  }
524  }
525 
533  void copy_all_properties(FaceHandle _fh_from, FaceHandle _fh_to, bool _copyBuildIn = false) {
534 
535  for( PropertyContainer::iterator p_it = fprops_.begin();
536  p_it != fprops_.end(); ++p_it) {
537 
538  // Copy all properties, if build in is true
539  // Otherwise, copy only properties without build in specifier
540  if ( *p_it && ( _copyBuildIn || (*p_it)->name().substr(0,2) != "f:") )
541  (*p_it)->copy(_fh_from.idx(), _fh_to.idx());
542  }
543 
544  }
545 
546 protected: //------------------------------------------------- low-level access
547 
548 public: // used by non-native kernel and MeshIO, should be protected
549 
550  size_t n_vprops(void) const { return vprops_.size(); }
551 
552  size_t n_eprops(void) const { return eprops_.size(); }
553 
554  size_t n_hprops(void) const { return hprops_.size(); }
555 
556  size_t n_fprops(void) const { return fprops_.size(); }
557 
558  size_t n_mprops(void) const { return mprops_.size(); }
559 
560  BaseProperty* _get_vprop( const std::string& _name)
561  { return vprops_.property(_name); }
562 
563  BaseProperty* _get_eprop( const std::string& _name)
564  { return eprops_.property(_name); }
565 
566  BaseProperty* _get_hprop( const std::string& _name)
567  { return hprops_.property(_name); }
568 
569  BaseProperty* _get_fprop( const std::string& _name)
570  { return fprops_.property(_name); }
571 
572  BaseProperty* _get_mprop( const std::string& _name)
573  { return mprops_.property(_name); }
574 
575  const BaseProperty* _get_vprop( const std::string& _name) const
576  { return vprops_.property(_name); }
577 
578  const BaseProperty* _get_eprop( const std::string& _name) const
579  { return eprops_.property(_name); }
580 
581  const BaseProperty* _get_hprop( const std::string& _name) const
582  { return hprops_.property(_name); }
583 
584  const BaseProperty* _get_fprop( const std::string& _name) const
585  { return fprops_.property(_name); }
586 
587  const BaseProperty* _get_mprop( const std::string& _name) const
588  { return mprops_.property(_name); }
589 
590  BaseProperty& _vprop( size_t _idx ) { return vprops_._property( _idx ); }
591  BaseProperty& _eprop( size_t _idx ) { return eprops_._property( _idx ); }
592  BaseProperty& _hprop( size_t _idx ) { return hprops_._property( _idx ); }
593  BaseProperty& _fprop( size_t _idx ) { return fprops_._property( _idx ); }
594  BaseProperty& _mprop( size_t _idx ) { return mprops_._property( _idx ); }
595 
596  const BaseProperty& _vprop( size_t _idx ) const
597  { return vprops_._property( _idx ); }
598  const BaseProperty& _eprop( size_t _idx ) const
599  { return eprops_._property( _idx ); }
600  const BaseProperty& _hprop( size_t _idx ) const
601  { return hprops_._property( _idx ); }
602  const BaseProperty& _fprop( size_t _idx ) const
603  { return fprops_._property( _idx ); }
604  const BaseProperty& _mprop( size_t _idx ) const
605  { return mprops_._property( _idx ); }
606 
607  size_t _add_vprop( BaseProperty* _bp ) { return vprops_._add( _bp ); }
608  size_t _add_eprop( BaseProperty* _bp ) { return eprops_._add( _bp ); }
609  size_t _add_hprop( BaseProperty* _bp ) { return hprops_._add( _bp ); }
610  size_t _add_fprop( BaseProperty* _bp ) { return fprops_._add( _bp ); }
611  size_t _add_mprop( BaseProperty* _bp ) { return mprops_._add( _bp ); }
612 
613 protected: // low-level access non-public
614 
615  BaseProperty& _vprop( BaseHandle _h )
616  { return vprops_._property( _h.idx() ); }
617  BaseProperty& _eprop( BaseHandle _h )
618  { return eprops_._property( _h.idx() ); }
619  BaseProperty& _hprop( BaseHandle _h )
620  { return hprops_._property( _h.idx() ); }
621  BaseProperty& _fprop( BaseHandle _h )
622  { return fprops_._property( _h.idx() ); }
623  BaseProperty& _mprop( BaseHandle _h )
624  { return mprops_._property( _h.idx() ); }
625 
626  const BaseProperty& _vprop( BaseHandle _h ) const
627  { return vprops_._property( _h.idx() ); }
628  const BaseProperty& _eprop( BaseHandle _h ) const
629  { return eprops_._property( _h.idx() ); }
630  const BaseProperty& _hprop( BaseHandle _h ) const
631  { return hprops_._property( _h.idx() ); }
632  const BaseProperty& _fprop( BaseHandle _h ) const
633  { return fprops_._property( _h.idx() ); }
634  const BaseProperty& _mprop( BaseHandle _h ) const
635  { return mprops_._property( _h.idx() ); }
636 
637 
638 public: //----------------------------------------------------- element numbers
639 
640 
641  virtual size_t n_vertices() const { return 0; }
642  virtual size_t n_halfedges() const { return 0; }
643  virtual size_t n_edges() const { return 0; }
644  virtual size_t n_faces() const { return 0; }
645 
646 
647 protected: //------------------------------------------- synchronize properties
648 
650  void vprops_reserve(size_t _n) const { vprops_.reserve(_n); }
651 
653  void vprops_resize(size_t _n) const { vprops_.resize(_n); }
654 
663  void vprops_resize_if_smaller(size_t _n) const { vprops_.resize_if_smaller(_n); }
664 
665  void vprops_clear() {
666  vprops_.clear();
667  }
668 
669  void vprops_swap(unsigned int _i0, unsigned int _i1) const {
670  vprops_.swap(_i0, _i1);
671  }
672 
673  void hprops_reserve(size_t _n) const { hprops_.reserve(_n); }
674  void hprops_resize(size_t _n) const { hprops_.resize(_n); }
675  void hprops_clear() {
676  hprops_.clear();
677  }
678  void hprops_swap(unsigned int _i0, unsigned int _i1) const {
679  hprops_.swap(_i0, _i1);
680  }
681 
682  void eprops_reserve(size_t _n) const { eprops_.reserve(_n); }
683  void eprops_resize(size_t _n) const { eprops_.resize(_n); }
684  void eprops_clear() {
685  eprops_.clear();
686  }
687  void eprops_swap(unsigned int _i0, unsigned int _i1) const {
688  eprops_.swap(_i0, _i1);
689  }
690 
691  void fprops_reserve(size_t _n) const { fprops_.reserve(_n); }
692  void fprops_resize(size_t _n) const { fprops_.resize(_n); }
693  void fprops_clear() {
694  fprops_.clear();
695  }
696  void fprops_swap(unsigned int _i0, unsigned int _i1) const {
697  fprops_.swap(_i0, _i1);
698  }
699 
700  void mprops_resize(size_t _n) const { mprops_.resize(_n); }
701  void mprops_clear() {
702  mprops_.clear();
703  }
704 
705 public:
706 
707  // uses std::clog as output stream
708  void property_stats() const;
709  void property_stats(std::ostream& _ostr) const;
710 
711  void vprop_stats( std::string& _string ) const;
712  void hprop_stats( std::string& _string ) const;
713  void eprop_stats( std::string& _string ) const;
714  void fprop_stats( std::string& _string ) const;
715  void mprop_stats( std::string& _string ) const;
716 
717  // uses std::clog as output stream
718  void vprop_stats() const;
719  void hprop_stats() const;
720  void eprop_stats() const;
721  void fprop_stats() const;
722  void mprop_stats() const;
723 
724  void vprop_stats(std::ostream& _ostr) const;
725  void hprop_stats(std::ostream& _ostr) const;
726  void eprop_stats(std::ostream& _ostr) const;
727  void fprop_stats(std::ostream& _ostr) const;
728  void mprop_stats(std::ostream& _ostr) const;
729 
730 public:
731 
732  typedef PropertyContainer::iterator prop_iterator;
733  typedef PropertyContainer::const_iterator const_prop_iterator;
734 
735  prop_iterator vprops_begin() { return vprops_.begin(); }
736  prop_iterator vprops_end() { return vprops_.end(); }
737  const_prop_iterator vprops_begin() const { return vprops_.begin(); }
738  const_prop_iterator vprops_end() const { return vprops_.end(); }
739 
740  prop_iterator eprops_begin() { return eprops_.begin(); }
741  prop_iterator eprops_end() { return eprops_.end(); }
742  const_prop_iterator eprops_begin() const { return eprops_.begin(); }
743  const_prop_iterator eprops_end() const { return eprops_.end(); }
744 
745  prop_iterator hprops_begin() { return hprops_.begin(); }
746  prop_iterator hprops_end() { return hprops_.end(); }
747  const_prop_iterator hprops_begin() const { return hprops_.begin(); }
748  const_prop_iterator hprops_end() const { return hprops_.end(); }
749 
750  prop_iterator fprops_begin() { return fprops_.begin(); }
751  prop_iterator fprops_end() { return fprops_.end(); }
752  const_prop_iterator fprops_begin() const { return fprops_.begin(); }
753  const_prop_iterator fprops_end() const { return fprops_.end(); }
754 
755  prop_iterator mprops_begin() { return mprops_.begin(); }
756  prop_iterator mprops_end() { return mprops_.end(); }
757  const_prop_iterator mprops_begin() const { return mprops_.begin(); }
758  const_prop_iterator mprops_end() const { return mprops_.end(); }
759 
760 private:
761 
762  PropertyContainer vprops_;
763  PropertyContainer hprops_;
764  PropertyContainer eprops_;
765  PropertyContainer fprops_;
766  PropertyContainer mprops_;
767 };
768 
769 
770 //=============================================================================
771 } // namespace OpenMesh
772 //=============================================================================
773 #endif // OPENMESH_BASE_KERNEL_HH defined
774 //=============================================================================
FPropHandleT< T >::const_reference property(FPropHandleT< T > _ph, FaceHandle _fh) const
Return value of property for an item.
Definition: BaseKernel.hh:395
PropertyT< T > & property(FPropHandleT< T > _ph)
Access a property.
Definition: BaseKernel.hh:321
FPropHandleT< T >::reference property(FPropHandleT< T > _ph, FaceHandle _fh)
Return value of property for an item.
Definition: BaseKernel.hh:389
void remove_property(HPropHandleT< T > &_ph)
Remove a property.
Definition: BaseKernel.hh:196
void copy_all_properties(FaceHandle _fh_from, FaceHandle _fh_to, bool _copyBuildIn=false)
Copies all properties from one mesh element to another (of the same type)
Definition: BaseKernel.hh:533
const PropertyT< T > & property(VPropHandleT< T > _ph) const
Access a property.
Definition: BaseKernel.hh:298
const PropertyT< T > & property(HPropHandleT< T > _ph) const
Access a property.
Definition: BaseKernel.hh:307
Handle representing an edge property.
Definition: Property.hh:515
void copy_all_properties(HalfedgeHandle _hh_from, HalfedgeHandle _hh_to, bool _copyBuildIn=false)
Copies all properties from one mesh element to another (of the same type)
Definition: BaseKernel.hh:495
Handle representing a vertex property.
Definition: Property.hh:487
Handle representing a mesh property.
Definition: Property.hh:543
const PropertyT< T > & mproperty(MPropHandleT< T > _ph) const
Access a property.
Definition: BaseKernel.hh:334
bool get_property_handle(HPropHandleT< T > &_ph, const std::string &_name) const
Retrieves the handle to a named property by it's name.
Definition: BaseKernel.hh:250
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:74
VPropHandleT< T >::const_reference property(VPropHandleT< T > _ph, VertexHandle _vh) const
Return value of property for an item.
Definition: BaseKernel.hh:356
bool get_property_handle(EPropHandleT< T > &_ph, const std::string &_name) const
Retrieves the handle to a named property by it's name.
Definition: BaseKernel.hh:257
void remove_property(MPropHandleT< T > &_ph)
Remove a property.
Definition: BaseKernel.hh:220
VPropHandleT< T >::reference property(VPropHandleT< T > _ph, VertexHandle _vh)
Return value of property for an item.
Definition: BaseKernel.hh:350
void vprops_reserve(size_t _n) const
Reserves space for _n elements in all vertex property vectors.
Definition: BaseKernel.hh:650
void copy_all_properties(VertexHandle _vh_from, VertexHandle _vh_to, bool _copyBuildIn=false)
Copies all properties from one mesh element to another (of the same type)
Definition: BaseKernel.hh:476
MPropHandleT< T >::const_reference property(MPropHandleT< T > _ph) const
Return value of property for an item.
Definition: BaseKernel.hh:408
void remove_property(EPropHandleT< T > &_ph)
Remove a property.
Definition: BaseKernel.hh:204
Default property class for any type T.
Definition: Property.hh:94
bool get_property_handle(MPropHandleT< T > &_ph, const std::string &_name) const
Retrieves the handle to a named property by it's name.
Definition: BaseKernel.hh:271
const PropertyT< T > & property(FPropHandleT< T > _ph) const
Access a property.
Definition: BaseKernel.hh:325
HPropHandleT< T >::reference property(HPropHandleT< T > _ph, HalfedgeHandle _hh)
Return value of property for an item.
Definition: BaseKernel.hh:363
void add_property(EPropHandleT< T > &_ph, const std::string &_name="<eprop>")
Adds a property.
Definition: BaseKernel.hh:152
PropertyT< T > & property(EPropHandleT< T > _ph)
Access a property.
Definition: BaseKernel.hh:312
bool get_property_handle(VPropHandleT< T > &_ph, const std::string &_name) const
Retrieves the handle to a named property by it's name.
Definition: BaseKernel.hh:243
void copy_property(EPropHandleT< T > _ph, EdgeHandle _eh_from, EdgeHandle _eh_to)
Copies a single property from one mesh element to another (of the same type)
Definition: BaseKernel.hh:448
Handle representing a halfedge property.
Definition: Property.hh:501
void vprops_resize_if_smaller(size_t _n) const
Same as vprops_resize() but ignores vertex property vectors that have a size larger than _n...
Definition: BaseKernel.hh:663
Handle for a vertex entity.
Definition: Handles.hh:123
This class provides the basic property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:99
void add_property(MPropHandleT< T > &_ph, const std::string &_name="<mprop>")
Adds a property.
Definition: BaseKernel.hh:166
void remove_property(VPropHandleT< T > &_ph)
Remove a property.
Definition: BaseKernel.hh:188
bool is_valid() const
The handle is valid iff the index is not equal to -1.
Definition: Handles.hh:77
void add_property(FPropHandleT< T > &_ph, const std::string &_name="<fprop>")
Adds a property.
Definition: BaseKernel.hh:159
Handle for a edge entity.
Definition: Handles.hh:137
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
EPropHandleT< T >::const_reference property(EPropHandleT< T > _ph, EdgeHandle _eh) const
Return value of property for an item.
Definition: BaseKernel.hh:382
void reset()
reset handle to be invalid
Definition: Handles.hh:80
void copy_all_properties(EdgeHandle _eh_from, EdgeHandle _eh_to, bool _copyBuildIn=false)
Copies all properties from one mesh element to another (of the same type)
Definition: BaseKernel.hh:514
PropertyT< T > & property(HPropHandleT< T > _ph)
Access a property.
Definition: BaseKernel.hh:303
const PropertyT< T > & property(EPropHandleT< T > _ph) const
Access a property.
Definition: BaseKernel.hh:316
PropertyT< T > & mproperty(MPropHandleT< T > _ph)
Access a property.
Definition: BaseKernel.hh:330
void copy_property(HPropHandleT< T > _ph, HalfedgeHandle _hh_from, HalfedgeHandle _hh_to)
Copies a single property from one mesh element to another (of the same type)
Definition: BaseKernel.hh:436
Handle representing a face property.
Definition: Property.hh:529
bool get_property_handle(FPropHandleT< T > &_ph, const std::string &_name) const
Retrieves the handle to a named property by it's name.
Definition: BaseKernel.hh:264
void remove_property(FPropHandleT< T > &_ph)
Remove a property.
Definition: BaseKernel.hh:212
void vprops_resize(size_t _n) const
Resizes all vertex property vectors to the specified size.
Definition: BaseKernel.hh:653
void add_property(HPropHandleT< T > &_ph, const std::string &_name="<hprop>")
Adds a property.
Definition: BaseKernel.hh:145
MPropHandleT< T >::reference property(MPropHandleT< T > _ph)
Return value of property for an item.
Definition: BaseKernel.hh:402
HPropHandleT< T >::const_reference property(HPropHandleT< T > _ph, HalfedgeHandle _hh) const
Return value of property for an item.
Definition: BaseKernel.hh:369
void add_property(VPropHandleT< T > &_ph, const std::string &_name="<vprop>")
Adds a property.
Definition: BaseKernel.hh:138
EPropHandleT< T >::reference property(EPropHandleT< T > _ph, EdgeHandle _eh)
Return value of property for an item.
Definition: BaseKernel.hh:376
Handle for a halfedge entity.
Definition: Handles.hh:130
void copy_property(FPropHandleT< T > _ph, FaceHandle _fh_from, FaceHandle _fh_to)
Copies a single property from one mesh element to another (of the same type)
Definition: BaseKernel.hh:460
PropertyT< T > & property(VPropHandleT< T > _ph)
Access a property.
Definition: BaseKernel.hh:294
void copy_property(VPropHandleT< T > &_ph, VertexHandle _vh_from, VertexHandle _vh_to)
Copies a single property from one mesh element to another (of the same type)
Definition: BaseKernel.hh:424
Handle for a face entity.
Definition: Handles.hh:144

Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .