Commit e158f096 authored by Locatelli's avatar Locatelli
Browse files

Merge master to ubuntu branch

parent caf443a6
0.0.6 05/11/21
--------------
* A reference axis is referenced by its name and the name of the component it belongs to.
* Camera points of view.
0.0.5 21/06/21
--------------
* Current value of axes.
\ No newline at end of file
...@@ -4,11 +4,11 @@ $ mvn clean package ...@@ -4,11 +4,11 @@ $ mvn clean package
The application can be launched with a connection to Nomad e.g: The application can be launched with a connection to Nomad e.g:
$ java -jar target/nomad-3d-editor-0.0.5-full.jar "{\"name\":\"n3d\", \"server\":\"tcp://localhost:7000\"}" $ java -jar target/nomad-3d-editor-0.0.6-full.jar "{\"name\":\"n3d\", \"server\":\"tcp://localhost:7000\"}"
Or standalone: Or standalone:
$ java -jar target/nomad-3d-editor-0.0.5-full.jar --no-link $ java -jar target/nomad-3d-editor-0.0.6-full.jar --no-link
For windows, ensure that jzmq.dll and libzmq.dll are accessible from the path. For windows, ensure that jzmq.dll and libzmq.dll are accessible from the path.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId> <groupId>fr.ill.ics</groupId>
<artifactId>nomad-3d-editor</artifactId> <artifactId>nomad-3d-editor</artifactId>
<version>0.0.5</version> <version>0.0.6</version>
<distributionManagement> <distributionManagement>
<repository> <repository>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<dependency> <dependency>
<groupId>fr.ill.ics</groupId> <groupId>fr.ill.ics</groupId>
<artifactId>nomad-3d-commons</artifactId> <artifactId>nomad-3d-commons</artifactId>
<version>0.0.5</version> <version>0.0.6</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -4,6 +4,7 @@ import java.io.File; ...@@ -4,6 +4,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.math.RoundingMode;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.FileWriter; import java.io.FileWriter;
...@@ -198,36 +199,17 @@ public class EditorMenuBar extends MenuBar { ...@@ -198,36 +199,17 @@ public class EditorMenuBar extends MenuBar {
} }
} }
private static final DecimalFormat df = new DecimalFormat("0.000");
public static class AxisTableEntry { public static class BaseAxisTableEntry {
private final SimpleStringProperty axisName; private final SimpleStringProperty axisName;
private final SimpleStringProperty componentName; private final SimpleStringProperty componentName;
private final SimpleStringProperty type;
private final SimpleDoubleProperty currentValue;
private AxisTableEntry(String axisName, String componentName, String type, double value) { private BaseAxisTableEntry(String axisName, String componentName) {
super(); super();
this.axisName = new SimpleStringProperty(axisName); this.axisName = new SimpleStringProperty(axisName);
this.componentName = new SimpleStringProperty(componentName); this.componentName = new SimpleStringProperty(componentName);
this.type = new SimpleStringProperty(type);
this.currentValue = new SimpleDoubleProperty(value);
}
private AxisTableEntry(String axisName, String componentName, String type) {
super();
this.axisName = new SimpleStringProperty(axisName);
this.componentName = new SimpleStringProperty(componentName);
this.type = new SimpleStringProperty(type);
this.currentValue = new SimpleDoubleProperty(0);
}
private AxisTableEntry(String axisName, String componentName) {
super();
this.axisName = new SimpleStringProperty(axisName);
this.componentName = new SimpleStringProperty(componentName);
this.type = new SimpleStringProperty("");
this.currentValue = new SimpleDoubleProperty(0);
} }
public String getAxisName() { public String getAxisName() {
...@@ -238,6 +220,25 @@ public class EditorMenuBar extends MenuBar { ...@@ -238,6 +220,25 @@ public class EditorMenuBar extends MenuBar {
return componentName.get(); return componentName.get();
} }
}
public static class AxisTableEntry extends BaseAxisTableEntry {
private final SimpleStringProperty type;
private final SimpleDoubleProperty currentValue;
private AxisTableEntry(String axisName, String componentName, String type, double value) {
super(axisName, componentName);
this.type = new SimpleStringProperty(type);
this.currentValue = new SimpleDoubleProperty(value);
}
private AxisTableEntry(String axisName, String componentName, String type) {
super(axisName, componentName);
this.type = new SimpleStringProperty(type);
this.currentValue = new SimpleDoubleProperty(0);
}
public String getType() { public String getType() {
return type.get(); return type.get();
} }
...@@ -250,6 +251,20 @@ public class EditorMenuBar extends MenuBar { ...@@ -250,6 +251,20 @@ public class EditorMenuBar extends MenuBar {
currentValue.set(value); currentValue.set(value);
} }
} }
public static class ReferenceAxisTableEntry extends BaseAxisTableEntry {
private final SimpleStringProperty length;
private ReferenceAxisTableEntry(String axisName, String componentName, String length) {
super(axisName, componentName);
this.length = new SimpleStringProperty(length);
}
public String getLength() {
return length.get();
}
}
/** /**
* A new Camera class to copy the original camera parameters into SimpleDoubleProperty type * A new Camera class to copy the original camera parameters into SimpleDoubleProperty type
...@@ -334,6 +349,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -334,6 +349,7 @@ public class EditorMenuBar extends MenuBar {
this.activeConfiguration = null; this.activeConfiguration = null;
this.activeLod = 0; this.activeLod = 0;
this.subdividedChilds = new LinkedList<>(); this.subdividedChilds = new LinkedList<>();
df.setRoundingMode(RoundingMode.CEILING);
this.file = new Menu("File"); this.file = new Menu("File");
MenuItem openItem = new MenuItem("Open"); MenuItem openItem = new MenuItem("Open");
...@@ -651,7 +667,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -651,7 +667,7 @@ public class EditorMenuBar extends MenuBar {
// Select the reference axis. // Select the reference axis.
if (editedAxis.getZeroValueReferenceAxis1() != null) { if (editedAxis.getZeroValueReferenceAxis1() != null) {
zeroValueReference1Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis1().getName()); zeroValueReference1Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis1().getNameId());
} }
zeroValueReference1Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { zeroValueReference1Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
...@@ -706,7 +722,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -706,7 +722,7 @@ public class EditorMenuBar extends MenuBar {
// Select the reference axis. // Select the reference axis.
if (editedAxis.getZeroValueReferenceAxis2() != null) { if (editedAxis.getZeroValueReferenceAxis2() != null) {
zeroValueReference2Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis2().getName()); zeroValueReference2Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis2().getNameId());
} }
zeroValueReference2Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { zeroValueReference2Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
...@@ -917,7 +933,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -917,7 +933,7 @@ public class EditorMenuBar extends MenuBar {
if (editedAxis.getReferenceAxis() != null) { if (editedAxis.getReferenceAxis() != null) {
// Select the reference axis. // Select the reference axis.
referenceBox.getSelectionModel().select(editedAxis.getReferenceAxis().getName()); referenceBox.getSelectionModel().select(editedAxis.getReferenceAxis().getNameId());
// Set the fields. // Set the fields.
xDirField.setText(String.format("%.3f", editedAxis.getDirection().getX())); xDirField.setText(String.format("%.3f", editedAxis.getDirection().getX()));
...@@ -1042,15 +1058,15 @@ public class EditorMenuBar extends MenuBar { ...@@ -1042,15 +1058,15 @@ public class EditorMenuBar extends MenuBar {
String controllerName = null; String controllerName = null;
if (editedAxis.getReferenceAxis() != null) { if (editedAxis.getReferenceAxis() != null) {
referenceAxisName = editedAxis.getReferenceAxis().getName(); referenceAxisName = editedAxis.getReferenceAxis().getNameId();
} }
if (editedAxis.getZeroValueReferenceAxis1() != null) { if (editedAxis.getZeroValueReferenceAxis1() != null) {
zeroValueReferenceAxis1Name = editedAxis.getZeroValueReferenceAxis1().getName(); zeroValueReferenceAxis1Name = editedAxis.getZeroValueReferenceAxis1().getNameId();
} }
if (editedAxis.getZeroValueReferenceAxis2() != null) { if (editedAxis.getZeroValueReferenceAxis2() != null) {
zeroValueReferenceAxis2Name = editedAxis.getZeroValueReferenceAxis2().getName(); zeroValueReferenceAxis2Name = editedAxis.getZeroValueReferenceAxis2().getNameId();
} }
if (editedAxis.getController() != null) { if (editedAxis.getController() != null) {
...@@ -1894,7 +1910,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -1894,7 +1910,7 @@ public class EditorMenuBar extends MenuBar {
ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue); ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue);
referenceAxisBuilder.setName(nameField.getText()); referenceAxisBuilder.setName(nameField.getText());
referenceAxisBuilder.setReference1(referenceAxis.getName(), referenceAxis.getDirection()); referenceAxisBuilder.setReference1(referenceAxis.getNameId(), referenceAxis.getDirection());
referenceAxisBuilder.update(); referenceAxisBuilder.update();
ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis(); ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis();
if (newAxis != null) { if (newAxis != null) {
...@@ -1916,7 +1932,7 @@ public class EditorMenuBar extends MenuBar { ...@@ -1916,7 +1932,7 @@ public class EditorMenuBar extends MenuBar {
ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue); ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue);
referenceAxisBuilder.setName(nameField.getText()); referenceAxisBuilder.setName(nameField.getText());
referenceAxisBuilder.setReference2(referenceAxis.getName(), referenceAxis.getDirection()); referenceAxisBuilder.setReference2(referenceAxis.getNameId(), referenceAxis.getDirection());
referenceAxisBuilder.update(); referenceAxisBuilder.update();
ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis(); ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis();
if (newAxis != null) { if (newAxis != null) {
...@@ -2184,33 +2200,37 @@ public class EditorMenuBar extends MenuBar { ...@@ -2184,33 +2200,37 @@ public class EditorMenuBar extends MenuBar {
GridPane scenePane = new GridPane(); GridPane scenePane = new GridPane();
Scene displayScene = new Scene(scenePane); Scene displayScene = new Scene(scenePane);
Stage displayStage = new Stage(StageStyle.UTILITY); Stage displayStage = new Stage(StageStyle.UTILITY);
displayStage.setWidth(600); displayStage.setWidth(810);
displayStage.setTitle("Reference Axes"); displayStage.setTitle("Reference Axes");
displayStage.setScene(displayScene); displayStage.setScene(displayScene);
displayStage.initOwner(Nomad3DEditor.getInstance().getStage()); displayStage.initOwner(Nomad3DEditor.getInstance().getStage());
TableView<AxisTableEntry> tableView = new TableView(); TableView<ReferenceAxisTableEntry> tableView = new TableView();
tableView.setEditable(false); tableView.setEditable(false);
TableColumn axisNameColumn = new TableColumn<>("Name"); TableColumn axisNameColumn = new TableColumn<>("Name");
axisNameColumn.setMinWidth(300); axisNameColumn.setMinWidth(300);
axisNameColumn.setCellValueFactory(new PropertyValueFactory<AxisTableEntry, String>("axisName")); axisNameColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("axisName"));
TableColumn componentNameColumn = new TableColumn<>("Component Name"); TableColumn componentNameColumn = new TableColumn<>("Component Name");
componentNameColumn.setMinWidth(300); componentNameColumn.setMinWidth(300);
componentNameColumn.setCellValueFactory(new PropertyValueFactory<AxisTableEntry, String>("componentName")); componentNameColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("componentName"));
TableColumn lengthColumn = new TableColumn<>("Length");
lengthColumn.setMinWidth(200);
lengthColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("length"));
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<AxisTableEntry>() { tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ReferenceAxisTableEntry>() {
@Override @Override
public void changed(ObservableValue<? extends AxisTableEntry> observable, AxisTableEntry oldValue, public void changed(ObservableValue<? extends ReferenceAxisTableEntry> observable, ReferenceAxisTableEntry oldValue,
AxisTableEntry newValue) { ReferenceAxisTableEntry newValue) {
referenceAxisDisplay.select(newValue.getAxisName(), newValue.getComponentName()); referenceAxisDisplay.select(newValue.getAxisName(), newValue.getComponentName());
} }
}); });
final ObservableList<AxisTableEntry> data = FXCollections.observableArrayList(); final ObservableList<ReferenceAxisTableEntry> data = FXCollections.observableArrayList();
List<ReferenceAxis> axes = ReferenceAxisList.getInstance().get(); List<ReferenceAxis> axes = ReferenceAxisList.getInstance().get();
for (ReferenceAxis axis : axes) { for (ReferenceAxis axis : axes) {
...@@ -2218,14 +2238,14 @@ public class EditorMenuBar extends MenuBar { ...@@ -2218,14 +2238,14 @@ public class EditorMenuBar extends MenuBar {
Component owner = axis.getComponent(); Component owner = axis.getComponent();
if (owner != null) { if (owner != null) {
data.add(new AxisTableEntry(axis.getName(), owner.getName())); data.add(new ReferenceAxisTableEntry(axis.getName(), owner.getName(), df.format(axis.getDirection().magnitude())));
} else { } else {
data.add(new AxisTableEntry(axis.getName(), "")); data.add(new ReferenceAxisTableEntry(axis.getName(), "", df.format(axis.getDirection().magnitude())));
} }
} }
tableView.setItems(data); tableView.setItems(data);
tableView.getColumns().addAll(axisNameColumn, componentNameColumn); tableView.getColumns().addAll(axisNameColumn, componentNameColumn, lengthColumn);
scenePane.addRow(0, tableView); scenePane.addRow(0, tableView);
......
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