Commit eb0e89f4 authored by legoc's avatar legoc

Save the viewer file with bounding box threshold

parent 32384275
......@@ -688,4 +688,5 @@ public class Nomad3DEditor extends Application {
// Change the center of the camera.
resetCamera(component);
}
}
......@@ -245,7 +245,8 @@ public class EditorMenuBar extends MenuBar {
}
}
});
MenuItem saveItem = new MenuItem("Save");
MenuItem saveItem = new MenuItem("Save Editor");
saveItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
saveItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
......@@ -256,16 +257,39 @@ public class EditorMenuBar extends MenuBar {
OperationsSerializer serializer = new OperationsSerializer();
serializer.write(Nomad3DEditor.getInstance().getModel());
// Save the viewer file.
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeForViewer(Nomad3DEditor.getInstance().getModel());
// Change the title.
updateModified(false);
}
}
});
this.file.getItems().addAll(openItem, saveItem);
MenuItem saveViewerItem = new MenuItem("Save Viewer");
saveViewerItem.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN));
saveViewerItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (Nomad3DEditor.getInstance().getModel() != null) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Save Viewer");
alert.setHeaderText("Hide the components with Bounding Box diagonal < " + hideBBDiagonal + "mm ?");
Optional<ButtonType> option = alert.showAndWait();
if (option.get() == null) {
return;
}
else if (option.get() == ButtonType.OK) {
// Save the viewer file.
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeForViewer(Nomad3DEditor.getInstance().getModel(), hideBBDiagonal);
}
}
}
});
this.file.getItems().addAll(openItem, saveItem, saveViewerItem);
this.edit = new Menu("Edit");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment