Commit 7cc8ba6b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

modification residues were not layouted inside complexes

parent 06772034
......@@ -3,6 +3,8 @@ minerva (14.0.3) stable; urgency=medium
due to problems with identifiers used by SBGN (#1006)
* Bug fix: upload of data overlay with conflicting overlay types caused error
(#998)
* Bug fix: upload of sbml file with protein modifications inside complex
crashed visualization (#966)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 06 Nov 2019 12:00:00 +0200
......
......@@ -318,9 +318,12 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand {
element.setX(elementCenterX - SPECIES_WIDTH / 2);
element.setY(elementCenterY - SPECIES_HEIGHT / 2);
index++;
if (element instanceof SpeciesWithModificationResidue) {
modifyElementModificationResiduesLocation((SpeciesWithModificationResidue) element);
}
}
}
for (Species element : speciesList) {
if (element instanceof SpeciesWithModificationResidue) {
modifyElementModificationResiduesLocation((SpeciesWithModificationResidue) element);
}
}
......
......@@ -19,6 +19,7 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.reaction.*;
import lcsb.mapviewer.model.map.reaction.type.TransportReaction;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.map.species.field.BindingRegion;
import lcsb.mapviewer.model.map.species.field.Residue;
public class ApplySimpleLayoutModelCommandTest extends CommandTestFunctions {
......@@ -198,6 +199,27 @@ public class ApplySimpleLayoutModelCommandTest extends CommandTestFunctions {
}
@Test
public void testModifyResiduesLocationInComplex() {
ApplySimpleLayoutModelCommand layoutModelCommand = new ApplySimpleLayoutModelCommand(null);
GenericProtein p1 = createProtein();
Complex c1 = createComplex();
c1.addSpecies(p1);
BindingRegion r = new BindingRegion();
p1.addBindingRegion(r);
Set<Species> elements = new HashSet<>();
elements.add(p1);
elements.add(c1);
layoutModelCommand.modifySpeciesListLocation(elements, new Point2D.Double(100, 100), new DoubleDimension(200, 200));
assertTrue(p1.getX() >= 100);
assertTrue(p1.getY() >= 100);
assertTrue(p1.getBorder().getMaxX() <= 300);
assertTrue(p1.getBorder().getMaxY() <= 300);
assertNotNull(r.getPosition());
}
@Test
public void testModifyElementLocation() {
ApplySimpleLayoutModelCommand layoutModelCommand = new ApplySimpleLayoutModelCommand(null);
......
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