PropertyManager: Added static copy(...) convenience method.
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1183 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -341,19 +341,47 @@ class PropertyManager {
|
|||||||
HandleTypeIterator_2 dst_begin, HandleTypeIterator_2 dst_end) const {
|
HandleTypeIterator_2 dst_begin, HandleTypeIterator_2 dst_end) const {
|
||||||
|
|
||||||
for (; begin != end && dst_begin != dst_end; ++begin, ++dst_begin) {
|
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,
|
template<typename RangeType, typename PROPTYPE_2,
|
||||||
typename MeshT_2, typename RangeType_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,
|
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,
|
copy_to(range.begin(), range.end(), dst_propmanager,
|
||||||
dst_range.begin(), dst_range.end());
|
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:
|
private:
|
||||||
void deleteProperty() {
|
void deleteProperty() {
|
||||||
if (!retain_)
|
if (!retain_)
|
||||||
|
|||||||
Reference in New Issue
Block a user