Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
a86f9eaa
Commit
a86f9eaa
authored
Nov 24, 2022
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-map-marker-color-config' into 'dev'
F map marker color config See merge request
!83
parents
89baf6a7
bc199886
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!89
Release v0.10.0
,
!83
F map marker color config
Pipeline
#30996
passed
Nov 25, 2022
Stage: setup
Stage: linting
Stage: test
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+5
-0
5 additions, 0 deletions
CHANGELOG.md
src/core/js/ext_map.js
+31
-17
31 additions, 17 deletions
src/core/js/ext_map.js
test/core/js/modules/ext_map.js.js
+3
-3
3 additions, 3 deletions
test/core/js/modules/ext_map.js.js
with
39 additions
and
20 deletions
CHANGELOG.md
+
5
−
0
View file @
a86f9eaa
...
...
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed (for changes in existing functionality)
*
Version bump of caosdb_map module (0.5.0):
*
Added configurable entityLayers
*
Changed name of the icon option to icon_options, because that name better
distiguished the options from the result icon object.
### Deprecated
### Removed
...
...
This diff is collapsed.
Click to expand it.
src/core/js/ext_map.js
+
31
−
17
View file @
a86f9eaa
...
...
@@ -25,7 +25,7 @@
/**
* @module caosdb_map
* @version 0.
4.1
* @version 0.
5.0
*
* For displaying a geographical map which shows entities at their associated
* geolocation.
...
...
@@ -43,7 +43,7 @@
var
caosdb_map
=
new
function
()
{
var
logger
=
log
.
getLogger
(
"
caosdb_map
"
);
this
.
version
=
"
0.
4.1
"
;
this
.
version
=
"
0.
5.0
"
;
this
.
dependencies
=
[
"
log
"
,
{
"
L
"
:
[
"
latlngGraticule
"
,
"
Proj
"
]
},
"
navbar
"
,
"
caosdb_utils
"
];
...
...
@@ -76,6 +76,8 @@ var caosdb_map = new function () {
* @property {DataModelConfig} datamodel - the data model for the
* display of entities in the map (also used by the query generator).
* @property {SelectConfig} select - config for the query generator.
* @property {Object.<string, EntityLayerConfig>} entityLayers -
* configuration for the entity layer which are to be shown on the map.
*/
/**
...
...
@@ -382,14 +384,23 @@ var caosdb_map = new function () {
*/
/**
* Configuration of the entity layers which are to be shown on the map.
*
* @typedef {object} EntityLayerConfig
* @property {string} id
* @property {string} name
* @property {string} description
* @property {DivIcon_options} icon_options
* @property {string} id - the id of the entity layer which is used
* internally.
* @property {string} name - a short name which is shown in the entity
* layers menu.
* @property {string} description - a short description which is shown as
* hover-over text in the entity layers menu.
* @property {DivIcon_options} icon_tions - leaflet options for the icon
* (aka the marker) which is shown on the map. These options are
* espcially useful to style the icons (color etc).
* @property {number} zIndexOffset
* @property {mapEntityGetter} get_entities
* @property {mapEntityPopupGenerator} make_popup
* @property {mapEntityGetter} get_entities - returns the entities which
* are to be shown on the map.
* @property {mapEntityPopupGenerator} make_popup - returns the popup which
* is to be shown when a user clicks on the map marker.
*/
/**
...
...
@@ -647,13 +658,13 @@ var caosdb_map = new function () {
* "all_map_entities" which shows all entities in the database with
* coordinates.
*
* @type {EntityLayerConfig
[]
}
* @type {
Object.<string,
EntityLayerConfig
>
}
*/
this
.
_default_entity_layer_config
=
{
"
current_page_entities
"
:
{
"
name
"
:
"
Entities on the current page.
"
,
"
description
"
:
"
Show all entities on the current page.
"
,
"
icon
"
:
{
"
icon
_options
"
:
{
html
:
'
<i class="bi-geo-alt-fill" style="font-size: 20px; color: #00F;"></i>
'
,
iconAnchor
:
[
10
,
19
],
className
:
""
,
...
...
@@ -675,7 +686,7 @@ var caosdb_map = new function () {
"
all_map_entities
"
:
{
"
name
"
:
"
All entities
"
,
"
description
"
:
"
Show all entities with coordinates.
"
,
"
icon
"
:
{
"
icon
_options
"
:
{
html
:
'
<i class="bi-geo-alt-fill" style="font-size: 20px; color: #F00;"></i>
'
,
iconAnchor
:
[
10
,
19
],
className
:
""
,
...
...
@@ -973,9 +984,10 @@ var caosdb_map = new function () {
this
.
_reload_layers
=
function
()
{
caosdb_map
.
_show_load_info
()
const
promises
=
[]
const
entity_layer_config
=
$
.
extend
(
true
,
{},
caosdb_map
.
_default_entity_layer_config
,
caosdb_map
.
config
[
"
entityLayers
"
]);
for
(
const
layer
of
caosdb_map
.
layers
)
{
promises
.
push
(
caosdb_map
.
_fill_layer
(
layer
.
layer_group
,
caosdb_map
.
_default_
entity_layer_config
[
layer
.
id
]));
entity_layer_config
[
layer
.
id
]));
}
Promise
.
all
(
promises
).
then
((
val
)
=>
{
caosdb_map
.
_hide_load_info
()
...
...
@@ -1067,14 +1079,16 @@ var caosdb_map = new function () {
view_config
);
// init entity layers
this
.
layers
=
this
.
init_entity_layers
(
this
.
_default_entity_layer_config
);
const
entity_layer_config
=
$
.
extend
(
true
,
{},
this
.
_default_entity_layer_config
,
config
[
"
entityLayers
"
]);
caosdb_map
.
entityLayers
=
entity_layer_config
;
this
.
layers
=
this
.
init_entity_layers
(
entity_layer_config
);
var
layerControl
=
L
.
control
.
layers
();
const
promises
=
[]
for
(
const
layer
of
this
.
layers
)
{
promises
.
push
(
caosdb_map
.
_fill_layer
(
layer
.
layer_group
,
this
.
_default_
entity_layer_config
[
layer
.
id
]));
entity_layer_config
[
layer
.
id
]));
layerControl
.
addOverlay
(
layer
.
layer_group
,
layer
.
chooser_html
.
outerHTML
);
layer
.
layer_group
.
addTo
(
this
.
_map
);
}
...
...
@@ -1139,7 +1153,7 @@ var caosdb_map = new function () {
*/
/**
* @param {EntityLayerConfig
[]
} config
s
* @param {
Object.<string,
EntityLayerConfig
>
} config
* @returns {_EntityLayer[]}
*/
this
.
init_entity_layers
=
function
(
configs
)
{
...
...
@@ -1165,7 +1179,7 @@ var caosdb_map = new function () {
layer_group
.
entities
=
entities
;
var
markers
=
caosdb_map
.
create_entity_markers
(
entities
,
config
.
datamodel
,
config
.
make_popup
,
config
.
zIndexOffset
,
config
.
icon
);
config
.
zIndexOffset
,
config
.
icon
_options
);
for
(
const
marker
of
markers
)
{
layer_group
.
addLayer
(
marker
);
...
...
@@ -1202,7 +1216,7 @@ var caosdb_map = new function () {
this
.
make_layer_chooser_html
=
function
(
config
)
{
return
$
(
'
<span/>
'
)
.
attr
(
"
title
"
,
config
.
description
)
.
append
(
config
.
icon
.
html
)
.
append
(
config
.
icon
_options
.
html
)
.
append
(
config
.
name
)[
0
];
}
...
...
This diff is collapsed.
Click to expand it.
test/core/js/modules/ext_map.js.js
+
3
−
3
View file @
a86f9eaa
...
...
@@ -76,7 +76,7 @@ QUnit.module("ext_map.js", {
});
QUnit
.
test
(
"
availability
"
,
function
(
assert
)
{
assert
.
equal
(
caosdb_map
.
version
,
"
0.
4.1
"
,
"
test version
"
);
assert
.
equal
(
caosdb_map
.
version
,
"
0.
5.0
"
,
"
test version
"
);
assert
.
ok
(
caosdb_map
.
init
,
"
init available
"
);
});
...
...
@@ -272,7 +272,7 @@ QUnit.test("make_layer_chooser_html", function (assert) {
"
id
"
:
"
test_id
"
,
"
name
"
:
"
test name
"
,
"
description
"
:
"
test description
"
,
"
icon
"
:
{
"
icon
_options
"
:
{
"
html
"
:
"
<span>ICON</span>
"
,
},
};
...
...
@@ -287,7 +287,7 @@ QUnit.test("_init_single_entity_layer", function (assert) {
"
id
"
:
"
test_id
"
,
"
name
"
:
"
test name
"
,
"
description
"
:
"
test description
"
,
"
icon
"
:
{
"
icon
_options
"
:
{
"
html
"
:
"
<span>ICON</span>
"
,
},
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment