Commit 8969d07b authored by Ivan Dages's avatar Ivan Dages
Browse files

calibrate axis : remove limits

parent 86b8401c
......@@ -499,7 +499,18 @@ public class EditorMenuBar extends MenuBar {
// Invalid input, nothing to do
}
});
valuePane.addRow(0, valueText, valueField);
Label unitLabel = new Label();
switch (selectedAxis.getType()) {
case TRANSLATION:
unitLabel.setText("mm");
break;
case ROTATION:
unitLabel.setText("");
break;
default:
break;
}
valuePane.addRow(0, valueText, valueField, unitLabel);
Thread valueThread = new Thread(new Runnable() {
@Override
public void run() {
......@@ -547,14 +558,9 @@ public class EditorMenuBar extends MenuBar {
buttonsPane.setAlignment(Pos.CENTER);
scenePane.addRow(2, buttonsPane);
GridPane.setMargin(buttonsPane, new Insets(10));
Button okButton = new Button("OK");
okButton.setDefaultButton(true);
okButton.setOnAction(okEvent -> {
calibrateStage.close();
valueThread.interrupt();
});
Button resetButton = new Button("Reset");
resetButton.setPrefWidth(100);
final double minInit = selectedAxis.getMinValue();
final double medianInit = selectedAxis.getMedianValue();
final double maxInit = selectedAxis.getMaxValue();
......@@ -565,13 +571,28 @@ public class EditorMenuBar extends MenuBar {
selectedAxis.setMaxValue(maxInit);
selectedAxis.move(valueInit - selectedAxis.getValue());
});
Button rmLimitsButton = new Button("Remove limits");
rmLimitsButton.setPrefWidth(resetButton.getPrefWidth());
rmLimitsButton.setOnAction(rmEvent -> {
selectedAxis.setMinValue(Double.NEGATIVE_INFINITY);
selectedAxis.setMaxValue(Double.POSITIVE_INFINITY);
});
Button okButton = new Button("OK");
okButton.setDefaultButton(true);
okButton.setOnAction(okEvent -> {
calibrateStage.close();
valueThread.interrupt();
});
Button cancelButton = new Button("Cancel");
cancelButton.setCancelButton(true);
cancelButton.setOnAction(cancelEvent -> {
resetButton.getOnAction().handle(null);
okButton.getOnAction().handle(null);
});
buttonsPane.addRow(1, okButton, resetButton, cancelButton);
buttonsPane.addRow(0, resetButton, rmLimitsButton);
buttonsPane.addRow(1, okButton, cancelButton);
GridPane.setHalignment(okButton, HPos.RIGHT);
GridPane.setHalignment(cancelButton, HPos.LEFT);
valueThread.start();
calibrateStage.show();
......@@ -1276,7 +1297,7 @@ public class EditorMenuBar extends MenuBar {
modifyButton.setDefaultButton(true);
buttonsPane.addColumn(0, modifyButton);
modifyButton.setOnAction(modifyEvent -> {
Nomad3DEditor.getInstance().getModel().getRoot().saveCurrentConfiguration(nameField.getText());
Nomad3DEditor.getInstance().getModel().getRoot().saveCurrentConfiguration(nameField.getText(), activeConfiguration);
updateConfigMenus();
modifyStage.close();
});
......@@ -1291,17 +1312,17 @@ public class EditorMenuBar extends MenuBar {
});
MenuItem saveMedianConfigItem = new MenuItem("Save median configuration");
saveMedianConfigItem.setOnAction(event -> {
Nomad3DEditor.getInstance().getModel().getRoot().saveMedianConfiguration();
Nomad3DEditor.getInstance().getModel().getRoot().saveMedianConfiguration(activeConfiguration);
updateConfigMenus();
});
MenuItem saveMinConfigItem = new MenuItem("Save min configuration");
saveMinConfigItem.setOnAction(event -> {
Nomad3DEditor.getInstance().getModel().getRoot().saveMinConfiguration();
Nomad3DEditor.getInstance().getModel().getRoot().saveMinConfiguration(activeConfiguration);
updateConfigMenus();
});
MenuItem saveMaxConfigItem = new MenuItem("Save max configuration");
saveMaxConfigItem.setOnAction(event -> {
Nomad3DEditor.getInstance().getModel().getRoot().saveMaxConfiguration();
Nomad3DEditor.getInstance().getModel().getRoot().saveMaxConfiguration(activeConfiguration);
updateConfigMenus();
});
this.removeConfig = new Menu("Remove configuration");
......@@ -1536,9 +1557,10 @@ public class EditorMenuBar extends MenuBar {
return;
}
for (Component comp : Nomad3DEditor.getInstance().getModel().getSelection()) {
comp.setConfigurationVisibility(false, activeConfiguration, null, false);
comp.setConfigurationVisibility(false, activeConfiguration, null, true, false);
comp.setVisible(false, activeConfiguration, false);
}
Nomad3DEditor.getInstance().getModel().clearSelection();
});
this.selection.getItems().addAll(selectAllItem, unselectAllItem,
new SeparatorMenuItem(),
......@@ -1607,7 +1629,7 @@ public class EditorMenuBar extends MenuBar {
wikiItem.setGraphic(urlView);
wikiItem.setOnAction(event -> {
try {
java.awt.Desktop.getDesktop().browse(new java.net.URI("https://code.ill.fr/instrument-control/protos/nomad-3d/nomad-3d-commons/wikis/home"));
java.awt.Desktop.getDesktop().browse(new java.net.URI("https://code.ill.fr/instrument-control/protos/nomad-3d/nomad-3d-editor/wikis/home"));
} catch (Exception e) {
Logger.getLogger("nomad-3d").severe(e.getMessage());
e.printStackTrace();
......@@ -1722,7 +1744,10 @@ public class EditorMenuBar extends MenuBar {
return;
}
activeConfiguration = Nomad3DEditor.getInstance().getModel().getRoot().getConfigurations().get(0).getConfiguration();
// Reset active configuration if needed
if (Nomad3DEditor.getInstance().getModel().getRoot().getConfigurationByName(activeConfiguration) == null) {
activeConfiguration = Nomad3DEditor.getInstance().getModel().getRoot().getConfigurations().get(0).getConfiguration();
}
// Show configuration
this.showConfig.getItems().clear();
......@@ -1766,7 +1791,7 @@ public class EditorMenuBar extends MenuBar {
MenuItem configItem = new MenuItem(config.getConfiguration());
configItem.setOnAction(event -> {
for (Component comp : Nomad3DEditor.getInstance().getModel().getSelection()) {
comp.setConfigurationVisibility(true, configItem.getText(), activeConfiguration, false);
comp.setConfigurationVisibility(true, configItem.getText(), activeConfiguration, false, false);
}
Nomad3DEditor.getInstance().getModel().showConfiguration(activeConfiguration);
});
......
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