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
minerva
core
Commits
302aeb8a
Commit
302aeb8a
authored
Sep 20, 2021
by
Piotr Gawron
Browse files
structural state should be between species and reaction
parent
b13c6e18
Changes
2
Hide whitespace changes
Inline
Side-by-side
converter/src/main/java/lcsb/mapviewer/converter/ZIndexPopulator.java
View file @
302aeb8a
...
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -13,12 +14,13 @@ import lcsb.mapviewer.common.comparator.DoubleComparator;
import
lcsb.mapviewer.common.comparator.StringComparator
;
import
lcsb.mapviewer.model.map.Drawable
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.layout.graphics.Layer
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
import
lcsb.mapviewer.model.map.species.Complex
;
import
lcsb.mapviewer.model.map.species.Element
;
import
lcsb.mapviewer.model.map.species.Species
;
import
lcsb.mapviewer.model.map.species.field.ModificationResidue
;
import
lcsb.mapviewer.model.map.species.field.SpeciesWithModificationResidue
;
import
lcsb.mapviewer.model.map.species.field.StructuralState
;
/**
...
...
@@ -41,18 +43,7 @@ public class ZIndexPopulator {
* z-values.
*/
public
void
populateZIndex
(
final
Model
model
)
{
List
<
Drawable
>
drawables
=
new
ArrayList
<>();
for
(
Layer
layer
:
model
.
getLayers
())
{
drawables
.
addAll
(
layer
.
getOvals
());
drawables
.
addAll
(
layer
.
getRectangles
());
drawables
.
addAll
(
layer
.
getTexts
());
}
drawables
.
addAll
(
model
.
getBioEntities
());
for
(
Species
species
:
model
.
getSpeciesList
())
{
if
(
species
.
getStructuralState
()
!=
null
)
{
drawables
.
add
(
species
.
getStructuralState
());
}
}
Set
<
Drawable
>
drawables
=
model
.
getDrawables
();
populateZIndex
(
drawables
);
...
...
@@ -129,6 +120,16 @@ public class ZIndexPopulator {
for
(
final
Drawable
drawable
:
sortedDrawables
)
{
if
(
drawable
.
getZ
()
==
null
)
{
drawable
.
setZ
(++
maxZIndex
);
if
(
drawable
instanceof
Species
)
{
if
(((
Species
)
drawable
).
getStructuralState
()
!=
null
)
{
((
Species
)
drawable
).
getStructuralState
().
setZ
(++
maxZIndex
);
}
}
if
(
drawable
instanceof
SpeciesWithModificationResidue
)
{
for
(
ModificationResidue
mr
:
((
SpeciesWithModificationResidue
)
drawable
).
getModificationResidues
())
{
mr
.
setZ
(++
maxZIndex
);
}
}
}
}
}
...
...
converter/src/test/java/lcsb/mapviewer/converter/ZIndexPopulatorTest.java
View file @
302aeb8a
...
...
@@ -96,7 +96,7 @@ public class ZIndexPopulatorTest {
}
@Test
public
void
testZIndexReactionShouldBe
BeforeElement
()
{
public
void
testZIndexReactionShouldBe
AfterStructuralState
()
{
Model
model
=
new
ModelFullIndexed
(
null
);
Species
species
=
createProtein
();
StructuralState
state
=
new
StructuralState
();
...
...
@@ -114,8 +114,9 @@ public class ZIndexPopulatorTest {
populator
.
populateZIndex
(
model
);
assertTrue
(
reaction
.
getZ
()
>
species
.
getZ
());
// structural state should be over reaction and species
assertTrue
(
species
.
getStructuralState
().
getZ
()
>
reaction
.
getZ
());
// structural state should be below reaction and above species
assertTrue
(
species
.
getStructuralState
().
getZ
()
<
reaction
.
getZ
());
assertTrue
(
species
.
getStructuralState
().
getZ
()
>
species
.
getZ
());
}
@Test
...
...
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