| 3440 | } |
| 3441 | |
| 3442 | void MapEditorController::simplifyPathClicked() |
| 3443 | { |
| 3444 | // TODO: make threshold configurable! |
| 3445 | const auto threshold = 0.1; |
| 3446 | |
| 3447 | auto* undo_step = new ReplaceObjectsUndoStep(map); |
| 3448 | MapPart* part = map->getCurrentPart(); |
| 3449 | |
| 3450 | for (auto* object : map->selectedObjects()) |
| 3451 | { |
| 3452 | if (object->getType() != Object::Path) |
| 3453 | continue; |
| 3454 | |
| 3455 | PathObject* path = object->asPath(); |
| 3456 | PathObject* undo_duplicate = nullptr; |
| 3457 | if (path->simplify(&undo_duplicate, threshold)) |
| 3458 | undo_step->addObject(part->findObjectIndex(path), undo_duplicate); |
| 3459 | path->update(); |
| 3460 | } |
| 3461 | |
| 3462 | if (undo_step->isEmpty()) |
| 3463 | delete undo_step; |
| 3464 | else |
| 3465 | { |
| 3466 | map->setObjectsDirty(); |
| 3467 | map->push(undo_step); |
| 3468 | map->emitSelectionEdited(); |
| 3469 | } |
| 3470 | } |
| 3471 | |
| 3472 | void MapEditorController::cutoutPhysicalClicked() |
| 3473 | { |
nothing calls this directly
no test coverage detected