- Modified copy_properties to include a flag, if the standard properties should be copied along with the other properties
- Added unittest to check if copy properties works for vertices refs #990 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@687 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -461,54 +461,79 @@ public:
|
||||
|
||||
/** Copies all properties from one mesh element to another (of the same type)
|
||||
*
|
||||
* \param _vh_from A vertex handle - source
|
||||
* \param _vh_to A vertex handle - target
|
||||
*
|
||||
* @param _vh_from A vertex handle - source
|
||||
* @param _vh_to A vertex handle - target
|
||||
* @param _copyBuildIn Should the internal properties (position, normal, texture coordinate,..) be copied?
|
||||
*/
|
||||
void copy_all_properties(VertexHandle _vh_from, VertexHandle _vh_to) {
|
||||
void copy_all_properties(VertexHandle _vh_from, VertexHandle _vh_to, bool _copyBuildIn = false) {
|
||||
|
||||
for( PropertyContainer::iterator p_it = vprops_.begin();
|
||||
p_it != vprops_.end(); ++p_it) {
|
||||
(*p_it)->copy(_vh_from.idx(), _vh_to.idx());
|
||||
p_it != vprops_.end(); ++p_it) {
|
||||
|
||||
// Copy all properties, if build in is true
|
||||
// Otherwise, copy only properties without build in specifier
|
||||
if ( _copyBuildIn || (*p_it)->name().substr(0,2) != "v:")
|
||||
(*p_it)->copy(_vh_from.idx(), _vh_to.idx());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Copies all properties from one mesh element to another (of the same type)
|
||||
*
|
||||
* \param _hh_from A halfedge handle - source
|
||||
* \param _hh_to A halfedge handle - target
|
||||
*
|
||||
* @param _hh_from A halfedge handle - source
|
||||
* @param _hh_to A halfedge handle - target
|
||||
* @param _copyBuildIn Should the internal properties (position, normal, texture coordinate,..) be copied?
|
||||
*/
|
||||
void copy_all_properties(HalfedgeHandle _hh_from, HalfedgeHandle _hh_to) {
|
||||
void copy_all_properties(HalfedgeHandle _hh_from, HalfedgeHandle _hh_to, bool _copyBuildIn = false) {
|
||||
|
||||
for( PropertyContainer::iterator p_it = hprops_.begin();
|
||||
p_it != hprops_.end(); ++p_it) {
|
||||
(*p_it)->copy(_hh_from.idx(), _hh_to.idx());
|
||||
p_it != hprops_.end(); ++p_it) {
|
||||
|
||||
// Copy all properties, if build in is true
|
||||
// Otherwise, copy only properties without build in specifier
|
||||
if ( _copyBuildIn || (*p_it)->name().substr(0,2) != "h:")
|
||||
(*p_it)->copy(_hh_from.idx(), _hh_to.idx());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Copies all properties from one mesh element to another (of the same type)
|
||||
*
|
||||
* \param _eh_from An edge handle - source
|
||||
* \param _eh_to An edge handle - target
|
||||
*
|
||||
* @param _eh_from An edge handle - source
|
||||
* @param _eh_to An edge handle - target
|
||||
* @param _copyBuildIn Should the internal properties (position, normal, texture coordinate,..) be copied?
|
||||
*/
|
||||
void copy_all_properties(EdgeHandle _eh_from, EdgeHandle _eh_to) {
|
||||
void copy_all_properties(EdgeHandle _eh_from, EdgeHandle _eh_to, bool _copyBuildIn = false) {
|
||||
for( PropertyContainer::iterator p_it = eprops_.begin();
|
||||
p_it != eprops_.end(); ++p_it) {
|
||||
(*p_it)->copy(_eh_from.idx(), _eh_to.idx());
|
||||
p_it != eprops_.end(); ++p_it) {
|
||||
|
||||
// Copy all properties, if build in is true
|
||||
// Otherwise, copy only properties without build in specifier
|
||||
if ( _copyBuildIn || (*p_it)->name().substr(0,2) != "e:")
|
||||
(*p_it)->copy(_eh_from.idx(), _eh_to.idx());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Copies all properties from one mesh element to another (of the same type)
|
||||
*
|
||||
* \param _fh_from A face handle - source
|
||||
* \param _fh_to A face handle - target
|
||||
* @param _fh_from A face handle - source
|
||||
* @param _fh_to A face handle - target
|
||||
* @param _copyBuildIn Should the internal properties (position, normal, texture coordinate,..) be copied?
|
||||
*
|
||||
*/
|
||||
void copy_all_properties(FaceHandle _fh_from, FaceHandle _fh_to) {
|
||||
void copy_all_properties(FaceHandle _fh_from, FaceHandle _fh_to, bool _copyBuildIn = false) {
|
||||
|
||||
for( PropertyContainer::iterator p_it = fprops_.begin();
|
||||
p_it != fprops_.end(); ++p_it) {
|
||||
(*p_it)->copy(_fh_from.idx(), _fh_to.idx());
|
||||
p_it != fprops_.end(); ++p_it) {
|
||||
|
||||
// Copy all properties, if build in is true
|
||||
// Otherwise, copy only properties without build in specifier
|
||||
if ( _copyBuildIn || (*p_it)->name().substr(0,2) != "f:")
|
||||
(*p_it)->copy(_fh_from.idx(), _fh_to.idx());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected: //------------------------------------------------- low-level access
|
||||
|
||||
Reference in New Issue
Block a user