Commit 22754eae authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when creating layout for self reaction create a line that is not empty

parent 91e86f7b
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment