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
8d6ca75b
Commit
8d6ca75b
authored
Feb 08, 2021
by
Piotr Gawron
Browse files
SBGN operators contain TEXT in a circle
parent
a0d17aed
Pipeline
#37319
passed with stage
in 15 minutes and 35 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
8d6ca75b
minerva
(
15.1.3
)
stable
;
urgency
=
medium
*
Bug
fix
:
modifier
reactions
to
phenotype
were
incorrectly
translated
to
Process
Description
reactions
when
exporting
to
SBGN
-
ML
(#
1445
)
*
Bug
fix
:
AND
/
OR
text
was
missing
when
drawing
diagram
as
SBGN
(#
1428
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
8
Feb
2021
12
:
00
:
00
+
0200
...
...
converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverter.java
View file @
8d6ca75b
...
...
@@ -352,7 +352,7 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
* @param sbgnFormat
* true if operator is to be drawn in SBGN format
*/
private
void
drawOperator
(
final
Graphics2D
graphics
,
final
NodeOperator
operator
,
boolean
sbgnFormat
)
{
void
drawOperator
(
final
Graphics2D
graphics
,
final
NodeOperator
operator
,
boolean
sbgnFormat
)
{
Color
oldColor
=
graphics
.
getColor
();
// draw line
...
...
@@ -361,13 +361,25 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
Point2D
centerPoint
=
operator
.
getLine
().
getPoints
().
get
(
0
);
Color
fillColor
=
Color
.
WHITE
;
double
radius
=
DEFAULT_OPERATOR_RADIUS
;
// bigger connecting point circles in SBGN view
String
text
=
operator
.
getOperatorText
();
if
(
operator
instanceof
AndOperator
||
operator
instanceof
SplitOperator
||
operator
instanceof
DissociationOperator
||
operator
instanceof
AssociationOperator
||
operator
instanceof
TruncationOperator
)
{
radius
=
1.5
;
fillColor
=
operator
.
getLine
().
getColor
();
}
// bigger connecting point circles in SBGN view
if
(
sbgnFormat
&&
(
operator
instanceof
AndOperator
||
operator
instanceof
OrOperator
))
{
fillColor
=
Color
.
WHITE
;
radius
=
15
;
if
(
operator
instanceof
AndOperator
)
{
text
=
"AND"
;
}
if
(
operator
instanceof
OrOperator
)
{
text
=
"OR"
;
}
}
// it's a circle
Ellipse2D
cir
=
new
Ellipse2D
.
Double
(
centerPoint
.
getX
()
-
radius
,
centerPoint
.
getY
()
-
radius
,
2
*
radius
,
2
*
radius
);
...
...
@@ -376,7 +388,6 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
graphics
.
setColor
(
operator
.
getLine
().
getColor
());
graphics
.
draw
(
cir
);
// and text defined by operator
String
text
=
operator
.
getOperatorText
();
Rectangle2D
rect
=
graphics
.
getFontMetrics
().
getStringBounds
(
text
,
graphics
);
graphics
.
drawString
(
text
,
(
int
)
(
centerPoint
.
getX
()
-
rect
.
getWidth
()
/
2
+
1
),
(
int
)
(
centerPoint
.
getY
()
+
rect
.
getHeight
()
/
2
)
-
2
);
...
...
converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/bioEntity/reaction/ReactionConverterTest.java
View file @
8d6ca75b
...
...
@@ -336,6 +336,30 @@ public class ReactionConverterTest extends GraphicsTestFunctions {
}
}
@Test
public
void
testDrawOperatorWithSbgn
()
throws
Exception
{
Graphics2D
graphics
=
createGraphicsMock
();
ReactionConverter
rc
=
new
ReactionConverter
(
colorExtractor
);
NodeOperator
operator
=
new
AndOperator
();
operator
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
1
,
2
),
new
Point2D
.
Double
(
3
,
4
)));
rc
.
drawOperator
(
graphics
,
operator
,
true
);
verify
(
graphics
,
times
(
1
)).
drawString
(
eq
(
"AND"
),
anyInt
(),
anyInt
());
}
@Test
public
void
testDrawOperatorWithoutSbgn
()
throws
Exception
{
Graphics2D
graphics
=
createGraphicsMock
();
ReactionConverter
rc
=
new
ReactionConverter
(
colorExtractor
);
NodeOperator
operator
=
new
AndOperator
();
operator
.
setLine
(
new
PolylineData
(
new
Point2D
.
Double
(
1
,
2
),
new
Point2D
.
Double
(
3
,
4
)));
rc
.
drawOperator
(
graphics
,
operator
,
false
);
verify
(
graphics
,
times
(
1
)).
drawString
(
eq
(
""
),
anyInt
(),
anyInt
());
}
@Test
public
void
testDrawComplexReactionWithSemanticZoomingAndAllModifersOff
()
throws
Exception
{
try
{
...
...
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