Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new geocoding provider: Bing (Locations API) #505

Merged
merged 236 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
6bf684f
overall code cleanup + draft provider class: `Bing`
Raruto Oct 11, 2023
6ceea40
missing variables
Raruto Oct 11, 2023
594540d
Merge branch 'dev' into bing-places
volterra79 Oct 12, 2023
1813892
Misspelling v-placeholder directive. Fix with right v-t-placeholder
volterra79 Oct 12, 2023
fcabeaf
Add comments and remove unused code
volterra79 Oct 12, 2023
6f426ef
Comment and what TODO
volterra79 Oct 12, 2023
74024c4
add `name` and `type`
Raruto Oct 13, 2023
de2dc29
comment
Raruto Oct 13, 2023
e05c2ad
remove helper funcion: `_createElement`
Raruto Oct 13, 2023
dfb2914
un-destructure
Raruto Oct 13, 2023
21558db
clean up query
Raruto Oct 13, 2023
f336b25
move guard condition
Raruto Oct 13, 2023
8d7b15c
set default options inside geocoding control
Raruto Oct 13, 2023
e741df5
simplify default `options` assignment
Raruto Oct 13, 2023
b66814b
dynamic extent
Raruto Oct 13, 2023
b2e3cda
remove nested classes (replaced by static: `GeocodingControl.providers`)
Raruto Oct 16, 2023
6feaf7a
move folder: `src/core/utils/` → `src/utils/`
Raruto Oct 16, 2023
ac89a3a
todo
Raruto Oct 16, 2023
f140074
add `provider` attribute
Raruto Oct 17, 2023
0803e80
move class: `OLControl` into `ControlsFactory`
Raruto Oct 17, 2023
4ca8658
add `pushin.svg`
Raruto Oct 17, 2023
c13c3e5
PoC reusable `<context-menu>` component
Raruto Oct 17, 2023
2621f0a
watcher
Raruto Oct 17, 2023
a91fc07
comments
Raruto Oct 17, 2023
2c02b2c
first attemp to handle multiple markers on map
Raruto Oct 17, 2023
7d02a3d
move event listeners into: `MapControlGeocoding.vue`
Raruto Oct 19, 2023
f846211
make it vue
Raruto Oct 19, 2023
97db10b
make use of `v-for` for list rendering
Raruto Oct 20, 2023
e0a77b3
new function: `GeocodingControl::getExtentForProvider(provider)`
Raruto Oct 20, 2023
b9b59ab
extract function: `_showResults(results)` + remove `cssClassess`
Raruto Oct 20, 2023
444399e
styling
Raruto Oct 20, 2023
1303377
remove unusued options
Raruto Oct 20, 2023
fbe93e4
unusued variables
Raruto Oct 20, 2023
586942c
sort css
Raruto Oct 20, 2023
06bdff1
move class: `ControlsFactory` into `src/app/gui/map/mapservice.js`
Raruto Oct 20, 2023
d27c4e0
remove inner factory object
Raruto Oct 20, 2023
30b65ba
comments
Raruto Oct 23, 2023
54a678f
bind event value to: `_onItemClick($event, item)`
Raruto Oct 23, 2023
da1625c
Merge branch 'dev' into bing-places
Raruto Oct 23, 2023
48808be
update index
Raruto Oct 23, 2023
12acfe5
Merge branch 'dev' into bing-places
volterra79 Oct 23, 2023
280f60d
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Oct 23, 2023
ad7b9e6
Add @click.stop to avoid to propagate click event.
volterra79 Oct 23, 2023
ed2a656
:sparkles: Add MarkersPanel.vue to show markers result on sidebar
volterra79 Oct 23, 2023
fe3638f
Delete unused file: `src/app/core/map/mapsregistry.js`
Raruto Oct 24, 2023
a94bcca
Remove test MarkesPanel (sidebar panel)
volterra79 Oct 24, 2023
78de373
Handle add remove marker feature on click result item using __uid pro…
volterra79 Oct 24, 2023
c36fa90
Add marker layer to query results
volterra79 Oct 24, 2023
710ad8c
Add MapControlGeocodingMarkerItem.vue and MapControlGeocodingMarkerIt…
volterra79 Oct 24, 2023
751efcc
Remove console.log
volterra79 Oct 24, 2023
70a32c9
add space
volterra79 Oct 24, 2023
1406619
Add action to marker layer on query result
volterra79 Oct 24, 2023
0cf996e
Add reset button markers
volterra79 Oct 25, 2023
854d387
Rename Marker components
volterra79 Oct 25, 2023
1b3adf5
Add MarkersEventBus
volterra79 Oct 25, 2023
329fa15
In case of layer.id __g3w_marker (layer use to stor markers) not add …
volterra79 Oct 25, 2023
f787dd1
Add button on geoconding control to remove all markers and show marke…
volterra79 Oct 25, 2023
ec7198a
Use MarkerResultFeature on QueryResuls.vue component
volterra79 Oct 25, 2023
3a72ffd
Fix pass item.__uid
volterra79 Oct 25, 2023
1e59ff5
Add open (plus) close (minu) marker feature show hide info data
volterra79 Oct 25, 2023
00486da
Add more than one markers action (zoom, remove)
volterra79 Oct 25, 2023
f5f674e
Add checkbox icon to set add or not marker. Liste vents form MarkerEv…
volterra79 Oct 25, 2023
6e40862
:sparkles: Edit (add) marker to Point layer
volterra79 Oct 26, 2023
7d030d4
:sparkles: Add toggle visibility of marker layer on map
volterra79 Oct 26, 2023
2d5653e
Fix visibility layer whe non marker are on map after remove
volterra79 Oct 26, 2023
3359592
attempt to get rid of `<marker-result-feature>`
Raruto Oct 26, 2023
92aa2fa
Chen geometry type of editable layer point and if is MultiPoint conve…
volterra79 Oct 26, 2023
4980df9
attempt to dump data using: `QueryResults.vue`
Raruto Oct 26, 2023
fec903b
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 26, 2023
bf4fae6
add showdat if to open close body marker
volterra79 Oct 26, 2023
e6624ae
move marker result feature component
volterra79 Oct 26, 2023
6e99e4b
jsdoc
Raruto Oct 27, 2023
2676c98
Remove pencil icon tool and leave select for editing
volterra79 Oct 27, 2023
970e549
Fix show at least maxSubsetLength if layer is not __g3w_marker
volterra79 Oct 27, 2023
a211594
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 27, 2023
becb776
pretty print json attributes
Raruto Oct 27, 2023
5ed9ba1
rename variable: `maxSubsetLength` → `MAX_SUBSET_LENGTH`
Raruto Oct 27, 2023
7e620ce
code format
Raruto Oct 27, 2023
05e8a40
comments
Raruto Oct 30, 2023
3a2b6d2
remove ternary condition
Raruto Oct 30, 2023
f6463aa
comments
Raruto Oct 30, 2023
49b8b18
ensure boolean return type: `isExternalLayerSelected`
Raruto Oct 30, 2023
23fa29f
remove short circuit condition
Raruto Oct 30, 2023
2008964
draft reusable queryresults
Raruto Oct 30, 2023
af17e7d
Add addActionsForLayers
volterra79 Oct 30, 2023
203c560
add `is_results_panel_open`
Raruto Oct 30, 2023
205d5e7
create component: `QueryResultsActionChooseLayer.vue`
Raruto Oct 31, 2023
9468f46
Add queryresults.state.actiontools[QueryResultsActionChooseLaye…
volterra79 Oct 31, 2023
0a7b465
listen for: `removeFeatureLayerFromResult`
Raruto Oct 31, 2023
7bf3658
remove commented code
Raruto Oct 31, 2023
2b45c99
:recycle: Move feature tools action on top of atrributes. Add new com…
volterra79 Oct 31, 2023
463c25f
Merge remote-tracking branch 'origin/bing-places' into bing-places
volterra79 Oct 31, 2023
416a60b
Merge branch 'dev' into bing-places
volterra79 Oct 31, 2023
8a70b11
remove `markers-visibility-layer` + move css stuff `g3w-mapcontrols.l…
Raruto Oct 31, 2023
421ff6f
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Oct 31, 2023
a2f91de
Reomve contex menu from Map.vue
volterra79 Oct 31, 2023
45a29fe
make it scoped
Raruto Oct 31, 2023
48da355
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 31, 2023
95d30cc
Fix edit amrker feature
volterra79 Oct 31, 2023
b2faf8e
Merge remote-tracking branch 'origin/bing-places' into bing-places
volterra79 Oct 31, 2023
ec3eaec
remove console.log
volterra79 Oct 31, 2023
e5b1f3e
add css var: `--skin-color`
Raruto Oct 31, 2023
04a5c63
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 31, 2023
0badb35
Uncomment toggle marker layer visibility. Handel show hide marker lis…
volterra79 Oct 31, 2023
e9c5231
Merge remote-tracking branch 'origin/bing-places' into bing-places
volterra79 Oct 31, 2023
117f954
css clean up
Raruto Oct 31, 2023
ba014f5
code clean up
Raruto Oct 31, 2023
3ff752d
Change style
volterra79 Oct 31, 2023
88ae365
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Oct 31, 2023
13c493a
sticky header
Raruto Oct 31, 2023
64a77fe
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 31, 2023
71a940a
Fix open close marker results
volterra79 Oct 31, 2023
37b679e
attempt to use: `addCurrentActionToolsLayer`
Raruto Oct 31, 2023
3608364
missing config
Raruto Oct 31, 2023
27c724e
Fix zoom to relation feature whe click on attribute table of alphanum…
volterra79 Oct 31, 2023
739433e
Merge remote-tracking branch 'origin/bing-places' into bing-places
volterra79 Oct 31, 2023
5f5e08f
attempt to simplify action registration
Raruto Oct 31, 2023
e2ffc2a
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Oct 31, 2023
db8e589
Pass config object to component actiontools
volterra79 Oct 31, 2023
fc3af46
Disable control during editing
volterra79 Oct 31, 2023
42064e7
Clean code
volterra79 Oct 31, 2023
221cd68
:recycle: Set action tool configuration
volterra79 Oct 31, 2023
a0d2471
Clean code
volterra79 Oct 31, 2023
3109fb7
second attempt with `addCurrentActionToolsLayer`
Raruto Nov 2, 2023
5d85894
Fix in case of iframe, move show/hide sidebar on top
volterra79 Nov 2, 2023
63ab5be
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Nov 2, 2023
18e9843
todo
Raruto Nov 2, 2023
59e91fd
formatting
Raruto Nov 2, 2023
9e6be88
config label
Raruto Nov 2, 2023
e27bdab
decrease border left
Raruto Nov 2, 2023
adc5768
Show edit tools only if there are point geometry layer editable
volterra79 Nov 2, 2023
d36c42a
Remove spaces
volterra79 Nov 2, 2023
87961e8
Add remind to add translation
volterra79 Nov 2, 2023
cccbc5e
Hide selection layer tool button if layer is g3w marker
volterra79 Nov 2, 2023
294815a
Merge branch 'dev' into bing-places
volterra79 Nov 2, 2023
5962802
Update search_from_bing.js
Raruto Nov 2, 2023
1633027
attempt to open sidebar panel on open
Raruto Nov 2, 2023
5eb0ed0
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Nov 2, 2023
f90832f
workaround for click event listener
Raruto Nov 3, 2023
8c21522
hide interal properties + include raw data in results
Raruto Nov 3, 2023
166de80
restore subset for g3w marker
Raruto Nov 3, 2023
e8b6cc0
check for single editable point layer
Raruto Nov 3, 2023
566b389
sort attributes
Raruto Nov 3, 2023
ca106b9
remove margins
Raruto Nov 3, 2023
5f6a84e
count selected features
Raruto Nov 3, 2023
8f0702a
new utils: `flattenObject`
Raruto Nov 3, 2023
b0f6ac4
Add Multipoint to is3DGeometry types
volterra79 Nov 3, 2023
887620e
Fix editing feature creation to pass on addLayerFeature editing api m…
volterra79 Nov 3, 2023
96e60cb
Add condition to not sho editing action onb marker when editing panel…
volterra79 Nov 6, 2023
ad20500
enable/disable buttons on editing
volterra79 Nov 6, 2023
7bf7cd3
Handle configuration mapcontrol from server has object (key: neme/typ…
volterra79 Nov 6, 2023
9564955
disable control instead of clearing results
Raruto Nov 6, 2023
61108f4
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Nov 6, 2023
6d9a3b1
Set items aligned to center
volterra79 Nov 6, 2023
7b8341f
comments
Raruto Nov 6, 2023
46fcccf
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Nov 6, 2023
b38f971
vertical spacing
Raruto Nov 6, 2023
a3ef48b
wrong guard
Raruto Nov 6, 2023
c2cdfb4
unified common controls factories
Raruto Nov 6, 2023
746bc2f
Clean code
volterra79 Nov 6, 2023
bda68df
Space
volterra79 Nov 6, 2023
76a584c
call queryresultservice removeFeatureLayerFromResult method on clearM…
volterra79 Nov 7, 2023
dac717f
remove internals
Raruto Nov 7, 2023
2145d69
simplify geoutils calls within `_editItem(layerId, feature)`
Raruto Nov 7, 2023
7b15047
wrong remove item uid
Raruto Nov 7, 2023
d44761c
keep markers results open when
Raruto Nov 7, 2023
a7d7857
alias without `raw_` prefix
Raruto Nov 7, 2023
bec8566
replace `raw_` field prefix with provider name
Raruto Nov 7, 2023
381ff94
rename internal prop: `__add` → `__selected`
Raruto Nov 7, 2023
8201fa9
add flag: `is_clearing`
Raruto Nov 8, 2023
e8909c9
i18n
Raruto Nov 8, 2023
833e5ea
replace directive: `v-html` → `v-t`
Raruto Nov 8, 2023
d9cca14
add i18n: `mapcontrols.geocoding.nolayers`
Raruto Nov 8, 2023
1e96729
reduce delta
Raruto Nov 8, 2023
dfe09ef
Merge branch 'dev' into bing-places
Raruto Nov 9, 2023
4ff845c
Fix search autocomplete
volterra79 Nov 9, 2023
9614323
Chnage markers layer style to style function
volterra79 Nov 9, 2023
202e79e
Add marker for search in lon lat
volterra79 Nov 9, 2023
20593d6
Get configuration geocoding from server and pass it to provider, for …
volterra79 Nov 9, 2023
408c261
Clean code
volterra79 Nov 10, 2023
8c62dc7
attempt to use computed: `has_providers`
Raruto Nov 10, 2023
b76d7c5
replace directive: `v-show` → `v-if`
Raruto Nov 10, 2023
efc0c80
add some help texts (eng only)
Raruto Nov 10, 2023
0bf4700
remove unused child' class
volterra79 Nov 10, 2023
bdf934d
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Nov 10, 2023
148cdb2
handle multiple tabs and subtabs color
Raruto Nov 10, 2023
739321d
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Nov 10, 2023
fdab212
wrong merge
Raruto Nov 10, 2023
01ee4bc
Align skin tabs color base on blue
volterra79 Nov 10, 2023
100746e
increase clickable marker area (pushpin icon)
Raruto Nov 10, 2023
d5cfa89
Add common less g3w-tabs-form-query file to set common tab css rules
volterra79 Nov 10, 2023
29f4f42
Change css less color of tabs
volterra79 Nov 10, 2023
e41c763
remove `v-else`
Raruto Nov 10, 2023
d2a85d4
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
Raruto Nov 10, 2023
0f09a32
tab group title more contrast between background color e text color
volterra79 Nov 10, 2023
839458e
Merge branch 'bing-places' of https://github.com/g3w-suite/g3w-client…
volterra79 Nov 10, 2023
a03a7bd
remove console.log
Raruto Nov 10, 2023
e42abe5
attempt to increment contrast
Raruto Nov 10, 2023
7a7cab8
Set group-title brackground tab
volterra79 Nov 10, 2023
bf79291
Merge branch 'dev' into bing-places
volterra79 Nov 14, 2023
d610c3e
Fix wrong assignment splice().concat(
volterra79 Nov 14, 2023
d5ed692
Add comment and remove logicop on filters string when value is single…
volterra79 Nov 15, 2023
1a8c128
set options.value instead of options.key to create filter for valuere…
volterra79 Nov 15, 2023
035150b
Merge branch 'dev' into bing-places
volterra79 Nov 15, 2023
95e926d
Merge branch 'dev' into bing-places
volterra79 Nov 15, 2023
23227b6
Merge branch 'dev' into bing-places
volterra79 Nov 16, 2023
90d5d5c
Add event set-layerzindex to listen when a new layer is add to map an…
volterra79 Nov 16, 2023
573bc3b
Listen set-layer-zindex map service event and set marker layer on top
volterra79 Nov 16, 2023
d27d2b8
Clean code
volterra79 Nov 16, 2023
fa05088
Clean code
volterra79 Nov 16, 2023
a7f2052
Set footer map control more dark
volterra79 Nov 16, 2023
a478dd3
Fix change mouse position map coordinate due refactor
volterra79 Nov 16, 2023
d0b5ff1
Scale select map control arrow more dark
volterra79 Nov 16, 2023
7ccabe1
Clean code and add shadow to logo image g3w
volterra79 Nov 16, 2023
cc1504d
Fix search value map dependency input
volterra79 Nov 17, 2023
04b8d34
Fix misspelled method
volterra79 Nov 17, 2023
bfd21d6
Merge branch 'dev' into bing-places
volterra79 Nov 17, 2023
7ac2a8c
Add field type bigint
volterra79 Nov 20, 2023
4edcf51
Show previous field label and values only if layer result has more th…
volterra79 Nov 21, 2023
e681d89
Clean code
volterra79 Nov 21, 2023
6b687a9
Remove tooltip after copy url
volterra79 Nov 21, 2023
5f0df6b
set tooltip width
volterra79 Nov 21, 2023
82905e3
Use v-t-tooltip directive to show tooltip on query feature action
volterra79 Nov 21, 2023
c67a35b
closes: https://github.com/g3w-suite/g3w-client/issues/501
Raruto Nov 21, 2023
5882190
docs
Raruto Nov 21, 2023
bb204df
comments
Raruto Nov 21, 2023
ad1b3c2
mispelling
Raruto Nov 21, 2023
ab59fa7
add option: `icon`
Raruto Nov 21, 2023
d9e3ec0
replace `(new Error).fileName` → `document.currentScript.src`
Raruto Nov 22, 2023
866eaab
mobile css
Raruto Nov 22, 2023
b23276b
unusued rules
Raruto Nov 22, 2023
bad0c0b
Remove console.log
volterra79 Nov 24, 2023
b91c693
Fix create right filter in case of input.attribute is not an array. N…
volterra79 Nov 24, 2023
edbe040
Add formatter 0 based on https://github.com/g3w-suite/g3w-admin/pull/671
volterra79 Nov 27, 2023
8c49ff6
Clean code
volterra79 Nov 27, 2023
098812a
Add reference usage
volterra79 Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ gulp.task('images', function () {
.pipe(gulp.dest(outputFolder + '/static/client/fonts/'))
});

/**
* Deploy geocoding providers (src/assets/geocoding-providers)
*/
gulp.task('geocoding-providers', function () {
return gulp.src(`${g3w.assetsFolder}/geocoding-providers/*`)
.pipe(flatten())
.pipe(gulp.dest(outputFolder + '/static/client/geocoding-providers/'));
});

/**
* Compile client styles (src/assets/style/less/app.less --> app.min.css)
*/
Expand Down Expand Up @@ -331,10 +340,11 @@ gulp.task('browser-sync', function() {
// gulp.watch(['./src/index.html', './src/**/*.html'], gulp.series('browser:reload'));
//

gulp.watch([g3w.assetsFolder + '/style/**/*.less'], () => runSequence('less','browser:reload'));
gulp.watch('./src/**/*.{png,jpg}', () => runSequence('images','browser:reload'));
gulp.watch(['./src/index.html'], () => runSequence('html', 'browser:reload'));
gulp.watch(g3w.pluginsFolder + '/*/plugin.js', (file) => {
gulp.watch([g3w.assetsFolder + '/style/**/*.less'], () => runSequence('less', 'browser:reload'));
gulp.watch([g3w.assetsFolder + '/geocoding-providers/**/*'], () => runSequence('geocoding-providers', 'browser:reload'));
gulp.watch('./src/**/*.{png,jpg,gif,svg}', () => runSequence('images', 'browser:reload'));
gulp.watch(['./src/index.html'], () => runSequence('html', 'browser:reload'));
gulp.watch(g3w.pluginsFolder + '/*/plugin.js', (file) => {
const plugins = process.env.G3W_PLUGINS;
process.env.G3W_PLUGINS = path.basename(path.dirname(file.path));
runSequence('deploy-plugins', 'browser:reload', () => process.env.G3W_PLUGINS = plugins)
Expand Down Expand Up @@ -465,7 +475,7 @@ gulp.task('build:plugins', (done) => runSequence('clone:default_plugins', 'selec
/**
* Compile and deploy local developed client file assets (static and templates)
*/
gulp.task('build:client', ['browserify:app', 'concatenate:vendor_js', 'concatenate:vendor_css', 'fonts', 'images', 'less', 'datatable-images', 'html']);
gulp.task('build:client', ['browserify:app', 'concatenate:vendor_js', 'concatenate:vendor_css', 'fonts', 'images', 'less', 'datatable-images', 'geocoding-providers', 'html']);

/**
* [PROD] Compile and deploy client application
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"homepage": "https://github.com/g3w-suite/g3w-client.git",
"dependencies": {
"lodash.clonedeep": "^4.5.0",
"util-deprecate": "^1.0.2",
"shp-write": "^0.3.2",
"util-deprecate": "^1.0.2",
"vue": "2.6.12",
"vue-color": "^2.8.1",
"vue-cookie": "^1.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Workflow = require('core/workflow/workflow');
* GUI modules
*/
const Panel = require('gui/panel');
const ControlFactory = require('gui/map/control/factory');
const { ControlFactory } = require('gui/map/mapservice');
const ComponentsFactory = require('gui/component/componentsfactory');
const FieldsService = require('gui/fields/fieldsservice');
const Component = require('gui/component/component');
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/layers/utils/addToSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function _handleExternalVectorLayerSelection(map, layer, {
return;
}
//Take in account array or single fid
fids = Array.iArray(fids) ? fids : [fid];
fids = Array.isArray(fids) ? fids : [fid];
features = Array.isArray(features) ? features : [features];
//check if layer.selection.features is undefined
if (undefined === layer.selection.features) {
Expand Down
20 changes: 0 additions & 20 deletions src/app/core/map/mapsregistry.js

This file was deleted.

113 changes: 96 additions & 17 deletions src/app/g3w-ol/controls/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,75 @@ import MapControlButton from 'components/MapControlButton';
*/
const layout = function ({ map, position, element }) {};

/**
* @param {Object} options
* @param {string} options.name
* @param {boolean} options.enabled
*/
const Control = function(options={}) {
const {name="", visible=true, enabled=false} = options;

const {
name="",
visible=true,
enabled=false
} = options;

/**
* @FIXME add description
*/
this._enabled = enabled;

/**
* @FIXME add description
*/
this.offline = options.offline !== undefined ? options.offline : true;

/**
* @FIXME add description
*/
this.name = name.split(' ').join('-').toLowerCase();

/**
* @FIXME add description
*/
this.id = this.name+'_'+(Math.floor(Math.random() * 1000000));
this.eventKeys = {}; // store eventKey and original havenHandler

/**
* store eventKey and original havenHandler
*/
this.eventKeys = {};

/*
tl: top-left
tr: top-right
bl: bottom-left
bt: bottom-right
*/
this.positionCode = options.position || 'tl';

/**
* @FIXME add description
*/
this.priority = options.priority || 0;

if (!options.element) {
const mapControlButtonVue = Vue.extend(MapControlButton({
className: "ol-"+this.name.split(' ').join('-').toLowerCase(),
className: "ol-"+this.name.split(' ').join('-').toLowerCase(),
customClass: options.customClass,
tipLabel: options.tipLabel || this.name,
label: options.label || ''
tipLabel: options.tipLabel || this.name,
label: options.label || '',
}));
options.element = new mapControlButtonVue().$mount().$el;
}
const buttonClickHandler = options.buttonClickHandler || Control.prototype._handleClick.bind(this);
$(options.element).on('click',buttonClickHandler);

// button click handler
$(options.element).on('click', options.buttonClickHandler || Control.prototype._handleClick.bind(this));

// parent constructor
ol.control.Control.call(this, options);

this.setVisible(visible);

this._postRender();
};

Expand All @@ -41,15 +82,23 @@ ol.inherits(Control, ol.control.Control);
const proto = Control.prototype;


//return if clickmap
/**
* return if clickmap
*/
proto.isClickMap = function(){
return this.clickmap;
};

/**
* @FIXME add description
*/
proto.isToggled = function() {
return this._toggled;
};

/**
* @FIXME add description
*/
proto.setEventKey = function({eventType, eventKey}){
this.eventKeys[eventType] = {
eventKey,
Expand Down Expand Up @@ -82,6 +131,9 @@ proto.overwriteEventHandler = function({eventType, handler}) {
}
};

/**
* @FIXME add description
*/
proto.getPosition = function(positionCode) {
positionCode = positionCode || this.positionCode;
const position = {};
Expand All @@ -93,7 +145,8 @@ proto.getPosition = function(positionCode) {
};

/**
* Method to handle toggle map controls
* Handle toggle of map controls
*
* @param event
*/
proto._handleClick = function(event) {
Expand All @@ -112,12 +165,16 @@ proto._handleClick = function(event) {
this.dispatchEvent('controlclick');
};

//shift of control position
/**
* shift control's position
*/
proto.shiftPosition = function(position) {
$(this.element).css(hWhere, position+'px');
};

// layout handler
/**
* layout handler
*/
proto.layout = function(map) {
if (map) {
const position = this.getPosition();
Expand All @@ -126,24 +183,35 @@ proto.layout = function(map) {
}
};

// change layout of controls // overwrite to customize beahviour
proto.changelayout = function(map) {};
/**
* change layout of controls
*/
proto.changelayout = function(map) {
// overwrite to customize beahviour
};

//called when a control is added ore removed to map (added: map is an ol.Map instance , removed map is null)
/**
* Called when a control is added ore removed to map
*
* @param {ol.Map | null} map instace to be added (null = remove from map)
*/
proto.setMap = function(map) {
if (map) {
this.layout(map);
ol.control.Control.prototype.setMap.call(this, map);
}
};

/**
*
* @FIXME add description
*/
proto.showControl = function(){
$(this.element).show();
};

//hide control and move all controls that sit on his right position
/**
* Hide control and move all controls that sit on his right position
*/
proto.hideControl = function() {
let position = $(this.element).position().left;
let controlWidth = $(this.element).outerWidth();
Expand Down Expand Up @@ -176,20 +244,31 @@ proto.setEnable = function(enabled) {
this._enabled = enabled;
};

/**
* @FIXME add description
*/
proto.getEnable = function() {
return this._enabled;
};

/**
* @FIXME add description
*/
proto.setVisible = function(visible=true){
this._visible = visible;
$(this.element)[visible ? 'show': 'hide']();
};

/**
* @FIXME add description
*/
proto.isVisible = function(){
return this._visible;
};


/**
* @FIXME add description
*/
proto._postRender = function() {};

module.exports = Control;
Loading