diff --git a/CHANGELOG b/CHANGELOG index de6c94e395a31e8f6d031e288d728252f7d27bf5..c5cf900a9cee9182a729e79e54518cadb1952aae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ minerva (15.0.0~alpha.0) stable; urgency=medium * Improvement: logs provided for validation data model are structurized (#325) + * Small improvement: compartments in not layouted SBML file are more + scattered (#326) * Small improvement: when downloading a map results in too big file (>1MB) the content is compressed and returned as a zip file (#348) * Small improvement: confirmation dialog when removing "general view" diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java index 7af8cb6dffcc6d583770ee267951ef96d8cf5ab9..7cc2f962a95326605f00c3db74b6caa9560b3fcf 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/layout/ApplySimpleLayoutModelCommand.java @@ -31,6 +31,8 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { private static final int SPECIES_WIDTH = 90; private static final int SPECIES_HEIGHT = 30; private static final double COMPLEX_PADDING = 5; + + private double borderOffset = COMPARTMENT_BORDER; /** * Default class logger. */ @@ -113,7 +115,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { Compartment compartment = compartments.iterator().next(); Rectangle2D border = computeCompartmentBorder(compartment, elements, minPoint, dimension); compartment.setBorder(border); - compartment.setNamePoint(border.getX() + COMPARTMENT_BORDER, border.getY() + COMPARTMENT_BORDER); + compartment.setNamePoint(border.getX() + COMPARTMENT_BORDER * 2, border.getY() + COMPARTMENT_BORDER * 2); Point2D point = new Point2D.Double(border.getX(), border.getY()); Dimension2D recursiveDimension = new DoubleDimension(border.getWidth(), border.getHeight()); Set<Element> elementsToModify = new HashSet<>(compartment.getElements()); @@ -170,9 +172,9 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { private Rectangle2D computeCompartmentBorder(Compartment compartment, Collection<Element> elements, Point2D minPoint, Dimension2D dimension) { - Rectangle2D border = new Rectangle2D.Double(minPoint.getX() + COMPARTMENT_BORDER, - minPoint.getY() + COMPARTMENT_BORDER, dimension.getWidth() - COMPARTMENT_BORDER * 2, - dimension.getHeight() - COMPARTMENT_BORDER * 2); + Rectangle2D border = new Rectangle2D.Double(minPoint.getX() + borderOffset, + minPoint.getY() + borderOffset, dimension.getWidth() - borderOffset * 2, + dimension.getHeight() - borderOffset * 2); for (Element element : compartment.getElements()) { if (!elements.contains(element) && element.getBorder() != null && element.getX() != 0 && element.getY() != 0) { border.add(element.getBorder()); @@ -405,6 +407,7 @@ public class ApplySimpleLayoutModelCommand extends ApplyLayoutModelCommand { height = Math.max(height, minPoint.getY() + dimension.getHeight()); model.setWidth(width); model.setHeight(height); + borderOffset = Math.max(borderOffset, Math.max(width, height) * 0.01); } protected Point2D estimateLayoutMinPoint(Model model) {