show_traversors.cpp 16.1 KB
Newer Older
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
21
22
23
24
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

25
#include "show_traversors.h"
26
27
28
29
30
31
32
33
34
#include <iostream>

#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"

#include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Render/SVG/mapSVGRender.h"

35
#include "Topology/generic/traversorFactory.h"
36
37
38
39

#include "Algo/Render/GL2/drawerCells.h"


Pierre Kraemer's avatar
Pierre Kraemer committed
40
MAP myMap;
41
VertexAttribute<VEC3> position ;
42
43
44
45
46
47
48
49
50
51
Dart dglobal;

void MyQT::cb_checkTopo(bool b)
{
	m_showTopo = b;
	updateGL();
}

void MyQT::cb_combo1(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
52
53
	m_first3 = x;
	if (m_first3!=m_second3)
54
55
56
57
58
59
60
		traverse3();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

void MyQT::cb_combo2(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
61
62
	m_ajd_or_inci3 = x;
	if (m_first3!=m_second3)
63
64
65
66
67
68
69
		traverse3();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

void MyQT::cb_combo3(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
70
71
	m_second3 = x;
	if (m_first3!=m_second3)
72
73
74
75
76
77
78
		traverse3();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

void MyQT::cb_combo4(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
79
80
	m_first2 = x;
	if (m_first2!=m_second2)
81
82
83
84
85
86
87
		traverse2();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

void MyQT::cb_combo5(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
88
89
	m_ajd_or_inci2 = x;
	if (m_first2!=m_second2)
90
91
92
93
94
95
96
		traverse2();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

void MyQT::cb_combo6(int x)
{
Sylvain Thery's avatar
Sylvain Thery committed
97
98
	m_second2 = x;
	if (m_first2!=m_second2)
99
100
101
102
103
		traverse2();
	else
		CGoGNerr <<"undefined traversor" << CGoGNendl;
}

Sylvain Thery's avatar
Sylvain Thery committed
104
105
106
107
108
109
110
111
112
void MyQT::cb_explode(int x)
{
	m_expl = float (x) /100.0f;
	if (m_last==2)
		traverse2();
	if (m_last==3)
		traverse3();
}

113
114
115
116
117
118
119
120

void MyQT::cb_initGL()
{
	// choose to use GL version 2
	Utils::GLSLShader::setCurrentOGLVersion(2);

    m_render_topo = new Algo::Render::GL2::Topo3Render();

121
	m_render_topo->updateData<PFP>(myMap, position,  0.95f, 0.9f, 0.8f);
Sylvain Thery's avatar
Sylvain Thery committed
122
	m_dm_topo = new DartMarker(myMap);
123
124
125
126
127
128
129
130
131
}

void MyQT::cb_redraw()
{
	if (m_showTopo)
	{
		m_render_topo->drawTopo();

		if (m_selected != NIL)
Sylvain Thery's avatar
Sylvain Thery committed
132
133
			m_render_topo->overdrawDart(m_selected, 7, 1.0f, 0.0f, 1.0f);

134
135
136
137
138
139
140
141
142
143
144
145
146
		for (std::vector<Dart>::iterator it=m_affDarts.begin(); it!=m_affDarts.end(); ++it)
		{
			m_render_topo->overdrawDart(*it, 6, 1.0f, 1.0f, 1.0f);
		}
	}

	m_drawer.callList();
}

void MyQT::cb_mousePress(int button, int x, int y)
{
	if (Shift())
	{
147
		Dart d = m_render_topo->picking<PFP>(myMap, x, y);
148
149
		if (d != Dart::nil())
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
150
			CGoGNout << "Dart " << d << " clicked" << CGoGNendl;
151
152
153
154
155
156
			m_selected = d;
		}
		updateGL();
	}
}

Sylvain Thery's avatar
Sylvain Thery committed
157
158
void  MyQT::cb_Save()
{
Sylvain Thery's avatar
Sylvain Thery committed
159
160
161
162
163
//	std::string filename = selectFileSave("Export SVG file ",".","(*.svg)");
//	Utils::SVG::SVGOut svg(filename,modelViewMatrix(),projectionMatrix());
//	m_drawer.toSVG(svg);
//	m_render_topo->toSVG(svg);

Pierre Kraemer's avatar
Pierre Kraemer committed
164
	Utils::SVG::SVGOut svg1(modelViewMatrix(), projectionMatrix());
Sylvain Thery's avatar
Sylvain Thery committed
165
	m_drawer.toSVG(svg1);
166
167
168
//	svg1.addOpacityAnimation(1.0f);
//	svg1.addOpacityAnimation(1.0f);
//	svg1.addOpacityAnimation(0.0f);
Sylvain Thery's avatar
Sylvain Thery committed
169

Pierre Kraemer's avatar
Pierre Kraemer committed
170
	Utils::SVG::SVGOut svg2(modelViewMatrix(), projectionMatrix());
Sylvain Thery's avatar
Sylvain Thery committed
171
	m_render_topo->toSVG(svg2);
172
173
174
//	svg2.addOpacityAnimation(1.0f);
//	svg2.addOpacityAnimation(0.0f);
//	svg2.addOpacityAnimation(1.0f);
Sylvain Thery's avatar
Sylvain Thery committed
175
176
177
178
179
180

	Utils::SVG::AnimatedSVGOut anim;

	anim.add(&svg1);
	anim.add(&svg2);

Sylvain Thery's avatar
Sylvain Thery committed
181
	std::string filename = selectFileSave("Export SVG file ",".","(*.svg)");
Sylvain Thery's avatar
Sylvain Thery committed
182
183

	anim.write(filename, 2.0f);
Sylvain Thery's avatar
Sylvain Thery committed
184
185
}

Pierre Kraemer's avatar
Pierre Kraemer committed
186
187
template <unsigned int ORBIT>
void MyQT::colorizeCell(Dart d, float r,float g, float b)
188
{
Pierre Kraemer's avatar
Pierre Kraemer committed
189
190
191
	TraversorDartsOfOrbit<PFP::MAP, ORBIT>doo (myMap, d);
	for (Dart e = doo.begin(); e != doo.end(); e = doo.next())
		m_render_topo->setDartColor(e, r, g, b);
192
193
194
195
196
197
}

void MyQT::traverse2()
{
	if (m_selected == NIL)
		return;
Sylvain Thery's avatar
Sylvain Thery committed
198
	m_last=2;
Sylvain Thery's avatar
Sylvain Thery committed
199
//	int code = (m_ajd_or_inci2)*100+m_first2*10+m_second2;
200
201

	m_drawer.newList(GL_COMPILE);
Sylvain Thery's avatar
Sylvain Thery committed
202
203
	m_drawer.lineWidth(7.0f);
	m_drawer.pointSize(9.0f);
Sylvain Thery's avatar
Sylvain Thery committed
204
	m_drawer.color3f(0.0f,0.7f,0.0f);
205
206
207

	m_affDarts.clear();

Sylvain Thery's avatar
Sylvain Thery committed
208
	if (m_ajd_or_inci2 == 0) // incident
209
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
210
		Algo::Render::drawerCell<PFP>(VERTEX+m_second2, m_drawer, myMap, m_selected, position, m_expl);
211
		m_drawer.color3f(1.0f,0.0f,0.0f);
212
		Traversor<PFP::MAP>* tra = TraversorFactory<PFP::MAP>::createIncident(myMap, m_selected, 2, VERTEX+m_second2, VERTEX+m_first2);
Sylvain Thery's avatar
Sylvain Thery committed
213
214
		for (Dart d=tra->begin(); d != tra->end(); d= tra->next())
				m_affDarts.push_back(d);
Pierre Kraemer's avatar
Pierre Kraemer committed
215
		Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap, m_affDarts, position, m_expl);
216
	}
Sylvain Thery's avatar
Sylvain Thery committed
217
	else	// adjacent
218
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
219
		Algo::Render::drawerCell<PFP>(VERTEX+m_first2, m_drawer, myMap, m_selected, position, m_expl);
220
		m_drawer.color3f(1.0f,0.0f,0.0f);
221
		Traversor<PFP::MAP>* tra = TraversorFactory<PFP::MAP>::createAdjacent(myMap, m_selected, 2, VERTEX+m_first2, VERTEX+m_second2);
Pierre Kraemer's avatar
Pierre Kraemer committed
222
223
224
		for (Dart d = tra->begin(); d != tra->end(); d = tra->next())
			m_affDarts.push_back(d);
		Algo::Render::drawerCells<PFP>(VERTEX+m_first2, m_drawer, myMap, m_affDarts, position, m_expl);
225
	}
Sylvain Thery's avatar
Sylvain Thery committed
226

227
	m_drawer.endList();
Sylvain Thery's avatar
Sylvain Thery committed
228

229
230
//	SelectorMarked sm(*m_dm_topo);
	m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f);
Sylvain Thery's avatar
Sylvain Thery committed
231

232
233
234
	updateGL();
}

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258


