camera.h 2.21 KB
Newer Older
1 2 3
#ifndef _CAMERA_H_
#define _CAMERA_H_

4
#include "view.h"
5
#include "QGLViewer/camera.h"
6

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

namespace SCHNApps
{

13
class Window;
14 15 16 17

class Camera : public qglviewer::Camera
{
public:
18 19
	static unsigned int cameraCount;

20
	Camera(const QString& name, Window* window);
21 22
	~Camera();

23
	const QString& getName() const { return m_name; }
24
	void setName(const QString& name) { m_name = name; }
Pierre Kraemer's avatar
Pierre Kraemer committed
25

26
	Window* getWindow() const { return m_window; }
Pierre Kraemer's avatar
Pierre Kraemer committed
27 28
	void setWindow(Window* w) { m_window = w; }

Pierre Kraemer's avatar
Pierre Kraemer committed
29
	bool isUsed() const { return !l_views.empty(); }
30
	bool isShared()	const { return l_views.size() > 1; }
31

Pierre Kraemer's avatar
Pierre Kraemer committed
32 33 34 35
	/*********************************************************
	 * CAMERA DRAWING
	 *********************************************************/

36
	virtual void draw();
37

38
	bool getDraw() const { return m_draw; }
39
	void setDraw(bool b = true) { m_draw = b; }
Pierre Kraemer's avatar
Pierre Kraemer committed
40

41 42
	bool getDrawFarPlane() const { return m_drawFarPlane; }
	void setDrawFarPlane(bool b) { m_drawFarPlane = b; }
Pierre Kraemer's avatar
Pierre Kraemer committed
43

44
	double getDrawScale() const { return m_drawScale; }
45
	void setDrawScale(double s) { m_drawScale = s; }
Pierre Kraemer's avatar
Pierre Kraemer committed
46

47 48
	bool getDrawPath() const { return m_drawPath; }
	void setDrawPath(bool b) { m_drawPath = b; }
Pierre Kraemer's avatar
Pierre Kraemer committed
49

50 51
	bool getDrawPathAxis() const { return m_drawPathAxis; }
	void setDrawPathAxis(bool b) { m_drawPathAxis = b; }
Pierre Kraemer's avatar
Pierre Kraemer committed
52

53
	double getDrawPathScale() const { return m_drawPathScale; }
54 55
	void setDrawPathScale(double s) { m_drawPathScale = s;}

Pierre Kraemer's avatar
Pierre Kraemer committed
56 57 58 59
	/*********************************************************
	 * MANAGE LINKED VIEWS
	 *********************************************************/

Pierre Kraemer's avatar
Pierre Kraemer committed
60 61
	void linkView(View* view);
	void unlinkView(View* view);
62 63
	const QList<View*>& getLinkedViews() const { return l_views; }
	bool isLinkedToView(View* view) const { return l_views.contains(view); }
Pierre Kraemer's avatar
Pierre Kraemer committed
64 65

	void fitParamWith(View* view);
66

Pierre Kraemer's avatar
Pierre Kraemer committed
67 68 69 70
	/*********************************************************
	 * SNAPSHOTS
	 *********************************************************/

71 72 73 74 75
	void resetSnapCount() { m_snapCount = 0; }
	void saveSnapshot(QString snapPathName);

protected:
	QString m_name;
Pierre Kraemer's avatar
Pierre Kraemer committed
76
	Window* m_window;
77

Pierre Kraemer's avatar
Pierre Kraemer committed
78
	QList<View*> l_views;
79 80 81 82 83 84 85 86 87 88 89 90

	bool m_draw;
	bool m_drawFarPlane;
	double m_drawScale;

	bool m_drawPath;
	bool m_drawPathAxis;
	double m_drawPathScale;

	int m_snapCount;
};

Pierre Kraemer's avatar
Pierre Kraemer committed
91 92 93 94
} // namespace SCHNApps

} // namespace CGoGN

95
#endif