Skip to content
Snippets Groups Projects
Commit fcaea20d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

moving of modification residues implemented + new coordinates are new objects

parent 2dada21d
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!576Error message improved
......@@ -21,6 +21,8 @@ import lcsb.mapviewer.model.map.reaction.Reactant;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.reaction.ReactionNode;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.field.ModificationResidue;
import lcsb.mapviewer.model.map.species.field.SpeciesWithModificationResidue;
/**
* Command which moves elements in model by dx, dy coordinates.
......@@ -115,7 +117,12 @@ public class MoveElementsCommand extends ModelCommand {
.setNamePoint(((Compartment) alias).getNamePoint().getX() + dx,
((Compartment) alias).getNamePoint().getY() + dy);
}
if (alias instanceof SpeciesWithModificationResidue) {
for (ModificationResidue mr : ((SpeciesWithModificationResidue) alias).getModificationResidues()) {
Point2D position = mr.getPosition();
position.setLocation(position.getX() + dx, position.getY() + dy);
}
}
includeInAffectedRegion(alias);
aliases.add(alias);
......@@ -124,25 +131,25 @@ public class MoveElementsCommand extends ModelCommand {
for (Reactant node : reaction.getReactants()) {
for (int i = 1; i < node.getLine().getPoints().size(); i++) {
Point2D point = node.getLine().getPoints().get(i);
point.setLocation(point.getX() + dx, point.getY() + dy);
node.getLine().getPoints().set(i, new Point2D.Double(point.getX() + dx, point.getY() + dy));
}
}
for (Product node : reaction.getProducts()) {
for (int i = 0; i < node.getLine().getPoints().size() - 1; i++) {
Point2D point = node.getLine().getPoints().get(i);
point.setLocation(point.getX() + dx, point.getY() + dy);
node.getLine().getPoints().set(i, new Point2D.Double(point.getX() + dx, point.getY() + dy));
}
}
for (Modifier node : reaction.getModifiers()) {
for (int i = 1; i < node.getLine().getPoints().size(); i++) {
Point2D point = node.getLine().getPoints().get(i);
point.setLocation(point.getX() + dx, point.getY() + dy);
node.getLine().getPoints().set(i, new Point2D.Double(point.getX() + dx, point.getY() + dy));
}
}
for (NodeOperator node : reaction.getOperators()) {
for (int i = 0; i < node.getLine().getPoints().size(); i++) {
Point2D point = node.getLine().getPoints().get(i);
point.setLocation(point.getX() + dx, point.getY() + dy);
node.getLine().getPoints().set(i, new Point2D.Double(point.getX() + dx, point.getY() + dy));
}
}
includeInAffectedRegion(reaction);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment