Commit a0097fe3 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

PropertyManager: Added set_range method.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@998 fdac6126-5c0c-442c-9429-916003d36597
parent 61c89332
...@@ -278,6 +278,37 @@ class PropertyManager { ...@@ -278,6 +278,37 @@ class PropertyManager {
return mesh_->property(prop_, handle); return mesh_->property(prop_, handle);
} }
/**
* Conveniently set the property for an entire range of values.
*
* Examples:
* \code
* MeshT mesh;
* PropertyManager<VPropHandleT<double>, MeshT> distance(
* mesh, "distance.plugin-example.i8.informatik.rwth-aachen.de");
* distance.set_range(
* mesh.vertices_begin(), mesh.vertices_end(),
* std::numeric_limits<double>::infinity());
* \endcode
* or
* \code
* MeshT::VertexHandle vh;
* distance.set_range(
* mesh.vv_begin(vh), mesh.vv_end(vh),
* std::numeric_limits<double>::infinity());
* \endcode
*
* @param begin Start iterator. Needs to dereference to HandleType.
* @param end End iterator. (Exclusive.)
* @param value The value the range will be set to.
*/
template<typename HandleTypeIterator>
void set_range(HandleTypeIterator begin, HandleTypeIterator end,
typename PROPTYPE::const_reference value) {
for (; begin != end; ++begin)
(*this)[*begin] = value;
}
private: private:
void deleteProperty() { void deleteProperty() {
if (!retain_) if (!retain_)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment