diff --git a/examples/GeoportalControls.ipynb b/examples/GeoportalControls.ipynb index f76fd5595..71f07f1e0 100644 --- a/examples/GeoportalControls.ipynb +++ b/examples/GeoportalControls.ipynb @@ -28,26 +28,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "3a686d99-c3ca-4596-81aa-24442564bea2", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "47bf5fd8b8aa413fb0eacad5627beee6", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#LayerSwitcher control\n", "m1 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n", @@ -75,14 +59,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "0a7ca855-c96d-4864-9b9c-1873712033bb", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "787604374bd34bbdba450d271c0f60bb", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#MousePosition control\n", "m3 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n", - "mouse_position_control = GeoportalMousePosition()\n", + "mouse_position_control = GeoportalMousePosition(display_altitude=True)\n", "m3.add(mouse_position_control)" ] }, diff --git a/ipyleaflet/geoportal.py b/ipyleaflet/geoportal.py index 9ec701dbd..dc3801b5b 100644 --- a/ipyleaflet/geoportal.py +++ b/ipyleaflet/geoportal.py @@ -2,7 +2,7 @@ # Distributed under the terms of the Modified BSD License. -from traitlets import Unicode, Bool, List, Dict +from traitlets import Unicode, Bool, List, Dict, Instance, Any from .leaflet import TileLayer, Control @@ -36,6 +36,17 @@ class GeoportalLayerSwitcher(Control): _view_name = Unicode("LeafletGeoportalLayerSwitcherView").tag(sync=True) _model_name = Unicode("LeafletGeoportalLayerSwitcherModel").tag(sync=True) + position = Unicode("bottomleft").tag(sync=True, o=True) + collapsed = Bool(False).tag(sync=True, o=True) + layers = List([]).tag(sync=True, o=True) + layer = Instance(TileLayer).tag(sync=True, o=True) + display = Bool(True).tag(sync=True, o=True) + config = Any().tag(sync=True, o=True) + visibility = Unicode("").tag(sync=True, o=True) + title = Unicode("").tag(sync=True, o=True) + description = Unicode("").tag(sync=True, o=True) + quicklook_url = Unicode("").tag(sync=True, o=True) + legends = List([]).tag(sync=True, o=True) class GeoportalSearchEngine(Control): @@ -54,7 +65,6 @@ class GeoportalSearchEngine(Control): collapsed = Bool(True).tag(sync=True, o=True) zoomTo = Unicode("auto").tag(sync=True, o=True) displayInfo = Bool(True).tag(sync=True, o=True) - apiKey = Unicode("cartes").tag(sync=True, o=True) displayAdvancedSearch = Bool(True).tag(sync=True, o=True) resources = List(["PositionOfInterest", "StreetAddress"]).tag(sync=True, o=True) advancedSearch = Dict({}).tag(sync=True, o=True) @@ -69,14 +79,19 @@ class GeoportalRoute(Control): ---------- """ - _view_name = Unicode("LeafletGeoportalRouteView").tag(sync=True) - _model_name = Unicode("LeafletGeoportalRouteModel").tag(sync=True) - position = Unicode("bottomleft").tag(sync=True) - collapsed = Bool(True).tag(sync=True) - exclusions = Dict({"toll": True, "bridge": False, "tunnel": True}).tag(sync=True) - graphs = List(["Pieton", "Voiture"]).tag(sync=True) - autocompleteOptions = Dict({}).tag(sync=True) - routeOptions = Dict({}).tag(sync=True) + _view_name = Unicode("LeafletGeoportalRouteView").tag(sync=True, o=True) + _model_name = Unicode("LeafletGeoportalRouteModel").tag(sync=True, o=True) + api_key = Unicode("essentiels").tag(sync=True, o=True) + position = Unicode("bottomleft").tag(sync=True, o=True) + collapsed = Bool(True).tag(sync=True, o=True) + ssl = Bool(True).tag(sync=True, o=True) + disableReverse = Bool(False).tag(sync=True, o=True) + exclusions = Dict({"toll": True, "bridge": False, "tunnel": True}).tag( + sync=True, o=True + ) + graphs = List(["Pieton", "Voiture"]).tag(sync=True, o=True) + autocompleteOptions = Dict({}).tag(sync=True, o=True) + routeOptions = Dict({}).tag(sync=True, o=True) class GeoportalMousePosition(Control): @@ -86,27 +101,17 @@ class GeoportalMousePosition(Control): ---------- """ - _view_name = Unicode("LeafletGeoportalMousePositionView").tag(sync=True) - _model_name = Unicode("LeafletGeoportalMousePositionModel").tag(sync=True) - position = Unicode("bottomleft").tag(sync=True) - collapsed = Bool(False).tag(sync=True) - displayAltitude = Bool(True).tag(sync=True) - displayCoordinates = Bool(True).tag(sync=True) - editCoordinates = Bool(False).tag(sync=True) - altitude = Dict({}).tag(sync=True) - serviceOptions = Dict({}) - crs = Unicode().tag(sync=True) - label = Unicode().tag(sync=True) - selectedtype = Unicode().tag(sync=True) - systems = ( - List( - [ - {crs: "", label: "Lon,Lat", selectedtype: "Geographical"}, - {crs: "", label: "Lambert 93", selectedtype: "Metric"}, - ] - ).tag(sync=True), - ) - units = List(["DEC", "DMS"]).tag(sync=True) + _view_name = Unicode("LeafletGeoportalMousePositionView").tag(sync=True, o=True) + _model_name = Unicode("LeafletGeoportalMousePositionModel").tag(sync=True, o=True) + api_key = Unicode("essentiels").tag(sync=True, o=True) + position = Unicode("bottomleft").tag(sync=True, o=True) + collapsed = Bool(False).tag(sync=True, o=True) + display_altitude = Bool(False).tag(sync=True, o=True) + display_coordinates = Bool(True).tag(sync=True, o=True) + edit_coordinates = Bool(True).tag(sync=True, o=True) + systems = List([]).tag(sync=True, o=True) + altitude = Any([]).tag(sync=True, o=True) + units = List([]).tag(sync=True, o=True) class GeoportalElevationPath(Control): @@ -118,6 +123,13 @@ class GeoportalElevationPath(Control): _view_name = Unicode("LeafletGeoportalElevationPathView").tag(sync=True) _model_name = Unicode("LeafletGeoportalElevationPathModel").tag(sync=True) + api_key = Unicode("essentiels").tag(sync=True, o=True) + position = Unicode("bottomleft").tag(sync=True, o=True) + openssl = Bool(True).tag(sync=True, o=True) + active = Bool(False).tag(sync=True, o=True) + stylesOptions = Unicode("DEFAULT_STYLES").tag(sync=True, o=True) + elevationPathOptions = Dict({}).tag(sync=True, o=True) + displayProfileOptions = Dict({}).tag(sync=True, o=True) class GeoportalIsocurve(Control): @@ -127,11 +139,12 @@ class GeoportalIsocurve(Control): ---------- """ - _view_name = Unicode("LeafletGeoportalIsocurveView").tag(sync=True) - _model_name = Unicode("LeafletGeoportalIsocurveModel").tag(sync=True) - collapsed = (Bool(False).tag(sync=True),) - methods = (List(["time", "distance"]).tag(sync=True),) - exclusions = (Dict({}).tag(sync=True),) - graphs = (List(["Pieton", "Voiture"]).tag(sync=True),) - isocurveOptions = (Dict({}).tag(sync=True),) - autocompleteOptions = Dict({}).tag(sync=True) + _view_name = Unicode("LeafletGeoportalIsocurveView").tag(sync=True, o=True) + _model_name = Unicode("LeafletGeoportalIsocurveModel").tag(sync=True, o=True) + api_key = Unicode("essentiels").tag(sync=True, o=True) + collapsed = Bool(False).tag(sync=True, o=True) + methods = List(["time", "distance"]).tag(sync=True, o=True) + exclusions = Dict({}).tag(sync=True).tag(sync=True, o=True) + graphs = List(["Pieton", "Voiture"]).tag(sync=True, o=True) + isocurveOptions = Dict({}).tag(sync=True, o=True) + autocompleteOptions = Dict({}).tag(sync=True).tag(sync=True, o=True) diff --git a/js/src/controls/GeoportalControls.js b/js/src/controls/GeoportalControls.js index 024cc406e..9ffaa1454 100644 --- a/js/src/controls/GeoportalControls.js +++ b/js/src/controls/GeoportalControls.js @@ -9,8 +9,11 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo defaults() { return { ...super.defaults(), - _view_name: 'LeafletGeoportalLayerSwitcherView', - _model_name: 'LeafletGeoportalLayerSwitcherModel' + _view_name: 'LeafletGeoportalLayerSwitcherView', + _model_name: 'LeafletGeoportalLayerSwitcherModel', + position : "bottomleft", + collapsed : false, + layers : [] }; } } @@ -21,7 +24,7 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo this.map_view = this.options.map_view; } create_obj() { - this.obj = L.geoportalControl.LayerSwitcher() + this.obj = L.geoportalControl.LayerSwitcher(this.get_options()) } } @@ -31,11 +34,11 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo ...super.defaults(), _view_name: 'LeafletGeoportalSearchEngineView', _model_name: 'LeafletGeoportalSearchEngineModel', + apiKey : 'essentiels', position : 'topleft', collapsed : true, zoomTo : 'auto', displayInfo : true, - apiKey : 'cartes', displayAdvancedSearch : true, resources : ["PositionOfInterest", "StreetAddress"], advancedSearch : {}, @@ -61,8 +64,11 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo ...super.defaults(), _view_name: 'LeafletGeoportalRouteView', _model_name: 'LeafletGeoportalRouteModel', + apiKey : 'essentiels', position : "bottomleft", collapsed : true, + ssl : true, + disableReverse : false, exclusions : {"toll" : true, "bridge" : false, "tunnel" : true @@ -90,35 +96,15 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo ...super.defaults(), _view_name: 'LeafletGeoportalMousePositionView', _model_name: 'LeafletGeoportalMousePositionModel', + apiKey : 'essentiels', position : 'bottomleft', collapsed : false, - displayAltitude : true, + displayAltitude : false, displayCoordinates : true, - editCoordinates : false, - crs : '', - label : '', - selectedtype: '', - altitude : { - triggerDelay : 100, - responseDelay : 500, - noDataValue : -99999, - noDataValueTolerance : 90000, - serviceOptions : {} - }, - systems : [ - { - crs : L.CRS.EPSG4326, - label : "Lon,Lat", - selectedtype : "Geographical" - }, - { - crs : L.geoportalCRS.EPSG2154, - label : "Lambert 93", - selectedtype : "Metric" - } - ], - units : ["DEC", "DMS"] - + editCoordinates : true, + altitude : {}, + systems : [], + units : [] }; } } @@ -129,7 +115,7 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo this.map_view = this.options.map_view; } create_obj() { - this.obj = L.geoportalControl.MousePosition({}) + this.obj = L.geoportalControl.MousePosition(this.get_options()) } } @@ -137,8 +123,15 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo defaults() { return { ...super.defaults(), - _view_name: 'LeafletGeoportalElevationPathView', - _model_name: 'LeafletGeoportalElevationPathModel' + _view_name: 'LeafletGeoportalElevationPathView', + _model_name: 'LeafletGeoportalElevationPathModel', + apiKey : 'essentiels', + position : 'bottomleft', + openssl : true, + active : false, + stylesOptions : 'DEFAULT_STYLES', + elevationPathOptions: {}, + displayProfileOptions : {}, }; } } @@ -149,7 +142,7 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo this.map_view = this.options.map_view; } create_obj() { - this.obj = L.geoportalControl.ElevationPath({}) + this.obj = L.geoportalControl.ElevationPath(this.get_options()) } } @@ -159,6 +152,7 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo ...super.defaults(), _view_name: 'LeafletGeoportalIsocurve', _model_name: 'LeafletGeoportalIsocurveModel', + apiKey : 'essentiels', collapsed : false, methods : ["time", "distance"], exclusions : { diff --git a/ui-tests/playwright-report/data/0b4b5351e3436d159131f12441826e9ae47a7ce8.webm b/ui-tests/playwright-report/data/0b4b5351e3436d159131f12441826e9ae47a7ce8.webm new file mode 100644 index 000000000..f1ed6bcde Binary files /dev/null and b/ui-tests/playwright-report/data/0b4b5351e3436d159131f12441826e9ae47a7ce8.webm differ diff --git a/ui-tests/playwright-report/index.html b/ui-tests/playwright-report/index.html new file mode 100644 index 000000000..3320d55e5 --- /dev/null +++ b/ui-tests/playwright-report/index.html @@ -0,0 +1,3 @@ +