Graphite  Version 3
An experimental 3D geometry processing program
mesh_grob_editor_interface.h
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000-2009 INRIA - Project ALICE
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy - levy@loria.fr
24  *
25  * Project ALICE
26  * LORIA, INRIA Lorraine,
27  * Campus Scientifique, BP 239
28  * 54506 VANDOEUVRE LES NANCY CEDEX
29  * FRANCE
30  *
31  * Note that the GNU General Public License does not permit incorporating
32  * the Software into proprietary programs.
33  *
34  * As an exception to the GPL, Graphite can be linked with the
35  * following (non-GPL) libraries: Qt, SuperLU, WildMagic and CGAL
36  */
37 
38 #ifndef H_OGF_MESH_INTERFACES_MESH_GROB_EDITOR_INTERFACE_H
39 #define H_OGF_MESH_INTERFACES_MESH_GROB_EDITOR_INTERFACE_H
40 
41 #include <OGF/mesh/common/common.h>
45 
46 namespace OGF {
47 
48  namespace NL {
49  class Vector;
50  }
51 
56  gom_class MESH_API MeshGrobEditor : public Interface {
57  public:
62 
66  ~MeshGrobEditor() override;
67 
72  MeshGrob* mesh_grob() const {
73  return dynamic_cast<MeshGrob*>(grob());
74  }
75 
76  gom_properties:
81  void set_dimension(index_t dim);
82 
88 
94 
101 
107 
113 
114  gom_slots:
115 
125  NL::Vector* find_attribute(
126  const std::string& attribute_name, bool quiet=false
127  );
128 
139  const std::string& attribute_name,
140  index_t dimension=1, MetaType* type=nullptr
141  );
142 
153  const std::string& attribute_name,
154  index_t dimension=1, MetaType* type=nullptr
155  );
156 
164  bool has_attribute(const std::string& attribute_name) const;
165 
166 
173  return find_attribute("vertices.point");
174  }
175 
184 
193 
202 
211 
215  void clear();
216 
223  index_t create_vertex(double x=0.0, double y=0.0, double z=0.0);
224 
231  void set_vertex(index_t v, double x=0.0, double y=0.0, double z=0.0);
232 
239 
240 
248 
256 
264 
272 
277 
278 
285 
293 
301 
309  void delete_vertices(NL::Vector* to_delete);
310 
321  NL::Vector* to_delete, bool delete_isolated_vertices=true
322  );
323 
334  NL::Vector* to_delete, bool delete_isolated_vertices=true
335  );
336 
347  NL::Vector* to_delete, bool delete_isolated_vertices=true
348  );
349 
350  protected:
351 
358  bool check_mesh_grob() const;
359 
367 
374  bool check_facet_index(index_t f) const;
375 
379  void update();
380  };
381 }
382 
383 #endif
Generic mechanism for attributes.
Represents additional functions that can be attached to an object.
Definition: commands.h:72
A wrapper to script low-level editing operations on a MeshGrob.
bool has_attribute(const std::string &attribute_name) const
Tests whether the mesh has an attribute.
void delete_cells(NL::Vector *to_delete, bool delete_isolated_vertices=true)
Deletes a set of cells.
MeshGrobEditor()
MeshGrobEditor constructor.
void clear()
clears this mesh.
void set_vertex(index_t v, double x=0.0, double y=0.0, double z=0.0)
Sets the coordinates of an existing vertex.
index_t create_vertices(index_t nb)
Creates multiple vertices.
MeshGrob * mesh_grob() const
Gets the wrapped MeshGrob.
void connect_facets()
Computes facet adjacencies.
bool check_mesh_grob() const
Checks whether MeshGrob is valid.
NL::Vector * get_tetrahedra() const
If the volume mesh is tetrahedralized, gets the array of tetrahedra.
NL::Vector * create_attribute(const std::string &attribute_name, index_t dimension=1, MetaType *type=nullptr)
Creates an attribute.
index_t get_nb_facets() const
Gets the number of facets.
index_t create_edge(index_t v1, index_t v2)
Creates an edge.
NL::Vector * find_or_create_attribute(const std::string &attribute_name, index_t dimension=1, MetaType *type=nullptr)
Creates an attribute.
index_t facet_nb_vertices(index_t f) const
Gets the number of vertices in a facet.
index_t get_nb_cells() const
Gets the number of cells.
void delete_edges(NL::Vector *to_delete, bool delete_isolated_vertices=true)
Deletes a set of edges.
index_t create_facet(index_t nb_vertices)
Creates a facet.
NL::Vector * get_triangle_adjacents() const
If the surface mesh is triangulated, gets the array of triangles.
NL::Vector * get_tetrahedra_adjacents() const
If the volume mesh is tetrahedralized, gets the array of tetrahedra adjacencies.
index_t get_dimension() const
Gets the dimension.
index_t create_vertex(double x=0.0, double y=0.0, double z=0.0)
Creates a new vertex.
void update()
Redisplays the wrapped MeshGrob.
bool check_facet_index(index_t f) const
Checks whether a facet index is valid.
~MeshGrobEditor() override
MeshGrobEditor destrutor.
index_t get_nb_edges() const
Gets the number of edges.
index_t get_nb_vertices() const
Gets the number of vertices.
void delete_facets(NL::Vector *to_delete, bool delete_isolated_vertices=true)
Deletes a set of facets.
NL::Vector * get_triangles() const
If the surface mesh is triangulated, gets the array of triangles.
void delete_vertices(NL::Vector *to_delete)
Deletes a set of vertices.
index_t create_quad(index_t v1, index_t v2, index_t v3, index_t v4)
Creates a quad.
index_t facet_vertex(index_t f, index_t lv) const
Gets a vertex in a facet.
index_t create_triangle(index_t v1, index_t v2, index_t v3)
Creates a triangle.
bool check_vertex_index(index_t v) const
Checks whether a vertex index is valid.
void set_facet_vertex(index_t f, index_t lv, index_t v)
Sets a vertex of the facet.
NL::Vector * get_points()
Gets the points.
A Grob wrapper around Geogram's Mesh class.
Definition: mesh_grob.h:56
The representation of a type in the Meta repository.
Definition: meta_type.h:221
A scriptable Vector objects.
Definition: vector.h:54
class that gathers commands with menu and dialogs.
the MeshGrob class.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
Definitions common to all include files in the mesh library.