Graphite  Version 3
An experimental 3D geometry processing program
mesh_grob_selection_tools.h
1 
2 /*
3  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
4  * Copyright (C) 2000-2009 INRIA - Project ALICE
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * If you modify this software, you should include a notice giving the
21  * name of the person performing the modification, the date of modification,
22  * and the reason for such modification.
23  *
24  * Contact: Bruno Levy - levy@loria.fr
25  *
26  * Project ALICE
27  * LORIA, INRIA Lorraine,
28  * Campus Scientifique, BP 239
29  * 54506 VANDOEUVRE LES NANCY CEDEX
30  * FRANCE
31  *
32  * Note that the GNU General Public License does not permit incorporating
33  * the Software into proprietary programs.
34  *
35  * As an exception to the GPL, Graphite can be linked
36  * with the following (non-GPL) libraries: Qt, SuperLU, WildMagic and CGAL
37  */
38 
39 #ifndef H_OGF_MESH_GFX_TOOLS_MESH_GROB_SELECTION_TOOLS_H
40 #define H_OGF_MESH_GFX_TOOLS_MESH_GROB_SELECTION_TOOLS_H
41 
42 #include <OGF/mesh_gfx/common/common.h>
44 
50 namespace OGF {
51 
55  class MESH_GFX_API MeshGrobSelectVertex : public MeshGrobTool {
56  public:
62  ToolsManager* parent
63  ) :
64  MeshGrobTool(parent),
65  vertex_(index_t(-1)) {
66  }
67 
71  void grab(const RayPick& p_ndc) override;
72 
76  void drag(const RayPick& p_ndc) override;
77 
78  private:
79  index_t vertex_;
80  };
81 
85  class MESH_GFX_API MeshGrobUnselectVertex : public MeshGrobTool {
86  public:
92  ToolsManager* parent
93  ) : MeshGrobTool(parent) {
94 
95  }
96 
100  void grab(const RayPick& p_ndc) override;
101  };
102 
103 
109  gom_attribute(category, "selection")
110  gom_attribute(icon, "select_vertex")
111  gom_attribute(help, "select vertex / unselect vertex")
112  gom_attribute(message,
113  "btn1: select/move vertex; btn3: unselect vertex"
114  )
115  gom_class MESH_GFX_API MeshGrobSelectUnselectVertex : public MultiTool {
116  public:
122  set_tool(MOUSE_BUTTON_LEFT, new MeshGrobSelectVertex(parent));
123  set_tool(MOUSE_BUTTON_RIGHT, new MeshGrobUnselectVertex(parent));
124  }
125 
129  void reset() override;
130  };
131 
132 }
133 
134 #endif
A tool that selects/unselects a vertex depending on the pushed mouse button.
MeshGrobSelectUnselectVertex(ToolsManager *parent)
MeshGrobSelectUnselectVertex constructor.
void reset() override
Resets this Tool.
A tool that selects a vertex.
void grab(const RayPick &p_ndc) override
void drag(const RayPick &p_ndc) override
The event handler for mouse drag events.
MeshGrobSelectVertex(ToolsManager *parent)
MeshGrobSelectTool.
Base class for tools that operate on MeshGrob.
A tool that unselects a vertex.
void grab(const RayPick &p_ndc) override
MeshGrobUnselectVertex(ToolsManager *parent)
MeshGrobSelectTool.
A Tool that can associate a different tool to each button of the mouse.
Definition: tool.h:199
Manages the Tool objects associated with a given Grob class.
Definition: tools_manager.h:62
Base classes for tools that operate on MeshGrob.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
Represents the information related with a picking event.
Definition: ray_picker.h:64