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

Pierre Kraemer's avatar
Pierre Kraemer committed
3 4 5 6 7 8 9
namespace CGoGN
{

namespace SCHNApps
{

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

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

23 24 25
/*********************************************************
 * MANAGE VBOs
 *********************************************************/
26

27
Utils::VBO* MapHandlerGen::getVBO(const QString& name) const
28
{
29
	if (h_vbo.contains(name))
30 31
		return h_vbo[name];
	else
32
		return NULL;
33 34
}

35
void MapHandlerGen::deleteVBO(const QString& name)
36
{
37
	if (h_vbo.contains(name))
38
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
39
		Utils::VBO* vbo = h_vbo[name];
40
		h_vbo.remove(name);
41
		emit(vboRemoved(vbo));
42
		delete vbo;
43 44 45
	}
}

46
/*********************************************************
47
 * MANAGE LINKED VIEWS
48 49
 *********************************************************/

Pierre Kraemer's avatar
Pierre Kraemer committed
50
void MapHandlerGen::linkView(View* view)
51 52 53 54 55
{
	if(view && !l_views.contains(view))
		l_views.push_back(view);
}

56
void MapHandlerGen::unlinkView(View* view)
57
{
Pierre Kraemer's avatar
Pierre Kraemer committed
58
	l_views.removeOne(view);
59
}
Pierre Kraemer's avatar
Pierre Kraemer committed
60 61 62 63

} // namespace SCHNApps

} // namespace CGoGN