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

import of structural state works with the new data structure

parent 47679cc5
No related branches found
No related tags found
1 merge request!978Resolve "species states size and position"
......@@ -11,8 +11,7 @@ import org.apache.logging.log4j.Logger;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.common.exception.*;
import lcsb.mapviewer.common.geometry.PointTransformation;
import lcsb.mapviewer.converter.ConverterException;
import lcsb.mapviewer.converter.model.celldesigner.geometry.CellDesignerAliasConverter;
......@@ -338,7 +337,7 @@ public class ModelContructor {
if (species instanceof Protein) {
Protein protein = ((Protein) species);
if (protein.getStructuralState() == null) {
protein.setStructuralState(state.getStructuralState());
protein.setStructuralState(createStructuralState(state, protein));
} else {
logger.warn(state.getWarningPrefix() + " tries to override another state: " + protein.getStructuralState());
}
......@@ -350,6 +349,18 @@ public class ModelContructor {
}
}
private StructuralState createStructuralState(State state, Species species) {
Double x = state.getRelX() * species.getWidth() + species.getX();
Double y = state.getRelY() * species.getHeight() + species.getY();
StructuralState structuralState= new StructuralState();
structuralState.setPosition(new Point2D.Double(x, y));
structuralState.setFontSize(10);
structuralState.setHeight(state.getHeight());
structuralState.setWidth(state.getWidth());
structuralState.setValue(state.getStructuralState());
return structuralState;
}
/**
* {@link ModificationResidue} in element might have slightly off coordinates
* (due to different symbol shapes). For that we need to align them to match our
......
......@@ -351,11 +351,7 @@ public class GPMLToModelTest extends WikipathwaysTestFunctions {
Protein protein = (Protein) model1.getElementsByName("Protein").get(0);
assertEquals(0, protein.getModificationResidues().size());
assertEquals("GTP", protein.getStructuralState());
Model model2 = serializeModelOverCellDesignerParser(model1);
assertEquals(0, mc.compare(model1, model2));
assertNotNull(protein.getStructuralState());
}
}
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