@maptiler/geocoding-control 2.1.7 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +34 -26
- package/SECURITY.md +16 -0
- package/dist/index.js +856 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +263 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/leaflet.public.js +1273 -0
- package/dist/leaflet.public.js.map +1 -0
- package/dist/leaflet.public.umd.js +276 -0
- package/dist/leaflet.public.umd.js.map +1 -0
- package/dist/maplibregl.js +1297 -0
- package/dist/maplibregl.js.map +1 -0
- package/dist/maplibregl.umd.js +276 -0
- package/dist/maplibregl.umd.js.map +1 -0
- package/dist/maptilersdk.js +1305 -0
- package/dist/maptilersdk.js.map +1 -0
- package/dist/maptilersdk.umd.js +276 -0
- package/dist/maptilersdk.umd.js.map +1 -0
- package/dist/src/components/clear-icon.d.ts +10 -0
- package/dist/src/components/fail-icon.d.ts +10 -0
- package/dist/src/components/loading-icon.d.ts +10 -0
- package/dist/src/components/marker.d.ts +10 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
- package/dist/src/components/search-icon.d.ts +10 -0
- package/dist/src/controls/leaflet-control.d.ts +58 -0
- package/dist/src/controls/leaflet-events.d.ts +42 -0
- package/dist/src/controls/leaflet-options.d.ts +84 -0
- package/dist/src/controls/maplibregl-control.d.ts +55 -0
- package/dist/src/controls/maplibregl-events.d.ts +44 -0
- package/dist/src/controls/maplibregl-options.d.ts +104 -0
- package/dist/src/controls/maptilersdk-control.d.ts +6 -0
- package/dist/src/controls/maptilersdk-events.d.ts +2 -0
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/geocoder/geocoder-events.d.ts +46 -0
- package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
- package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +11 -147
- package/dist/src/geocoder/geocoder.d.ts +112 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/leaflet.public.d.ts +7 -0
- package/dist/src/maplibregl.d.ts +7 -0
- package/dist/src/maptilersdk.d.ts +7 -0
- package/dist/src/types.d.ts +45 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/mask.d.ts +2 -0
- package/dist/src/utils/proximity.d.ts +2 -0
- package/package.json +80 -113
- package/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/geo-coordinates-parser.t.d.ts +0 -8
- package/geoUtils.d.ts +0 -3
- package/leaflet-controller.d.ts +0 -12
- package/leaflet-controller.js +0 -2475
- package/leaflet-controller.js.map +0 -1
- package/leaflet-controller.umd.js +0 -2
- package/leaflet-controller.umd.js.map +0 -1
- package/leaflet.d.ts +0 -131
- package/leaflet.js +0 -5082
- package/leaflet.js.map +0 -1
- package/leaflet.umd.js +0 -14
- package/leaflet.umd.js.map +0 -1
- package/maplibregl-controller.d.ts +0 -19
- package/maplibregl-controller.js +0 -2418
- package/maplibregl-controller.js.map +0 -1
- package/maplibregl-controller.umd.js +0 -2
- package/maplibregl-controller.umd.js.map +0 -1
- package/maplibregl.d.ts +0 -2509
- package/maplibregl.js +0 -5142
- package/maplibregl.js.map +0 -1
- package/maplibregl.umd.js +0 -14
- package/maplibregl.umd.js.map +0 -1
- package/maptilersdk.d.ts +0 -2504
- package/maptilersdk.js +0 -5152
- package/maptilersdk.js.map +0 -1
- package/maptilersdk.umd.js +0 -14
- package/maptilersdk.umd.js.map +0 -1
- package/mask.d.ts +0 -2
- package/openlayers-controller.d.ts +0 -15
- package/openlayers-controller.js +0 -2174
- package/openlayers-controller.js.map +0 -1
- package/openlayers-controller.umd.js +0 -2
- package/openlayers-controller.umd.js.map +0 -1
- package/openlayers.d.ts +0 -109
- package/openlayers.js +0 -5045
- package/openlayers.js.map +0 -1
- package/openlayers.umd.js +0 -14
- package/openlayers.umd.js.map +0 -1
- package/proximity.d.ts +0 -2
- package/react.d.ts +0 -45
- package/react.js +0 -2795
- package/react.js.map +0 -1
- package/react.umd.js +0 -14
- package/react.umd.js.map +0 -1
- package/style.css +0 -1
- package/svelte/ClearIcon.svelte +0 -12
- package/svelte/ClearIcon.svelte.d.ts +0 -25
- package/svelte/FailIcon.svelte +0 -12
- package/svelte/FailIcon.svelte.d.ts +0 -25
- package/svelte/FeatureItem.svelte +0 -246
- package/svelte/FeatureItem.svelte.d.ts +0 -26
- package/svelte/GeocodingControl.svelte +0 -921
- package/svelte/GeocodingControl.svelte.d.ts +0 -105
- package/svelte/LoadingIcon.svelte +0 -40
- package/svelte/LoadingIcon.svelte.d.ts +0 -25
- package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/svelte/MapLibreBasedGeocodingControl.js +0 -210
- package/svelte/MarkerIcon.svelte +0 -71
- package/svelte/MarkerIcon.svelte.d.ts +0 -18
- package/svelte/ReverseGeocodingIcon.svelte +0 -12
- package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
- package/svelte/SearchIcon.svelte +0 -26
- package/svelte/SearchIcon.svelte.d.ts +0 -25
- package/svelte/geo-coordinates-parser.t.d.ts +0 -8
- package/svelte/geo-coordinates-parser.t.js +0 -1
- package/svelte/geoUtils.d.ts +0 -3
- package/svelte/geoUtils.js +0 -18
- package/svelte/info.json +0 -1
- package/svelte/leaflet-controller.d.ts +0 -12
- package/svelte/leaflet-controller.js +0 -274
- package/svelte/leaflet.d.ts +0 -131
- package/svelte/leaflet.js +0 -116
- package/svelte/maplibregl-controller.d.ts +0 -19
- package/svelte/maplibregl-controller.js +0 -279
- package/svelte/maplibregl.d.ts +0 -2509
- package/svelte/maplibregl.js +0 -17
- package/svelte/maptilersdk.d.ts +0 -2504
- package/svelte/maptilersdk.js +0 -32
- package/svelte/mask.d.ts +0 -2
- package/svelte/mask.js +0 -54
- package/svelte/openlayers-controller.d.ts +0 -15
- package/svelte/openlayers-controller.js +0 -283
- package/svelte/openlayers.d.ts +0 -109
- package/svelte/openlayers.js +0 -178
- package/svelte/proximity.d.ts +0 -2
- package/svelte/proximity.js +0 -60
- package/svelte/react.d.ts +0 -45
- package/svelte/react.js +0 -106
- package/svelte/types.js +0 -1
- package/svelte/vanilla.d.ts +0 -61
- package/svelte/vanilla.js +0 -101
- package/svelte/vite-env.d.ts +0 -2
- package/types.d.ts +0 -391
- package/vanilla.d.ts +0 -61
- package/vanilla.js +0 -2799
- package/vanilla.js.map +0 -1
- package/vanilla.umd.js +0 -14
- package/vanilla.umd.js.map +0 -1
- /package/{icons → dist/icons}/10pin.svg +0 -0
- /package/{icons → dist/icons}/9pin.svg +0 -0
- /package/{icons → dist/icons}/advertising_column.svg +0 -0
- /package/{icons → dist/icons}/aerodrome.svg +0 -0
- /package/{icons → dist/icons}/alcohol.svg +0 -0
- /package/{icons → dist/icons}/alpine_hut.svg +0 -0
- /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
- /package/{icons → dist/icons}/amusement_park.svg +0 -0
- /package/{icons → dist/icons}/apartment.svg +0 -0
- /package/{icons → dist/icons}/archaeological_site.svg +0 -0
- /package/{icons → dist/icons}/area.svg +0 -0
- /package/{icons → dist/icons}/art.svg +0 -0
- /package/{icons → dist/icons}/arts_centre.svg +0 -0
- /package/{icons → dist/icons}/artwork.svg +0 -0
- /package/{icons → dist/icons}/audioguide.svg +0 -0
- /package/{icons → dist/icons}/bag.svg +0 -0
- /package/{icons → dist/icons}/beauty.svg +0 -0
- /package/{icons → dist/icons}/bed.svg +0 -0
- /package/{icons → dist/icons}/bell_tower.svg +0 -0
- /package/{icons → dist/icons}/beverages.svg +0 -0
- /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
- /package/{icons → dist/icons}/biergarten.svg +0 -0
- /package/{icons → dist/icons}/bird_hide.svg +0 -0
- /package/{icons → dist/icons}/boat_rental.svg +0 -0
- /package/{icons → dist/icons}/bookmaker.svg +0 -0
- /package/{icons → dist/icons}/books.svg +0 -0
- /package/{icons → dist/icons}/bowl.svg +0 -0
- /package/{icons → dist/icons}/bowling_alley.svg +0 -0
- /package/{icons → dist/icons}/bunker.svg +0 -0
- /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
- /package/{icons → dist/icons}/bus_station.svg +0 -0
- /package/{icons → dist/icons}/bust.svg +0 -0
- /package/{icons → dist/icons}/camping.svg +0 -0
- /package/{icons → dist/icons}/car_parts.svg +0 -0
- /package/{icons → dist/icons}/car_wash.svg +0 -0
- /package/{icons → dist/icons}/caravan_park.svg +0 -0
- /package/{icons → dist/icons}/carpet.svg +0 -0
- /package/{icons → dist/icons}/cattle_grid.svg +0 -0
- /package/{icons → dist/icons}/cave_entrance.svg +0 -0
- /package/{icons → dist/icons}/chalet.svg +0 -0
- /package/{icons → dist/icons}/charity.svg +0 -0
- /package/{icons → dist/icons}/chemist.svg +0 -0
- /package/{icons → dist/icons}/chimney.svg +0 -0
- /package/{icons → dist/icons}/church.svg +0 -0
- /package/{icons → dist/icons}/city_gate.svg +0 -0
- /package/{icons → dist/icons}/clinic.svg +0 -0
- /package/{icons → dist/icons}/clothes.svg +0 -0
- /package/{icons → dist/icons}/coffee.svg +0 -0
- /package/{icons → dist/icons}/community_centre.svg +0 -0
- /package/{icons → dist/icons}/computer.svg +0 -0
- /package/{icons → dist/icons}/consulate.svg +0 -0
- /package/{icons → dist/icons}/copyshop.svg +0 -0
- /package/{icons → dist/icons}/cosmetics.svg +0 -0
- /package/{icons → dist/icons}/courthouse.svg +0 -0
- /package/{icons → dist/icons}/crane.svg +0 -0
- /package/{icons → dist/icons}/dairy.svg +0 -0
- /package/{icons → dist/icons}/deli.svg +0 -0
- /package/{icons → dist/icons}/department_store.svg +0 -0
- /package/{icons → dist/icons}/diy.svg +0 -0
- /package/{icons → dist/icons}/electronics.svg +0 -0
- /package/{icons → dist/icons}/embankment.svg +0 -0
- /package/{icons → dist/icons}/embassy.svg +0 -0
- /package/{icons → dist/icons}/excrement_bags.svg +0 -0
- /package/{icons → dist/icons}/fabric.svg +0 -0
- /package/{icons → dist/icons}/farmyard.svg +0 -0
- /package/{icons → dist/icons}/ferry.svg +0 -0
- /package/{icons → dist/icons}/firepit.svg +0 -0
- /package/{icons → dist/icons}/firestation.svg +0 -0
- /package/{icons → dist/icons}/fishing.svg +0 -0
- /package/{icons → dist/icons}/fitness.svg +0 -0
- /package/{icons → dist/icons}/ford.svg +0 -0
- /package/{icons → dist/icons}/fort.svg +0 -0
- /package/{icons → dist/icons}/fortress.svg +0 -0
- /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
- /package/{icons → dist/icons}/generator_wind.svg +0 -0
- /package/{icons → dist/icons}/golf_pin.svg +0 -0
- /package/{icons → dist/icons}/greengrocer.svg +0 -0
- /package/{icons → dist/icons}/guest_house.svg +0 -0
- /package/{icons → dist/icons}/helipad.svg +0 -0
- /package/{icons → dist/icons}/hifi.svg +0 -0
- /package/{icons → dist/icons}/hostel.svg +0 -0
- /package/{icons → dist/icons}/hotel.svg +0 -0
- /package/{icons → dist/icons}/housenumber.svg +0 -0
- /package/{icons → dist/icons}/houseware.svg +0 -0
- /package/{icons → dist/icons}/hunting_stand.svg +0 -0
- /package/{icons → dist/icons}/interior_decoration.svg +0 -0
- /package/{icons → dist/icons}/internet_cafe.svg +0 -0
- /package/{icons → dist/icons}/kindergarten.svg +0 -0
- /package/{icons → dist/icons}/kissing_gate.svg +0 -0
- /package/{icons → dist/icons}/manor.svg +0 -0
- /package/{icons → dist/icons}/map.svg +0 -0
- /package/{icons → dist/icons}/marker_reverse.svg +0 -0
- /package/{icons → dist/icons}/marker_selected.svg +0 -0
- /package/{icons → dist/icons}/marker_unselected.svg +0 -0
- /package/{icons → dist/icons}/marketplace.svg +0 -0
- /package/{icons → dist/icons}/massage.svg +0 -0
- /package/{icons → dist/icons}/mast.svg +0 -0
- /package/{icons → dist/icons}/mast_communications.svg +0 -0
- /package/{icons → dist/icons}/mast_lighting.svg +0 -0
- /package/{icons → dist/icons}/medical_supply.svg +0 -0
- /package/{icons → dist/icons}/memorial.svg +0 -0
- /package/{icons → dist/icons}/miniature_golf.svg +0 -0
- /package/{icons → dist/icons}/motel.svg +0 -0
- /package/{icons → dist/icons}/mountain_range.svg +0 -0
- /package/{icons → dist/icons}/multifaith.svg +0 -0
- /package/{icons → dist/icons}/musical_instrument.svg +0 -0
- /package/{icons → dist/icons}/newsagent.svg +0 -0
- /package/{icons → dist/icons}/nightclub.svg +0 -0
- /package/{icons → dist/icons}/ocean.svg +0 -0
- /package/{icons → dist/icons}/office.svg +0 -0
- /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
- /package/{icons → dist/icons}/palace.svg +0 -0
- /package/{icons → dist/icons}/parcel_locker.svg +0 -0
- /package/{icons → dist/icons}/parking_space.svg +0 -0
- /package/{icons → dist/icons}/parking_tickets.svg +0 -0
- /package/{icons → dist/icons}/pet.svg +0 -0
- /package/{icons → dist/icons}/photo.svg +0 -0
- /package/{icons → dist/icons}/picnic.svg +0 -0
- /package/{icons → dist/icons}/plaque.svg +0 -0
- /package/{icons → dist/icons}/poi.svg +0 -0
- /package/{icons → dist/icons}/post_box.svg +0 -0
- /package/{icons → dist/icons}/post_office.svg +0 -0
- /package/{icons → dist/icons}/postal_code.svg +0 -0
- /package/{icons → dist/icons}/pub.svg +0 -0
- /package/{icons → dist/icons}/public_bath.svg +0 -0
- /package/{icons → dist/icons}/public_bookcase.svg +0 -0
- /package/{icons → dist/icons}/public_building.svg +0 -0
- /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
- /package/{icons → dist/icons}/reverse.svg +0 -0
- /package/{icons → dist/icons}/river.svg +0 -0
- /package/{icons → dist/icons}/road.svg +0 -0
- /package/{icons → dist/icons}/saddle.svg +0 -0
- /package/{icons → dist/icons}/sauna.svg +0 -0
- /package/{icons → dist/icons}/sea.svg +0 -0
- /package/{icons → dist/icons}/second_hand.svg +0 -0
- /package/{icons → dist/icons}/shintoist.svg +0 -0
- /package/{icons → dist/icons}/shoe.svg +0 -0
- /package/{icons → dist/icons}/shower.svg +0 -0
- /package/{icons → dist/icons}/shrine.svg +0 -0
- /package/{icons → dist/icons}/sikhist.svg +0 -0
- /package/{icons → dist/icons}/slipway.svg +0 -0
- /package/{icons → dist/icons}/snowmobile.svg +0 -0
- /package/{icons → dist/icons}/social_facility.svg +0 -0
- /package/{icons → dist/icons}/sports.svg +0 -0
- /package/{icons → dist/icons}/sprite.json +0 -0
- /package/{icons → dist/icons}/sprite.png +0 -0
- /package/{icons → dist/icons}/sprite@2x.json +0 -0
- /package/{icons → dist/icons}/sprite@2x.png +0 -0
- /package/{icons → dist/icons}/stationery.svg +0 -0
- /package/{icons → dist/icons}/stile.svg +0 -0
- /package/{icons → dist/icons}/stone.svg +0 -0
- /package/{icons → dist/icons}/storage_tank.svg +0 -0
- /package/{icons → dist/icons}/stream.svg +0 -0
- /package/{icons → dist/icons}/street.svg +0 -0
- /package/{icons → dist/icons}/supermarket.svg +0 -0
- /package/{icons → dist/icons}/tea.svg +0 -0
- /package/{icons → dist/icons}/telescope_dish.svg +0 -0
- /package/{icons → dist/icons}/telescope_dome.svg +0 -0
- /package/{icons → dist/icons}/ticket.svg +0 -0
- /package/{icons → dist/icons}/tobacco.svg +0 -0
- /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_cooling.svg +0 -0
- /package/{icons → dist/icons}/tower_dish.svg +0 -0
- /package/{icons → dist/icons}/tower_dome.svg +0 -0
- /package/{icons → dist/icons}/tower_generic.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
- /package/{icons → dist/icons}/tower_lighting.svg +0 -0
- /package/{icons → dist/icons}/townhall.svg +0 -0
- /package/{icons → dist/icons}/toys.svg +0 -0
- /package/{icons → dist/icons}/trade.svg +0 -0
- /package/{icons → dist/icons}/traffic_light.svg +0 -0
- /package/{icons → dist/icons}/train_station.svg +0 -0
- /package/{icons → dist/icons}/travel_agency.svg +0 -0
- /package/{icons → dist/icons}/tyres.svg +0 -0
- /package/{icons → dist/icons}/university.svg +0 -0
- /package/{icons → dist/icons}/variety_store.svg +0 -0
- /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
- /package/{icons → dist/icons}/vending_machine.svg +0 -0
- /package/{icons → dist/icons}/video.svg +0 -0
- /package/{icons → dist/icons}/video_games.svg +0 -0
- /package/{icons → dist/icons}/waste_disposal.svg +0 -0
- /package/{icons → dist/icons}/water_well.svg +0 -0
- /package/{icons → dist/icons}/waterfall.svg +0 -0
- /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
package/svelte/maptilersdk.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as maptilersdk from "@maptiler/sdk";
|
|
2
|
-
import { crateClasses, } from "./MapLibreBasedGeocodingControl";
|
|
3
|
-
import { name, version } from "./info.json";
|
|
4
|
-
export { createMapLibreGlMapController } from "./maplibregl-controller";
|
|
5
|
-
const { MapLibreBasedGeocodingControl, events } = crateClasses(maptilersdk.Evented, maptilersdk, (map, div) => {
|
|
6
|
-
const sdkConfig = {};
|
|
7
|
-
if (!("getSdkConfig" in map && typeof map.getSdkConfig === "function")) {
|
|
8
|
-
throw new Error("MapTiler SDK not detected");
|
|
9
|
-
}
|
|
10
|
-
const { primaryLanguage, apiKey } = map.getSdkConfig();
|
|
11
|
-
sdkConfig.apiKey = apiKey;
|
|
12
|
-
const match = /^([a-z]{2})($|_|-)/.exec(primaryLanguage);
|
|
13
|
-
if (match) {
|
|
14
|
-
sdkConfig.language = match[1];
|
|
15
|
-
}
|
|
16
|
-
div.className += " maptiler-ctrl";
|
|
17
|
-
return sdkConfig;
|
|
18
|
-
});
|
|
19
|
-
export class GeocodingControl extends MapLibreBasedGeocodingControl {
|
|
20
|
-
onAdd(map) {
|
|
21
|
-
map.telemetry?.registerModule(name, version);
|
|
22
|
-
return super.onAddInt(map);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export const SelectEvent = events.SelectEvent;
|
|
26
|
-
export const FeaturesListedEvent = events.FeaturesListedEvent;
|
|
27
|
-
export const FeaturesMarkedEvent = events.FeaturesMarkedEvent;
|
|
28
|
-
export const OptionsVisibilityChangeEvent = events.OptionsVisibilityChangeEvent;
|
|
29
|
-
export const PickEvent = events.PickEvent;
|
|
30
|
-
export const QueryChangeEvent = events.QueryChangeEvent;
|
|
31
|
-
export const ResponseEvent = events.ResponseEvent;
|
|
32
|
-
export const ReverseToggleEvent = events.ReverseToggleEvent;
|
package/svelte/mask.d.ts
DELETED
package/svelte/mask.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import bbox from "@turf/bbox";
|
|
2
|
-
import difference from "@turf/difference";
|
|
3
|
-
import flatten from "@turf/flatten";
|
|
4
|
-
import { featureCollection, polygon } from "@turf/helpers";
|
|
5
|
-
import union from "@turf/union";
|
|
6
|
-
import { unwrapBbox } from "./geoUtils";
|
|
7
|
-
export function setMask(picked, setData) {
|
|
8
|
-
const diff = difference(featureCollection([
|
|
9
|
-
polygon([
|
|
10
|
-
[
|
|
11
|
-
[180, 90],
|
|
12
|
-
[-180, 90],
|
|
13
|
-
[-180, -90],
|
|
14
|
-
[180, -90],
|
|
15
|
-
[180, 90],
|
|
16
|
-
],
|
|
17
|
-
]),
|
|
18
|
-
picked,
|
|
19
|
-
]));
|
|
20
|
-
if (!diff) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
diff.properties = { isMask: true };
|
|
24
|
-
const bb = unwrapBbox(bbox(picked));
|
|
25
|
-
// bigger features (continents, oceans) have bigger tolerance
|
|
26
|
-
// because of the used source data simplification
|
|
27
|
-
const tolerance = (bb[2] - bb[0]) / 360 / 1_000;
|
|
28
|
-
const leaksLeft = bb[0] < -180;
|
|
29
|
-
const leaksRight = bb[2] > 180;
|
|
30
|
-
const flattened = flatten(picked);
|
|
31
|
-
if (flattened.features.length > 1 && (leaksLeft || leaksRight)) {
|
|
32
|
-
for (const poly of flattened.features) {
|
|
33
|
-
const bb = unwrapBbox(bbox(poly));
|
|
34
|
-
if (leaksRight && bb[0] < -180 + tolerance) {
|
|
35
|
-
for (const ring of poly.geometry.coordinates) {
|
|
36
|
-
for (const position of ring) {
|
|
37
|
-
position[0] += 360 - tolerance;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (leaksLeft && bb[2] > 180 - tolerance) {
|
|
42
|
-
for (const ring of poly.geometry.coordinates) {
|
|
43
|
-
for (const position of ring) {
|
|
44
|
-
position[0] -= 360 - tolerance;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
setData(featureCollection([
|
|
51
|
-
flattened.features.length < 2 ? picked : (union(flattened) ?? picked),
|
|
52
|
-
diff,
|
|
53
|
-
]));
|
|
54
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type Map from "ol/Map";
|
|
2
|
-
import type { AnimationOptions, FitOptions } from "ol/View";
|
|
3
|
-
import { type StyleLike } from "ol/style/Style";
|
|
4
|
-
import type { FlatStyleLike } from "ol/style/flat";
|
|
5
|
-
import type { BBox, Feature as FeatureType, MapEvent, Position } from "./types";
|
|
6
|
-
export declare function createOpenLayersMapController(map: Map, flyToOptions?: AnimationOptions, flyToBounds?: FitOptions, fullGeometryStyle?: StyleLike | FlatStyleLike): {
|
|
7
|
-
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
8
|
-
flyTo(center: Position, zoom: number): void;
|
|
9
|
-
fitBounds(bbox: BBox, padding: number, maxZoom: number): void;
|
|
10
|
-
indicateReverse(reverse: boolean): void;
|
|
11
|
-
setReverseMarker(coordinates?: Position): void;
|
|
12
|
-
setFeatures(markedFeatures: FeatureType[] | undefined, picked: FeatureType | undefined, showPolygonMarker: boolean): void;
|
|
13
|
-
setSelectedMarker(index: number): void;
|
|
14
|
-
getCenterAndZoom(): [number, x: number, y: number] | undefined;
|
|
15
|
-
};
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { Feature as OlFeature } from "ol";
|
|
2
|
-
import { GeometryCollection as OlGeometryCollection, LineString as OlLineString, MultiLineString as OlMultiLineString, MultiPolygon as OlMultiPolygon, Point as OlPoint, Polygon as OlPolygon, } from "ol/geom";
|
|
3
|
-
import VectorLayer from "ol/layer/Vector";
|
|
4
|
-
import { fromLonLat, getUserProjection, toLonLat, transformExtent, } from "ol/proj";
|
|
5
|
-
import VectorSource from "ol/source/Vector";
|
|
6
|
-
import Fill from "ol/style/Fill";
|
|
7
|
-
import Icon from "ol/style/Icon";
|
|
8
|
-
import Stroke from "ol/style/Stroke";
|
|
9
|
-
import Style, {} from "ol/style/Style";
|
|
10
|
-
import Text from "ol/style/Text";
|
|
11
|
-
import { setMask } from "./mask";
|
|
12
|
-
const EPSG_4326 = "EPSG:4326";
|
|
13
|
-
function defaultStyle(feature) {
|
|
14
|
-
const properties = feature.getProperties();
|
|
15
|
-
const { isMask } = properties;
|
|
16
|
-
const type = feature.getGeometry()?.getType();
|
|
17
|
-
const weight = isMask
|
|
18
|
-
? 0
|
|
19
|
-
: type === "LineString" || type === "MultiLineString"
|
|
20
|
-
? 3
|
|
21
|
-
: 2;
|
|
22
|
-
return new Style({
|
|
23
|
-
stroke: isMask
|
|
24
|
-
? undefined
|
|
25
|
-
: new Stroke({
|
|
26
|
-
color: "#3170fe",
|
|
27
|
-
lineDash: [weight, weight],
|
|
28
|
-
width: weight,
|
|
29
|
-
lineCap: "butt",
|
|
30
|
-
}),
|
|
31
|
-
fill: isMask
|
|
32
|
-
? new Fill({
|
|
33
|
-
color: "#00000020",
|
|
34
|
-
})
|
|
35
|
-
: undefined,
|
|
36
|
-
image: new Icon({
|
|
37
|
-
src: `/icons/marker_${properties.isReverse
|
|
38
|
-
? "reverse"
|
|
39
|
-
: properties.isSelected
|
|
40
|
-
? "selected"
|
|
41
|
-
: "unselected"}.svg`,
|
|
42
|
-
anchor: [0.5, 1],
|
|
43
|
-
}),
|
|
44
|
-
zIndex: properties.isSelected ? 2 : properties.isReverse ? 0 : 1,
|
|
45
|
-
text: properties.isSelected && properties.tooltip
|
|
46
|
-
? new Text({
|
|
47
|
-
backgroundFill: new Fill({ color: "white" }),
|
|
48
|
-
text: properties.tooltip,
|
|
49
|
-
offsetY: -40,
|
|
50
|
-
backgroundStroke: new Stroke({
|
|
51
|
-
color: "white",
|
|
52
|
-
lineJoin: "round",
|
|
53
|
-
width: 3,
|
|
54
|
-
}),
|
|
55
|
-
padding: [2, 0, 0, 2],
|
|
56
|
-
})
|
|
57
|
-
: undefined,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
export function createOpenLayersMapController(map, flyToOptions = {}, flyToBounds = {}, fullGeometryStyle = defaultStyle) {
|
|
61
|
-
let prevSelected = -1;
|
|
62
|
-
let prevHovered;
|
|
63
|
-
let eventHandler;
|
|
64
|
-
let reverseMarker;
|
|
65
|
-
let indicatingReverse = false;
|
|
66
|
-
const vectorLayer = new VectorLayer({
|
|
67
|
-
updateWhileAnimating: true,
|
|
68
|
-
});
|
|
69
|
-
map.addLayer(vectorLayer);
|
|
70
|
-
const source = new VectorSource({});
|
|
71
|
-
vectorLayer.setSource(source);
|
|
72
|
-
vectorLayer.setStyle(fullGeometryStyle);
|
|
73
|
-
map.on("click", (e) => {
|
|
74
|
-
map.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
75
|
-
const id = feature.getId();
|
|
76
|
-
if (!id) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
e.stopPropagation();
|
|
80
|
-
eventHandler?.({ type: "markerClick", id });
|
|
81
|
-
return feature;
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
map.on("pointermove", (e) => {
|
|
85
|
-
const featureId = map.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
86
|
-
return feature.getId();
|
|
87
|
-
});
|
|
88
|
-
if (prevHovered === featureId) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (prevHovered) {
|
|
92
|
-
eventHandler?.({
|
|
93
|
-
type: "markerMouseLeave",
|
|
94
|
-
id: prevHovered,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (featureId) {
|
|
98
|
-
eventHandler?.({
|
|
99
|
-
type: "markerMouseEnter",
|
|
100
|
-
id: featureId,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
map.getTargetElement().style.cursor = featureId
|
|
104
|
-
? "pointer"
|
|
105
|
-
: indicatingReverse
|
|
106
|
-
? "crosshair"
|
|
107
|
-
: "";
|
|
108
|
-
prevHovered = featureId;
|
|
109
|
-
});
|
|
110
|
-
function getProjection() {
|
|
111
|
-
return getUserProjection() ?? map.getView().getProjection();
|
|
112
|
-
}
|
|
113
|
-
function fromWgs84(geometry) {
|
|
114
|
-
return geometry.transform(EPSG_4326, getProjection());
|
|
115
|
-
}
|
|
116
|
-
const handleMapClick = (e) => {
|
|
117
|
-
eventHandler?.({
|
|
118
|
-
type: "mapClick",
|
|
119
|
-
coordinates: toLonLat(e.coordinate, getProjection()),
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
return {
|
|
123
|
-
setEventHandler(handler) {
|
|
124
|
-
if (handler) {
|
|
125
|
-
eventHandler = handler;
|
|
126
|
-
map.on("click", handleMapClick);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
eventHandler = undefined;
|
|
130
|
-
map.un("click", handleMapClick);
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
flyTo(center, zoom) {
|
|
134
|
-
map.getView().animate({
|
|
135
|
-
center: fromLonLat(center, getProjection()),
|
|
136
|
-
...(zoom ? { zoom } : {}),
|
|
137
|
-
duration: 2000,
|
|
138
|
-
...flyToOptions,
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
fitBounds(bbox, padding, maxZoom) {
|
|
142
|
-
map.getView().fit(transformExtent(bbox, EPSG_4326, getProjection()), {
|
|
143
|
-
padding: [padding, padding, padding, padding],
|
|
144
|
-
...(maxZoom ? { maxZoom } : {}),
|
|
145
|
-
duration: 2000,
|
|
146
|
-
...flyToBounds,
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
indicateReverse(reverse) {
|
|
150
|
-
indicatingReverse = reverse;
|
|
151
|
-
map.getTargetElement().style.cursor = reverse ? "crosshair" : "";
|
|
152
|
-
},
|
|
153
|
-
setReverseMarker(coordinates) {
|
|
154
|
-
if (reverseMarker) {
|
|
155
|
-
if (!coordinates) {
|
|
156
|
-
source.removeFeature(reverseMarker);
|
|
157
|
-
reverseMarker.dispose();
|
|
158
|
-
reverseMarker = undefined;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
reverseMarker.getGeometry().setCoordinates(fromLonLat(coordinates, getProjection()));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else if (coordinates) {
|
|
165
|
-
reverseMarker = new OlFeature(new OlPoint(fromLonLat(coordinates, getProjection())));
|
|
166
|
-
reverseMarker.setProperties({ isReverse: true });
|
|
167
|
-
source.addFeature(reverseMarker);
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
setFeatures(markedFeatures, picked, showPolygonMarker) {
|
|
171
|
-
function setData(data) {
|
|
172
|
-
if (!data) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
for (const f of data.features) {
|
|
176
|
-
const geom = f.geometry.type === "Polygon"
|
|
177
|
-
? new OlPolygon(f.geometry.coordinates)
|
|
178
|
-
: f.geometry.type === "MultiPolygon"
|
|
179
|
-
? new OlMultiPolygon(f.geometry.coordinates)
|
|
180
|
-
: null;
|
|
181
|
-
if (!geom) {
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
source.addFeature(new OlFeature({
|
|
185
|
-
isMask: !!f.properties?.isMask,
|
|
186
|
-
geometry: fromWgs84(geom),
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
source.clear();
|
|
191
|
-
if (reverseMarker) {
|
|
192
|
-
source.addFeature(reverseMarker);
|
|
193
|
-
}
|
|
194
|
-
block: if (picked) {
|
|
195
|
-
let handled = false;
|
|
196
|
-
if (picked.geometry.type === "GeometryCollection") {
|
|
197
|
-
const geoms = picked.geometry.geometries
|
|
198
|
-
.map((geometry) => geometry.type === "Polygon"
|
|
199
|
-
? new OlPolygon(geometry.coordinates)
|
|
200
|
-
: geometry.type === "MultiPolygon"
|
|
201
|
-
? new OlMultiPolygon(geometry.coordinates)
|
|
202
|
-
: null)
|
|
203
|
-
.filter((a) => !!a);
|
|
204
|
-
if (geoms.length > 0) {
|
|
205
|
-
source.addFeature(new OlFeature(fromWgs84(new OlGeometryCollection(geoms))));
|
|
206
|
-
handled = true;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
for (const geometry of picked.geometry.geometries) {
|
|
210
|
-
if (geometry.type === "LineString") {
|
|
211
|
-
source.addFeature(new OlFeature(fromWgs84(new OlLineString(geometry.coordinates))));
|
|
212
|
-
handled = true;
|
|
213
|
-
}
|
|
214
|
-
else if (geometry.type === "MultiLineString") {
|
|
215
|
-
source.addFeature(new OlFeature(fromWgs84(new OlMultiLineString(geometry.coordinates))));
|
|
216
|
-
}
|
|
217
|
-
handled = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (handled) {
|
|
222
|
-
// nothing
|
|
223
|
-
}
|
|
224
|
-
else if (picked.geometry.type === "Polygon") {
|
|
225
|
-
setMask(picked, setData);
|
|
226
|
-
}
|
|
227
|
-
else if (picked.geometry.type === "MultiPolygon") {
|
|
228
|
-
setMask(picked, setData);
|
|
229
|
-
}
|
|
230
|
-
else if (picked.geometry.type === "LineString") {
|
|
231
|
-
source.addFeature(new OlFeature(fromWgs84(new OlLineString(picked.geometry.coordinates))));
|
|
232
|
-
break block; // no pin for (multi)linestrings
|
|
233
|
-
}
|
|
234
|
-
else if (picked.geometry.type === "MultiLineString") {
|
|
235
|
-
source.addFeature(new OlFeature(fromWgs84(new OlMultiLineString(picked.geometry.coordinates))));
|
|
236
|
-
break block; // no pin for (multi)linestrings
|
|
237
|
-
}
|
|
238
|
-
if (!showPolygonMarker && !picked.geometry.type.endsWith("Point")) {
|
|
239
|
-
break block;
|
|
240
|
-
}
|
|
241
|
-
source.addFeature(new OlFeature(fromWgs84(new OlPoint(picked.center))));
|
|
242
|
-
}
|
|
243
|
-
for (const feature of markedFeatures ?? []) {
|
|
244
|
-
if (feature === picked) {
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
const marker = new OlFeature(new OlPoint(fromLonLat(feature.center, getProjection())));
|
|
248
|
-
marker.setId(feature.id);
|
|
249
|
-
marker.setProperties({
|
|
250
|
-
fuzzy: !!feature.matching_text,
|
|
251
|
-
tooltip: feature.place_type[0] === "reverse"
|
|
252
|
-
? feature.place_name
|
|
253
|
-
: feature.place_name.replace(/,.*/, ""),
|
|
254
|
-
});
|
|
255
|
-
source.addFeature(marker);
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
setSelectedMarker(index) {
|
|
259
|
-
const features = source.getFeatures();
|
|
260
|
-
const offset = features[0]?.getProperties().isReverse ? 1 : 0;
|
|
261
|
-
if (prevSelected > -1) {
|
|
262
|
-
features[prevSelected + offset]?.setProperties({
|
|
263
|
-
isSelected: false,
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
if (index > -1) {
|
|
267
|
-
features[index + offset]?.setProperties({
|
|
268
|
-
isSelected: true,
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
prevSelected = index;
|
|
272
|
-
},
|
|
273
|
-
getCenterAndZoom() {
|
|
274
|
-
const view = map.getView();
|
|
275
|
-
const center = view.getCenter();
|
|
276
|
-
const zoom = view.getZoom();
|
|
277
|
-
if (!center || zoom === undefined) {
|
|
278
|
-
return undefined;
|
|
279
|
-
}
|
|
280
|
-
return [zoom, ...toLonLat(center, getProjection())];
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
}
|
package/svelte/openlayers.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { Map } from "ol";
|
|
2
|
-
import type { ObjectEvent } from "ol/Object";
|
|
3
|
-
import type { CombinedOnSignature, EventTypes } from "ol/Observable";
|
|
4
|
-
import type { AnimationOptions, FitOptions } from "ol/View";
|
|
5
|
-
import { Control } from "ol/control";
|
|
6
|
-
import type { Options } from "ol/control/Control";
|
|
7
|
-
import type { EventsKey } from "ol/events";
|
|
8
|
-
import BaseEvent from "ol/events/Event";
|
|
9
|
-
import type { StyleLike } from "ol/style/Style";
|
|
10
|
-
import type { FlatStyleLike } from "ol/style/flat";
|
|
11
|
-
import type { ControlOptions, Feature, FeatureCollection } from "./types";
|
|
12
|
-
export { createOpenLayersMapController } from "./openlayers-controller";
|
|
13
|
-
type OpenLayersControlOptions = ControlOptions & Options & {
|
|
14
|
-
flyTo?: boolean | (AnimationOptions & FitOptions);
|
|
15
|
-
fullGeometryStyle?: StyleLike | FlatStyleLike;
|
|
16
|
-
};
|
|
17
|
-
type CustomEventMap = {
|
|
18
|
-
select: SelectEvent;
|
|
19
|
-
featureslisted: FeaturesListedEvent;
|
|
20
|
-
featuresmarked: FeaturesMarkedEvent;
|
|
21
|
-
optionsvisibilitychange: OptionsVisibilityChangeEvent;
|
|
22
|
-
pick: PickEvent;
|
|
23
|
-
querychange: QueryChangeEvent;
|
|
24
|
-
response: ResponseEvent;
|
|
25
|
-
reversetoggle: ReverseToggleEvent;
|
|
26
|
-
};
|
|
27
|
-
type CustomObjectOnSignature<ReturnType> = {
|
|
28
|
-
<K extends keyof CustomEventMap>(type: K, listener: (evt: CustomEventMap[K]) => void): ReturnType;
|
|
29
|
-
} & {
|
|
30
|
-
(type: "propertychange", listener: (evt: ObjectEvent) => void): ReturnType;
|
|
31
|
-
} & CombinedOnSignature<EventTypes | "propertychange" | keyof CustomEventMap, ReturnType>;
|
|
32
|
-
export declare class GeocodingControl extends Control {
|
|
33
|
-
#private;
|
|
34
|
-
on: CustomObjectOnSignature<EventsKey>;
|
|
35
|
-
once: CustomObjectOnSignature<EventsKey>;
|
|
36
|
-
un: CustomObjectOnSignature<EventsKey>;
|
|
37
|
-
constructor(options: OpenLayersControlOptions);
|
|
38
|
-
setMap(map: Map | null): void;
|
|
39
|
-
/**
|
|
40
|
-
* Update the control options.
|
|
41
|
-
*
|
|
42
|
-
* @param options options to update
|
|
43
|
-
*/
|
|
44
|
-
setOptions(options: OpenLayersControlOptions): void;
|
|
45
|
-
/**
|
|
46
|
-
* Set the content of search input box.
|
|
47
|
-
*
|
|
48
|
-
* @param value text to set
|
|
49
|
-
* @param submit perform the search
|
|
50
|
-
*/
|
|
51
|
-
setQuery(value: string, submit?: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Clear geocoding search results from the map.
|
|
54
|
-
*/
|
|
55
|
-
clearMap(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Clear search result list.
|
|
58
|
-
*/
|
|
59
|
-
clearList(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Set reverse geocoding mode.
|
|
62
|
-
*
|
|
63
|
-
* @param reverseActive reverse geocoding active
|
|
64
|
-
*/
|
|
65
|
-
setReverseMode(reverseActive: boolean): void;
|
|
66
|
-
/**
|
|
67
|
-
* Focus the search input box.
|
|
68
|
-
*
|
|
69
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
70
|
-
*/
|
|
71
|
-
focus(options?: FocusOptions): void;
|
|
72
|
-
/**
|
|
73
|
-
* Blur the search input box.
|
|
74
|
-
*/
|
|
75
|
-
blur(): void;
|
|
76
|
-
}
|
|
77
|
-
export declare class SelectEvent extends BaseEvent {
|
|
78
|
-
feature: Feature | undefined;
|
|
79
|
-
constructor(feature: Feature | undefined);
|
|
80
|
-
}
|
|
81
|
-
export declare class FeaturesListedEvent extends BaseEvent {
|
|
82
|
-
features: Feature[] | undefined;
|
|
83
|
-
constructor(features: Feature[] | undefined);
|
|
84
|
-
}
|
|
85
|
-
export declare class FeaturesMarkedEvent extends BaseEvent {
|
|
86
|
-
features: Feature[] | undefined;
|
|
87
|
-
constructor(features: Feature[] | undefined);
|
|
88
|
-
}
|
|
89
|
-
export declare class OptionsVisibilityChangeEvent extends BaseEvent {
|
|
90
|
-
optionsVisible: boolean;
|
|
91
|
-
constructor(optionsVisible: boolean);
|
|
92
|
-
}
|
|
93
|
-
export declare class PickEvent extends BaseEvent {
|
|
94
|
-
feature: Feature | undefined;
|
|
95
|
-
constructor(feature: Feature | undefined);
|
|
96
|
-
}
|
|
97
|
-
export declare class QueryChangeEvent extends BaseEvent {
|
|
98
|
-
query: string;
|
|
99
|
-
constructor(query: string);
|
|
100
|
-
}
|
|
101
|
-
export declare class ResponseEvent extends BaseEvent {
|
|
102
|
-
url: string;
|
|
103
|
-
featureCollection: FeatureCollection;
|
|
104
|
-
constructor(url: string, featureCollection: FeatureCollection);
|
|
105
|
-
}
|
|
106
|
-
export declare class ReverseToggleEvent extends BaseEvent {
|
|
107
|
-
reverse: boolean;
|
|
108
|
-
constructor(reverse: boolean);
|
|
109
|
-
}
|
package/svelte/openlayers.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { Control } from "ol/control";
|
|
2
|
-
import BaseEvent from "ol/events/Event";
|
|
3
|
-
import GeocodingControlComponent from "./GeocodingControl.svelte";
|
|
4
|
-
import { createOpenLayersMapController } from "./openlayers-controller";
|
|
5
|
-
export { createOpenLayersMapController } from "./openlayers-controller";
|
|
6
|
-
export class GeocodingControl extends Control {
|
|
7
|
-
#gc;
|
|
8
|
-
#options;
|
|
9
|
-
constructor(options) {
|
|
10
|
-
const div = document.createElement("div");
|
|
11
|
-
div.className = "ol-search";
|
|
12
|
-
super({
|
|
13
|
-
element: div,
|
|
14
|
-
target: options.target,
|
|
15
|
-
});
|
|
16
|
-
const { flyTo, fullGeometryStyle, ...restOptions } = options;
|
|
17
|
-
this.#gc = new GeocodingControlComponent({
|
|
18
|
-
target: div,
|
|
19
|
-
props: {
|
|
20
|
-
flyTo: flyTo === undefined ? true : !!flyTo,
|
|
21
|
-
...restOptions,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
this.#gc.$on("select", (event) => {
|
|
25
|
-
this.dispatchEvent(new SelectEvent(event.detail.feature));
|
|
26
|
-
});
|
|
27
|
-
this.#gc.$on("pick", (event) => {
|
|
28
|
-
this.dispatchEvent(new PickEvent(event.detail.feature));
|
|
29
|
-
});
|
|
30
|
-
this.#gc.$on("featureslisted", (event) => {
|
|
31
|
-
this.dispatchEvent(new FeaturesListedEvent(event.detail.features));
|
|
32
|
-
});
|
|
33
|
-
this.#gc.$on("featuresmarked", (event) => {
|
|
34
|
-
this.dispatchEvent(new FeaturesMarkedEvent(event.detail.features));
|
|
35
|
-
});
|
|
36
|
-
this.#gc.$on("response", (event) => {
|
|
37
|
-
this.dispatchEvent(new ResponseEvent(event.detail.url, event.detail.featureCollection));
|
|
38
|
-
});
|
|
39
|
-
this.#gc.$on("optionsvisibilitychange", (event) => {
|
|
40
|
-
this.dispatchEvent(new OptionsVisibilityChangeEvent(event.detail.optionsVisible));
|
|
41
|
-
});
|
|
42
|
-
this.#gc.$on("reversetoggle", (event) => {
|
|
43
|
-
this.dispatchEvent(new ReverseToggleEvent(event.detail.reverse));
|
|
44
|
-
});
|
|
45
|
-
this.#gc.$on("querychange", (event) => {
|
|
46
|
-
this.dispatchEvent(new QueryChangeEvent(event.detail.query));
|
|
47
|
-
});
|
|
48
|
-
this.#options = options;
|
|
49
|
-
}
|
|
50
|
-
setMap(map) {
|
|
51
|
-
super.setMap(map);
|
|
52
|
-
if (map) {
|
|
53
|
-
const {
|
|
54
|
-
// marker,
|
|
55
|
-
// showResultMarkers,
|
|
56
|
-
flyTo, fullGeometryStyle, } = this.#options;
|
|
57
|
-
const mapController = createOpenLayersMapController(map, typeof flyTo === "boolean" ? undefined : flyTo, typeof flyTo === "boolean" ? undefined : flyTo,
|
|
58
|
-
// marker,
|
|
59
|
-
// showResultMarkers,
|
|
60
|
-
fullGeometryStyle);
|
|
61
|
-
this.#gc?.$set({ mapController });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Update the control options.
|
|
66
|
-
*
|
|
67
|
-
* @param options options to update
|
|
68
|
-
*/
|
|
69
|
-
setOptions(options) {
|
|
70
|
-
Object.assign(this.#options, options);
|
|
71
|
-
const { flyTo, fullGeometryStyle, ...restOptions } = this.#options;
|
|
72
|
-
this.#gc?.$set({
|
|
73
|
-
...restOptions,
|
|
74
|
-
flyTo: flyTo === undefined ? true : !!flyTo,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Set the content of search input box.
|
|
79
|
-
*
|
|
80
|
-
* @param value text to set
|
|
81
|
-
* @param submit perform the search
|
|
82
|
-
*/
|
|
83
|
-
setQuery(value, submit = true) {
|
|
84
|
-
this.#gc?.setQuery(value, submit);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Clear geocoding search results from the map.
|
|
88
|
-
*/
|
|
89
|
-
clearMap() {
|
|
90
|
-
this.#gc?.clearMap();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Clear search result list.
|
|
94
|
-
*/
|
|
95
|
-
clearList() {
|
|
96
|
-
this.#gc?.clearList();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Set reverse geocoding mode.
|
|
100
|
-
*
|
|
101
|
-
* @param reverseActive reverse geocoding active
|
|
102
|
-
*/
|
|
103
|
-
setReverseMode(reverseActive) {
|
|
104
|
-
this.#gc?.$set({ reverseActive });
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Focus the search input box.
|
|
108
|
-
*
|
|
109
|
-
* @param options [FocusOptions](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
|
|
110
|
-
*/
|
|
111
|
-
focus(options) {
|
|
112
|
-
this.#gc?.focus(options);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Blur the search input box.
|
|
116
|
-
*/
|
|
117
|
-
blur() {
|
|
118
|
-
this.#gc?.blur();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
export class SelectEvent extends BaseEvent {
|
|
122
|
-
feature;
|
|
123
|
-
constructor(feature) {
|
|
124
|
-
super("select");
|
|
125
|
-
this.feature = feature;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export class FeaturesListedEvent extends BaseEvent {
|
|
129
|
-
features;
|
|
130
|
-
constructor(features) {
|
|
131
|
-
super("featureslisted");
|
|
132
|
-
this.features = features;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export class FeaturesMarkedEvent extends BaseEvent {
|
|
136
|
-
features;
|
|
137
|
-
constructor(features) {
|
|
138
|
-
super("featuresmarked");
|
|
139
|
-
this.features = features;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
export class OptionsVisibilityChangeEvent extends BaseEvent {
|
|
143
|
-
optionsVisible;
|
|
144
|
-
constructor(optionsVisible) {
|
|
145
|
-
super("optionsvisibilitychange");
|
|
146
|
-
this.optionsVisible = optionsVisible;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
export class PickEvent extends BaseEvent {
|
|
150
|
-
feature;
|
|
151
|
-
constructor(feature) {
|
|
152
|
-
super("pick");
|
|
153
|
-
this.feature = feature;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
export class QueryChangeEvent extends BaseEvent {
|
|
157
|
-
query;
|
|
158
|
-
constructor(query) {
|
|
159
|
-
super("querychange");
|
|
160
|
-
this.query = query;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
export class ResponseEvent extends BaseEvent {
|
|
164
|
-
url;
|
|
165
|
-
featureCollection;
|
|
166
|
-
constructor(url, featureCollection) {
|
|
167
|
-
super("response");
|
|
168
|
-
this.url = url;
|
|
169
|
-
this.featureCollection = featureCollection;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
export class ReverseToggleEvent extends BaseEvent {
|
|
173
|
-
reverse;
|
|
174
|
-
constructor(reverse) {
|
|
175
|
-
super("reversetoggle");
|
|
176
|
-
this.reverse = reverse;
|
|
177
|
-
}
|
|
178
|
-
}
|
package/svelte/proximity.d.ts
DELETED