Commit 9d84a793 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

layer elements contain z index

parent c8fb7f9e
......@@ -55,6 +55,11 @@ public class LayerRect implements Serializable {
*/
private Double y = 0.0;
/**
* Z index.
*/
private Integer z;
/**
* Width of the rectangle.
*/
......@@ -239,4 +244,12 @@ public class LayerRect implements Serializable {
public void setHeight(Double height) {
this.height = height;
}
public Integer getZ() {
return z;
}
public void setZ(Integer z) {
this.z = z;
}
}
......@@ -66,6 +66,11 @@ public class LayerText implements Serializable {
*/
private Double y = 0.0;
/**
* Z-index.
*/
private Integer z;
/**
* Width of the rectangle where text is drawn.
*/
......@@ -350,4 +355,12 @@ public class LayerText implements Serializable {
return "[" + this.getClass().getSimpleName() + ": " + this.getNotes() + "]";
}
public Integer getZ() {
return z;
}
public void setZ(Integer z) {
this.z = z;
}
}
-- add z-index to all layer elements
alter table layer_rect_table add column z integer;
alter table layer_oval_table add column z integer;
alter table layer_text_table add column z integer;
with v_layer_text_table as
(
select id, row_number() over (order by width*height desc, id) as rn from layer_text_table
)
update layer_text_table set z = v_layer_text_table.rn
from v_layer_text_table
where layer_text_table.id = v_layer_text_table.id;
with v_layer_oval_table as
(
select id, row_number() over (order by width*height desc, id) as rn from layer_oval_table
)
update layer_oval_table set z = v_layer_oval_table.rn
from v_layer_oval_table
where layer_oval_table.id = v_layer_oval_table.id;
with v_layer_rect_table as
(
select id, row_number() over (order by width*height desc, id) as rn from layer_rect_table
)
update layer_rect_table set z = v_layer_rect_table.rn
from v_layer_rect_table
where layer_rect_table.id = v_layer_rect_table.id;
ALTER TABLE layer_rect_table ALTER COLUMN z SET NOT NULL;
ALTER TABLE layer_oval_table ALTER COLUMN z SET NOT NULL;
ALTER TABLE layer_text_table ALTER COLUMN z SET NOT NULL;
package lcsb.mapviewer.persist;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
......@@ -41,6 +42,7 @@ import org.xml.sax.SAXException;
import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.LayerRect;
import lcsb.mapviewer.model.map.reaction.type.ModulationReaction;
import lcsb.mapviewer.model.map.reaction.type.TransportReaction;
import lcsb.mapviewer.model.map.species.AntisenseRna;
......@@ -384,4 +386,12 @@ public abstract class PersistTestFunctions {
return result;
}
protected LayerRect createRect() {
LayerRect lr = new LayerRect();
lr.setColor(Color.YELLOW);
lr.setZ(0);
return lr;
}
}
......@@ -130,8 +130,7 @@ public class CommentDaoTest extends PersistTestFunctions {
Layer layer = new Layer();
model.addLayer(layer);
LayerRect lr = new LayerRect();
lr.setColor(Color.YELLOW);
LayerRect lr = createRect();
layer.addLayerRect(lr);
Reaction reaction = createReaction();
......
......@@ -175,9 +175,7 @@ public class LayoutDaoTest extends PersistTestFunctions {
Layer layer = new Layer();
model.addLayer(layer);
LayerRect lr = new LayerRect();
lr.setColor(Color.YELLOW);
layer.addLayerRect(lr);
layer.addLayerRect(createRect());
Reaction reaction = createReaction();
reaction.addProduct(new Product(alias));
......
......@@ -431,9 +431,7 @@ public class ModelDaoTest extends PersistTestFunctions {
Layer layer = new Layer();
model.addLayer(layer);
LayerRect lr = new LayerRect();
lr.setColor(Color.YELLOW);
layer.addLayerRect(lr);
layer.addLayerRect(createRect());
Reaction reaction = createReaction();
reaction.addProduct(new Product(alias));
......
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