void MyQT::dynamicMarkOrbit(unsigned int orb)
{
	switch(orb)
	{
	case VERTEX:
		m_dm_topo->markOrbit<VERTEX>(m_selected);
		break;
	case EDGE:
		m_dm_topo->markOrbit<EDGE>(m_selected);
		break;
	case FACE:
		m_dm_topo->markOrbit<FACE>(m_selected);
		break;
	case VOLUME:
		m_dm_topo->markOrbit<VOLUME>(m_selected);
		break;
	default:
		break;
	}
}


259
260
261
262
void MyQT::traverse3()
{
	if (m_selected == NIL)
		return;
Sylvain Thery's avatar
Sylvain Thery committed
263
264
265

	m_last=3;

266

267
268
	m_affDarts.clear();
	m_drawer.newList(GL_COMPILE);
Sylvain Thery's avatar
Sylvain Thery committed
269
270
	m_drawer.lineWidth(7.0f);
	m_drawer.pointSize(9.0f);
Sylvain Thery's avatar
Sylvain Thery committed
271
	m_drawer.color3f(0.0f,0.7f,0.0f);
272

Sylvain Thery's avatar
Sylvain Thery committed
273
274
275
	m_dm_topo->unmarkAll();
	SelectorMarked sm(*m_dm_topo);

Sylvain Thery's avatar
Sylvain Thery committed
276
	if (m_ajd_or_inci3 == 0) // incident
277
	{
Sylvain Thery's avatar
Sylvain Thery committed
278
		Algo::Render::drawerCell<PFP>(VERTEX+m_second3, m_drawer,myMap,m_selected,position,m_expl);
279
		dynamicMarkOrbit(VERTEX+m_second3);
280
		m_drawer.color3f(1.0f,0.0f,0.0f);
281

282
		Traversor<PFP::MAP>* tra = TraversorFactory<PFP::MAP>::createIncident(myMap,m_selected, 3, VERTEX+m_second3, VERTEX+m_first3);
283
		for (Dart d = tra->begin(); d != tra->end(); d = tra->next())
Sylvain Thery's avatar
Sylvain Thery committed
284
285
		{
			m_affDarts.push_back(d);
286
			dynamicMarkOrbit(VERTEX+m_first3);
Sylvain Thery's avatar
Sylvain Thery committed
287
		}
288

Pierre Kraemer's avatar
Pierre Kraemer committed
289
		Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap, m_affDarts, position, m_expl);
Sylvain Thery's avatar
Sylvain Thery committed
290

291
292
		m_render_topo->updateData<PFP>(myMap, position, 0.95f, 0.9f, 0.8f); //sm

Pierre Kraemer's avatar
Pierre Kraemer committed
293
		for (std::vector<Dart>::iterator id = m_affDarts.begin(); id != m_affDarts.end(); ++id)
Sylvain Thery's avatar
Sylvain Thery committed
294
295
			m_render_topo->setDartColor(*id,0.7f,0.0f,0.0f);
		m_render_topo->setDartColor(m_selected,0.0f,0.7f,0.0f);
296
	}
Sylvain Thery's avatar
Sylvain Thery committed
297
	else	// adjacent
298
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
299
		Algo::Render::drawerCell<PFP>(VERTEX+m_first3, m_drawer, myMap, m_selected, position, m_expl);
300
		dynamicMarkOrbit(VERTEX+m_first3);
301
		m_drawer.color3f(1.0f,0.0f,0.0f);
302

303
		Traversor<PFP::MAP>* tra = TraversorFactory<PFP::MAP>::createAdjacent(myMap,m_selected, 3, VERTEX+m_first3, VERTEX+m_second3);
304
		for (Dart d = tra->begin(); d != tra->end(); d = tra->next())
Sylvain Thery's avatar
Sylvain Thery committed
305
306
		{
			m_affDarts.push_back(d);
307
			dynamicMarkOrbit(VERTEX+m_first3);
Sylvain Thery's avatar
Sylvain Thery committed
308
		}
309

Sylvain Thery's avatar
Sylvain Thery committed
310
		Algo::Render::drawerCells<PFP>(VERTEX+m_first3, m_drawer, myMap,m_affDarts,position,m_expl);
Sylvain Thery's avatar
Sylvain Thery committed
311

312
		m_render_topo->updateData<PFP>(myMap, position,  0.95f, 0.9f, 0.8f); //sm
Sylvain Thery's avatar
Sylvain Thery committed
313
314
315
		for (std::vector<Dart>::iterator id=m_affDarts.begin(); id != m_affDarts.end(); ++id)
			m_render_topo->setDartColor(*id,0.7f,0.0f,0.0f);
		m_render_topo->setDartColor(m_selected,0.0f,0.7f,0.0f);
316
317
318
	}

	m_drawer.endList();
Sylvain Thery's avatar
Sylvain Thery committed
319

320
321
322
	updateGL();
}

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
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
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
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
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
/*
void MyQT::dyn_trav3XXaY(unsigned int first, unsigned int second)
{
	unsigned int val = first *16 + second;
	switch(val)
	{
	case 0x00:
		break;
	case 0x10:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+1, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
		break;
	case 0x20:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+2, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
	break;
	case 0x30:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+3, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;

	case 0x01:
	{
		Traversor3XXaY<PFP::MAP, VERTEX, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX>(d);
		}
	}
		break;
	case 0x21:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+2, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
	break;
	case 0x31:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+3, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;


	case 0x02:
	{
		Traversor3XXaY<PFP::MAP, VERTEX, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX>(d);
		}
	}
		break;
	case 0x12:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+1, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
	break;
	case 0x32:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+3, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;

	case 0x03:
	{
		Traversor3XXaY<PFP::MAP, VERTEX, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX>(d);
		}
	}
	break;
	case 0x13:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+1, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
	break;
	case 0x23:
	{
		Traversor3XXaY<PFP::MAP, VERTEX+2, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
	break;

	}
}

void MyQT::dyn_trav3XY(unsigned int first, unsigned int second)
{
	unsigned int val = second *16 + first;
	switch(val)
	{
	case 0x00:
		break;
	case 0x10:
	{
		Traversor3XY<PFP::MAP, VERTEX+1, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+0>(d);
		}
	}
		break;
	case 0x20:
	{
		Traversor3XY<PFP::MAP, VERTEX+2, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+0>(d);
		}
	}
	break;
	case 0x30:
	{
		Traversor3XY<PFP::MAP, VERTEX+3, VERTEX+0> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+0>(d);
		}
	}
	break;

	case 0x01:
	{
		Traversor3XY<PFP::MAP, VERTEX, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
		break;
	case 0x21:
	{
		Traversor3XY<PFP::MAP, VERTEX+2, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
	break;
	case 0x31:
	{
		Traversor3XY<PFP::MAP, VERTEX+3, VERTEX+1> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+1>(d);
		}
	}
	break;


	case 0x02:
	{
		Traversor3XY<PFP::MAP, VERTEX, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
		break;
	case 0x12:
	{
		Traversor3XY<PFP::MAP, VERTEX+1, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
	break;
	case 0x32:
	{
		Traversor3XY<PFP::MAP, VERTEX+3, VERTEX+2> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+2>(d);
		}
	}
	break;

	case 0x03:
	{
		Traversor3XY<PFP::MAP, VERTEX, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;
	case 0x13:
	{
		Traversor3XY<PFP::MAP, VERTEX+1, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;
	case 0x23:
	{
		Traversor3XY<PFP::MAP, VERTEX+2, VERTEX+3> tra(myMap,m_selected);
		for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
		{
			m_affDarts.push_back(d);
			m_dm_topo->markOrbit<VERTEX+3>(d);
		}
	}
	break;

	}
}
*/




598
599
int main(int argc, char **argv)
{
Pierre Kraemer's avatar
Pierre Kraemer committed
600
	position = myMap.addAttribute<VEC3, VERTEX>( "position");
601

602
	Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
603
604
605
606
607
608
609
610
611
612
613
614
	dglobal = prim.hexaGrid_topo(4,4,4);
	prim.embedHexaGrid(1.0f,1.0f,1.0f);

    // un peu d'interface
	QApplication app(argc, argv);
	MyQT sqt;

	// interface de tuto5.ui
    Utils::QT::uiDockInterface dock;
    sqt.setDock(&dock);

 	// message d'aide
615
	sqt.setHelpMsg("shit click to select a dart\nand select a traversor\nif keyboard focus problem\nundock");
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

	//  bounding box
    Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
    float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
    Geom::Vec3f lPosObj = (bb.min() +  bb.max()) / PFP::REAL(2);

    // envoit info BB a l'interface
	sqt.setParamObject(lWidthObj, lPosObj.data());

	sqt.setCallBack( dock.combo1, SIGNAL(	activated(int)), SLOT(cb_combo1(int)) );
	sqt.setCallBack( dock.combo2, SIGNAL(	activated(int)), SLOT(cb_combo2(int)) );
	sqt.setCallBack( dock.combo3, SIGNAL(	activated(int)), SLOT(cb_combo3(int)) );

	sqt.setCallBack( dock.combo4, SIGNAL(	activated(int)), SLOT(cb_combo4(int)) );
	sqt.setCallBack( dock.combo5, SIGNAL(	activated(int)), SLOT(cb_combo5(int)) );
	sqt.setCallBack( dock.combo6, SIGNAL(	activated(int)), SLOT(cb_combo6(int)) );
Sylvain Thery's avatar
Sylvain Thery committed
632
	sqt.setCallBack( dock.explodeSlider, SIGNAL(valueChanged(int)), SLOT(cb_explode(int)) );
633
634
635
636
637
638
639
640
641
642

	sqt.setCallBack( dock.checkTopo, SIGNAL(	clicked(bool)), SLOT(cb_checkTopo(bool)) );

	sqt.m_selected = NIL;

	sqt.show();

	// et on attend la fin.
	return app.exec();
}