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
4d294c53
Commit
4d294c53
authored
Apr 09, 2018
by
Piotr Gawron
Browse files
markers pointing to reaction that are surfaces are forced to be markers with default icon
parent
fd7eb0ac
Pipeline
#4453
passed with stage
in 1 minute and 30 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend-js/package-lock.json
View file @
4d294c53
...
...
@@ -45,38 +45,30 @@
"litemol"
:
"github:dsehnal/LiteMol#67556b0de0d2428f9494136758cbf8a662f66412"
},
"dependencies"
:
{
"ProtVista"
:
{
"version"
:
"git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e"
,
"dev"
:
true
,
"requires"
:
{
"d3"
:
"3.5.17"
,
"file-saver"
:
"1.3.3"
,
"jquery"
:
"2.2.4"
,
"jszip"
:
"3.1.4"
,
"underscore"
:
"1.8.3"
},
"dependencies"
:
{
"jquery"
:
{
"version"
:
"2.2.4"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz"
,
"integrity"
:
"sha1-LInWiJterFIqfuoywUUhVZxsvwI="
,
"dev"
:
true
}
}
},
"jquery"
:
{
"version"
:
"3.3.1"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz"
,
"integrity"
:
"sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
,
"dev"
:
true
},
"litemol"
:
{
"version"
:
"github:dsehnal/LiteMol#67556b0de0d2428f9494136758cbf8a662f66412"
,
"dev"
:
true
,
"requires"
:
{
"@types/react"
:
"15.6.15"
,
"@types/react-dom"
:
"15.5.7"
}
}
}
},
"ProtVista"
:
{
"version"
:
"git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e"
,
"dev"
:
true
,
"requires"
:
{
"d3"
:
"3.5.17"
,
"file-saver"
:
"1.3.3"
,
"jquery"
:
"2.2.4"
,
"jszip"
:
"3.1.4"
,
"underscore"
:
"1.8.3"
},
"dependencies"
:
{
"jquery"
:
{
"version"
:
"2.2.4"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz"
,
"integrity"
:
"sha1-LInWiJterFIqfuoywUUhVZxsvwI="
,
"dev"
:
true
}
}
},
...
...
@@ -2058,6 +2050,14 @@
"immediate"
:
"3.0.6"
}
},
"litemol"
:
{
"version"
:
"github:dsehnal/LiteMol#67556b0de0d2428f9494136758cbf8a662f66412"
,
"dev"
:
true
,
"requires"
:
{
"@types/react"
:
"15.6.15"
,
"@types/react-dom"
:
"15.5.7"
}
},
"lodash"
:
{
"version"
:
"4.17.4"
,
"resolved"
:
"https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz"
,
...
...
frontend-js/src/main/js/map/CustomMap.js
View file @
4d294c53
...
...
@@ -705,7 +705,7 @@ CustomMap.prototype.renderOverlayCollection = function (params) {
var
submaps
=
self
.
getSubmaps
().
concat
([
self
]);
return
overlayCollection
.
getIdentifiedElements
().
then
(
function
(
identifiedElements
)
{
return
self
.
appendElementsPointingToSubmap
(
identifiedElements
);
return
self
.
appendElementsPointingToSubmap
(
identifiedElements
,
overlayCollection
);
}).
then
(
function
(
identifiedElements
)
{
elements
=
identifiedElements
;
var
promises
=
[];
...
...
@@ -735,7 +735,7 @@ CustomMap.prototype.renderOverlayCollection = function (params) {
});
};
CustomMap
.
prototype
.
appendElementsPointingToSubmap
=
function
(
identifiedElements
)
{
CustomMap
.
prototype
.
appendElementsPointingToSubmap
=
function
(
identifiedElements
,
overlayDb
)
{
var
self
=
this
;
var
existingElements
=
{};
var
i
;
...
...
@@ -750,7 +750,12 @@ CustomMap.prototype.appendElementsPointingToSubmap = function (identifiedElement
if
(
!
existingElements
[
element
.
getId
()
+
"
_
"
+
ie
.
getIcon
()
+
"
_
"
+
element
.
getType
()])
{
existingElements
[
element
.
getId
()
+
"
_
"
+
ie
.
getIcon
()
+
"
_
"
+
element
.
getType
()]
=
true
;
var
newElement
=
new
IdentifiedElement
(
elementsPointingToSubmap
[
j
]);
newElement
.
setIcon
(
ie
.
getIcon
());
if
(
ie
.
getIcon
()
===
undefined
)
{
newElement
.
setIcon
(
overlayDb
.
getIcon
(
0
));
}
else
{
newElement
.
setIcon
(
ie
.
getIcon
());
}
identifiedElements
.
push
(
newElement
);
}
}
...
...
frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js
View file @
4d294c53
...
...
@@ -51,6 +51,7 @@ AbstractDbOverlay.prototype.encodeQuery = function (type, arg0, arg1, arg2) {
if
(
type
===
AbstractDbOverlay
.
QueryType
.
SEARCH_BY_COORDINATES
)
{
var
modelId
=
arg0
;
var
coordinates
=
arg1
;
// noinspection UnnecessaryLocalVariableJS
var
zoom
=
arg2
;
return
JSON
.
stringify
({
type
:
type
,
...
...
@@ -59,6 +60,7 @@ AbstractDbOverlay.prototype.encodeQuery = function (type, arg0, arg1, arg2) {
zoom
:
zoom
});
}
else
if
(
type
===
AbstractDbOverlay
.
QueryType
.
SEARCH_BY_TARGET
)
{
// noinspection UnnecessaryLocalVariableJS
var
target
=
arg0
;
return
JSON
.
stringify
({
type
:
type
,
...
...
@@ -66,6 +68,7 @@ AbstractDbOverlay.prototype.encodeQuery = function (type, arg0, arg1, arg2) {
});
}
else
if
(
type
===
AbstractDbOverlay
.
QueryType
.
SEARCH_BY_QUERY
)
{
var
query
=
arg0
;
// noinspection UnnecessaryLocalVariableJS
var
perfect
=
arg1
;
return
JSON
.
stringify
({
type
:
type
,
...
...
@@ -239,7 +242,7 @@ AbstractDbOverlay.prototype.setAllowSearchById = function (allowSearchById) {
}
else
if
(
allowSearchById
===
undefined
)
{
this
.
_allowSearchById
=
false
;
}
else
{
throw
new
Error
(
"
Unknown type of allowSearchById:
"
,
allowSearchById
);
throw
new
Error
(
"
Unknown type of allowSearchById:
"
+
allowSearchById
);
}
};
...
...
@@ -249,7 +252,7 @@ AbstractDbOverlay.prototype.setAllowGeneralSearch = function (allowGeneralSearch
}
else
if
(
allowGeneralSearch
===
undefined
)
{
this
.
_allowGeneralSearch
=
false
;
}
else
{
throw
new
Error
(
"
Unknown type of allowSearchById:
"
,
allowGeneralSearch
);
throw
new
Error
(
"
Unknown type of allowSearchById:
"
+
allowGeneralSearch
);
}
};
...
...
@@ -270,7 +273,7 @@ AbstractDbOverlay.prototype.getColor = function (colorId) {
AbstractDbOverlay
.
prototype
.
getIcon
=
function
(
colorId
,
id
)
{
var
suffix
=
"
_
"
+
id
;
if
(
id
>=
100
)
{
if
(
id
>=
100
||
id
===
undefined
)
{
suffix
=
""
;
}
var
color
=
this
.
getColor
(
colorId
);
...
...
frontend-js/src/test/js/map/CustomMap-test.js
View file @
4d294c53
...
...
@@ -992,4 +992,26 @@ describe('CustomMap', function () {
});
});
describe
(
"
appendElementsPointingToSubmap
"
,
function
()
{
it
(
"
point to reaction
"
,
function
()
{
helper
.
setUrl
(
"
http://test/?id=complex_model_with_submaps
"
);
return
ServerConnector
.
getProject
().
then
(
function
(
project
)
{
var
map
=
helper
.
createCustomMap
(
project
);
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
reaction
=
new
IdentifiedElement
({
id
:
161955
,
modelId
:
16729
,
type
:
"
REACTION
"
});
return
map
.
appendElementsPointingToSubmap
([
reaction
],
oc
).
then
(
function
(
elements
)
{
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
var
element
=
elements
[
i
];
//alias pointing to reaction should have an icon
if
(
element
.
type
===
"
ALIAS
"
)
{
assert
.
ok
(
element
.
getIcon
()
!==
undefined
);
}
}
});
});
});
});
});
frontend-js/src/test/js/map/overlay/AbstractDbOverlay-test.js
View file @
4d294c53
...
...
@@ -16,86 +16,87 @@ describe('AbstractDbOverlay', function () {
updateInfoWindowForIdentifiedElement
:
function
()
{
}
};
it
(
"
constructor 1
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
describe
(
"
constructor
"
,
function
()
{
it
(
"
default
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
});
assert
.
ok
(
oc
);
assert
.
equal
(
oc
.
getName
(),
'
test name
'
);
assert
.
equal
(
logger
.
getWarnings
().
length
,
0
);
});
assert
.
ok
(
oc
);
assert
.
equal
(
oc
.
getName
(),
'
test name
'
);
assert
.
equal
(
logger
.
getWarnings
().
length
,
0
);
});
it
(
"
constructor 2
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
,
allowSearchById
:
true
it
(
"
allowSearchById
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
,
allowSearchById
:
true
});
assert
.
ok
(
oc
);
assert
.
ok
(
oc
.
allowSearchById
());
});
assert
.
ok
(
oc
);
assert
.
ok
(
oc
.
allowSearchById
());
});
it
(
"
constructor 3
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
,
allowSearchById
:
false
,
allowGeneralSearch
:
true
it
(
"
allowGeneralSearch
"
,
function
()
{
var
oc
=
new
AbstractDbOverlay
({
map
:
mapMock
,
name
:
'
test name
'
,
allowSearchById
:
false
,
allowGeneralSearch
:
true
});
assert
.
ok
(
oc
);
assert
.
ok
(
oc
.
allowGeneralSearch
());
});
assert
.
ok
(
oc
);
assert
.
ok
(
oc
.
allowGeneralSearch
());
});
it
(
"
splitQuery
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
describe
(
"
splitQuery
"
,
function
()
{
it
(
"
nothing to split
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
result
=
oc
.
splitQuery
(
"
test q
"
);
assert
.
equal
(
result
[
0
],
"
test q
"
);
});
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
it
(
"
splitQuery 2
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
result
=
oc
.
splitQuery
(
"
test q
"
);
assert
.
equal
(
result
[
0
],
"
test q
"
);
});
it
(
"
split by comma
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
result
=
oc
.
splitQuery
(
"
test,q
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q
"
);
});
var
result
=
oc
.
splitQuery
(
"
test,q
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q
"
);
});
it
(
"
split
Query 3
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
it
(
"
split
by semicolon
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
result
=
oc
.
splitQuery
(
"
test;q
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q
"
);
});
var
result
=
oc
.
splitQuery
(
"
test;q
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q
"
);
});
it
(
"
split by semicolon and comma
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
it
(
"
splitQuery 4
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
result
=
oc
.
splitQuery
(
"
test;q,bla
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q,bla
"
);
assert
.
equal
(
result
.
length
,
2
);
});
it
(
"
split by semicolon, comma and add full text search
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
result
=
oc
.
splitQuery
(
"
test;q,bla
"
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q,bla
"
);
assert
.
equal
(
result
.
length
,
2
);
var
result
=
oc
.
splitQuery
(
"
test;q,bla
"
,
true
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q,bla
"
);
assert
.
equal
(
result
[
2
],
"
test;q,bla
"
);
});
});
it
(
"
splitQuery 5
"
,
function
()
{
var
map
=
helper
.
createCustomMap
();
var
oc
=
helper
.
createSearchDbOverlay
(
map
);
var
result
=
oc
.
splitQuery
(
"
test;q,bla
"
,
true
);
assert
.
equal
(
result
[
0
],
"
test
"
);
assert
.
equal
(
result
[
1
],
"
q,bla
"
);
assert
.
equal
(
result
[
2
],
"
test;q,bla
"
);
});
});
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