Commit 01132dad authored by Piotr Gawron's avatar Piotr Gawron
Browse files

import from wikipathways provides center line

parent 1d1e8893
......@@ -20,8 +20,10 @@ import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.common.geometry.PointTransformation;
import lcsb.mapviewer.converter.ConverterException;
import lcsb.mapviewer.converter.model.celldesigner.geometry.CellDesignerAliasConverter;
import lcsb.mapviewer.converter.model.celldesigner.geometry.ReactionCellDesignerConverter;
import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionLineData;
import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType;
import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils;
......@@ -123,6 +125,8 @@ public class ModelContructor {
*/
private BiopaxParser biopaxParser = new BiopaxParser();
private PointTransformation pt = new PointTransformation();
/**
* List of {@link Shape#shape shapes} that are not supported to be part of a
* {@link Complex complex}.
......@@ -767,6 +771,8 @@ public class ModelContructor {
}
}
createReactionCenterLine(reaction);
ModifierTypeUtils mtu = new ModifierTypeUtils();
for (Modifier m : reaction.getModifiers()) {
m.getLine().setEndPoint(m.getLine().getPoints().get(m.getLine().getPoints().size() - 2));
......@@ -776,6 +782,32 @@ public class ModelContructor {
return reaction;
}
private void createReactionCenterLine(Reaction reaction) {
AbstractNode input = reaction.getReactants().get(0);
AbstractNode output = reaction.getProducts().get(0);
for (NodeOperator operator : reaction.getOperators()) {
if (operator.isReactantOperator()) {
input = operator;
} else if (operator.isProductOperator()) {
output = operator;
}
}
PolylineData line = new PolylineData();
input.getLine().trimEnd(ReactionCellDesignerConverter.RECT_SIZE / 2 - 1);
line.addPoint(pt.copyPoint(input.getLine().getEndPoint()));
if (output instanceof NodeOperator) {
output.getLine().trimEnd(ReactionCellDesignerConverter.RECT_SIZE / 2 - 1);
line.addPoint(pt.copyPoint(output.getLine().getEndPoint()));
} else {
output.getLine().trimBegin(ReactionCellDesignerConverter.RECT_SIZE / 2 - 1);
line.addPoint(pt.copyPoint(output.getLine().getBeginPoint()));
}
reaction.setLine(line);
}
/**
* Creates {@link Reactant} from gpml edge.
*
......
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