Commit 6ca78b06 authored by Matthias Möller's avatar Matthias Möller

using dynamic request_attribute method for the example

closes #2422

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1242 fdac6126-5c0c-442c-9429-916003d36597
parent 7c589bb6
......@@ -51,9 +51,6 @@
struct MyTraits : public OpenMesh::DefaultTraits
{
VertexAttributes(OpenMesh::Attributes::Status);
FaceAttributes(OpenMesh::Attributes::Status);
EdgeAttributes(OpenMesh::Attributes::Status);
};
......@@ -67,6 +64,11 @@ int main()
{
MyMesh mesh;
// the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute
mesh.request_face_status();
mesh.request_edge_status();
mesh.request_vertex_status();
// generate vertices
MyMesh::VertexHandle vhandle[8];
......
......@@ -9,11 +9,14 @@ we have to extend the default traits for our mesh class.
Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute
which is used to hold the flag "deleted" if an element is deleted.
The struct which defines the mesh traits then looks like this:
Instead of defining the required attributes via traits on compile-time, it is possible to request
attributes dynamically on run-time by requesting them.
In this example, we want to delete faces, edges and vertices, therefore requesting the status attribute is required.
\note You have to request attributes before you use them, if you don't enable them via traits.
\dontinclude delete_geometry.cc
\skipline struct
\until };
\skipline // the request
\until mesh.request_vertex_status();
After having created the geometry of the cube one can delete faces and vertices
by simply calling delete_vertices() (delete_faces() or delete_edges() respectively).
......
......@@ -609,9 +609,14 @@ TEST_F(OpenMeshTutorials, extending_the_mesh_using_traits) {
EXPECT_TRUE(ok) << "Cannot write mesh to file 'smoothed_extended_output.off'";
}
/*
TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
MyMeshWithStatus mesh;
Mesh mesh;
// the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute
mesh.request_face_status();
mesh.request_edge_status();
mesh.request_vertex_status();
// generate vertices
MyMeshWithStatus::VertexHandle vhandle[8];
......@@ -730,7 +735,7 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
EXPECT_TRUE(ok) << "Cannot write mesh to file 'deleted_output.off'";
}
*/
TEST_F(OpenMeshTutorials, storing_custom_properties) {
MyMesh mesh;
......
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