Commit 13de138c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

glyph text is not ignored

parent af397630
Pipeline #28857 passed with stage
in 11 minutes and 57 seconds
......@@ -8,6 +8,8 @@ minerva (15.1.0) unstable; urgency=medium
(#1254)
* Small improvement: in SBML render stroke color for glyphs is used for
defining font color
* Small improvement: when SBML with layout contains different glyph text and
species name those two values are assigned to name and full name (#1275)
* Bug fix: export to image from selected polygon contained all elements
inside rectangle bounded by the polygon coordinates (#1096)
* Bug fix: continuous refreshing list of project when uploading/removing
......
......@@ -162,6 +162,19 @@ public abstract class SbmlElementParser<T extends org.sbml.jsbml.Symbol> extends
}
}
source.setNamePoint(new Point2D.Double(x, y));
if (textGlyph.isSetText() && textGlyph.getText() != null && !textGlyph.getText().isEmpty()) {
String name = textGlyph.getText();
if (!name.equals(source.getName())) {
if (source.getFullName() == null || source.getFullName().isEmpty()
|| source.getFullName().equals(source.getName())) {
source.setFullName(source.getName());
source.setName(name);
} else {
logger.warn(new LogMarker(ProjectLogEntryType.PARSING_ISSUE, source),
"Glyph text ignored because name and full name already assigned");
}
}
}
}
}
}
......
......@@ -264,4 +264,13 @@ public class SbmlParserTest extends SbmlTestFunctions {
Model m = parser.createModel(new ConverterParams().filename("testFiles/layoutExample/reaction_with_duplicated_product.xml"));
assertNotNull(m.getReactions().iterator().next().getKinetics());
}
@Test
public void testLayoutContainDifferentNameThanSpecies() throws Exception {
Model m = parser.createModel(new ConverterParams().filename("testFiles/small/different_name_fullname.xml"));
Species species = m.getElementByElementId("sa1");
assertEquals("SNCA", species.getName());
assertEquals("Synuclein Alpha", species.getFullName());
}
}
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created by minerva version Unknown on 2020-06-24 at 08:44:19 CEST with JSBML version 1.4. -->
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" layout:required="false" level="3" multi:required="true" render:required="false" version="2" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" xmlns:multi="http://www.sbml.org/sbml/level3/version1/multi/version1" xmlns:render="http://www.sbml.org/sbml/level3/version1/render/version1">
<model id="id1" name="UNKNOWN DISEASE MAP">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#id1">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
<layout:listOfLayouts xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<layout:layout layout:id="minerva_layout">
<render:listOfRenderInformation xmlns:render="http://www.sbml.org/sbml/level3/version1/render/version1">
<render:renderInformation render:id="minerva_definitions">
<render:listOfColorDefinitions>
<render:colorDefinition render:id="color_FFFFFFFF" render:value="#FFFFFFFF"/>
<render:colorDefinition render:id="color_FF000000" render:value="#000000FF"/>
</render:listOfColorDefinitions>
<render:listOfStyles>
<render:style render:idList="sa1">
<render:g render:fill="color_FFFFFFFF" render:font-size="12" render:stroke-width="1.0">
<render:rectangle render:height="100%" render:rx="0%" render:ry="0%" render:stroke="color_FF000000" render:width="100%" render:x="0%" render:y="0%"/>
</render:g>
</render:style>
<render:style render:idList="text_sa1">
<render:g render:stroke="color_FF000000" render:text-anchor="start" render:vtext-anchor="middle"/>
</render:style>
</render:listOfStyles>
</render:renderInformation>
</render:listOfRenderInformation>
<layout:dimensions layout:height="1000" layout:width="1000"/>
<layout:listOfCompartmentGlyphs>
<layout:compartmentGlyph layout:compartment="default" layout:id="default_compartment">
<layout:boundingBox>
<layout:position layout:x="0" layout:y="0" layout:z="0"/>
<layout:dimensions layout:height="1000" layout:width="1000"/>
</layout:boundingBox>
</layout:compartmentGlyph>
</layout:listOfCompartmentGlyphs>
<layout:listOfSpeciesGlyphs>
<layout:speciesGlyph layout:id="sa1" layout:species="species_0">
<layout:boundingBox>
<layout:position layout:x="10" layout:y="10" layout:z="123"/>
<layout:dimensions layout:height="10" layout:width="10"/>
</layout:boundingBox>
</layout:speciesGlyph>
</layout:listOfSpeciesGlyphs>
<layout:listOfReactionGlyphs>
</layout:listOfReactionGlyphs>
<layout:listOfTextGlyphs>
<layout:textGlyph layout:id="text_sa1" layout:originOfText="sa1" layout:text="SNCA">
<layout:boundingBox>
<layout:position layout:x="15" layout:y="10" layout:z="124"/>
<layout:dimensions layout:height="10" layout:width="10"/>
</layout:boundingBox>
</layout:textGlyph>
</layout:listOfTextGlyphs>
</layout:layout>
</layout:listOfLayouts>
<listOfCompartments>
<compartment constant="false" id="default" multi:isType="false" size="1" spatialDimensions="3">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#default">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
</compartment>
</listOfCompartments>
<listOfSpecies>
<species boundaryCondition="false" compartment="default" constant="false" hasOnlySubstanceUnits="false" id="species_0" initialConcentration="0" multi:speciesType="minerva_species_type_GenericProtein" name="Synuclein Alpha" sboTerm="SBO:0000252">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#species_0">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
</listOfReactions>
</model>
</sbml>
Supports Markdown
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