Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

mapsViewDialog.cpp 1.73 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
#include "dialogs/mapsViewDialog.h"
2
3
4
5

#include "window.h"
#include "view.h"
#include "plugin.h"
6
#include "mapHandler.h"
7
8
9
10

#include <QMessageBox>
#include <QMouseEvent>

Pierre Kraemer's avatar
Pierre Kraemer committed
11
12
13
14
15
16
namespace CGoGN
{

namespace SCHNApps
{

17
18
19
20
21
22
23
24
25
26
MapsViewDialog::MapsViewDialog(Window* window, View* view) :
	QDialog(view),
	m_window(window),
	m_view(view)
{
	this->setupUi(this);
	this->setWindowTitle(m_view->getName() + QString(" : maps"));

	connect(mapList, SIGNAL(itemSelectionChanged()), this, SLOT(cb_selectedMapsChanged()));

27
28
	connect(m_window, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(cb_addMapToList(MapHandlerGen*)));
	connect(m_window, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(cb_removeMapFromList(MapHandlerGen*)));
29

30
31
	QList<MapHandlerGen*> maps = m_window->getMapsList();
	foreach(MapHandlerGen* m, maps)
32
33
34
35
36
37
38
39
40
41
42
		mapList->addItem(m->getName());
}

MapsViewDialog::~MapsViewDialog()
{}

void MapsViewDialog::cb_selectedMapsChanged()
{
	for(int i = 0; i < mapList->count(); ++i)
	{
		QString mapName = mapList->item(i)->text();
43
44
		MapHandlerGen* map = m_window->getMap(mapName);
		if(mapList->item(i)->isSelected())
45
		{
46
			assert(!m_view->isLinkedToMap(map) && !map->isLinkedToView(m_view));
47
48
49
			m_view->linkMap(map);
			map->linkView(m_view);
		}
50
		else if(!mapList->item(i)->isSelected())
51
		{
52
			assert(m_view->isLinkedToMap(map) && map->isLinkedToView(m_view));
53
54
55
56
			m_view->unlinkMap(map);
			map->unlinkView(m_view);
		}
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
57
	m_view->updateGL();
58
59
}

60
void MapsViewDialog::cb_addMapToList(MapHandlerGen* m)
61
62
63
64
{
	mapList->addItem(m->getName());
}

65
void MapsViewDialog::cb_removeMapFromList(MapHandlerGen* m)
66
67
68
69
70
71
72
73
74
75
{
	for(int i = 0; i < mapList->count(); ++i)
	{
		if(mapList->item(i)->text() == m->getName())
		{
			delete mapList->item(i);
			return;
		}
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
76
77
78
79

} // namespace SCHNApps

} // namespace CGoGN