Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

firstPlugin.h 2.75 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
#ifndef _FIRSTPLUGIN_H_
#define _FIRSTPLUGIN_H_
Pierre Kraemer's avatar
Pierre Kraemer committed
3

4
#include "plugins/visualPlugin.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6

/**---CGoGN includes **/
7
#include "Topology/generic/parameters.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
8
#include "Topology/map/embeddedMap2.h"
9
#include "Algo/Render/GL2/topoRender.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
10
11
/**---CGoGN includes **/

12
13
/**---Definitions specific to CGoGN ---*/
using namespace CGoGN ;
Pierre Kraemer's avatar
Pierre Kraemer committed
14

15
16
17
18
19
20
/**
 * Struct that contains some informations about the types of the manipulated objects
 * Mainly here to be used by the algorithms that are parameterized by it
 */
struct PFP: public PFP_STANDARD
{
Pierre Kraemer's avatar
Pierre Kraemer committed
21
	// definition of the map
22
23
	typedef EmbeddedMap2 MAP;
};
Pierre Kraemer's avatar
Pierre Kraemer committed
24

25
26
typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3;
Pierre Kraemer's avatar
Pierre Kraemer committed
27
/**---Definitions specific to CGoGN ---*/
Pierre Kraemer's avatar
Pierre Kraemer committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

/**
 * This class is a basic minimal plugin.
 * All the methods in this class are overloaded methods.
 * In order to create a valid plugin, all the method in this
 * needs to be declared (they are actually overloaded methods
 * from VisualPlugin), even if your plugin doesn't make any
 * drawing.
 */

/**
 * Our plugin must inherit from VisualPlugin,
 * that is a class that itself is an implementation
 * of the Plugin interface (virtual class). It contains
 * many useful and essantial methods.
 */
44
45
class FirstPlugin : public VisualPlugin
{
Pierre Kraemer's avatar
Pierre Kraemer committed
46
47
48
49
50
	/**
	 * Essential Qt macros.
	 */
	Q_OBJECT
	Q_INTERFACES(Plugin)
51

Pierre Kraemer's avatar
Pierre Kraemer committed
52
public:
53
54
	FirstPlugin() {}
	~FirstPlugin() {}
Pierre Kraemer's avatar
Pierre Kraemer committed
55
56
57
58
59
60

	/**
	 * The classical call back for the initGL method
	 * When a scene will be link to this plugin, it will call
	 * back this method with itself as a parameter.
	 */
Pierre Kraemer's avatar
Pierre Kraemer committed
61
	void cb_initGL(Scene *scene);
Pierre Kraemer's avatar
Pierre Kraemer committed
62
63
64
65
66
67
68

	/**
	 * The drawing method that needs to be overloaded.
	 * Each time a scene (that is to say, at least one of the
	 * views that is contains) needs to be refresh, it calls back
	 * this method with itself as a parameter
	 */
Pierre Kraemer's avatar
Pierre Kraemer committed
69
	void cb_redraw(Scene *scene);
Pierre Kraemer's avatar
Pierre Kraemer committed
70
71
72
73
74
75
76
77
78

	/**
	 * The plugin's activation method
	 * Each time the main application loads this plugin,
	 * it call this method. Writing this method is
	 * the occasion to initialize the plugin and check certain
	 * conditions.
	 * If this methods return 'false', the plugin load will be aborted.
	 */
79
	bool enable();
80

Pierre Kraemer's avatar
Pierre Kraemer committed
81
82
83
84
85
86
87
88
89
	/**
	 * The plugin's disabling method
	 * Each time the main application will unload the plugin
	 * it will call this method.
	 */
	void disable();

protected:
	/** Attributes that are specific to this plugin **/
90
	MAP myMap;
Pierre Kraemer's avatar
Pierre Kraemer committed
91

92
93
	// attribute for vertices positions
	VertexAttribute<VEC3> position;
Pierre Kraemer's avatar
Pierre Kraemer committed
94

95
	// render (for the topo)
Pierre Kraemer's avatar
Pierre Kraemer committed
96
	Algo::Render::GL2::TopoRender *m_render_topo;
Pierre Kraemer's avatar
Pierre Kraemer committed
97

98
	// just for more compact writing
Pierre Kraemer's avatar
Pierre Kraemer committed
99
100
101
102
103
104
105
106
107
108
109
110
	inline Dart PHI1(Dart d)
	{
		return myMap.phi1(d);
	}
	inline Dart PHI_1(Dart d)
	{
		return myMap.phi_1(d);
	}
	inline Dart PHI2(Dart d)
	{
		return myMap.phi2(d);
	}
111
	template<int X>
Pierre Kraemer's avatar
Pierre Kraemer committed
112
113
114
115
	Dart PHI(Dart d)
	{
		return myMap.phi<X>(d);
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
116
117
118
	/** Attributes that are specific to this plugin **/
};

Pierre Kraemer's avatar
Pierre Kraemer committed
119
#endif // _FIRSTPLUGIN_H_