Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
12de5196
Commit
12de5196
authored
2 months ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
when creating hierarchy consider also pathways
parent
8ed0aa54
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1871
Resolve "problem with websocket connection"
,
!1858
Resolve "for some translocations the reactant and product are the same species in CellDesigner or SBML exports"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
model-command/src/main/java/lcsb/mapviewer/commands/CreateHierarchyCommand.java
+62
-13
62 additions, 13 deletions
.../java/lcsb/mapviewer/commands/CreateHierarchyCommand.java
with
62 additions
and
13 deletions
model-command/src/main/java/lcsb/mapviewer/commands/CreateHierarchyCommand.java
+
62
−
13
View file @
12de5196
...
...
@@ -42,11 +42,11 @@ public class CreateHierarchyCommand extends ModelCommand {
/**
* Top left corner x coordinate of the text associated with compartment.
*/
private
static
final
double
DEFAULT_TITLE_X_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
=
10
;
private
static
final
double
DEFAULT_TITLE_X_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
=
10
;
/**
* Top left corner y coordinate of the text associated with compartment.
*/
private
static
final
double
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
=
10
;
private
static
final
double
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
=
10
;
/**
* Default class logger.
*/
...
...
@@ -168,10 +168,10 @@ public class CreateHierarchyCommand extends ModelCommand {
if
(
rect
.
getFillColor
()
!=
null
)
{
compartment
.
setFillColor
(
rect
.
getFillColor
());
}
compartment
.
setNameX
(
rect
.
getX
()
+
DEFAULT_TITLE_X_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameY
(
rect
.
getY
()
+
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameWidth
(
rect
.
getWidth
()
-
2
*
DEFAULT_TITLE_X_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameHeight
(
rect
.
getHeight
()
-
2
*
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameX
(
rect
.
getX
()
+
DEFAULT_TITLE_X_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameY
(
rect
.
getY
()
+
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameWidth
(
rect
.
getWidth
()
-
2
*
DEFAULT_TITLE_X_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameHeight
(
rect
.
getHeight
()
-
2
*
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameHorizontalAlign
(
HorizontalAlign
.
LEFT
);
compartment
.
setNameVerticalAlign
(
VerticalAlign
.
TOP
);
compartment
.
setZ
(
rect
.
getZ
());
...
...
@@ -196,10 +196,10 @@ public class CreateHierarchyCommand extends ModelCommand {
rap
.
processNotes
(
compartment
);
text
.
setNotes
(
compartment
.
getName
()
+
"\n"
+
compartment
.
getNotes
());
compartment
.
setNameX
(
text
.
getX
()
+
DEFAULT_TITLE_X_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameY
(
text
.
getY
()
+
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameWidth
(
text
.
getWidth
()
-
2
*
DEFAULT_TITLE_X_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameHeight
(
text
.
getHeight
()
-
2
*
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
T
IAL_COMPARTMENT
);
compartment
.
setNameX
(
text
.
getX
()
+
DEFAULT_TITLE_X_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameY
(
text
.
getY
()
+
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameWidth
(
text
.
getWidth
()
-
2
*
DEFAULT_TITLE_X_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameHeight
(
text
.
getHeight
()
-
2
*
DEFAULT_TITLE_Y_COORD_IN_ARTIFI
C
IAL_COMPARTMENT
);
compartment
.
setNameHorizontalAlign
(
HorizontalAlign
.
LEFT
);
compartment
.
setNameVerticalAlign
(
VerticalAlign
.
TOP
);
...
...
@@ -292,12 +292,49 @@ public class CreateHierarchyCommand extends ModelCommand {
compartment
.
setTransparencyLevel
(
maxVisibilityLevel
+
""
);
}
for
(
final
Element
child
:
compartment
.
getElements
())
{
if
(
child
.
getVisibilityLevel
()
==
null
||
child
.
getVisibilityLevel
().
isEmpty
(
))
{
if
(
!
isExcludedChildVisibility
(
child
))
{
child
.
setVisibilityLevel
(
compartment
.
getTransparencyLevel
());
}
}
}
private
boolean
isExcludedChildVisibility
(
final
Element
child
)
{
return
excluded
.
contains
(
child
);
}
private
void
settingTransparencyLevelForPathway
(
final
PathwayCompartment
pathway
)
{
Set
<
Element
>
pathwayChildren
=
getPathwayChildren
(
pathway
);
if
(
pathway
.
getTransparencyLevel
()
==
null
||
pathway
.
getTransparencyLevel
().
isEmpty
())
{
double
rate
=
computeRate
(
pathway
,
Configuration
.
MAX_VISIBLE_OBJECT_SIZE
);
int
maxVisibilityLevel
=
(
int
)
((
int
)
Math
.
ceil
(
Math
.
log
(
rate
))
/
LOG_4
);
for
(
final
Element
child
:
pathwayChildren
)
{
maxVisibilityLevel
=
Math
.
min
(
maxVisibilityLevel
,
computeVisibility
(
child
));
}
if
(
maxVisibilityLevel
>=
zoomLevels
)
{
maxVisibilityLevel
=
zoomLevels
;
}
if
(
maxVisibilityLevel
<=
0
)
{
maxVisibilityLevel
=
1
;
}
pathway
.
setTransparencyLevel
(
maxVisibilityLevel
+
""
);
}
for
(
final
Element
child
:
pathwayChildren
)
{
if
(!
isExcludedChildVisibility
(
child
))
{
child
.
setVisibilityLevel
(
pathway
.
getTransparencyLevel
());
}
}
}
private
Set
<
Element
>
getPathwayChildren
(
final
PathwayCompartment
pathway
)
{
Set
<
Element
>
children
=
new
HashSet
<>();
for
(
Element
element
:
pathway
.
getModel
().
getElements
())
{
if
(
element
.
getPathway
()
==
pathway
)
{
children
.
add
(
element
);
}
}
return
children
;
}
/**
* Sets transparency level in hierarchical view for complex alias.
*
...
...
@@ -320,20 +357,32 @@ public class CreateHierarchyCommand extends ModelCommand {
complex
.
setTransparencyLevel
(
maxVisibilityLevel
+
""
);
}
for
(
final
Element
child
:
complex
.
getElements
())
{
if
(
child
.
getVisibilityLevel
()
==
null
||
child
.
getVisibilityLevel
().
isEmpty
(
))
{
if
(
!
isExcludedChildVisibility
(
child
))
{
child
.
setVisibilityLevel
(
complex
.
getTransparencyLevel
());
}
}
}
private
final
Set
<
Element
>
excluded
=
new
HashSet
<>();
/**
* Sets transparency level in hierarchical view for all elements.
*
* @param sortedAliases list of aliases
*/
private
void
settingOfTransparencyLevel
(
final
List
<
Element
>
sortedAliases
)
{
excluded
.
clear
();
for
(
final
Element
alias
:
sortedAliases
)
{
if
(
alias
.
getVisibilityLevel
()
!=
null
&&
!
alias
.
getVisibilityLevel
().
isEmpty
())
{
excluded
.
add
(
alias
);
}
}
for
(
final
Element
alias
:
sortedAliases
)
{
if
(
alias
instanceof
Compartment
)
{
if
(
alias
instanceof
PathwayCompartment
)
{
settingTransparencyLevelForPathway
((
PathwayCompartment
)
alias
);
}
else
if
(
alias
instanceof
Compartment
)
{
settingTransparencyLevelForCompartment
((
Compartment
)
alias
);
}
else
if
(
alias
instanceof
Complex
)
{
settingTransparencyLevelForComplex
((
Complex
)
alias
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment