Commit 164f6754 authored by legoc's avatar legoc
Browse files

Better selection of a reference axis

parent f7a94317
......@@ -1852,7 +1852,7 @@ public class EditorMenuBar extends MenuBar {
@Override
public void changed(ObservableValue<? extends AxisTableEntry> observable, AxisTableEntry oldValue, AxisTableEntry newValue) {
referenceAxisDisplay.select(newValue.getAxisName());
referenceAxisDisplay.select(newValue.getAxisName(), newValue.getComponentName());
}
});
......
......@@ -17,6 +17,7 @@ public class ReferenceAxisListDisplay {
private Group visualGroup;
private String selectedAxisName = "";
private String selectedComponentName = "";
/**
* Default constructor.
......@@ -39,23 +40,43 @@ public class ReferenceAxisListDisplay {
ArrayList<ReferenceAxis> axes = ReferenceAxisList.getInstance().get();
ReferenceAxis selectedAxis = null;
// Add the reference axes.
for (ReferenceAxis axis : axes) {
Group visualAxisGroup = new Group();
if (axis.getName().equals(selectedAxisName)) {
Axis.updateVisualAxisGroup(visualAxisGroup, Axis.Type.NEW, axis.getPosition(), axis.getDirection(), false);
String componentName = "";
if (axis.getComponent() != null) {
componentName = axis.getComponent().getName();
}
if (axis.getName().equals(selectedAxisName)
&& componentName.equals(selectedComponentName)) {
// Store the selected axis.
selectedAxis = axis;
}
else {
// Create and add the axis.
Group visualAxisGroup = new Group();
Axis.updateVisualAxisGroup(visualAxisGroup, Axis.Type.REFERENCE1, axis.getPosition(), axis.getDirection(), false);
visualGroup.getChildren().add(visualAxisGroup);
}
}
// Add the selected axis.
if (selectedAxis != null) {
Group visualAxisGroup = new Group();
Axis.updateVisualAxisGroup(visualAxisGroup, Axis.Type.NEW, selectedAxis.getPosition(), selectedAxis.getDirection(), false);
visualGroup.getChildren().add(visualAxisGroup);
}
visualGroup.setDepthTest(DepthTest.DISABLE);
}
public void select(String axisName) {
public void select(String axisName, String componentName) {
this.selectedAxisName = axisName;
this.selectedComponentName = componentName;
init();
}
......
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