controlDock_mapTab.cpp 16.5 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()));
23

24 25 26 27
	connect(button_duplicate, SIGNAL(clicked()), this, SLOT(duplicateCurrentMap()));
	connect(button_remove, SIGNAL(clicked()), this, SLOT(removeCurrentMap()));

	connect(check_drawBB, SIGNAL(toggled(bool)), this, SLOT(showBBChanged(bool)));
28
	connect(combo_bbVertexAttribute, SIGNAL(currentIndexChanged(int)), this, SLOT(bbVertexAttributeChanged(int)));
Pierre Kraemer's avatar
Pierre Kraemer committed
29 30
	connect(list_vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(vertexAttributeCheckStateChanged(QListWidgetItem*)));

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

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

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

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

Pierre Kraemer's avatar
Pierre Kraemer committed
48
	connect(list_faceSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
49
	connect(list_faceSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
50 51
	connect(button_faceAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_faceRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
52

Pierre Kraemer's avatar
Pierre Kraemer committed
53
	connect(list_volumeSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
54
	connect(list_volumeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
55 56
	connect(button_volumeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
	connect(button_volumeRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59

	connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
Pierre Kraemer's avatar
Pierre Kraemer committed
60 61
}

62 63 64
unsigned int ControlDock_MapTab::getCurrentOrbit()
{
	int current = tabWidget_mapInfo->currentIndex();
65
	switch (current)
66 67 68 69 70 71 72 73 74 75
	{
		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;
}

76 77 78 79 80 81 82 83 84
void ControlDock_MapTab::setSelectedMap(const QString& mapName)
{
	if (mapName == QString("NONE"))
	{
		QList<QListWidgetItem*> items = list_maps->selectedItems();
		if(!items.empty())
		{
			items[0]->setSelected(false);
		}
85
		m_selectedMap = NULL;
86
		updateSelectedMapInfo();
87 88 89 90 91 92 93 94 95 96
		return;
	}

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

Pierre Kraemer's avatar
Pierre Kraemer committed
97 98 99 100 101 102




void ControlDock_MapTab::selectedMapChanged()
{
103
	if (!b_updatingUI)
Pierre Kraemer's avatar
Pierre Kraemer committed
104
	{
105 106 107
		MapHandlerGen* old = m_selectedMap;

		if (old)
Pierre Kraemer's avatar
Pierre Kraemer committed
108
		{
109 110 111 112 113
			disconnect(old, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
			disconnect(old, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(selectedMapVBOAdded(Utils::VBO*)));
			disconnect(old, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(selectedMapVBORemoved(Utils::VBO*)));
			disconnect(old, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorAdded(unsigned int, const QString&)));
			disconnect(old, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(selectedMapCellSelectorRemoved(unsigned int, const QString&)));
Pierre Kraemer's avatar
Pierre Kraemer committed
114 115 116
		}

		QList<QListWidgetItem*> items = list_maps->selectedItems();
117
		if (!items.empty())
Pierre Kraemer's avatar
Pierre Kraemer committed
118 119 120 121
		{
			QString selectedMapName = items[0]->text();
			m_selectedMap = m_schnapps->getMap(selectedMapName);

Sylvain Thery's avatar
Sylvain Thery committed
122 123 124 125 126
			// RECORDING
			QTextStream* rec = m_schnapps->pythonStreamRecorder();
			if (rec)
				*rec << "schnapps.setSelectedMap(\"" << m_selectedMap->getName() << "\");" << endl;

Pierre Kraemer's avatar
Pierre Kraemer committed
127 128 129
			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
130 131
			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&)));
132 133 134

			for(unsigned int i = 0; i < NB_ORBITS; ++i)
				m_selectedSelector[i] = NULL;
Pierre Kraemer's avatar
Pierre Kraemer committed
135
		}
136 137
		else
			m_selectedMap = NULL;
138 139 140

		updateSelectedMapInfo();
		m_schnapps->notifySelectedMapChanged(old, m_selectedMap);
Pierre Kraemer's avatar
Pierre Kraemer committed
141 142 143
	}
}

144 145 146 147 148 149 150 151 152 153 154
void ControlDock_MapTab::showBBChanged(bool b)
{
	if (!b_updatingUI)
	{

		if (m_selectedMap)
		{
			m_selectedMap->showBB(b);
			// RECORDING
			QTextStream* rec = m_schnapps->pythonStreamRecorder();
			if (rec)
155
				*rec << m_selectedMap->getName() << ".showBB(" << b << ");" << endl;
156 157 158 159 160 161 162 163 164 165 166 167
		}
			
	}
}


void ControlDock_MapTab::duplicateCurrentMap()
{
	if (!b_updatingUI)
	{
		if (m_selectedMap)
		{
168
			/*MapHandlerGen* mhg = */m_schnapps->duplicateMap(m_selectedMap->getName(), true);
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
		}
	}
}

void ControlDock_MapTab::removeCurrentMap()
{
	if (!b_updatingUI)
	{
		if (m_selectedMap)
		{
			m_schnapps->removeMap(m_selectedMap->getName());
			// RECORDING
			QTextStream* rec = m_schnapps->pythonStreamRecorder();
			if (rec)
				*rec << "schnapps.removeMap(" << m_selectedMap->getName() << ".getName());" << endl;
		}
	}
}



190 191 192 193
void ControlDock_MapTab::bbVertexAttributeChanged(int index)
{
	if (!b_updatingUI)
	{
Sylvain Thery's avatar
Sylvain Thery committed
194 195 196 197 198
		// RECORDING
		QTextStream* rec = m_schnapps->pythonStreamRecorder();
		if (rec)
			*rec << m_selectedMap->getName() << ".setBBVertexAttribute(\"" << combo_bbVertexAttribute->currentText() << "\");" << endl;

199 200 201
		m_selectedMap->setBBVertexAttribute(combo_bbVertexAttribute->currentText());
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
202 203 204

void ControlDock_MapTab::vertexAttributeCheckStateChanged(QListWidgetItem *item)
{
205
	if (!b_updatingUI)
Pierre Kraemer's avatar
Pierre Kraemer committed
206
	{
207
		if (item->checkState() == Qt::Checked)
Pierre Kraemer's avatar
Pierre Kraemer committed
208 209
		{
			Utils::VBO* vbo = m_selectedMap->createVBO(item->text());
210
			if (!vbo)
Pierre Kraemer's avatar
Pierre Kraemer committed
211 212 213 214 215 216 217 218 219 220 221
			{
				b_updatingUI = true;
				item->setCheckState(Qt::Unchecked);
				b_updatingUI = false;
			}
		}
		else
			m_selectedMap->deleteVBO(item->text());
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
222
void ControlDock_MapTab::selectedSelectorChanged()
Pierre Kraemer's avatar
Pierre Kraemer committed
223
{
224
	if (!b_updatingUI)
Pierre Kraemer's avatar
Pierre Kraemer committed
225
	{
226
		if (m_selectedMap)
Pierre Kraemer's avatar
Pierre Kraemer committed
227
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
228 229
			QList<QListWidgetItem*> items;
			unsigned int orbit = getCurrentOrbit();
230
			switch (orbit)
Pierre Kraemer's avatar
Pierre Kraemer committed
231 232 233 234 235 236 237
			{
				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;
			}
238
			if (!items.empty())
239
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
240
				m_selectedSelector[orbit] = m_selectedMap->getCellSelector(orbit, items[0]->text());
Sylvain Thery's avatar
Sylvain Thery committed
241

Sylvain Thery's avatar
Sylvain Thery committed
242 243
				QTextStream* rec = m_schnapps->pythonStreamRecorder();
				if (rec)
Sylvain Thery's avatar
bugs  
Sylvain Thery committed
244
					*rec << "schnapps.setSelectedSelectorCurrentMap(" << orbit << ", \"" << items[0]->text() << "\");" << endl;
245
			}
246
			m_schnapps->notifySelectedCellSelectorChanged(m_selectedSelector[orbit]); // notify even if nothing selected !
247
		}
Sylvain Thery's avatar
Sylvain Thery committed
248

249 250 251
	}
}

252 253
void ControlDock_MapTab::selectorCheckStateChanged(QListWidgetItem* item)
{
254
	if (!b_updatingUI)
255
	{
256
		if (m_selectedMap)
257 258 259 260 261 262 263 264 265
		{
			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
266
void ControlDock_MapTab::addSelector()
Pierre Kraemer's avatar
Pierre Kraemer committed
267
{
268
	if (!b_updatingUI)
Pierre Kraemer's avatar
Pierre Kraemer committed
269
	{
270
		if (m_selectedMap)
271
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
272
			unsigned int orbit = getCurrentOrbit();
Sylvain Thery's avatar
Sylvain Thery committed
273 274 275 276 277 278 279 280
			QString sel_name = QString("selector_") + QString::number(CellSelectorGen::selectorCount);
			m_selectedMap->addCellSelector(orbit, sel_name);

			// RECORDING
			QTextStream* rec = m_schnapps->pythonStreamRecorder();
			if (rec)
				*rec << m_selectedMap->getName() << ".addCellSelector(" << orbit << ", \"" << sel_name << "\");" << endl;

281 282 283 284
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
285
void ControlDock_MapTab::removeSelector()
Pierre Kraemer's avatar
Pierre Kraemer committed
286
{
287
	if (!b_updatingUI)
Pierre Kraemer's avatar
Pierre Kraemer committed
288
	{
289
		if (m_selectedMap)
Pierre Kraemer's avatar
Pierre Kraemer committed
290
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
291 292
			QList<QListWidgetItem*> items;
			unsigned int orbit = getCurrentOrbit();
293
			switch (orbit)
Pierre Kraemer's avatar
Pierre Kraemer committed
294 295 296 297 298 299 300
			{
				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;
			}
301
			if (!items.empty())
Sylvain Thery's avatar
Sylvain Thery committed
302
			{
303 304
				if (m_selectedSelector[orbit]->getName() == items[0]->text())
					m_selectedSelector[orbit] = NULL;
Pierre Kraemer's avatar
Pierre Kraemer committed
305
				m_selectedMap->removeCellSelector(orbit, items[0]->text());
Sylvain Thery's avatar
Sylvain Thery committed
306 307 308 309 310
				// RECORDING
				QTextStream* rec = m_schnapps->pythonStreamRecorder();
				if (rec)
					*rec << m_selectedMap->getName() << ".removeCellSelector(" << orbit << ", \"" << items[0]->text() << "\");" << endl;
			}
Pierre Kraemer's avatar
Pierre Kraemer committed
311 312 313 314
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
315 316 317 318


void ControlDock_MapTab::mapAdded(MapHandlerGen* m)
{
319
	b_updatingUI = true;
320
	list_maps->addItem(m->getName());
Pierre Kraemer's avatar
Pierre Kraemer committed
321 322 323 324 325
	b_updatingUI = false;
}

void ControlDock_MapTab::mapRemoved(MapHandlerGen* m)
{
326
	QList<QListWidgetItem*> items = list_maps->findItems(m->getName(), Qt::MatchExactly);
Pierre Kraemer's avatar
Pierre Kraemer committed
327
	if(!items.empty())
328 329
	{
		b_updatingUI = true;
Sylvain Thery's avatar
Sylvain Thery committed
330

Pierre Kraemer's avatar
Pierre Kraemer committed
331
		delete items[0];
Sylvain Thery's avatar
Sylvain Thery committed
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
		if (m_schnapps->getSelectedMap() == m)
		{
			std::cout << "Unselecting" << std::endl;
			m_selectedSelector[DART] = NULL;
			foreach(QListWidgetItem* item, list_dartSelectors->selectedItems())
				item->setSelected(false);
			m_selectedSelector[VERTEX] = NULL;
			foreach(QListWidgetItem* item, list_vertexSelectors->selectedItems())
				item->setSelected(false);
			m_selectedSelector[EDGE] = NULL;
			foreach(QListWidgetItem* item, list_edgeSelectors->selectedItems())
				item->setSelected(false);
			m_selectedSelector[FACE] = NULL;
			foreach(QListWidgetItem* item, list_faceSelectors->selectedItems())
				item->setSelected(false);
			m_selectedSelector[VOLUME] = NULL;
			foreach(QListWidgetItem* item, list_volumeSelectors->selectedItems())
				item->setSelected(false);
		}

352 353
		b_updatingUI = false;
	}
Sylvain Thery's avatar
Sylvain Thery committed
354

Pierre Kraemer's avatar
Pierre Kraemer committed
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
}





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
376 377 378 379 380 381 382 383 384 385
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
386 387 388 389 390 391 392 393




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

394 395
	combo_bbVertexAttribute->clear();
	combo_bbVertexAttribute->addItem("- select attribute -");
396
	QString vec3TypeName = QString::fromStdString(nameOfType(PFP_SCHNAPPS::VEC3()));
397

Pierre Kraemer's avatar
Pierre Kraemer committed
398 399 400 401 402 403
	list_dartAttributes->clear();
	list_vertexAttributes->clear();
	list_edgeAttributes->clear();
	list_faceAttributes->clear();
	list_volumeAttributes->clear();

Pierre Kraemer's avatar
Pierre Kraemer committed
404 405 406 407 408 409
	list_dartSelectors->clear();
	list_vertexSelectors->clear();
	list_edgeSelectors->clear();
	list_faceSelectors->clear();
	list_volumeSelectors->clear();

410
	if (m_selectedMap)
Pierre Kraemer's avatar
Pierre Kraemer committed
411
	{
412
		GenericMap* m = m_selectedMap->getGenericMap();
413

414
		for (unsigned int orbit = DART; orbit <= VOLUME; ++orbit)
Pierre Kraemer's avatar
Pierre Kraemer committed
415
		{
416 417
			check_drawBB->setChecked(m_selectedMap->isBBshown());

418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
			unsigned int nbc = m->getNbCells(orbit);

			QListWidget* selectorList = NULL;

			switch (orbit)
			{
				case DART : {
					unsigned int nb = m_selectedMap->getNbDarts();
					label_dartNbOrbits->setText(QString::number(nb));
					label_dartNbCells->setText(QString::number(nbc));
					selectorList = list_dartSelectors;
					break;
				}
				case VERTEX : {
					unsigned int nb = m_selectedMap->getNbOrbits(VERTEX);
					label_vertexNbOrbits->setText(QString::number(nb));
					label_vertexNbCells->setText(QString::number(nbc));
					selectorList = list_vertexSelectors;
					break;
				}
				case EDGE : {
					unsigned int nb = m_selectedMap->getNbOrbits(EDGE);
					label_edgeNbOrbits->setText(QString::number(nb));
					label_edgeNbCells->setText(QString::number(nbc));
					selectorList = list_edgeSelectors;
					break;
				}
				case FACE : {
					unsigned int nb = m_selectedMap->getNbOrbits(FACE);
					label_faceNbOrbits->setText(QString::number(nb));
					label_faceNbCells->setText(QString::number(nbc));
					selectorList = list_faceSelectors;
					break;
				}
				case VOLUME : {
					unsigned int nb = m_selectedMap->getNbOrbits(VOLUME);
					label_volumeNbOrbits->setText(QString::number(nb));
					label_volumeNbCells->setText(QString::number(nbc));
					selectorList = list_volumeSelectors;
					break;
				}
Pierre Kraemer's avatar
Pierre Kraemer committed
459 460
			}

461 462 463 464 465 466 467 468 469 470 471
			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);
			}
472

473
			if (m->isOrbitEmbedded(orbit))
Pierre Kraemer's avatar
Pierre Kraemer committed
474
			{
475 476 477 478 479 480 481
				AttributeContainer& cont = m->getAttributeContainer(orbit);
				std::vector<std::string> names;
				std::vector<std::string> types;
				cont.getAttributesNames(names);
				cont.getAttributesTypes(types);
				unsigned int idx = 1;
				for(unsigned int i = 0; i < names.size(); ++i)
Pierre Kraemer's avatar
Pierre Kraemer committed
482
				{
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
					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 (type == vec3TypeName)
							{
								combo_bbVertexAttribute->addItem(name);
								if (m_selectedMap->getBBVertexAttributeName() == name)
									combo_bbVertexAttribute->setCurrentIndex(idx);
								++idx;
							}
							if (m_selectedMap->getVBO(name))
								item->setCheckState(Qt::Checked);
							else
								item->setCheckState(Qt::Unchecked);
503
//							item->setToolTip(QString("Check for VBO"));
504 505 506 507 508 509 510 511 512 513 514
						} 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;
					}
Pierre Kraemer's avatar
Pierre Kraemer committed
515 516 517 518
				}
			}
		}
	}
Sylvain Thery's avatar
bugs  
Sylvain Thery committed
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
	else
	{
		for (unsigned int orbit = DART; orbit <= VOLUME; ++orbit)
		{
			switch (orbit)
			{
				case DART :
					label_dartNbOrbits->setText(QString::number(0));
					label_dartNbCells->setText(QString::number(0));
					break;
				case VERTEX :
					label_vertexNbOrbits->setText(QString::number(0));
					label_vertexNbCells->setText(QString::number(0));
					break;
				case EDGE :
					label_edgeNbOrbits->setText(QString::number(0));
					label_edgeNbCells->setText(QString::number(0));
					break;
				case FACE :
					label_faceNbOrbits->setText(QString::number(0));
					label_faceNbCells->setText(QString::number(0));
					break;
				case VOLUME :
					label_volumeNbOrbits->setText(QString::number(0));
					label_volumeNbCells->setText(QString::number(0));
					break;
			}
		}
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
548 549 550 551 552 553 554

	b_updatingUI = false;
}

} // namespace SCHNApps

} // namespace CGoGN