Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
22754eae
Commit
22754eae
authored
May 29, 2019
by
Piotr Gawron
Browse files
when creating layout for self reaction create a line that is not empty
parent
91e86f7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java
View file @
22754eae
...
...
@@ -12,7 +12,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.logging.log4j.*
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
lcsb.mapviewer.commands.CommandExecutionException
;
import
lcsb.mapviewer.common.Configuration
;
...
...
@@ -58,7 +59,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
private
static
final
int
SPECIES_WIDTH
=
90
;
private
static
final
int
SPECIES_HEIGHT
=
30
;
private
static
final
double
COMPLEX_PADDING
=
5
;
private
PointTransformation
pt
=
new
PointTransformation
();
public
ApplySimpleLayoutModelCommand
(
Model
model
,
Collection
<
BioEntity
>
bioEntities
,
Double
minX
,
Double
minY
,
...
...
@@ -247,17 +248,23 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
Point2D
centerLineEnd
=
pt
.
getPointOnLine
(
reactantElement
.
getCenter
(),
productElement
.
getCenter
(),
0.6
);
Point2D
middle
=
pt
.
getPointOnLine
(
reactantElement
.
getCenter
(),
productElement
.
getCenter
(),
0.5
);
PolylineData
centerLine
=
new
PolylineData
();
// for self reactions
if
(
productElement
.
equals
(
reactantElement
))
{
if
(
centerLineStart
.
equals
(
centerLineEnd
))
{
centerLine
.
addPoint
(
pt
.
copyPoint
(
centerLineStart
));
centerLineStart
.
setLocation
(
centerLineStart
.
getX
(),
centerLineStart
.
getY
()
+
50
);
centerLine
.
addPoint
(
pt
.
copyPoint
(
centerLineStart
));
centerLine
.
addPoint
(
pt
.
copyPoint
(
centerLineEnd
));
centerLineEnd
.
setLocation
(
centerLineStart
.
getX
(),
centerLineEnd
.
getY
()
+
50
);
}
else
{
centerLine
.
addPoint
(
pt
.
copyPoint
(
centerLineStart
));
centerLine
.
addPoint
(
pt
.
copyPoint
(
centerLineEnd
));
}
reaction
.
setLine
(
centerLine
);
modifyReactants
(
reaction
,
centerLineStart
);
modifyProducts
(
reaction
,
centerLineEnd
);
modifyModifiers
(
reaction
,
middle
);
reaction
.
setLine
(
new
PolylineData
(
centerLineStart
,
centerLineEnd
));
if
(
super
.
isAddReactionPrefixes
())
{
super
.
getModel
().
removeReaction
(
reaction
);
...
...
@@ -284,7 +291,6 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
PolylineData
line
=
new
PolylineData
();
line
.
addPoint
(
reactant
.
getElement
().
getCenter
());
line
.
addPoint
(
middle
);
line
.
addPoint
(
middle
);
if
(
reaction
.
isReversible
())
{
line
.
getBeginAtd
().
setArrowType
(
ArrowType
.
FULL
);
}
...
...
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