mapHandler.h 1.34 KB
Newer Older
1 2
#ifndef _MAPHANDLER_H_
#define _MAPHANDLER_H_
3

4 5
#include <QString>
#include "types.h"
6

7 8
#include "view.h"

9 10 11 12 13 14 15 16 17
namespace CGoGN
{
	class GenericMap;
	namespace Utils
	{
		class VBO;
	}
}

18
class MapHandler : public QObject
19
{
20 21
	Q_OBJECT

22
public:
23
	MapHandler(const QString& name, Window* window, CGoGN::GenericMap* map);
24 25
	~MapHandler();

26 27
	const QString& getName() { return m_name; }
	void setName(const QString& name) { m_name = name; }
28

29 30 31
	Window* getWindow() { return m_window; }
	void setWindow(Window* w) { m_window = w; }

32
	CGoGN::GenericMap* getMap() { return m_map; }
33

34 35 36 37 38
	CGoGN::Utils::VBO* addVBO(const QString& name);
	void removeVBO(const QString& name);
	CGoGN::Utils::VBO* getVBO(const QString& name);
	CGoGN::Utils::VBO* findFirstVBOMatching(const QRegExp& regexp);
	QList<CGoGN::Utils::VBO*> findVBOsMatching(const QRegExp& regexp);
39

40
	int getNbVBO() { return h_vbo.count(); }
41

42 43 44 45 46 47 48 49 50
	/*********************************************************
	 * MANAGE LINKED VIEWS
	 *********************************************************/

	bool linkView(View* view);
	void unlinkView(View* view);
	bool isLinkedToView(View* view) { return l_views.contains(view); }
	QList<View*> getLinkedViews() { return l_views; }

51
protected:
52
	QString m_name;
53
	Window* m_window;
Pierre Kraemer's avatar
Pierre Kraemer committed
54
	CGoGN::GenericMap* m_map;
55

56 57
	QList<View*> l_views;

58
	VBOHash h_vbo;
59 60 61

public slots:
	void cb_viewRemoved(View* view);
62 63 64
};

#endif