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

when copying element fon't forget about glyph

parent 3f299d06
No related branches found
No related tags found
1 merge request!768Resolve "Custom images as overlay levels or background"
......@@ -53,13 +53,29 @@ public class Glyph implements Serializable {
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "file_entry_id")
private UploadedFileEntry file;
/**
* Project in which this glyph is available.
*/
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Project project;
/**
* Default constructor.
*/
public Glyph() {
}
/**
* Constructor that creates copy of the element.
*
* @param original element to be copied
*/
public Glyph(Glyph original) {
// we should reference to the same file
setFile(file);
}
public UploadedFileEntry getFile() {
return file;
}
......
......@@ -302,6 +302,7 @@ public abstract class Element implements BioEntity, Serializable, SbmlArgument {
this.formula = original.getFormula();
setVisibilityLevel(original.getVisibilityLevel());
setTransparencyLevel(original.getTransparencyLevel());
setGlyph(new Glyph(original.getGlyph()));
}
/**
......
......@@ -25,6 +25,7 @@ import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.SearchIndex;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.Glyph;
import lcsb.mapviewer.model.map.layout.graphics.LayerText;
import lcsb.mapviewer.model.map.model.ElementSubmodelConnection;
import lcsb.mapviewer.model.map.model.Model;
......@@ -98,19 +99,36 @@ public class ElementTest extends ModelTestFunctions {
assertEquals(Math.sqrt(200), distance, EPSILON);
}
@Test
public void testConstructor() {
try {
GenericProtein protein = new GenericProtein();
protein.addSearchIndex(new SearchIndex());
protein.setSubmodel(new ElementSubmodelConnection());
Element copy = new GenericProtein(protein);
assertNotNull(copy);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testConstructor() {
try {
GenericProtein protein = new GenericProtein();
protein.addSearchIndex(new SearchIndex());
protein.setSubmodel(new ElementSubmodelConnection());
Element copy = new GenericProtein(protein);
assertNotNull(copy);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testCopyGlyph() {
try {
GenericProtein protein = new GenericProtein();
protein.addSearchIndex(new SearchIndex());
protein.setSubmodel(new ElementSubmodelConnection());
protein.setGlyph(new Glyph());
Element copy = new GenericProtein(protein);
assertNotNull(copy.getGlyph());
ElementComparator comparator = new ElementComparator();
assertEquals(0, comparator.compare(copy, protein));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test
public void testIncreaseBorder() {
......
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