| 320 | } |
| 321 | |
| 322 | void PatternEditorWindow::onOpenPattern() |
| 323 | { |
| 324 | GenericFileDialog::get().showOpenFileDialog( |
| 325 | "Open pattern", "Pattern file (*.sim){.sim},.*", _startingPath, [&](std::filesystem::path const& path) { |
| 326 | auto firstFilename = ifd::FileDialog::Instance().GetResult(); |
| 327 | auto firstFilenameCopy = firstFilename; |
| 328 | _startingPath = firstFilenameCopy.remove_filename().string(); |
| 329 | ClusteredDataDescription content; |
| 330 | if (SerializerService::get().deserializeContentFromFile(content, firstFilename.string())) { |
| 331 | auto center = Viewport::get().getCenterInWorldPos(); |
| 332 | content.setCenter(center); |
| 333 | _simulationFacade->addAndSelectSimulationData(DataDescription(content)); |
| 334 | EditorModel::get().update(); |
| 335 | } else { |
| 336 | GenericMessageDialog::get().information("Open pattern", "The selected file could not be opened."); |
| 337 | } |
| 338 | }); |
| 339 | } |
| 340 | |
| 341 | void PatternEditorWindow::onSavePattern() |
| 342 | { |
nothing calls this directly
no test coverage detected