Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-editor
Commits
94af7c06
Commit
94af7c06
authored
May 07, 2019
by
legoc
Browse files
Added TranslationDirection to Axis
parent
f104ee4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/gui/EditorMenuBar.java
View file @
94af7c06
...
...
@@ -580,6 +580,36 @@ public class EditorMenuBar extends MenuBar {
}
});
///////////////////////////////////////////////////////////////////////////////////////
// Translation direction
ObservableList
<
Axis
.
TranslationDirection
>
translationDirections
=
FXCollections
.
observableArrayList
(
Axis
.
TranslationDirection
.
FW
,
Axis
.
TranslationDirection
.
BW
);
ComboBox
<
Axis
.
TranslationDirection
>
translationDirectionBox
=
new
ComboBox
<>(
translationDirections
);
translationDirectionBox
.
setVisible
(
editedAxis
.
getType
()
==
Axis
.
Type
.
TRANSLATION
);
translationDirectionBox
.
getSelectionModel
().
select
(
editedAxis
.
getTranslationDirection
());
translationDirectionBox
.
getSelectionModel
().
selectedItemProperty
().
addListener
(
new
ChangeListener
<
Axis
.
TranslationDirection
>()
{
@Override
public
void
changed
(
ObservableValue
<?
extends
Axis
.
TranslationDirection
>
observable
,
Axis
.
TranslationDirection
oldValue
,
Axis
.
TranslationDirection
newValue
)
{
// Reset the movement.
editedAxis
.
resetMovement
();
// Set the translation direction.
editedAxis
.
setTranslationDirection
(
newValue
);
// Set the status.
zeroValueReference1Label
.
setTextFill
(
editedAxis
.
calculateZeroValueReferenceAxis1Status
()
==
Axis
.
Status
.
NOK
?
Color
.
RED
:
Color
.
BLACK
);
zeroValueReference2Label
.
setTextFill
(
editedAxis
.
calculateZeroValueReferenceAxis2Status
()
==
Axis
.
Status
.
NOK
?
Color
.
RED
:
Color
.
BLACK
);
// Calculate the zero value if possible.
editedAxis
.
calculateZeroValueFromReferences
();
// Set the direction fields.
xDirField
.
setText
(
String
.
format
(
"%.3f"
,
editedAxis
.
getDirection
().
getX
()));
yDirField
.
setText
(
String
.
format
(
"%.3f"
,
editedAxis
.
getDirection
().
getY
()));
zDirField
.
setText
(
String
.
format
(
"%.3f"
,
editedAxis
.
getDirection
().
getZ
()));
}
});
///////////////////////////////////////////////////////////////////////////////////////
// Type
Label
typeLabel
=
new
Label
(
"Type : "
);
...
...
@@ -597,6 +627,9 @@ public class EditorMenuBar extends MenuBar {
// Change the visibility of the rotation direction box.
rotationDirectionBox
.
setVisible
(
newValue
==
Axis
.
Type
.
ROTATION
);
// Change the visibility of the translation direction box.
translationDirectionBox
.
setVisible
(
newValue
==
Axis
.
Type
.
TRANSLATION
);
// Change the visibility of the zero value reference boxes and labels.
zeroValueReference1Label
.
setVisible
(
newValue
==
Axis
.
Type
.
ROTATION
||
newValue
==
Axis
.
Type
.
TRANSLATION
);
zeroValueReference1Box
.
setVisible
(
newValue
==
Axis
.
Type
.
ROTATION
||
newValue
==
Axis
.
Type
.
TRANSLATION
);
...
...
@@ -729,6 +762,9 @@ public class EditorMenuBar extends MenuBar {
rotationDirectionBox
.
setValue
(
Axis
.
RotationDirection
.
CCW
);
editedAxis
.
setRotationDirection
(
Axis
.
RotationDirection
.
CCW
);
translationDirectionBox
.
setValue
(
Axis
.
TranslationDirection
.
FW
);
editedAxis
.
setTranslationDirection
(
Axis
.
TranslationDirection
.
FW
);
// Set the status.
zeroValueReference1Label
.
setTextFill
(
editedAxis
.
calculateZeroValueReferenceAxis1Status
()
==
Axis
.
Status
.
NOK
?
Color
.
RED
:
Color
.
BLACK
);
zeroValueReference2Label
.
setTextFill
(
editedAxis
.
calculateZeroValueReferenceAxis2Status
()
==
Axis
.
Status
.
NOK
?
Color
.
RED
:
Color
.
BLACK
);
...
...
@@ -825,6 +861,7 @@ public class EditorMenuBar extends MenuBar {
editedAxis
.
getType
(),
referenceAxisName
,
editedAxis
.
getRotationDirection
(),
editedAxis
.
getTranslationDirection
(),
zeroValueReferenceAxis1Name
,
reversedDirection1Check
.
isSelected
(),
zeroValueReferenceAxis2Name
,
...
...
@@ -871,7 +908,7 @@ public class EditorMenuBar extends MenuBar {
mainPane
.
setVgap
(
5
);
mainPane
.
setAlignment
(
Pos
.
TOP_LEFT
);
mainPane
.
addRow
(
0
,
controllerLabel
,
controllerBox
,
minValueLabel
,
maxValueLabel
);
mainPane
.
addRow
(
1
,
typeLabel
,
typeBox
,
rotationDirectionBox
);
mainPane
.
addRow
(
1
,
typeLabel
,
typeBox
,
rotationDirectionBox
,
translationDirectionBox
);
mainPane
.
addRow
(
2
,
referenceLabel
,
referenceBox
);
GridPane
.
setColumnSpan
(
typeBox
,
GridPane
.
REMAINING
);
addPane
.
addRow
(
0
,
mainPane
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment