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.71 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
#include "dialogs/mapsViewDialog.h"
2
3
4
5
6
7
8
9

#include "window.h"
#include "view.h"
#include "plugin.h"

#include <QMessageBox>
#include <QMouseEvent>

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

namespace SCHNApps
{

16
17
18
19
20
21
22
23
24
25
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()));

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

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

MapsViewDialog::~MapsViewDialog()
{}

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

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

64
void MapsViewDialog::cb_removeMapFromList(MapHandlerGen* m)
65
66
67
68
69
70
71
72
73
74
{
	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
75
76
77
78

} // namespace SCHNApps

} // namespace CGoGN