surface_modelisation.h 3.3 KB
Newer Older
1
2
3
4
5
6
7
#ifndef _SURFACE_MODELISATION_PLUGIN_H_
#define _SURFACE_MODELISATION_PLUGIN_H_

#include "plugin_interaction.h"
#include "surface_modelisation_dockTab.h"

#include "mapHandler.h"
8
9
10
11
12
#include "Utils/drawer.h"
#include "Topology/map/map2.h"
#include <QVector>
#include "QGLViewer/camera.h"
#include "QGLViewer/vec.h"
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

namespace CGoGN
{

namespace SCHNApps
{

struct MapParameters
{
	MapParameters() :
		vertexSelector(NULL),
		edgeSelector(NULL),
		faceSelector(NULL)
	{}

Pierre Kraemer's avatar
Pierre Kraemer committed
28
	VertexAttribute<PFP2::VEC3, PFP2::MAP::IMPL> positionAttribute;
29

Pierre Kraemer's avatar
Pierre Kraemer committed
30
31
32
	CellSelector<PFP2::MAP, VERTEX>* vertexSelector;
	CellSelector<PFP2::MAP, EDGE>* edgeSelector;
	CellSelector<PFP2::MAP, FACE>* faceSelector;
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
};

class Surface_Modelisation_Plugin : public PluginInteraction
{
	Q_OBJECT
	Q_INTERFACES(CGoGN::SCHNApps::Plugin)

	friend class Surface_Modelisation_DockTab;

public:
	Surface_Modelisation_Plugin();

	~Surface_Modelisation_Plugin()
	{}

	virtual bool enable();
	virtual void disable();

51
52
    virtual void draw(View *view);
    virtual void drawMap(View* view, MapHandlerGen* map);
53
54
55

	virtual void keyPress(View* view, QKeyEvent* event) {}
	virtual void keyRelease(View* view, QKeyEvent* event) {}
56
    virtual void mousePress(View* view, QMouseEvent* event);
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	virtual void mouseRelease(View* view, QMouseEvent* event) {}
	virtual void mouseMove(View* view, QMouseEvent* event) {}
	virtual void wheelEvent(View* view, QWheelEvent* event) {}

	virtual void viewLinked(View *view) {}
	virtual void viewUnlinked(View *view) {}

private slots:
	// slots called from SCHNApps signals
	void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
	void mapAdded(MapHandlerGen* map);
	void mapRemoved(MapHandlerGen* map);

	// slots called from MapHandler signals
	void attributeAdded(unsigned int orbit, const QString& name);
	void cellSelectorAdded(unsigned int orbit, const QString& name);
	void cellSelectorRemoved(unsigned int orbit, const QString& name);

public slots:
	// slots for Python calls
	void changePositionAttribute(const QString& view, const QString& map, const QString& name);
	void changeVertexSelector(const QString& map, const QString& name);
	void changeEdgeSelector(const QString& map, const QString& name);
	void changeFaceSelector(const QString& map, const QString& name);

protected:
83
	void createEmptyMap();
84
85
86
87
88
89
90
91
92
93
94
    void createNewFace(MapHandlerGen* mhg);
    void addCube(MapHandlerGen* mhg);
    void mergeVolumes(MapHandlerGen* mhg);
    void splitSurface(MapHandlerGen* mhg);
    void extrudeRegion(MapHandlerGen* mhg);

    void splitVertex(MapHandlerGen* mhg);
    void deleteVertex(MapHandlerGen* mhg);

    void cutEdge(MapHandlerGen* mhg);
    void uncutEdge(MapHandlerGen* mhg);
95
	void flipEdge(MapHandlerGen* mhg);
96
97
98
99
100
101
102
103
104
105
106
    void flipBackEdge(MapHandlerGen* mhg);
    void collapseEdge(MapHandlerGen* mhg);

    void splitFace(MapHandlerGen* mhg);
    void mergeFaces(MapHandlerGen* mhg);
    void deleteFace(MapHandlerGen* mhg);
    void sewFaces(MapHandlerGen* mhg);
    void unsewFaces(MapHandlerGen* mhg);
    void extrudeFace(MapHandlerGen* mhg);
    void pathExtrudeFace(MapHandlerGen *mhg);

107
108
109
110

protected:
	Surface_Modelisation_DockTab* m_dockTab;
	QHash<MapHandlerGen*, MapParameters> h_parameterSet;
111
112
    Utils::Drawer* m_drawer;

113
114
115
    std::vector<PFP2::VEC3> collectedVertices;
    bool collect;
    int mapNumber;
116
117
118
119
120
121
122
};

} // namespace SCHNApps

} // namespace CGoGN

#endif