controlDock_mapTab.cpp 14.9 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "controlDock_mapTab.h"

#include "schnapps.h"
#include "view.h"

namespace CGoGN
{

namespace SCHNApps
{

ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) :
	m_schnapps(s),
	m_selectedMap(NULL),
	b_updatingUI(false)
{
17 18 19
	for(unsigned int i = 0; i < NB_ORBITS; ++i)
		m_selectedSelector[i] = NULL;

Pierre Kraemer's avatar
Pierre Kraemer committed
20 21
	setupUi(this);

Pierre Kraemer's avatar
Pierre Kraemer committed
22
	connect(list_maps, SIGNAL(itemSelectionChanged()), this, SLOT(selectedMapChanged()));
Sylvain Thery's avatar
Sylvain Thery committed
23
//	connect(list_maps, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(mapCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
24 25
	connect(list_vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(vertexAttributeCheckStateChanged(QListWidgetItem*)));

Pierre Kraemer's avatar
Pierre Kraemer committed
26
	connect(tabWidget_mapInfo, SIGNAL(currentChanged(int)), this, SLOT(selectedSelectorChanged()));
Pierre Kraemer's avatar
Pierre Kraemer committed
27

Pierre Kraemer's avatar
Pierre Kraemer committed
28
	connect(list_dartSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
29
	connect(list_dartSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
30 31
	connect(button_dartAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_dartRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
32

Pierre Kraemer's avatar
Pierre Kraemer committed
33
	connect(list_vertexSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
34
	connect(list_vertexSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
35 36
	connect(button_vertexAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_vertexRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
37

Pierre Kraemer's avatar
Pierre Kraemer committed
38
	connect(list_edgeSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
39
	connect(list_edgeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
40 41
	connect(button_edgeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_edgeRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
42

Pierre Kraemer's avatar
Pierre Kraemer committed
43
	connect(list_faceSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
44
	connect(list_faceSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
45 46
	connect(button_faceAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_faceRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
47

Pierre Kraemer's avatar
Pierre Kraemer committed
48
	connect(list_volumeSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
49
	connect(list_volumeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
50 51
	connect(button_volumeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_volumeRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
Pierre Kraemer's avatar
Pierre Kraemer committed
52 53 54

	connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
Sylvain Thery's avatar
Sylvain Thery committed
55
//	connect(m_schnapps, SIGNAL(selectedViewChanged(View*,View*)), this, SLOT(selectedViewChanged(View*,View*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
56 57
}

58 59 60 61 62 63 64 65 66 67 68 69 70 71
unsigned int ControlDock_MapTab::getCurrentOrbit()
{
	int current = tabWidget_mapInfo->currentIndex();
	switch(current)
	{
		case 0 : return DART; break;
		case 1 : return VERTEX; break;
		case 2 : return EDGE; break;
		case 3 : return FACE; break;
		case 4 : return VOLUME; break;
	}
	return DART;
}

Pierre Kraemer's avatar
Pierre Kraemer committed
72 73 74 75 76 77 78 79 80 81 82 83 84




void ControlDock_MapTab::selectedMapChanged()
{
	if(!b_updatingUI)
	{
		if(m_selectedMap)
		{
			disconnect(m_selectedMap, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
			disconnect(m_selectedMap, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(selectedMapVBOAdded(Utils::VBO*)));
			disconnect(m_selectedMap, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(selectedMapVBORemoved(Utils::VBO*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
85 86
			disconnect(m_selectedMap, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorAdded(unsigned int, const QString&)));
			disconnect(m_selectedMap, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorRemoved(unsigned int, const QString&)));
Pierre Kraemer's avatar
Pierre Kraemer committed
87 88 89
		}

		QList<QListWidgetItem*> items = list_maps->selectedItems();
90

Pierre Kraemer's avatar
Pierre Kraemer committed
91 92
		if(!items.empty())
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
93 94
			MapHandlerGen* old = m_selectedMap;

Pierre Kraemer's avatar
Pierre Kraemer committed
95 96 97
			QString selectedMapName = items[0]->text();
			m_selectedMap = m_schnapps->getMap(selectedMapName);

Sylvain Thery's avatar
Sylvain Thery committed
98
//			items[0]->setCheckState(Qt::Checked);
99

Pierre Kraemer's avatar
Pierre Kraemer committed
100 101 102
			updateSelectedMapInfo();

			m_schnapps->notifySelectedMapChanged(old, m_selectedMap);
Sylvain Thery's avatar
Sylvain Thery committed
103
//			m_schnapps->getSelectedView()->setLastSelectedMap(m_selectedMap);
Pierre Kraemer's avatar
Pierre Kraemer committed
104 105 106 107

			connect(m_selectedMap, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
			connect(m_selectedMap, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(selectedMapVBOAdded(Utils::VBO*)));
			connect(m_selectedMap, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(selectedMapVBORemoved(Utils::VBO*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
108 109
			connect(m_selectedMap, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorAdded(unsigned int, const QString&)));
			connect(m_selectedMap, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorRemoved(unsigned int, const QString&)));
Pierre Kraemer's avatar
Pierre Kraemer committed
110
		}
111 112 113 114 115
		else
		{
			MapHandlerGen* old = m_selectedMap;
			m_selectedMap = NULL;
			m_schnapps->notifySelectedMapChanged(old,m_selectedMap);
Sylvain Thery's avatar
Sylvain Thery committed
116
//			m_schnapps->getSelectedView()->setLastSelectedMap(NULL);
117
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
118 119 120
	}
}

Sylvain Thery's avatar
Sylvain Thery committed
121

Pierre Kraemer's avatar
Pierre Kraemer committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

void ControlDock_MapTab::vertexAttributeCheckStateChanged(QListWidgetItem *item)
{
	if(!b_updatingUI)
	{
		if(item->checkState() == Qt::Checked)
		{
			Utils::VBO* vbo = m_selectedMap->createVBO(item->text());
			if(!vbo)
			{
				b_updatingUI = true;
				item->setCheckState(Qt::Unchecked);
				b_updatingUI = false;
			}
		}
		else
			m_selectedMap->deleteVBO(item->text());
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
142
void ControlDock_MapTab::selectedSelectorChanged()
Pierre Kraemer's avatar
Pierre Kraemer committed
143 144 145 146 147
{
	if(!b_updatingUI)
	{
		if(m_selectedMap)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
148 149 150 151 152 153 154 155 156 157
			QList<QListWidgetItem*> items;
			unsigned int orbit = getCurrentOrbit();
			switch(orbit)
			{
				case DART: items = list_dartSelectors->selectedItems(); break;
				case VERTEX: items = list_vertexSelectors->selectedItems(); break;
				case EDGE: items = list_edgeSelectors->selectedItems(); break;
				case FACE: items = list_faceSelectors->selectedItems(); break;
				case VOLUME: items = list_volumeSelectors->selectedItems(); break;
			}
Pierre Kraemer's avatar
Pierre Kraemer committed
158
			if(!items.empty())
Pierre Kraemer's avatar
Pierre Kraemer committed
159
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
160
				m_selectedSelector[orbit] = m_selectedMap->getCellSelector(orbit, items[0]->text());
Pierre Kraemer's avatar
Pierre Kraemer committed
161 162
				m_schnapps->notifySelectedCellSelectorChanged(m_selectedSelector[orbit]);
			}
163 164 165 166
		}
	}
}

167 168 169 170 171 172 173 174 175 176 177 178 179 180
void ControlDock_MapTab::selectorCheckStateChanged(QListWidgetItem* item)
{
	if(!b_updatingUI)
	{
		if(m_selectedMap)
		{
			unsigned int orbit = getCurrentOrbit();
			CellSelectorGen* cs = m_selectedMap->getCellSelector(orbit, item->text());
			cs->setMutuallyExclusive(item->checkState() == Qt::Checked);
			m_selectedMap->updateMutuallyExclusiveSelectors(orbit);
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
181
void ControlDock_MapTab::addSelector()
Pierre Kraemer's avatar
Pierre Kraemer committed
182 183 184 185
{
	if(!b_updatingUI)
	{
		if(m_selectedMap)
186
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
187 188
			unsigned int orbit = getCurrentOrbit();
			m_selectedMap->addCellSelector(orbit, QString("selector_") + QString::number(CellSelectorGen::selectorCount));
189 190 191 192
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
193
void ControlDock_MapTab::removeSelector()
Pierre Kraemer's avatar
Pierre Kraemer committed
194 195 196 197 198
{
	if(!b_updatingUI)
	{
		if(m_selectedMap)
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
199 200 201 202 203 204 205 206 207 208
			QList<QListWidgetItem*> items;
			unsigned int orbit = getCurrentOrbit();
			switch(orbit)
			{
				case DART: items = list_dartSelectors->selectedItems(); break;
				case VERTEX: items = list_vertexSelectors->selectedItems(); break;
				case EDGE: items = list_edgeSelectors->selectedItems(); break;
				case FACE: items = list_faceSelectors->selectedItems(); break;
				case VOLUME: items = list_volumeSelectors->selectedItems(); break;
			}
Pierre Kraemer's avatar
Pierre Kraemer committed
209
			if(!items.empty())
Pierre Kraemer's avatar
Pierre Kraemer committed
210
				m_selectedMap->removeCellSelector(orbit, items[0]->text());
Pierre Kraemer's avatar
Pierre Kraemer committed
211 212 213 214
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
215 216 217 218 219 220




void ControlDock_MapTab::mapAdded(MapHandlerGen* m)
{
221
	b_updatingUI = true;
Thery Sylvain's avatar
Thery Sylvain committed
222
//	QListWidgetItem* item = new QListWidgetItem(m->getName(), list_maps);
Sylvain Thery's avatar
Sylvain Thery committed
223
//	item->setCheckState(Qt::Unchecked);
Thery Sylvain's avatar
Thery Sylvain committed
224 225

	new QListWidgetItem(m->getName(), list_maps);
Pierre Kraemer's avatar
Pierre Kraemer committed
226 227 228 229 230
	b_updatingUI = false;
}

void ControlDock_MapTab::mapRemoved(MapHandlerGen* m)
{
231
	QList<QListWidgetItem*> items = list_maps->findItems(m->getName(), Qt::MatchExactly);
Pierre Kraemer's avatar
Pierre Kraemer committed
232
	if(!items.empty())
233 234
	{
		b_updatingUI = true;
Pierre Kraemer's avatar
Pierre Kraemer committed
235
		delete items[0];
236 237
		b_updatingUI = false;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
238 239
}

Sylvain Thery's avatar
Sylvain Thery committed
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
//void ControlDock_MapTab::selectedViewChanged(View* prev, View* cur)
//{
//	if(prev)
//	{
//		foreach(MapHandlerGen* map, prev->getLinkedMaps())
//		{
//			QList<QListWidgetItem*> prevItems = list_maps->findItems(map->getName(), Qt::MatchExactly);
//			if(!prevItems.empty())
//			{
//				b_updatingUI = true;
//				prevItems[0]->setCheckState(Qt::Unchecked);
//				b_updatingUI = false;
//			}
//		}

//		disconnect(prev, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(selectedViewMapLinked(MapHandlerGen*)));
//		disconnect(prev, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(selectedViewMapUnlinked(MapHandlerGen*)));
//	}
//	if(cur)
//	{
//		foreach(MapHandlerGen* map, cur->getLinkedMaps())
//		{
//			QList<QListWidgetItem*> curItems = list_maps->findItems(map->getName(), Qt::MatchExactly);
//			if(!curItems.empty())
//			{
//				b_updatingUI = true;
//				curItems[0]->setCheckState(Qt::Checked);
//				b_updatingUI = false;
//			}
//		}

//		connect(cur, SIGNAL(mapLinked(MapHandlerGen*)), this, SLOT(selectedViewMapLinked(MapHandlerGen*)));
//		connect(cur, SIGNAL(mapUnlinked(MapHandlerGen*)), this, SLOT(selectedViewMapUnlinked(MapHandlerGen*)));
//	}

//	if( (cur->lastSelectedMap() != NULL) && (cur->isLinkedToMap(cur->lastSelectedMap())))
//	{
//		setSelectedMap(cur->lastSelectedMap()->getName());
//	}
//	else
//	{
//		MapHandlerGen* map = m_schnapps->getSelectedMap();
//		if ((map == NULL) || (! map->isLinkedToView(cur)))
//		{
//			bool changed = false;
//			const MapSet& ms = m_schnapps->getMapSet();
//			foreach(MapHandlerGen* mhg, ms)
//			{
//				if (mhg->isLinkedToView(cur))
//				{
//					setSelectedMap(mhg->getName());
//					changed = true;
//					break; // out of the loop, not nice but ...
//				}
//			}
//			if (!changed)// no possibility to selected a map automatically so none
//			{
//				setSelectedMap(QString("NONE"));
//			}
//		}
//	}

//}





//void ControlDock_MapTab::selectedViewMapLinked(MapHandlerGen* map)
//{
//	QList<QListWidgetItem*> curItems = list_maps->findItems(map->getName(), Qt::MatchExactly);
//	if(!curItems.empty())
//	{
//		b_updatingUI = true;
//		curItems[0]->setCheckState(Qt::Checked);
//		b_updatingUI = false;
//	}
//}

//void ControlDock_MapTab::selectedViewMapUnlinked(MapHandlerGen* map)
//{
//	QList<QListWidgetItem*> prevItems = list_maps->findItems(map->getName(), Qt::MatchExactly);
//	if(!prevItems.empty())
//	{
//		b_updatingUI = true;
//		prevItems[0]->setCheckState(Qt::Unchecked);
//		b_updatingUI = false;
//	}
//}
Pierre Kraemer's avatar
Pierre Kraemer committed
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348





void ControlDock_MapTab::selectedMapAttributeAdded(unsigned int orbit, const QString &name)
{
	updateSelectedMapInfo();
}

void ControlDock_MapTab::selectedMapVBOAdded(Utils::VBO *vbo)
{
	updateSelectedMapInfo();
}

void ControlDock_MapTab::selectedMapVBORemoved(Utils::VBO *vbo)
{
	updateSelectedMapInfo();
}

Pierre Kraemer's avatar
Pierre Kraemer committed
349 350 351 352 353 354 355 356 357 358
void ControlDock_MapTab::selectedMapCellSelectorAdded(unsigned int orbit, const QString& name)
{
	updateSelectedMapInfo();
}

void ControlDock_MapTab::selectedMapCellSelectorRemoved(unsigned int orbit, const QString& name)
{
	updateSelectedMapInfo();
}

Pierre Kraemer's avatar
Pierre Kraemer committed
359 360 361 362 363 364 365 366 367 368 369 370 371 372




void ControlDock_MapTab::updateSelectedMapInfo()
{
	b_updatingUI = true;

	list_dartAttributes->clear();
	list_vertexAttributes->clear();
	list_edgeAttributes->clear();
	list_faceAttributes->clear();
	list_volumeAttributes->clear();

Pierre Kraemer's avatar
Pierre Kraemer committed
373 374 375 376 377 378
	list_dartSelectors->clear();
	list_vertexSelectors->clear();
	list_edgeSelectors->clear();
	list_faceSelectors->clear();
	list_volumeSelectors->clear();

Pierre Kraemer's avatar
Pierre Kraemer committed
379 380 381 382
	GenericMap* m = m_selectedMap->getGenericMap();
	for(unsigned int orbit = DART; orbit <= VOLUME; ++orbit)
	{
		unsigned int nbc = m->getNbCells(orbit);
383 384 385

		QListWidget* selectorList = NULL;

Pierre Kraemer's avatar
Pierre Kraemer committed
386 387 388
		switch(orbit)
		{
			case DART : {
389
				unsigned int nb = m_selectedMap->getNbDarts();
390 391
				label_dartNbOrbits->setText(QString::number(nb));
				label_dartNbCells->setText(QString::number(nbc));
392
				selectorList = list_dartSelectors;
Pierre Kraemer's avatar
Pierre Kraemer committed
393 394 395
				break;
			}
			case VERTEX : {
396
				unsigned int nb = m_selectedMap->getNbOrbits(VERTEX);
397 398
				label_vertexNbOrbits->setText(QString::number(nb));
				label_vertexNbCells->setText(QString::number(nbc));
399
				selectorList = list_vertexSelectors;
Pierre Kraemer's avatar
Pierre Kraemer committed
400 401 402
				break;
			}
			case EDGE : {
403
				unsigned int nb = m_selectedMap->getNbOrbits(EDGE);
404 405
				label_edgeNbOrbits->setText(QString::number(nb));
				label_edgeNbCells->setText(QString::number(nbc));
406
				selectorList = list_edgeSelectors;
Pierre Kraemer's avatar
Pierre Kraemer committed
407 408 409
				break;
			}
			case FACE : {
410
				unsigned int nb = m_selectedMap->getNbOrbits(FACE);
411 412
				label_faceNbOrbits->setText(QString::number(nb));
				label_faceNbCells->setText(QString::number(nbc));
413
				selectorList = list_faceSelectors;
Pierre Kraemer's avatar
Pierre Kraemer committed
414 415 416
				break;
			}
			case VOLUME : {
417
				unsigned int nb = m_selectedMap->getNbOrbits(VOLUME);
418 419
				label_volumeNbOrbits->setText(QString::number(nb));
				label_volumeNbCells->setText(QString::number(nbc));
420
				selectorList = list_volumeSelectors;
Pierre Kraemer's avatar
Pierre Kraemer committed
421 422 423 424
				break;
			}
		}

425 426 427 428 429 430 431 432 433 434 435 436
		foreach(CellSelectorGen* cs, m_selectedMap->getCellSelectorSet(orbit).values())
		{
			QListWidgetItem* item = new QListWidgetItem(cs->getName(), selectorList);
			item->setFlags(item->flags() | Qt::ItemIsEditable);
			if(m_selectedSelector[orbit] == cs)
				item->setSelected(true);
			if(cs->isMutuallyExclusive())
				item->setCheckState(Qt::Checked);
			else
				item->setCheckState(Qt::Unchecked);
		}

Pierre Kraemer's avatar
Pierre Kraemer committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
		if(m->isOrbitEmbedded(orbit))
		{
			AttributeContainer& cont = m->getAttributeContainer(orbit);
			std::vector<std::string> names;
			std::vector<std::string> types;
			cont.getAttributesNames(names);
			cont.getAttributesTypes(types);
			for(unsigned int i = 0; i < names.size(); ++i)
			{
				QString name = QString::fromStdString(names[i]);
				QString type = QString::fromStdString(types[i]);
				switch(orbit)
				{
					case DART : {
						list_dartAttributes->addItem(name + " (" + type + ")");
					} break;
					case VERTEX : {
						QListWidgetItem* item = new QListWidgetItem(name /*+ " (" + type + ")"*/, list_vertexAttributes);
						if(m_selectedMap->getVBO(name))
							item->setCheckState(Qt::Checked);
						else
							item->setCheckState(Qt::Unchecked);
					} break;
					case EDGE : {
						list_edgeAttributes->addItem(name + " (" + type + ")");
					} break;
					case FACE : {
						list_faceAttributes->addItem(name + " (" + type + ")");
					} break;
					case VOLUME : {
						list_volumeAttributes->addItem(name + " (" + type + ")");
					} break;
				}
			}
		}
	}

	b_updatingUI = false;
}

477 478 479

void ControlDock_MapTab::setSelectedMap(const QString& mapName)
{
480
	if (mapName == QString("NONE"))
481 482 483 484 485
	{
		QList<QListWidgetItem*> items = list_maps->selectedItems();
		if(!items.empty())
		{
			items[0]->setSelected(false);
486
			m_selectedMap = NULL;
487
		}
488 489 490 491 492 493 494
		return;
	}

	QList<QListWidgetItem *> lm = list_maps->findItems(mapName,Qt::MatchExactly);
	if (!lm.empty())
	{
		lm[0]->setSelected(true);
495
	}
496 497 498
}


Pierre Kraemer's avatar
Pierre Kraemer committed
499 500 501
} // namespace SCHNApps

} // namespace CGoGN