Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
4c70aff2
Commit
4c70aff2
authored
Jun 26, 2020
by
Piotr Gawron
Browse files
raise warnings when necessary
parent
c358fb5c
Pipeline
#29002
passed with stage
in 16 minutes and 23 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
4c70aff2
...
...
@@ -17,6 +17,8 @@ minerva (15.1.0) unstable; urgency=medium
exported
to
SBGN
PD
(#
1302
)
*
Small
improvement
:
Unknown
Transition
Reaction
is
exported
to
GPML
as
CONVERSION
(#
1300
)
*
Small
improvement
:
when
uploading
complex
map
with
images
warnings
are
raised
if
images
are
not
referenced
in
coords
.
txt
file
(#
1308
)
*
Bug
fix
:
export
to
image
from
selected
polygon
contained
all
elements
inside
rectangle
bounded
by
the
polygon
coordinates
(#
1096
)
*
Bug
fix
:
continuous
refreshing
list
of
project
when
uploading
/
removing
...
...
converter/src/main/java/lcsb/mapviewer/converter/OverviewParser.java
View file @
4c70aff2
package
lcsb.mapviewer.converter
;
import
java.awt.
*
;
import
java.awt.
Polygon
;
import
java.awt.geom.Area
;
import
java.awt.geom.Point2D
;
import
java.awt.image.BufferedImage
;
import
java.io.*
;
import
java.util.*
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
...
...
@@ -350,6 +349,30 @@ public class OverviewParser {
}
}
if
(
images
.
size
()
>
1
)
{
Set
<
OverviewImage
>
usedImages
=
new
HashSet
<>();
Set
<
OverviewImage
>
childImages
=
new
HashSet
<>();
for
(
OverviewImage
image
:
images
)
{
if
(
image
.
getLinks
().
size
()
>
0
)
{
usedImages
.
add
(
image
);
}
for
(
OverviewLink
link
:
image
.
getLinks
())
{
if
(
link
instanceof
OverviewImageLink
)
{
usedImages
.
add
(((
OverviewImageLink
)
link
).
getLinkedOverviewImage
());
childImages
.
add
(((
OverviewImageLink
)
link
).
getLinkedOverviewImage
());
}
}
}
for
(
OverviewImage
image
:
images
)
{
if
(!
usedImages
.
contains
(
image
))
{
logger
.
warn
(
"Image is not referenced in coordinates file: "
+
image
.
getFilename
());
}
}
if
(
images
.
size
()
>
childImages
.
size
()
+
1
)
{
logger
.
warn
(
"In coords.txt, more than one image can be the starting one for 'Show overview',"
+
" picking at random."
);
}
}
}
/**
...
...
converter/src/test/java/lcsb/mapviewer/converter/OverviewParserTest.java
View file @
4c70aff2
...
...
@@ -230,4 +230,33 @@ public class OverviewParserTest extends ConverterTestFunctions {
assertEquals
(
1
,
oi2
.
getLinks
().
size
());
}
@Test
public
void
testParseValidComplexCoordinatesWithExtraImages
()
throws
Exception
{
String
invalidCoordinates
=
FileUtils
.
readFileToString
(
new
File
(
"testFiles/coordinates.txt"
),
"UTF-8"
);
Set
<
Model
>
models
=
createValidTestMapModel
();
List
<
OverviewImage
>
images
=
new
ArrayList
<>();
OverviewImage
oi
=
new
OverviewImage
();
oi
.
setFilename
(
"test.png"
);
oi
.
setWidth
(
1000
);
oi
.
setHeight
(
1000
);
images
.
add
(
oi
);
OverviewImage
oi2
=
new
OverviewImage
();
oi2
.
setFilename
(
"test2.png"
);
oi2
.
setWidth
(
1000
);
oi2
.
setHeight
(
1000
);
images
.
add
(
oi2
);
OverviewImage
oi3
=
new
OverviewImage
();
oi3
.
setFilename
(
"test2.png"
);
oi3
.
setWidth
(
1000
);
oi3
.
setHeight
(
1000
);
images
.
add
(
oi3
);
parser
.
processCoordinates
(
models
,
images
,
invalidCoordinates
);
assertEquals
(
2
,
super
.
getWarnings
().
size
());
}
}
model/src/test/java/lcsb/mapviewer/model/map/OverviewLinkComparatorTest.java
View file @
4c70aff2
...
...
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.junit.*
;
import
org.mockito.Mockito
;
import
lcsb.mapviewer.ModelTestFunctions
;
import
lcsb.mapviewer.common.exception.NotImplementedException
;
...
...
@@ -33,21 +34,12 @@ public class OverviewLinkComparatorTest extends ModelTestFunctions {
@Test
(
expected
=
NotImplementedException
.
class
)
public
void
testInvalid
()
throws
Exception
{
class
Tmp
extends
OverviewLink
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
OverviewLink
copy
()
{
return
null
;
}
}
;
OverviewLinkComparator
omlc
=
new
OverviewLinkComparator
();
OverviewLink
oml
=
new
Tmp
();
OverviewLink
oml2
=
new
Tmp
();
OverviewLink
oml
=
Mockito
.
mock
(
OverviewLink
.
class
);
omlc
.
compare
(
oml
,
oml
2
);
omlc
.
compare
(
oml
,
oml
);
}
@Test
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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