34
34
#include < set>
35
35
#include < iostream>
36
36
#include < assert.h>
37
+
37
38
using namespace std ;
39
+ using namespace Eigen ;
38
40
39
41
MainWindow::MainWindow (QWidget *parent) :
40
42
QMainWindow(parent),
@@ -310,10 +312,10 @@ void MainWindow::esc() {
310
312
}
311
313
312
314
void MainWindow::undo (){
313
- Action action = history.undo ();
315
+ Event action = history.undo ();
314
316
switch (action.type ) {
315
- case Action ::NO_ACTION: return ;
316
- case Action ::ADD_SPHERE: { // a sphere was added: remove it.
317
+ case Event ::NO_ACTION: return ;
318
+ case Event ::ADD_SPHERE: { // a sphere was added: remove it.
317
319
assert (action.sphere_id >= 0 && action.sphere_id < (int )project.spheres .size ());
318
320
Sphere *sphere = project.spheres [action.sphere_id ];
319
321
auto markers = ui->markerList ->getItems ();
@@ -329,12 +331,14 @@ void MainWindow::undo(){
329
331
delete sphere;
330
332
}
331
333
break ;
334
+ default :
335
+ break ;
332
336
}
333
337
}
334
338
335
339
void MainWindow::redo () {
336
- Action action = history.redo ();
337
- if (action.type == Action ::NO_ACTION)
340
+ Event action = history.redo ();
341
+ if (action.type == Event ::NO_ACTION)
338
342
return ;
339
343
340
344
}
@@ -564,7 +568,7 @@ void MainWindow::updateBorderPoints(QGraphicsEllipseItem *point) {
564
568
m->fit ();
565
569
int sphere_id = project.indexOf (m->sphere );
566
570
assert (sphere_id != -1 );
567
- history.push (Action (Action ::MOVE_BORDER, sphere_id, *(m->sphere )));
571
+ history.push (Event (Event ::MOVE_BORDER, sphere_id, *(m->sphere )));
568
572
}
569
573
}
570
574
@@ -598,7 +602,7 @@ void MainWindow::newSphere() {
598
602
ui->markerList ->setSelected (marker);
599
603
connect (marker, SIGNAL (removed ()), this , SLOT (removeSphere ()));
600
604
marker->setEditing (true );
601
- history.push (Action (Action ::ADD_SPHERE, project.indexOf (sphere), *sphere));
605
+ history.push (Event (Event ::ADD_SPHERE, project.indexOf (sphere), *sphere));
602
606
}
603
607
604
608
@@ -640,7 +644,7 @@ void MainWindow::newWhite() {
640
644
void MainWindow::removeSphere () {
641
645
auto marker = dynamic_cast <SphereMarker *>(QObject::sender ());
642
646
int sphere_id = project.indexOf (marker->sphere );
643
- history.push (Action (Action ::REMOVE_SPHERE, sphere_id, *(marker->sphere )));
647
+ history.push (Event (Event ::REMOVE_SPHERE, sphere_id, *(marker->sphere )));
644
648
project.spheres .erase (std::remove (project.spheres .begin (), project.spheres .end (), marker->sphere ), project.spheres .end ());
645
649
delete marker;
646
650
}
0 commit comments