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-commons
Commits
d9a5fdb0
Commit
d9a5fdb0
authored
Jul 04, 2017
by
Ivan Dages
Browse files
regroup components
parent
3cba8951
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/model/Component.java
View file @
d9a5fdb0
...
...
@@ -766,6 +766,31 @@ public class Component {
return
roots
;
}
public
static
Component
ancestorOf
(
Set
<
Component
>
components
)
{
if
(
components
.
isEmpty
())
{
return
null
;
}
Iterator
<
Component
>
iter
=
components
.
iterator
();
Component
curComp
=
iter
.
next
();
if
(
curComp
.
isRoot
())
{
return
null
;
}
Component
ancestor
=
curComp
.
getParent
();
while
(
iter
.
hasNext
())
{
curComp
=
iter
.
next
();
if
(
curComp
.
isRoot
())
{
return
null
;
}
while
(!
curComp
.
isChild
(
ancestor
))
{
if
(
ancestor
.
isRoot
())
{
return
null
;
}
ancestor
=
ancestor
.
getParent
();
}
}
return
ancestor
;
}
/**
* Computes the axes of this component and its sub-hierarchy for each configuration, merges the results and
* analyzes the configurations in order to set the min/median/max values.
...
...
@@ -1429,6 +1454,9 @@ public class Component {
* @return The inserted component
*/
public
Component
insertBlock
(
HashSet
<
Component
>
block
,
boolean
fixedBlock
)
{
return
insertBlock
(
block
,
fixedBlock
,
"INSERTED"
);
}
public
Component
insertBlock
(
HashSet
<
Component
>
block
,
boolean
fixedBlock
,
String
tag
)
{
Component
inserted
=
new
Component
();
for
(
Iterator
<
Component
>
iter
=
block
.
iterator
()
;
iter
.
hasNext
()
;
)
{
...
...
@@ -1445,7 +1473,7 @@ public class Component {
inserted
.
addConfiguration
(
newConfig
);
}
inserted
.
setName
(
"NOMAD_3D_
INSERTED
-"
+
insertedIndex
);
inserted
.
setName
(
"NOMAD_3D_
"
+
tag
+
"
-"
+
insertedIndex
);
inserted
.
setFileName
(
"NOMAD_3D_INSERTED"
);
inserted
.
setAxis
(
Axis
.
FREE_AXIS
.
clone
());
inserted
.
getAxis
().
setMethod
(
Axis
.
Method
.
TO_COMPUTE
);
...
...
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