surface_differentialProperties.h 2.81 KB
Newer Older
1 2
#ifndef _SURFACE_DIFFERENTIALPROPERTIES_PLUGIN_H_
#define _SURFACE_DIFFERENTIALPROPERTIES_PLUGIN_H_
Pierre Kraemer's avatar
Pierre Kraemer committed
3

4
#include "plugin_processing.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
5

6 7
#include "dialog_computeNormal.h"
#include "dialog_computeCurvature.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
8

9 10
namespace CGoGN
{
Pierre Kraemer's avatar
Pierre Kraemer committed
11

12 13
namespace SCHNApps
{
Pierre Kraemer's avatar
Pierre Kraemer committed
14

15
class Surface_DifferentialProperties_Plugin : public PluginProcessing
Pierre Kraemer's avatar
Pierre Kraemer committed
16 17 18 19 20
{
	Q_OBJECT
	Q_INTERFACES(CGoGN::SCHNApps::Plugin)

public:
21 22
	Surface_DifferentialProperties_Plugin()
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
23

24
	~Surface_DifferentialProperties_Plugin()
Pierre Kraemer's avatar
Pierre Kraemer committed
25 26 27
	{}

	virtual bool enable();
28
	virtual void disable();
Pierre Kraemer's avatar
Pierre Kraemer committed
29

30
private slots:
Pierre Kraemer's avatar
Pierre Kraemer committed
31 32 33 34 35 36 37 38 39 40
	void mapAdded(MapHandlerGen* map);
	void mapRemoved(MapHandlerGen* map);
	void attributeModified(unsigned int orbit, QString nameAttr);

	void openComputeNormalDialog();
	void openComputeCurvatureDialog();

	void computeNormalFromDialog();
	void computeCurvatureFromDialog();

Sylvain Thery's avatar
Sylvain Thery committed
41 42
	void appsFinished();

43
public slots:
Pierre Kraemer's avatar
Pierre Kraemer committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
	void computeNormal(const QString& mapName,
		const QString& positionAttributeName = "position",
		const QString& normalAttributeName = "normal",
		bool autoUpdate = true);

	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",
		bool compute_kmean = true,
		bool compute_kgaussian = true,
		bool autoUpdate = true
	);

private:
64 65
	Dialog_ComputeNormal* m_computeNormalDialog;
	Dialog_ComputeCurvature* m_computeCurvatureDialog;
Pierre Kraemer's avatar
Pierre Kraemer committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106

	QAction* m_computeNormalAction;
	QAction* m_computeCurvatureAction;

	struct ComputeNormalParameters
	{
		ComputeNormalParameters() {}
		ComputeNormalParameters(const QString& p, const QString& n, bool update) :
			positionName(p), normalName(n), autoUpdate(update)
		{}
		QString positionName;
		QString normalName;
		bool autoUpdate;
	};
	QHash<QString, ComputeNormalParameters> computeNormalLastParameters;

	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,
			bool kmean, bool kgaussian, bool update) :
			positionName(p), normalName(n),
			KmaxName(Kmax), kmaxName(kmax), KminName(Kmin), kminName(kmin), KnormalName(Knormal),
			compute_kmean(kmean), compute_kgaussian(kgaussian), autoUpdate(update)
		{}
		QString positionName;
		QString normalName;
		QString KmaxName;
		QString kmaxName;
		QString KminName;
		QString kminName;
		QString KnormalName;
		bool compute_kmean;
		bool compute_kgaussian;
		bool autoUpdate;
	};
	QHash<QString, ComputeCurvatureParameters> computeCurvatureLastParameters;
};

107 108 109 110
} // namespace SCHNApps

} // namespace CGoGN

Pierre Kraemer's avatar
Pierre Kraemer committed
111
#endif