Commit 2ae42db3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when parsing sbgn file z-index is automatically assigned

parent 6c7454a0
......@@ -24,6 +24,7 @@ import org.sbgn.bindings.Sbgn;
import lcsb.mapviewer.common.comparator.DoubleComparator;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.ZIndexPopulator;
import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SpeciesConverter;
import lcsb.mapviewer.converter.model.celldesigner.geometry.CellDesignerAliasConverter;
import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType;
......@@ -185,6 +186,8 @@ public class SbgnmlXmlParser {
}
}
}
new ZIndexPopulator().populateZIndex(model);
return model;
}
......
......@@ -43,16 +43,33 @@ public class SbgnmlXmlParserTest2 {
@Test
public void createModelWithCompartmentsTest() throws Exception {
try {
Converter converter = new SbgnmlXmlConverter();
Model model = converter
.createModel(new ConverterParams().filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/elements_inside_compartment.xml"));
Complex complexInsideCompartment = model.getElementByElementId("csa1830");
assertNotNull("Complex inside compartment has undefined compartment", complexInsideCompartment.getCompartment());
Complex complexOutsideCompartment = model.getElementByElementId("csa1831");
assertNull("Complex outside compartment has not null compartment",complexOutsideCompartment.getCompartment());
Compartment compartment = model.getElementByElementId("ca107");
assertNull("Top compartment has not null compartment", compartment.getCompartment());
Converter converter = new SbgnmlXmlConverter();
Model model = converter
.createModel(new ConverterParams()
.filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/elements_inside_compartment.xml"));
Complex complexInsideCompartment = model.getElementByElementId("csa1830");
assertNotNull("Complex inside compartment has undefined compartment", complexInsideCompartment.getCompartment());
Complex complexOutsideCompartment = model.getElementByElementId("csa1831");
assertNull("Complex outside compartment has not null compartment", complexOutsideCompartment.getCompartment());
Compartment compartment = model.getElementByElementId("ca107");
assertNull("Top compartment has not null compartment", compartment.getCompartment());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void createModelWithZIndex() throws Exception {
try {
Converter converter = new SbgnmlXmlConverter();
Model model = converter
.createModel(new ConverterParams()
.filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/elements_inside_compartment.xml"));
Complex complex = model.getElementByElementId("csa1830");
assertNotNull(complex.getZ());
} catch (Exception e) {
e.printStackTrace();
throw e;
......
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