Commit d37e6e5d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

boolean gate operator has non zero line

parent 345b351b
......@@ -676,7 +676,7 @@ public class ReactionFromXml {
operator.getLine().trimEnd(ReactionCellDesignerConverter.RECT_SIZE / 2 - 1);
result.addNode(operator);
PolylineData centerLine = new PolylineData();
centerLine.addPoint(reactant.getLine().getEndPoint());
centerLine.addPoint(operator.getLine().getEndPoint());
......@@ -894,11 +894,11 @@ public class ReactionFromXml {
product.getLine().getEndAtd().setArrowType(ArrowType.FULL);
result.addNode(andOperator);
PolylineData centerLine = new PolylineData();
centerLine.addPoint(pointTransformation.copyPoint(andOperator.getLine().getEndPoint()));
centerLine.addPoint(pointTransformation.copyPoint(product.getLine().getBeginPoint()));
result.setLine(centerLine);
} else {
NodeOperator operator = null;
......@@ -935,15 +935,30 @@ public class ReactionFromXml {
operator.addInputs(andOperator.getInputs());
// empty line
//operator line
PolylineData line = new PolylineData();
line.addPoint(product.getLine().getBeginPoint());
line.addPoint(product.getLine().getBeginPoint());
line.addPoint(pointTransformation.copyPoint(product.getLine().getBeginPoint()));
double secondX = (product.getLine().getPoints().get(1).getX() + product.getLine().getPoints().get(0).getX())*0.4;
double secondY = (product.getLine().getPoints().get(1).getY() + product.getLine().getPoints().get(0).getY())*0.4;
double thirdX = (product.getLine().getPoints().get(1).getX() + product.getLine().getPoints().get(0).getX())*0.6;
double thirdY = (product.getLine().getPoints().get(1).getY() + product.getLine().getPoints().get(0).getY())*0.6;
Point2D secondPoint = new Point2D.Double(secondX, secondY);
Point2D thirdPoint = new Point2D.Double(thirdX, thirdY);
line.addPoint(pointTransformation.copyPoint(secondPoint));
operator.setLine(line);
//center line
PolylineData centerLine = new PolylineData();
centerLine.addPoint(pointTransformation.copyPoint(secondPoint));
centerLine.addPoint(pointTransformation.copyPoint(thirdPoint));
result.setLine(centerLine);
//product line is not trimmed
product.getLine().getPoints().get(0).setLocation(thirdPoint);
result.addNode(operator);
}
}
/**
......
......@@ -1689,7 +1689,7 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(0.0, reaction.getReactants().get(0).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getReactants().get(1).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getProducts().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getOperators().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
CellDesignerXmlParser cellDesignerXmlParser = new CellDesignerXmlParser();
......@@ -1702,11 +1702,6 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
ModelComparator mc = new ModelComparator();
assertEquals("After CellDesigner xml serialization models are different", 0, mc.compare(model, model2));
// NormalImageGenerator generator = new NormalImageGenerator(1, 0, 0,
// 1024, 1024, model, true, false, 0, false);
// generator.saveToPNG("tmp.png");
// Desktop.getDesktop().open(new File("tmp.png"));
} catch (Exception e) {
e.printStackTrace();
throw e;
......@@ -1728,12 +1723,7 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(0.0, reaction.getReactants().get(0).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getReactants().get(1).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getProducts().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
// NormalImageGenerator generator = new NormalImageGenerator(1, 0, 0,
// 1024, 1024, model, true, false, 0, false);
// generator.saveToPNG("tmp.png");
// Desktop.getDesktop().open(new File("tmp.png"));
assertEquals(0.0, reaction.getOperators().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
} catch (Exception e) {
e.printStackTrace();
......@@ -1756,12 +1746,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(0.0, reaction.getReactants().get(0).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getReactants().get(1).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getProducts().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getOperators().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
// NormalImageGenerator generator = new NormalImageGenerator(1, 0, 0,
// 1024, 1024, model, true, false, 0, false);
// generator.saveToPNG("tmp.png");
// Desktop.getDesktop().open(new File("tmp.png"));
assertNotNull(reaction.getLine());
} catch (Exception e) {
e.printStackTrace();
......@@ -1784,12 +1771,7 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(0.0, reaction.getReactants().get(0).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getReactants().get(1).getLine().getEndPoint().distance(200.0, 127.0), EPSILON);
assertEquals(0.0, reaction.getProducts().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
// NormalImageGenerator generator = new NormalImageGenerator(1, 0, 0,
// 1024, 1024, model, true, false, 0, false);
// generator.saveToPNG("tmp.png");
// Desktop.getDesktop().open(new File("tmp.png"));
assertEquals(0.0, reaction.getOperators().get(0).getLine().getBeginPoint().distance(200.0, 127.0), EPSILON);
} catch (Exception e) {
e.printStackTrace();
......
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