Commit 5f669809 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

PropertyManager: Added copy_to method.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1176 fdac6126-5c0c-442c-9429-916003d36597
parent cc08cfa9
......@@ -57,7 +57,7 @@ namespace OpenMesh {
*
* \code
* TriMesh mesh;
* PropertyManager<VPropHandleT<bool>, MeshT> visited(mesh, "visited.plugin-example.i8.informatik.rwth-aachen.de");
* PropertyManager<VPropHandleT<bool>, TriMesh> visited(mesh, "visited.plugin-example.i8.informatik.rwth-aachen.de");
*
* for (TriMesh::VertexIter vh_it = mesh.begin(); ... ; ...) {
* if (!visited[*vh_it]) {
......@@ -320,6 +320,40 @@ class PropertyManager {
(*this)[*begin] = value;
}
/**
* Conveniently transfer the values managed by one property manager
* onto the values managed by a different property manager.
*
* @param begin Start iterator. Needs to dereference to HandleType. Will
* be used with this property manager.
* @param end End iterator. (Exclusive.) Will be used with this property
* manager.
* @param dst_propmanager The destination property manager.
* @param dst_begin Start iterator. Needs to dereference to the
* HandleType of dst_propmanager. Will be used with dst_propmanager.
* @param dst_end End iterator. (Exclusive.)
* Will be used with dst_propmanager. Used to double check the bounds.
*/
template<typename HandleTypeIterator, typename PROPTYPE_2,
typename MeshT_2, typename HandleTypeIterator_2>
void copy_to(HandleTypeIterator begin, HandleTypeIterator end,
PropertyManager<PROPTYPE_2, MeshT_2> &dst_propmanager,
HandleTypeIterator_2 dst_begin, HandleTypeIterator_2 dst_end) const {
for (; begin != end && dst_begin != dst_end; ++begin, ++dst_begin) {
dst_propmanager[dst_begin] = (*this)[*begin];
}
}
template<typename RangeType, typename PROPTYPE_2,
typename MeshT_2, typename RangeType_2>
void copy_to(RangeType range,
PropertyManager<PROPTYPE_2, MeshT_2> &dst_propmanager,
RangeType_2 dst_range) const {
copy_to(range.begin(), range.end(), dst_propmanager,
dst_range.begin(), dst_range.end());
}
private:
void deleteProperty() {
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