mapHandler.cpp 1.21 KB
Newer Older
1
#include "mapHandler.h"
2

3
#include "system.h"
4

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

namespace SCHNApps
{

MapHandlerGen::MapHandlerGen(const QString& name, Window* window, GenericMap* map) :
12
	m_name(name),
Pierre Kraemer's avatar
Pierre Kraemer committed
13 14
	m_window(window),
	m_map(map)
15
{
Pierre Kraemer's avatar
Pierre Kraemer committed
16
	m_render = new Algo::Render::GL2::MapRender();
17
}
18

19
MapHandlerGen::~MapHandlerGen()
20
{
21 22
	foreach(CGoGN::Utils::VBO* vbo, h_vbo)
		delete vbo;
23 24
}

25 26 27
/*********************************************************
 * MANAGE VBOs
 *********************************************************/
28

Pierre Kraemer's avatar
Pierre Kraemer committed
29
Utils::VBO* MapHandlerGen::getVBO(const std::string& name)
30
{
31
	if (h_vbo.contains(name))
32 33
		return h_vbo[name];
	else
34
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
35
		Utils::VBO* vbo = new Utils::VBO();
36 37
		h_vbo.insert(name, vbo);
		return vbo;
38 39 40
	}
}

41
void MapHandlerGen::deleteVBO(const std::string& name)
42
{
43
	if (h_vbo.contains(name))
44
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
45
		Utils::VBO* vbo = h_vbo[name];
46 47
		h_vbo.remove(name);
		delete vbo;
48 49 50
	}
}

51
/*********************************************************
52
 * MANAGE LINKED VIEWS
53 54
 *********************************************************/

Pierre Kraemer's avatar
Pierre Kraemer committed
55
void MapHandlerGen::linkView(View* view)
56 57 58 59 60
{
	if(view && !l_views.contains(view))
		l_views.push_back(view);
}

61
void MapHandlerGen::unlinkView(View* view)
62
{
Pierre Kraemer's avatar
Pierre Kraemer committed
63
	l_views.removeOne(view);
64
}
Pierre Kraemer's avatar
Pierre Kraemer committed
65 66 67 68

} // namespace SCHNApps

} // namespace CGoGN