Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

differentialProperties.h 3.08 KB
Newer Older
1
2
3
4
#ifndef _DIFFERENTIALPROPERTIES_PLUGIN_H_
#define _DIFFERENTIALPROPERTIES_PLUGIN_H_

#include "plugin.h"
5

6
7
#include "computeNormalDialog.h"
#include "computeCurvatureDialog.h"
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


using namespace CGoGN;
using namespace SCHNApps;


class DifferentialPropertiesPlugin : public Plugin
{
	Q_OBJECT
	Q_INTERFACES(CGoGN::SCHNApps::Plugin)

public:
	DifferentialPropertiesPlugin()
	{
		setProvidesRendering(false);
	}

	~DifferentialPropertiesPlugin()
	{}

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

	virtual void redraw(View *view) {}

33
34
35
36
37
38
	virtual void keyPress(View* view, QKeyEvent* event) {}
	virtual void keyRelease(View* view, QKeyEvent* event) {}
	virtual void mousePress(View* view, QMouseEvent* event) {}
	virtual void mouseRelease(View* view, QMouseEvent* event) {}
	virtual void mouseMove(View* view, QMouseEvent* event) {}
	virtual void wheelEvent(View* view, QWheelEvent* event) {}
39
40

public slots:
41
42
43
44
	void mapAdded(MapHandlerGen* map);
	void mapRemoved(MapHandlerGen* map);
	void attributeModified(unsigned int orbit, QString nameAttr);

45
46
	void openComputeNormalDialog();
	void openComputeCurvatureDialog();
47

48
49
50
	void computeNormalFromDialog();
	void computeCurvatureFromDialog();

51
	void computeNormal(const QString& mapName,
52
53
		const QString& positionAttributeName = "position",
		const QString& normalAttributeName = "normal",
54
		bool autoUpdate = true);
55

56
57
58
59
60
61
62
63
64
	void computeCurvature(
		const QString& mapName,
		const QString& positionAttributeName = "position",
		const QString& normalAttributeName = "normal",
		const QString& KmaxAttributeName = "Kmax",
		const QString& kmaxAttributeName = "kmax",
		const QString& KminAttributeName = "Kmin",
		const QString& kminAttributeName = "kmin",
		const QString& KnormalAttributeName = "Knormal",
65
66
		bool compute_kmean = true,
		bool compute_kgaussian = true,
67
		bool autoUpdate = true
68
	);
69
70

private:
71
72
	ComputeNormalDialog* m_computeNormalDialog;
	ComputeCurvatureDialog* m_computeCurvatureDialog;
73

74
75
	QAction* m_computeNormalAction;
	QAction* m_computeCurvatureAction;
76
77
78
79

	struct ComputeNormalParameters
	{
		ComputeNormalParameters() {}
80
81
		ComputeNormalParameters(const QString& p, const QString& n, bool update) :
			positionName(p), normalName(n), autoUpdate(update)
82
		{}
83
84
		QString positionName;
		QString normalName;
85
		bool autoUpdate;
86
87
	};
	QHash<QString, ComputeNormalParameters> computeNormalLastParameters;
88
89
90
91
92
93
94

	struct ComputeCurvatureParameters
	{
		ComputeCurvatureParameters() {}
		ComputeCurvatureParameters(
			const QString& p, const QString& n,
			const QString& Kmax, const QString& kmax, const QString& Kmin, const QString& kmin, const QString& Knormal,
95
			bool kmean, bool kgaussian, bool update) :
96
97
			positionName(p), normalName(n),
			KmaxName(Kmax), kmaxName(kmax), KminName(Kmin), kminName(kmin), KnormalName(Knormal),
98
			compute_kmean(kmean), compute_kgaussian(kgaussian), autoUpdate(update)
99
100
101
102
103
104
105
106
		{}
		QString positionName;
		QString normalName;
		QString KmaxName;
		QString kmaxName;
		QString KminName;
		QString kminName;
		QString KnormalName;
107
108
		bool compute_kmean;
		bool compute_kgaussian;
109
110
111
		bool autoUpdate;
	};
	QHash<QString, ComputeCurvatureParameters> computeCurvatureLastParameters;
112
113
114
};

#endif