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

Method simplifyPathClicked

src/gui/map/map_editor.cpp:3442–3470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3440}
3441
3442void 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
3472void MapEditorController::cutoutPhysicalClicked()
3473{

Callers

nothing calls this directly

Calls 11

getCurrentPartMethod · 0.80
asPathMethod · 0.80
simplifyMethod · 0.80
findObjectIndexMethod · 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