Commit f9e84a14 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '813-invisible-layer' into 'devel_13.1.x'

Resolve "Network and Empty overlay view show pathways"

See merge request minerva/core!790
parents a02bbd27 b4ce4d37
......@@ -3,6 +3,7 @@ minerva (12.3.1~beta.1) unstable; urgency=low
name was used
* Bug fix: plugin tab header wasn't properly resized after adding plugins
that introduced second line for tab selection (#758)
* Bug fix: invisible layer shouldn't be shown in the on th map (#813)
minerva (13.1.0~beta.0) unstable; urgency=low
* Feature: annotators are more flexible - you can define set of input and
......
......@@ -711,7 +711,9 @@ public abstract class AbstractImageGenerator {
List<Drawable> bioEntities = new ArrayList<>();
bioEntities.addAll(params.getModel().getBioEntities());
for (Layer layer : params.getModel().getLayers()) {
bioEntities.addAll(layer.getDrawables());
if (layer.isVisible()) {
bioEntities.addAll(layer.getDrawables());
}
}
bioEntities.sort(BioEntity.Z_INDEX_COMPARATOR);
......
......@@ -13,6 +13,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import lcsb.mapviewer.model.map.layout.graphics.Layer;
import lcsb.mapviewer.model.map.layout.graphics.LayerRect;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.reaction.Reaction;
......@@ -68,6 +70,33 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions {
}
}
@Test
public void testDrawMapWithInvisibleLayerNesting() throws Exception {
try {
Graphics2D graphics = createGraphicsMock();
Model model = createEmptyModel();
Layer layer = new Layer();
layer.setVisible(false);
LayerRect rect = new LayerRect();
rect.setX(10.0);
rect.setX(10.0);
rect.setWidth(20.);
rect.setHeight(20.);
layer.addLayerRect(rect);
model.addLayer(layer);
AbstractImageGenerator gen = createAbstractImageGeneratorMock(graphics, model);
gen.setParams(new AbstractImageGenerator.Params().model(model).nested(true));
gen.draw();
// 3 times for proteins and 4 times for reaction
verify(graphics, times(0)).draw(any());
} catch (Exception e) {
throw e;
}
}
@Test
public void testDrawSimpleMapWithWhenNestingHidesElement() throws Exception {
try {
......@@ -88,9 +117,7 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions {
}
private Model createSimpleModel() {
Model model = new ModelFullIndexed(null);
model.setWidth(100);
model.setHeight(100);
Model model = createEmptyModel();
GenericProtein protein1 = createProtein();
model.addElement(protein1);
......@@ -110,6 +137,13 @@ public class AbstractImageGeneratorTest extends GraphicsTestFunctions {
return model;
}
private Model createEmptyModel() {
Model model = new ModelFullIndexed(null);
model.setWidth(100);
model.setHeight(100);
return model;
}
private AbstractImageGenerator createAbstractImageGeneratorMock(Graphics2D graphics, Model model) throws Exception {
AbstractImageGenerator result = Mockito.mock(AbstractImageGenerator.class, Mockito.CALLS_REAL_METHODS);
result.setGraphics(graphics);
......
......@@ -87,6 +87,7 @@
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
"optional": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
......@@ -3309,7 +3310,8 @@
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc="
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"optional": true
},
"loose-envify": {
"version": "1.3.1",
......
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