Commit 7978e545 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

PropertyManager: Added static copy(...) convenience method.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1183 fdac6126-5c0c-442c-9429-916003d36597
parent 09190c7c
......@@ -341,19 +341,47 @@ class PropertyManager {
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];
dst_propmanager[*dst_begin] = (*this)[*begin];
}
}
template<typename RangeType, typename PROPTYPE_2,
typename MeshT_2, typename RangeType_2>
void copy_to(RangeType range,
void copy_to(const RangeType &range,
PropertyManager<PROPTYPE_2, MeshT_2> &dst_propmanager,
RangeType_2 dst_range) const {
const RangeType_2 &dst_range) const {
copy_to(range.begin(), range.end(), dst_propmanager,
dst_range.begin(), dst_range.end());
}
/**
* 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.
*
* @param 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.
*
* @param src_mesh Source mesh from which to copy.
* @param src_range Source range which to copy. Must not be smaller than
* dst_range.
* @param dst_mesh Destination mesh on which to copy.
* @param dst_range Destination range.
*/
template<typename RangeType, typename MeshT_2, typename RangeType_2>
static void copy(const char *prop_name,
MeshT &src_mesh, const RangeType &src_range,
MeshT_2 &dst_mesh, const RangeType_2 &dst_range) {
typedef OpenMesh::PropertyManager<PROPTYPE, MeshT> DstPM;
DstPM dst(DstPM::createIfNotExists(dst_mesh, prop_name));
typedef OpenMesh::PropertyManager<PROPTYPE, MeshT_2> SrcPM;
SrcPM src(src_mesh, prop_name, true);
src.copy_to(src_range, dst, dst_range);
}
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