| 3408 | } |
| 3409 | |
| 3410 | void MapEditorController::convertToCurvesClicked() |
| 3411 | { |
| 3412 | auto* undo_step = new ReplaceObjectsUndoStep(map); |
| 3413 | MapPart* part = map->getCurrentPart(); |
| 3414 | |
| 3415 | for (auto* object : map->selectedObjects()) |
| 3416 | { |
| 3417 | if (object->getType() != Object::Path) |
| 3418 | continue; |
| 3419 | |
| 3420 | PathObject* path = object->asPath(); |
| 3421 | PathObject* undo_duplicate = nullptr; |
| 3422 | if (path->convertToCurves(&undo_duplicate)) |
| 3423 | { |
| 3424 | undo_step->addObject(part->findObjectIndex(path), undo_duplicate); |
| 3425 | // TODO: make threshold configurable? |
| 3426 | const auto threshold = 0.08; |
| 3427 | path->simplify(nullptr, threshold); |
| 3428 | } |
| 3429 | path->update(); |
| 3430 | } |
| 3431 | |
| 3432 | if (undo_step->isEmpty()) |
| 3433 | delete undo_step; |
| 3434 | else |
| 3435 | { |
| 3436 | map->setObjectsDirty(); |
| 3437 | map->push(undo_step); |
| 3438 | map->emitSelectionEdited(); |
| 3439 | } |
| 3440 | } |
| 3441 | |
| 3442 | void MapEditorController::simplifyPathClicked() |
| 3443 | { |
nothing calls this directly
no test coverage detected