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
Devrim Gunyel
core
Commits
7f602263
Commit
7f602263
authored
Jun 07, 2019
by
Piotr Gawron
Browse files
Merge branch '825-glyph-review' into 'devel_13.1.x'
pathways can be drawn using glyphs See merge request
!802
parents
2887b1e1
ec7dad53
Changes
6
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
7f602263
...
...
@@ -28,6 +28,7 @@ minerva (12.3.1~beta.1) unstable; urgency=low
close
button
twice
(#
818
)
*
Bug
fix
:
empty
type
for
data
overlay
is
allowed
(#
827
)
*
Bug
fix
:
genetic
variants
data
overlay
was
ignoring
color
parameter
(#
827
)
*
Bug
fix
:
pathways
can
be
drawn
using
glyphs
(#
825
)
minerva
(
13.1.0
~
beta
.0
)
unstable
;
urgency
=
low
*
Feature
:
annotators
are
more
flexible
-
you
can
define
set
of
input
and
...
...
converter/src/main/java/lcsb/mapviewer/converter/ProjectFactory.java
View file @
7f602263
...
...
@@ -18,8 +18,11 @@ import lcsb.mapviewer.converter.zip.LayoutZipEntryFile;
import
lcsb.mapviewer.converter.zip.ZipEntryFile
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.map.layout.graphics.Glyph
;
import
lcsb.mapviewer.model.map.layout.graphics.Layer
;
import
lcsb.mapviewer.model.map.layout.graphics.LayerText
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.ModelSubmodelConnection
;
import
lcsb.mapviewer.model.map.species.Element
;
public
class
ProjectFactory
{
...
...
@@ -90,7 +93,15 @@ public class ProjectFactory {
}
private
void
assignGlyphsToElements
(
Project
project
)
throws
InvalidGlyphFile
{
Set
<
ModelData
>
models
=
new
HashSet
<>();
models
.
addAll
(
project
.
getModels
());
for
(
ModelData
model
:
project
.
getModels
())
{
for
(
ModelSubmodelConnection
connection
:
model
.
getSubmodels
())
{
models
.
add
(
connection
.
getSubmodel
());
}
}
for
(
ModelData
model
:
models
)
{
for
(
Element
element
:
model
.
getElements
())
{
Glyph
glyph
=
extractGlyph
(
project
,
element
.
getNotes
());
if
(
glyph
!=
null
)
{
...
...
@@ -98,6 +109,15 @@ public class ProjectFactory {
element
.
setGlyph
(
glyph
);
}
}
for
(
Layer
layer
:
model
.
getLayers
())
{
for
(
LayerText
text
:
layer
.
getTexts
())
{
Glyph
glyph
=
extractGlyph
(
project
,
text
.
getNotes
());
if
(
glyph
!=
null
)
{
text
.
setNotes
(
removeGlyph
(
text
.
getNotes
()));
text
.
setGlyph
(
glyph
);
}
}
}
}
}
...
...
converter/src/test/java/lcsb/mapviewer/converter/ProjectFactoryTest.java
View file @
7f602263
...
...
@@ -23,6 +23,8 @@ import lcsb.mapviewer.model.Project;
import
lcsb.mapviewer.model.map.OverviewImage
;
import
lcsb.mapviewer.model.map.OverviewLink
;
import
lcsb.mapviewer.model.map.OverviewModelLink
;
import
lcsb.mapviewer.model.map.layout.graphics.Layer
;
import
lcsb.mapviewer.model.map.layout.graphics.LayerText
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.ModelFullIndexed
;
...
...
@@ -211,6 +213,53 @@ public class ProjectFactoryTest extends ConverterTestFunctions {
}
@Test
public
void
testParseGlyphsAndPutThemAsTextGlyphs
()
throws
Exception
{
try
{
Model
model
=
new
ModelFullIndexed
(
null
);
Layer
layer
=
new
Layer
();
LayerText
text
=
new
LayerText
();
text
.
setNotes
(
"Glyph: glyphs/g1.png"
);
layer
.
addLayerText
(
text
);
model
.
addLayer
(
layer
);
MockConverter
.
modelToBeReturned
=
model
;
ComplexZipConverter
converter
=
new
ComplexZipConverter
(
MockConverter
.
class
);
ProjectFactory
projectFactory
=
new
ProjectFactory
(
converter
);
ComplexZipConverterParams
params
=
new
ComplexZipConverterParams
();
params
.
zipFile
(
new
ZipFile
(
"testFiles/complex_with_glyphs.zip"
));
params
.
entry
(
new
ModelZipEntryFile
(
"main.xml"
,
"main"
,
true
,
false
,
null
));
ZipFile
zipFile
=
new
ZipFile
(
"testFiles/complex_with_glyphs.zip"
);
ZipEntryFileFactory
factory
=
new
ZipEntryFileFactory
();
Enumeration
<?
extends
ZipEntry
>
entries
=
zipFile
.
entries
();
while
(
entries
.
hasMoreElements
())
{
ZipEntry
entry
=
entries
.
nextElement
();
if
(!
entry
.
isDirectory
())
{
params
.
entry
(
factory
.
createZipEntryFile
(
entry
,
zipFile
));
}
}
Project
project
=
projectFactory
.
create
(
params
);
assertNotNull
(
project
);
model
=
project
.
getModels
().
iterator
().
next
().
getModel
();
LayerText
fetchedProtein
=
model
.
getLayers
().
iterator
().
next
().
getTexts
().
get
(
0
);
assertFalse
(
"Glyph field should be removed from notes"
,
fetchedProtein
.
getNotes
().
contains
(
"Glyph"
));
assertNotNull
(
"Glyph in the protein is not defined but should"
,
fetchedProtein
.
getGlyph
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
private
GenericProtein
createProtein
()
{
GenericProtein
result
=
new
GenericProtein
(
"s"
+
elementCounter
++);
return
result
;
...
...
model-command/src/main/java/lcsb/mapviewer/commands/CreateHierarchyCommand.java
View file @
7f602263
...
...
@@ -43,11 +43,11 @@ public class CreateHierarchyCommand extends ModelCommand {
private
static
final
double
LOG_4
=
Math
.
log
(
4
);
/**
* Top left corner x coordinate of the text associated with comp
r
atment.
* Top left corner x coordinate of the text associated with compa
r
tment.
*/
private
static
final
double
DEFAULT_TITLE_X_COORD_IN_ARTIFITIAL_COMPARTMENT
=
10
;
/**
* Top left corner y coordinate of the text associated with comp
r
atment.
* Top left corner y coordinate of the text associated with compa
r
tment.
*/
private
static
final
double
DEFAULT_TITLE_Y_COORD_IN_ARTIFITIAL_COMPARTMENT
=
10
;
...
...
@@ -180,6 +180,7 @@ public class CreateHierarchyCommand extends ModelCommand {
compartment
.
setName
(
extractNameFromText
(
text
.
getNotes
()));
compartment
.
setNotes
(
extractNotesFromText
(
text
.
getNotes
()));
compartment
.
setZ
(
text
.
getZ
());
compartment
.
setGlyph
(
text
.
getGlyph
());
rap
.
processNotes
(
compartment
);
compartment
.
setNamePoint
(
new
Point2D
.
Double
(
text
.
getX
()
+
DEFAULT_TITLE_X_COORD_IN_ARTIFITIAL_COMPARTMENT
,
...
...
model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/LayerText.java
View file @
7f602263
...
...
@@ -5,9 +5,11 @@ import java.awt.geom.Rectangle2D;
import
java.io.Serializable
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.ManyToOne
;
import
org.apache.log4j.Logger
;
...
...
@@ -92,6 +94,12 @@ public class LayerText implements Serializable, Drawable {
*/
private
Double
fontSize
=
DEFAULT_LAYER_FONT_SIZE
;
/**
* Glyph used for drawing (instead of text).
*/
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
private
Glyph
glyph
=
null
;
/**
* Default constructor.
*/
...
...
@@ -130,6 +138,9 @@ public class LayerText implements Serializable, Drawable {
height
=
layerText
.
getHeight
();
notes
=
layerText
.
getNotes
();
fontSize
=
layerText
.
getFontSize
();
if
(
layerText
.
getGlyph
()
!=
null
)
{
setGlyph
(
new
Glyph
(
layerText
.
getGlyph
()));
}
}
/**
...
...
@@ -377,4 +388,12 @@ public class LayerText implements Serializable, Drawable {
return
"x="
+
x
+
";y="
+
y
+
"; w="
+
width
+
", h="
+
height
;
}
public
Glyph
getGlyph
()
{
return
glyph
;
}
public
void
setGlyph
(
Glyph
glyph
)
{
this
.
glyph
=
glyph
;
}
}
persist/src/main/resources/db/migration/13.1.0~beta.1/V13.1.0.20190607__text_contains_glyph.sql
0 → 100644
View file @
7f602263
alter
table
layer_text_table
add
column
glyph_id
integer
;
alter
table
layer_text_table
add
constraint
layer_text_table_glyph_fk
FOREIGN
KEY
(
glyph_id
)
REFERENCES
glyph_table
(
id
)
MATCH
SIMPLE
ON
UPDATE
NO
ACTION
ON
DELETE
NO
ACTION
;
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