MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / convertToCurvesClicked

Method convertToCurvesClicked

src/gui/map/map_editor.cpp:3410–3440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3408}
3409
3410void 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
3442void MapEditorController::simplifyPathClicked()
3443{

Callers

nothing calls this directly

Calls 12

getCurrentPartMethod · 0.80
asPathMethod · 0.80
convertToCurvesMethod · 0.80
findObjectIndexMethod · 0.80
simplifyMethod · 0.80
setObjectsDirtyMethod · 0.80
emitSelectionEditedMethod · 0.80
getTypeMethod · 0.45
addObjectMethod · 0.45
updateMethod · 0.45
isEmptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected