Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
14640457
Commit
14640457
authored
Jul 03, 2017
by
Ivan Dages
Browse files
configurations edition
parent
0dbbf97c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/Nomad3DEditor.java
View file @
14640457
...
...
@@ -19,6 +19,7 @@ import javafx.beans.value.ChangeListener;
import
javafx.beans.value.ObservableValue
;
import
javafx.geometry.Bounds
;
import
javafx.geometry.Point2D
;
import
javafx.geometry.Point3D
;
import
javafx.scene.AmbientLight
;
import
javafx.scene.Camera
;
import
javafx.scene.Cursor
;
...
...
@@ -335,6 +336,13 @@ public class Nomad3DEditor extends Application {
scene
.
setFill
(
Color
.
WHITE
);
buildEventHandlers
(
axesGroup
);
// Initialize the camera position
Bounds
rootBounds
=
this
.
model
.
getRoot
().
getSceneNode
().
localToScene
(
this
.
model
.
getRoot
().
getSceneNode
().
getBoundsInLocal
());
Point3D
rootCenter
=
new
Point3D
(
rootBounds
.
getMinX
(),
rootBounds
.
getMinY
(),
rootBounds
.
getMinZ
());
rootCenter
=
rootCenter
.
add
(
rootBounds
.
getWidth
()
/
2.0
,
rootBounds
.
getHeight
()
/
2.0
,
rootBounds
.
getDepth
()
/
2.0
);
this
.
controls
.
setCenter
(
rootCenter
);
this
.
controls
.
zoom
(-
1.0
*
((
new
Point3D
(
rootBounds
.
getWidth
(),
rootBounds
.
getHeight
(),
rootBounds
.
getDepth
())).
magnitude
()),
false
,
false
);
return
scene
;
}
...
...
src/main/java/fr/ill/ics/n3d/gui/EditorMenuBar.java
View file @
14640457
...
...
@@ -82,6 +82,8 @@ public class EditorMenuBar extends MenuBar {
/** Selection menu. */
private
Menu
selection
;
private
Menu
showSelectionInConfig
;
/** Help menu. */
private
Menu
help
;
...
...
@@ -686,10 +688,8 @@ public class EditorMenuBar extends MenuBar {
});
scenePane
.
addRow
(
0
,
searchField
);
searchField
.
setPrefWidth
(
sceneWidth
);
GridPane
.
setColumnSpan
(
searchField
,
GridPane
.
REMAINING
);
scenePane
.
addRow
(
1
,
controllersList
);
controllersList
.
setPrefWidth
(
sceneWidth
);
GridPane
.
setColumnSpan
(
controllersList
,
GridPane
.
REMAINING
);
Button
selectButton
=
new
Button
(
"Select"
);
...
...
@@ -735,6 +735,12 @@ public class EditorMenuBar extends MenuBar {
scenePane
.
addRow
(
2
,
selectButton
,
cancelButton
);
GridPane
.
setMargin
(
scenePane
,
new
Insets
(
10
));
scenePane
.
setPrefSize
(
sceneWidth
,
500
);
searchField
.
prefWidthProperty
().
bind
(
scenePane
.
widthProperty
());
controllersList
.
prefWidthProperty
().
bind
(
scenePane
.
widthProperty
());
controllersList
.
prefHeightProperty
().
bind
(
scenePane
.
heightProperty
());
selectButton
.
prefWidthProperty
().
bind
(
scenePane
.
widthProperty
());
cancelButton
.
prefWidthProperty
().
bind
(
scenePane
.
widthProperty
());
controllersList
.
requestFocus
();
linkStage
.
show
();
...
...
@@ -1037,7 +1043,6 @@ public class EditorMenuBar extends MenuBar {
}
});
this
.
showConfig
=
new
Menu
(
"Show configuration"
);
updateConfigMenus
();
MenuItem
resetMoveItem
=
new
MenuItem
(
"Reset movement"
);
resetMoveItem
.
setAccelerator
(
new
KeyCodeCombination
(
KeyCode
.
R
,
KeyCombination
.
SHIFT_DOWN
));
resetMoveItem
.
setOnAction
(
new
EventHandler
<
ActionEvent
>()
{
...
...
@@ -1186,9 +1191,22 @@ public class EditorMenuBar extends MenuBar {
updateWalls
();
}
});
this
.
showSelectionInConfig
=
new
Menu
(
"Show selection in current configuration"
);
MenuItem
hideInConfigItem
=
new
MenuItem
(
"Hide selection in current configuration"
);
hideInConfigItem
.
setOnAction
(
event
->
{
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
==
null
||
activeConfiguration
==
null
)
{
return
;
}
for
(
Component
comp
:
Nomad3DEditor
.
getInstance
().
getModel
().
getSelection
())
{
comp
.
setConfigurationVisibility
(
false
,
activeConfiguration
,
null
,
false
);
comp
.
setVisible
(
false
,
activeConfiguration
,
false
);
}
});
this
.
selection
.
getItems
().
addAll
(
selectAllItem
,
unselectAllItem
,
new
SeparatorMenuItem
(),
showSelectionItem
,
hideSelectionItem
,
focusSelectionItem
,
new
SeparatorMenuItem
(),
showSelectionInConfig
,
hideInConfigItem
,
new
SeparatorMenuItem
(),
markWallItem
,
markPartsItem
);
...
...
@@ -1245,6 +1263,8 @@ public class EditorMenuBar extends MenuBar {
helpStage
.
show
();
});
this
.
help
.
getItems
().
addAll
(
cameraHelpItem
);
update
();
this
.
getMenus
().
addAll
(
this
.
file
,
this
.
edit
,
this
.
view
,
this
.
selection
,
this
.
help
);
}
...
...
@@ -1282,6 +1302,11 @@ public class EditorMenuBar extends MenuBar {
}
return
modifiedComponent
;
}
private
boolean
modelLoaded
()
{
return
!(
Nomad3DEditor
.
getInstance
().
getModel
()
==
null
||
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
==
null
);
}
/**
* Updates the menu bar and the Nomad3DEditor.getInstance() accordingly.
...
...
@@ -1298,7 +1323,7 @@ public class EditorMenuBar extends MenuBar {
private
void
updateLodMenu
()
{
Logger
.
getLogger
(
"nomad-3d"
).
info
(
"Updating LODs..."
);
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
==
null
||
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
==
null
)
{
if
(
!
modelLoaded
()
)
{
return
;
}
this
.
lodMenu
.
getItems
().
clear
();
...
...
@@ -1330,6 +1355,9 @@ public class EditorMenuBar extends MenuBar {
* Updates the camera.
*/
private
void
updateCamera
()
{
if
(!
modelLoaded
())
{
return
;
}
Nomad3DEditor
.
getInstance
().
buildCamera
();
Nomad3DEditor
.
getInstance
().
getControls
().
setTarget
(
Nomad3DEditor
.
getInstance
().
getCamera
());
Nomad3DEditor
.
getInstance
().
getControls
().
update
();
...
...
@@ -1339,7 +1367,7 @@ public class EditorMenuBar extends MenuBar {
* Updates the "show configuration" sub-menu.
*/
private
void
updateConfigMenus
()
{
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
==
null
||
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
==
null
)
{
if
(
!
modelLoaded
()
)
{
return
;
}
...
...
@@ -1380,13 +1408,26 @@ public class EditorMenuBar extends MenuBar {
});
this
.
removeConfig
.
getItems
().
add
(
configItem
);
}
// Show selection in current configuration
this
.
showSelectionInConfig
.
getItems
().
clear
();
for
(
ConfigParams
config
:
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
().
getConfigurations
())
{
MenuItem
configItem
=
new
MenuItem
(
config
.
getConfiguration
());
configItem
.
setOnAction
(
event
->
{
for
(
Component
comp
:
Nomad3DEditor
.
getInstance
().
getModel
().
getSelection
())
{
comp
.
setConfigurationVisibility
(
true
,
configItem
.
getText
(),
activeConfiguration
,
false
);
}
Nomad3DEditor
.
getInstance
().
getModel
().
showConfiguration
(
activeConfiguration
);
});
this
.
showSelectionInConfig
.
getItems
().
add
(
configItem
);
}
}
/**
* Updates the axes visibility..
*/
private
void
updateAxes
()
{
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
!=
null
&&
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
!=
null
)
{
if
(
modelLoaded
()
)
{
Nomad3DEditor
.
getInstance
().
getModel
().
setVisualizeAxes
(
showAxes
);
}
}
...
...
@@ -1395,7 +1436,7 @@ public class EditorMenuBar extends MenuBar {
* Updates the walls visibility.
*/
private
void
updateWalls
()
{
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
!=
null
&&
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
!=
null
)
{
if
(
modelLoaded
()
)
{
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
().
setWallsVisible
(
showWalls
,
activeConfiguration
);
if
(!
showWalls
)
{
// Hidden parts are unselected
...
...
@@ -1412,7 +1453,7 @@ public class EditorMenuBar extends MenuBar {
* Updates the coordinate system visibility.
*/
private
void
updateSystem
()
{
if
(
Nomad3DEditor
.
getInstance
().
getControls
()
!=
null
&&
Nomad3DEditor
.
getInstance
().
getControls
().
getCenterNode
()
!=
null
)
{
if
(
modelLoaded
()
&&
Nomad3DEditor
.
getInstance
().
getControls
().
getCenterNode
()
!=
null
)
{
Nomad3DEditor
.
getInstance
().
getControls
().
getCenterNode
().
setVisible
(
showSystem
);
}
}
...
...
@@ -1421,9 +1462,9 @@ public class EditorMenuBar extends MenuBar {
* Updates the focus of the selection.
*/
private
void
updateFocus
()
{
if
(
Nomad3DEditor
.
getInstance
().
getModel
()
==
null
||
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
()
==
null
)
{
return
;
}
if
(!
modelLoaded
()
)
{
return
;
}
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
().
focusSelection
(
Nomad3DEditor
.
getInstance
().
getModel
().
getSelection
(),
focusSelection
,
activeConfiguration
,
true
);
...
...
@@ -1435,6 +1476,10 @@ public class EditorMenuBar extends MenuBar {
*/
@SuppressWarnings
(
"unchecked"
)
private
void
updateScene
()
{
if
(!
modelLoaded
())
{
return
;
}
Nomad3DEditor
.
getInstance
().
getRoot
().
getChildren
().
remove
(
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
().
getSceneNode
());
Nomad3DEditor
.
getInstance
().
getModel
().
computeSceneHierarchies
(
activeLod
);
Nomad3DEditor
.
getInstance
().
getRoot
().
getChildren
().
add
(
Nomad3DEditor
.
getInstance
().
getModel
().
getRoot
().
getSceneNode
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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