| OpenMesh

Classes | Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
OpenMesh::PropertyManager< PROPTYPE, MeshT > Class Template Reference

This class is intended to manage the lifecycle of properties. More...

`#include <OpenMesh/Core/Utils/PropertyManager.hh>`

## Public Types
using | Value = typename PROPTYPE::Value
using | value_type = typename PROPTYPE::value_type
using | Handle = typename PROPTYPE::Handle
using | Self = PropertyManager< PROPTYPE, MeshT >
using | Reference = typename PROPTYPE::reference
using | ConstReference = typename PROPTYPE::const_reference

## Public Member Functions
| PropertyManager (PolyConnectivity &mesh, const char *propname, bool existing)
| PropertyManager (PolyConnectivity &mesh, const char *propname)
| Constructor. More...
| PropertyManager (const Value &initial_value, PolyConnectivity &mesh, const char *propname)
| Constructor. More...
| PropertyManager (const PolyConnectivity &mesh)
| Constructor. More...
| PropertyManager (const Value &initial_value, const PolyConnectivity &mesh)
| Constructor. More...
| PropertyManager (PolyConnectivity &mesh, PROPTYPE property_handle)
| Constructor. More...
| PropertyManager (const PropertyManager &rhs)
PropertyManager | clone ()
| Create property manager referring to a copy of the current property. More...
PropertyManager & | operator= (const PropertyManager &rhs)
void | swap (PropertyManager &rhs)
bool | isValid () const
| operator bool () const
const PROPTYPE & | getRawProperty () const
const std::string & | getName () const
PROPTYPE::reference & | operator* ()
| Get the mesh corresponding to the property. More...
PROPTYPE::const_reference & | operator* () const
| Access the value of the encapsulated mesh property. More...
PROPTYPE::reference | operator[] (Handle handle)
| Enables convenient access to the encapsulated property. More...
PROPTYPE::const_reference | operator[] (const Handle &handle) const
| Enables convenient access to the encapsulated property. More...
PROPTYPE::reference | operator() (const Handle &handle=Handle())
| Enables convenient access to the encapsulated property. More...
PROPTYPE::const_reference | operator() (const Handle &handle=Handle()) const
| Enables convenient access to the encapsulated property. More...
template<typename HandleTypeIterator , typename PROP_VALUE >
void | set_range (HandleTypeIterator begin, HandleTypeIterator end, const PROP_VALUE &value)
| Conveniently set the property for an entire range of values. More...
template<typename HandleTypeIterator , typename PROPTYPE_2 , typename HandleTypeIterator_2 >
void | copy_to (HandleTypeIterator begin, HandleTypeIterator end, PropertyManager< PROPTYPE_2 > &dst_propmanager, HandleTypeIterator_2 dst_begin, HandleTypeIterator_2 dst_end) const
| Conveniently transfer the values managed by one property manager onto the values managed by a different property manager. More...
template<typename RangeType , typename PROPTYPE_2 , typename RangeType_2 >
void | copy_to (const RangeType &range, PropertyManager< PROPTYPE_2 > &dst_propmanager, const RangeType_2 &dst_range) const

## Static Public Member Functions
static bool | propertyExists (PolyConnectivity &mesh, const char *propname)
template<typename RangeType , typename RangeType_2 >
static void | copy (const char *prop_name, PolyConnectivity &src_mesh, const RangeType &src_range, PolyConnectivity &dst_mesh, const RangeType_2 &dst_range)
| Copy the values of a property from a source range to a target range. More...

## Related Functions
(Note that these are not member functions.)
template<typename ElementT , typename T >
PropertyManager< typename HandleToPropHandle< ElementT, T >::type > | makeTemporaryProperty (PolyConnectivity &mesh, const char *propname)
template<typename ElementT , typename T >
PropertyManager< typename HandleToPropHandle< ElementT, T >::type > | makeTemporaryProperty (PolyConnectivity &mesh)
template<typename ElementT , typename T >
bool | hasProperty (const PolyConnectivity &mesh, const char *propname)
template<typename ElementT , typename T >
PropertyManager< typename HandleToPropHandle< ElementT, T >::type > | getProperty (PolyConnectivity &mesh, const char *propname)
template<typename ElementT , typename T >
PropertyManager< typename HandleToPropHandle< ElementT, T >::type > | getOrMakeProperty (PolyConnectivity &mesh, const char *propname)
template<typename PROPTYPE >
PropertyManager< PROPTYPE > | makePropertyManagerFromNew (PolyConnectivity &mesh, const char *propname)
template<typename PROPTYPE , typename MeshT = int>
PropertyManager< PROPTYPE, MeshT > | makePropertyManagerFromExisting (PolyConnectivity &mesh, const char *propname)
template<typename PROPTYPE , typename MeshT = int>
PropertyManager< PROPTYPE, MeshT > | makePropertyManagerFromExistingOrNew (PolyConnectivity &mesh, const char *propname)
template<typename PROPTYPE , typename ITERATOR_TYPE , typename PROP_VALUE >
PropertyManager< PROPTYPE > | makePropertyManagerFromExistingOrNew (PolyConnectivity &mesh, const char *propname, const ITERATOR_TYPE &begin, const ITERATOR_TYPE &end, const PROP_VALUE &init_value)
template<typename PROPTYPE , typename ITERATOR_RANGE , typename PROP_VALUE >
PropertyManager< PROPTYPE > | makePropertyManagerFromExistingOrNew (PolyConnectivity &mesh, const char *propname, const ITERATOR_RANGE &range, const PROP_VALUE &init_value)
template<typename MeshT >
PropertyManager< OpenMesh::VPropHandleT< typename MeshT::Point > > | getPointsProperty (MeshT &mesh)
template<typename MeshT >
ConstPropertyViewer< OpenMesh::VPropHandleT< typename MeshT::Point > > | getPointsProperty (const MeshT &mesh)

## Detailed Description

### template<typename PROPTYPE, typename MeshT = int>
class OpenMesh::PropertyManager< PROPTYPE, MeshT >

This class is intended to manage the lifecycle of properties.

It also defines convenience operators to access the encapsulated property's value.

It is recommended to use the factory functions makeTemporaryProperty(), getProperty(), and getOrMakeProperty() to construct a PropertyManager, e.g.

Note that the second template parameter is depcretated.

{
TriMesh mesh;
auto visited = makeTemporaryProperty<VertexHandle, bool>(mesh);
for (auto vh : mesh.vertices()) {
if (!visited[vh]) {
visitComponent(mesh, vh, visited);
}
}
// The property is automatically removed at the end of the scope
}

## Constructor & Destructor Documentation

## ◆ PropertyManager() [1/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | PolyConnectivity & | mesh,
|  | const char * | propname,
|  | bool | existing
| ) |  |
| inline

Deprecated:
  Use a constructor without `existing` and check existance with hasProperty() instead.

Constructor.

Throws an `std::runtime_error` if `existing` is true and no property named `propname` of the appropriate property type exists.

Parameters

  mesh | The mesh on which to create the property.
  propname | The name of the property.
  existing | If false, a new property is created and its lifecycle is managed (i.e. the property is deleted upon destruction of the PropertyManager instance). If true, the instance merely acts as a convenience wrapper around an existing property with no lifecycle management whatsoever.

See also
  PropertyManager::getOrMakeProperty, PropertyManager::getProperty, PropertyManager::makeTemporaryProperty

## ◆ PropertyManager() [2/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| inline

Constructor.

Asks for a property with name propname and creates one if none exists. Lifetime is not managed.

Parameters

  mesh | The mesh on which to create the property.
  propname | The name of the property.

## ◆ PropertyManager() [3/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | const Value & | initial_value,
|  | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| inline

Constructor.

Asks for a property with name propname and creates one if none exists. Lifetime is not managed.

Parameters

  initial_value | If the proeprty is newly created, it will be initialized with initial_value. If the property already existed, nothing is changes.
  mesh | The mesh on which to create the property.
  propname | The name of the property.

## ◆ PropertyManager() [4/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | const PolyConnectivity & | mesh | ) |
| inline

Constructor.

Create an anonymous property. Lifetime is managed.

Parameters

  mesh | The mesh on which to create the property.

## ◆ PropertyManager() [5/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | const Value & | initial_value,
|  | const PolyConnectivity & | mesh
| ) |  |
| inline

Constructor.

Create an anonymous property. Lifetime is managed.

Parameters

  initial_value | The property will be initialized with initial_value.
  mesh | The mesh on which to create the property.

## ◆ PropertyManager() [6/6]

template<typename PROPTYPE, typename MeshT = int>

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | PolyConnectivity & | mesh,
|  | PROPTYPE | property_handle
| ) |  |
| inline

Constructor.

Create a wrapper around an existing property. Lifetime is not managed.

Parameters

  mesh | The mesh on which to create the property.
  property_handle | Handle to an existing property that should be wrapped.

## Member Function Documentation

## ◆ clone()

template<typename PROPTYPE, typename MeshT = int>

PropertyManager OpenMesh::PropertyManager< PROPTYPE, MeshT >::clone | ( |  | ) |
| inline

Create property manager referring to a copy of the current property.

This can be used to explicitely create a copy of a named property. The cloned property will be unnamed.

## ◆ copy()

template<typename PROPTYPE, typename MeshT = int>
template<typename RangeType , typename RangeType_2 >

static void OpenMesh::PropertyManager< PROPTYPE, MeshT >::copy | ( | const char * | prop_name,
|  | PolyConnectivity & | src_mesh,
|  | const RangeType & | src_range,
|  | PolyConnectivity & | dst_mesh,
|  | const RangeType_2 & | dst_range
| ) |  |
| inline static

Copy the values of a property from a source range to a target range.

The source range must not be smaller than the target range.

Parameters

  prop_name | Name of the property to copy. Must exist on the source mesh. Will be created on the target mesh if it doesn't exist.
  src_mesh | Source mesh from which to copy.
  src_range | Source range which to copy. Must not be smaller than dst_range.
  dst_mesh | Destination mesh on which to copy.
  dst_range | Destination range.

## ◆ copy_to()

template<typename PROPTYPE, typename MeshT = int>
template<typename HandleTypeIterator , typename PROPTYPE_2 , typename HandleTypeIterator_2 >

void OpenMesh::PropertyManager< PROPTYPE, MeshT >::copy_to | ( | HandleTypeIterator | begin,
|  | HandleTypeIterator | end,
|  | PropertyManager< PROPTYPE_2 > & | dst_propmanager,
|  | HandleTypeIterator_2 | dst_begin,
|  | HandleTypeIterator_2 | dst_end
| ) |  | const
| inline

Conveniently transfer the values managed by one property manager onto the values managed by a different property manager.

Parameters

  begin | Start iterator. Needs to dereference to HandleType. Will be used with this property manager.
  end | End iterator. (Exclusive.) Will be used with this property manager.
  dst_propmanager | The destination property manager.
  dst_begin | Start iterator. Needs to dereference to the HandleType of dst_propmanager. Will be used with dst_propmanager.
  dst_end | End iterator. (Exclusive.) Will be used with dst_propmanager. Used to double check the bounds.

## ◆ operator()() [1/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator() | ( | const Handle & | handle = `Handle()` | ) |
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

## ◆ operator()() [2/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::const_reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator() | ( | const Handle & | handle = `Handle()` | ) | const
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

## ◆ operator*() [1/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::reference& OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator* | ( |  | ) |
| inline

Get the mesh corresponding to the property.

If you use PropertyManager without second template parameter (recommended) you need to specify the actual mesh type when using this function, e.g.:

{
TriMesh mesh;
auto visited = VProp<bool>(mesh);
TriMesh& mesh_ref = visited.getMesh<TriMesh>();
}
/
template <typename MeshType >
const MeshType& getMesh() const { return dynamic_cast<const MeshType&>(mesh_); }
const MeshT& getMesh() const { return dynamic_cast<const MeshT&>(mesh_); }
OM_DEPRECATED("retain no longer has any effect. Instead, named properties are always retained, while unnamed ones are not.")
void retain(bool = true) {}
PropertyManager(PropertyManager &&rhs)
:
mesh_(rhs.mesh_),
prop_(rhs.prop_),
retain_(rhs.retain_),
name_(rhs.name_)
{
if (!rhs.retain_)
rhs.prop_.invalidate(); // only invalidate unnamed properties
}
PropertyManager& operator=(PropertyManager&& rhs)
{
if ((&mesh_ != &rhs.mesh_) || (prop_ != rhs.prop_))
{
if (rhs.retain_)
{
// retained properties cannot be invalidated. Copy instead
Storage::copy(rhs, *this);
}
else
{
// swap the data stored in the properties
Storage::swap(rhs, *this);
// remove the property from rhs
rhs.mesh().remove_property(rhs.prop_);
// invalidate prop_
rhs.prop_.invalidate();
}
}
return *this;
}
static PropertyManager createIfNotExists(PolyConnectivity &mesh, const char *propname) {
return PropertyManager(mesh, propname);
}
template<typename PROP_VALUE, typename ITERATOR_TYPE>
static PropertyManager createIfNotExists(PolyConnectivity &mesh, const char *propname,
const ITERATOR_TYPE &begin, const ITERATOR_TYPE &end,
const PROP_VALUE &init_value) {
const bool exists = propertyExists(mesh, propname);
PropertyManager pm(mesh, propname, exists);
pm.retain();
if (!exists)
pm.set_range(begin, end, init_value);
return std::move(pm);
}
template<typename PROP_VALUE, typename ITERATOR_RANGE>
static PropertyManager createIfNotExists(PolyConnectivity &mesh, const char *propname,
const ITERATOR_RANGE &range, const PROP_VALUE &init_value) {
return createIfNotExists(
mesh, propname, range.begin(), range.end(), init_value);
}

Note
  This method is only used for mesh properties.

## ◆ operator*() [2/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::const_reference& OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator* | ( |  | ) | const
| inline

Access the value of the encapsulated mesh property.

Example:

PolyMesh m;
auto description = getProperty<void, std::string>(m, "description");
std::cout << *description << std::endl;

Note
  This method is only used for mesh properties.

## ◆ operator[]() [1/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator[] | ( | Handle | handle | ) |
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

## ◆ operator[]() [2/2]

template<typename PROPTYPE, typename MeshT = int>

PROPTYPE::const_reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator[] | ( | const Handle & | handle | ) | const
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

## ◆ set_range()

template<typename PROPTYPE, typename MeshT = int>
template<typename HandleTypeIterator , typename PROP_VALUE >

void OpenMesh::PropertyManager< PROPTYPE, MeshT >::set_range | ( | HandleTypeIterator | begin,
|  | HandleTypeIterator | end,
|  | const PROP_VALUE & | value
| ) |  |
| inline

Conveniently set the property for an entire range of values.

Examples:

MeshT mesh;
PropertyManager<VPropHandleT<double>> distance(
mesh, "distance.plugin-example.i8.informatik.rwth-aachen.de");
distance.set_range(
mesh.vertices_begin(), mesh.vertices_end(),
std::numeric_limits<double>::infinity());

or

MeshT::VertexHandle vh;
distance.set_range(
mesh.vv_begin(vh), mesh.vv_end(vh),
std::numeric_limits<double>::infinity());

Parameters

  begin | Start iterator. Needs to dereference to HandleType.
  end | End iterator. (Exclusive.)
  value | The value the range will be set to.

## Friends And Related Function Documentation

## ◆ getOrMakeProperty()

template<typename ElementT , typename T >

PropertyManager< typename HandleToPropHandle< ElementT, T >::type > getOrMakeProperty | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Obtains a handle to a named property if it exists or creates a new one otherwise.

Used for creating or accessing permanent properties.

Example:

PolyMesh m;
{
auto is_quad = getOrMakeProperty<FaceHandle, bool>(m, "is_quad");
for (auto& fh : m.faces()) {
is_quad[fh] = (m.valence(fh) == 4);
}
// The property remains on the mesh after the end of the scope.
}
{
// Retrieve the property from the previous scope.
auto is_quad = getOrMakeProperty<FaceHandle, bool>(m, "is_quad");
// Use is_quad here.
}

Parameters

  mesh | The mesh on which the property is created
  propname | The name of the created property

Template Parameters

  ElementT | Element type of the created property, e.g. VertexHandle, HalfedgeHandle, etc.
  T | Value type of the created property, e.g., `double`, `int`, etc.

Returns
  A PropertyManager wrapping the property

## ◆ getPointsProperty() [1/2]

template<typename MeshT >

PropertyManager< OpenMesh::VPropHandleT< typename MeshT::Point > > getPointsProperty | ( | MeshT & | mesh | ) |
| related

Returns a convenience wrapper around the points property of a mesh.

## ◆ getPointsProperty() [2/2]

template<typename MeshT >

ConstPropertyViewer< OpenMesh::VPropHandleT< typename MeshT::Point > > getPointsProperty | ( | const MeshT & | mesh | ) |
| related

Returns a convenience wrapper around the points property of a mesh that only allows const access.

## ◆ getProperty()

template<typename ElementT , typename T >

PropertyManager< typename HandleToPropHandle< ElementT, T >::type > getProperty | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Obtains a handle to a named property.

Example:

PolyMesh m;
{
try {
auto is_quad = getProperty<FaceHandle, bool>(m, "is_quad");
// Use is_quad here.
}
catch (const std::runtime_error& e) {
// There is no is_quad face property on the mesh.
}
}

Precondition
  Property with the name `propname` of matching type exists.

Exceptions

  std::runtime_error | if no property with the name `propname` of matching type exists.

Parameters

  mesh | The mesh on which the property is created
  propname | The name of the created property

Template Parameters

  ElementT | Element type of the created property, e.g. VertexHandle, HalfedgeHandle, etc.
  T | Value type of the created property, e.g., `double`, `int`, etc.

Returns
  A PropertyManager wrapping the property

## ◆ hasProperty()

template<typename ElementT , typename T >

bool hasProperty | ( | const PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Tests whether a property with the given element type, value type, and name is present on the given mesh.

- Example:
  PolyMesh m;
  if (hasProperty<FaceHandle, bool>(m, "is_quad")) {
  // We now know the property exists: getProperty won't throw.
  auto is_quad = getProperty<FaceHandle, bool>(m, "is_quad");
  // Use is_quad here.
  }

Parameters

  mesh | The mesh in question
  propname | The property name of the expected property

Template Parameters

  ElementT | Element type of the expected property, e.g. VertexHandle, HalfedgeHandle, etc.
  T | Value type of the expected property, e.g., `double`, `int`, etc.
  MeshT | Type of the mesh. Can often be inferred from `mesh`

## ◆ makePropertyManagerFromExisting()

template<typename PROPTYPE , typename MeshT = int>

PropertyManager< PROPTYPE, MeshT > makePropertyManagerFromExisting | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Deprecated:
  Use getProperty() instead.

Creates a non-owning wrapper for an existing mesh property (no lifecycle management).

Intended for convenient access.

Precondition
  Property with the name `propname` of matching type exists.

Exceptions

  std::runtime_error | if no property with the name `propname` of matching type exists.

## ◆ makePropertyManagerFromExistingOrNew() [1/3]

template<typename PROPTYPE , typename MeshT = int>

PropertyManager< PROPTYPE, MeshT > makePropertyManagerFromExistingOrNew | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Deprecated:
  Use getOrMakeProperty() instead.

Creates a non-owning wrapper for a mesh property (no lifecycle management). If the given property does not exist, it is created.

Intended for creating or accessing persistent properties.

## ◆ makePropertyManagerFromExistingOrNew() [2/3]

template<typename PROPTYPE , typename ITERATOR_TYPE , typename PROP_VALUE >

PropertyManager< PROPTYPE > makePropertyManagerFromExistingOrNew | ( | PolyConnectivity & | mesh,
|  | const char * | propname,
|  | const ITERATOR_TYPE & | begin,
|  | const ITERATOR_TYPE & | end,
|  | const PROP_VALUE & | init_value
| ) |  |
| related

Like the two parameter version of makePropertyManagerFromExistingOrNew() except it initializes the property with the specified value over the specified range if it needs to be created. If the property already exists, this function has the exact same effect as the two parameter version.

Creates a non-owning wrapper for a mesh property (no lifecycle management). If the given property does not exist, it is created.

Intended for creating or accessing persistent properties.

## ◆ makePropertyManagerFromExistingOrNew() [3/3]

template<typename PROPTYPE , typename ITERATOR_RANGE , typename PROP_VALUE >

PropertyManager< PROPTYPE > makePropertyManagerFromExistingOrNew | ( | PolyConnectivity & | mesh,
|  | const char * | propname,
|  | const ITERATOR_RANGE & | range,
|  | const PROP_VALUE & | init_value
| ) |  |
| related

Like the two parameter version of makePropertyManagerFromExistingOrNew() except it initializes the property with the specified value over the specified range if it needs to be created. If the property already exists, this function has the exact same effect as the two parameter version.

Creates a non-owning wrapper for a mesh property (no lifecycle management). If the given property does not exist, it is created.

Intended for creating or accessing persistent properties.

## ◆ makePropertyManagerFromNew()

template<typename PROPTYPE >

PropertyManager< PROPTYPE > makePropertyManagerFromNew | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Deprecated:
  Use makeTemporaryProperty() instead.

Creates a new property whose lifecycle is managed by the returned PropertyManager.

Intended for temporary properties. Shadows any existing properties of matching name and type.

## ◆ makeTemporaryProperty() [1/2]

template<typename ElementT , typename T >

PropertyManager< typename HandleToPropHandle< ElementT, T >::type > makeTemporaryProperty | ( | PolyConnectivity & | mesh,
|  | const char * | propname
| ) |  |
| related

Deprecated:
  Temporary properties should not have a name.

Creates a new property whose lifetime is limited to the current scope.

Used for temporary properties. Shadows any existing properties of matching name and type.

Example:

PolyMesh m;
{
auto is_quad = makeTemporaryProperty<FaceHandle, bool>(m);
for (auto& fh : m.faces()) {
is_quad[fh] = (m.valence(fh) == 4);
}
// The property is automatically removed from the mesh at the end of the scope.
}

Parameters

  mesh | The mesh on which the property is created
  propname | (optional) The name of the created property

Template Parameters

  ElementT | Element type of the created property, e.g. VertexHandle, HalfedgeHandle, etc.
  T | Value type of the created property, e.g., `double`, `int`, etc.

Returns
  A PropertyManager handling the lifecycle of the property

## ◆ makeTemporaryProperty() [2/2]

template<typename ElementT , typename T >

PropertyManager< typename HandleToPropHandle< ElementT, T >::type > makeTemporaryProperty | ( | PolyConnectivity & | mesh | ) |
| related

Creates a new property whose lifetime is limited to the current scope.

Used for temporary properties. Shadows any existing properties of matching name and type.

Example:

PolyMesh m;
{
auto is_quad = makeTemporaryProperty<FaceHandle, bool>(m);
for (auto& fh : m.faces()) {
is_quad[fh] = (m.valence(fh) == 4);
}
// The property is automatically removed from the mesh at the end of the scope.
}

Parameters

  mesh | The mesh on which the property is created

Template Parameters

  ElementT | Element type of the created property, e.g. VertexHandle, HalfedgeHandle, etc.
  T | Value type of the created property, e.g., `double`, `int`, etc.

Returns
  A PropertyManager handling the lifecycle of the property

The documentation for this class was generated from the following file:

- OpenMesh/Core/Utils/PropertyManager.hh