From 3e2f8826c6244f4aa26d0d5d9308ba96e57faf15 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 14 Nov 2018 11:05:47 +0100
Subject: [PATCH] proper operator types for specific reaction types

---
 .../layout/ApplySimpleLayoutModelCommand.java      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java
index 6978f94949..c2edd349dc 100644
--- a/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java
+++ b/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java
@@ -26,13 +26,17 @@ import lcsb.mapviewer.model.map.model.Model;
 import lcsb.mapviewer.model.map.reaction.AbstractNode;
 import lcsb.mapviewer.model.map.reaction.AndOperator;
 import lcsb.mapviewer.model.map.reaction.AssociationOperator;
+import lcsb.mapviewer.model.map.reaction.DissociationOperator;
 import lcsb.mapviewer.model.map.reaction.Modifier;
 import lcsb.mapviewer.model.map.reaction.NodeOperator;
 import lcsb.mapviewer.model.map.reaction.Product;
 import lcsb.mapviewer.model.map.reaction.Reactant;
 import lcsb.mapviewer.model.map.reaction.Reaction;
 import lcsb.mapviewer.model.map.reaction.SplitOperator;
+import lcsb.mapviewer.model.map.reaction.TruncationOperator;
+import lcsb.mapviewer.model.map.reaction.type.DissociationReaction;
 import lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction;
+import lcsb.mapviewer.model.map.reaction.type.TruncationReaction;
 import lcsb.mapviewer.model.map.species.Complex;
 import lcsb.mapviewer.model.map.species.Element;
 import lcsb.mapviewer.model.map.species.Species;
@@ -280,9 +284,15 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
   }
 
   private void modifyProducts(Reaction reaction, Point2D middle) {
-    SplitOperator operator = null;
+    NodeOperator operator = null;
     if (reaction.getProducts().size() > 1) {
-      operator = new SplitOperator();
+      if (reaction instanceof DissociationReaction) {
+        operator = new DissociationOperator();
+      } else if (reaction instanceof TruncationReaction) {
+        operator = new TruncationOperator();
+      } else {
+        operator = new SplitOperator();
+      }
       Point2D productPoint = reaction.getProducts().get(0).getElement().getCenter();
       Point2D operatorPoint = getMiddlePoint(middle, productPoint);
       operator.setLine(new PolylineData(middle, operatorPoint));
-- 
GitLab