Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
8373beb0
Commit
8373beb0
authored
May 10, 2019
by
Piotr Gawron
Browse files
when copying element fon't forget about glyph
parent
3f299d06
Changes
3
Hide whitespace changes
Inline
Side-by-side
model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Glyph.java
View file @
8373beb0
...
...
@@ -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
;
}
...
...
model/src/main/java/lcsb/mapviewer/model/map/species/Element.java
View file @
8373beb0
...
...
@@ -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
()));
}
/**
...
...
model/src/test/java/lcsb/mapviewer/model/map/species/ElementTest.java
View file @
8373beb0
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment