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
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:
$ 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.
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomad-3d-editor</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
<distributionManagement>
<repository>
......@@ -41,7 +41,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomad-3d-commons</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</dependency>
</dependencies>
......
......@@ -4,6 +4,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.math.RoundingMode;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
......@@ -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 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();
this.axisName = new SimpleStringProperty(axisName);
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() {
......@@ -238,6 +220,25 @@ public class EditorMenuBar extends MenuBar {
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() {
return type.get();
}
......@@ -251,6 +252,20 @@ public class EditorMenuBar extends MenuBar {
}
}
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
* to put them into the table used in "Set Camera POVs"
......@@ -334,6 +349,7 @@ public class EditorMenuBar extends MenuBar {
this.activeConfiguration = null;
this.activeLod = 0;
this.subdividedChilds = new LinkedList<>();
df.setRoundingMode(RoundingMode.CEILING);
this.file = new Menu("File");
MenuItem openItem = new MenuItem("Open");
......@@ -651,7 +667,7 @@ public class EditorMenuBar extends MenuBar {
// Select the reference axis.
if (editedAxis.getZeroValueReferenceAxis1() != null) {
zeroValueReference1Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis1().getName());
zeroValueReference1Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis1().getNameId());
}
zeroValueReference1Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
......@@ -706,7 +722,7 @@ public class EditorMenuBar extends MenuBar {
// Select the reference axis.
if (editedAxis.getZeroValueReferenceAxis2() != null) {
zeroValueReference2Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis2().getName());
zeroValueReference2Box.getSelectionModel().select(editedAxis.getZeroValueReferenceAxis2().getNameId());
}
zeroValueReference2Box.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
......@@ -917,7 +933,7 @@ public class EditorMenuBar extends MenuBar {
if (editedAxis.getReferenceAxis() != null) {
// Select the reference axis.
referenceBox.getSelectionModel().select(editedAxis.getReferenceAxis().getName());
referenceBox.getSelectionModel().select(editedAxis.getReferenceAxis().getNameId());
// Set the fields.
xDirField.setText(String.format("%.3f", editedAxis.getDirection().getX()));
......@@ -1042,15 +1058,15 @@ public class EditorMenuBar extends MenuBar {
String controllerName = null;
if (editedAxis.getReferenceAxis() != null) {
referenceAxisName = editedAxis.getReferenceAxis().getName();
referenceAxisName = editedAxis.getReferenceAxis().getNameId();
}
if (editedAxis.getZeroValueReferenceAxis1() != null) {
zeroValueReferenceAxis1Name = editedAxis.getZeroValueReferenceAxis1().getName();
zeroValueReferenceAxis1Name = editedAxis.getZeroValueReferenceAxis1().getNameId();
}
if (editedAxis.getZeroValueReferenceAxis2() != null) {
zeroValueReferenceAxis2Name = editedAxis.getZeroValueReferenceAxis2().getName();
zeroValueReferenceAxis2Name = editedAxis.getZeroValueReferenceAxis2().getNameId();
}
if (editedAxis.getController() != null) {
......@@ -1894,7 +1910,7 @@ public class EditorMenuBar extends MenuBar {
ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue);
referenceAxisBuilder.setName(nameField.getText());
referenceAxisBuilder.setReference1(referenceAxis.getName(), referenceAxis.getDirection());
referenceAxisBuilder.setReference1(referenceAxis.getNameId(), referenceAxis.getDirection());
referenceAxisBuilder.update();
ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis();
if (newAxis != null) {
......@@ -1916,7 +1932,7 @@ public class EditorMenuBar extends MenuBar {
ReferenceAxis referenceAxis = ReferenceAxisList.getInstance().getAxis(newValue);
referenceAxisBuilder.setName(nameField.getText());
referenceAxisBuilder.setReference2(referenceAxis.getName(), referenceAxis.getDirection());
referenceAxisBuilder.setReference2(referenceAxis.getNameId(), referenceAxis.getDirection());
referenceAxisBuilder.update();
ReferenceAxis newAxis = referenceAxisBuilder.getNewAxis();
if (newAxis != null) {
......@@ -2184,33 +2200,37 @@ public class EditorMenuBar extends MenuBar {
GridPane scenePane = new GridPane();
Scene displayScene = new Scene(scenePane);
Stage displayStage = new Stage(StageStyle.UTILITY);
displayStage.setWidth(600);
displayStage.setWidth(810);
displayStage.setTitle("Reference Axes");
displayStage.setScene(displayScene);
displayStage.initOwner(Nomad3DEditor.getInstance().getStage());
TableView<AxisTableEntry> tableView = new TableView();
TableView<ReferenceAxisTableEntry> tableView = new TableView();
tableView.setEditable(false);
TableColumn axisNameColumn = new TableColumn<>("Name");
axisNameColumn.setMinWidth(300);
axisNameColumn.setCellValueFactory(new PropertyValueFactory<AxisTableEntry, String>("axisName"));
axisNameColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("axisName"));
TableColumn componentNameColumn = new TableColumn<>("Component Name");
componentNameColumn.setMinWidth(300);
componentNameColumn.setCellValueFactory(new PropertyValueFactory<AxisTableEntry, String>("componentName"));
componentNameColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("componentName"));
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<AxisTableEntry>() {
TableColumn lengthColumn = new TableColumn<>("Length");
lengthColumn.setMinWidth(200);
lengthColumn.setCellValueFactory(new PropertyValueFactory<ReferenceAxisTableEntry, String>("length"));
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ReferenceAxisTableEntry>() {
@Override
public void changed(ObservableValue<? extends AxisTableEntry> observable, AxisTableEntry oldValue,
AxisTableEntry newValue) {
public void changed(ObservableValue<? extends ReferenceAxisTableEntry> observable, ReferenceAxisTableEntry oldValue,
ReferenceAxisTableEntry newValue) {
referenceAxisDisplay.select(newValue.getAxisName(), newValue.getComponentName());
}
});
final ObservableList<AxisTableEntry> data = FXCollections.observableArrayList();
final ObservableList<ReferenceAxisTableEntry> data = FXCollections.observableArrayList();
List<ReferenceAxis> axes = ReferenceAxisList.getInstance().get();
for (ReferenceAxis axis : axes) {
......@@ -2218,14 +2238,14 @@ public class EditorMenuBar extends MenuBar {
Component owner = axis.getComponent();
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 {
data.add(new AxisTableEntry(axis.getName(), ""));
data.add(new ReferenceAxisTableEntry(axis.getName(), "", df.format(axis.getDirection().magnitude())));
}
}
tableView.setItems(data);
tableView.getColumns().addAll(axisNameColumn, componentNameColumn);
tableView.getColumns().addAll(axisNameColumn, componentNameColumn, lengthColumn);
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