add zone, add popup address, add popup zone, add remove marker, add close popup

This commit is contained in:
2025-10-07 16:25:24 -04:00
parent db3ec6cddd
commit 849a6f07a0
10 changed files with 658 additions and 297 deletions
+17 -11
View File
@@ -1,13 +1,19 @@
import {DeliveryZone, IMapAdapter, LatLng, MapOptions} from './map-adapter.interface';
import {Zone, IMapAdapter, LatLng, MapOptions, Address} from './map-adapter.interface';
export declare class LeafletAdapter implements IMapAdapter {
private map;
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: {
color?: string;
}): void;
destroy(): void;
addZone(zone: DeliveryZone[]): void;
updateZone(one: DeliveryZone[]): void;
private map;
private deliveryCheckMarker?;
private markers?: {};
private popup?;
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: { id?: string; color?: string }): void;
removeMarker(id?: string): void;
destroy(): void;
addZone(zone: Zone[]): void;
updateZone(zone: Zone[]): void;
openZonePopup(zone: Zone) : void
openAddressPopup(address: Address): void;
closePopup(): void;
on(type: string, event: (e: any) => void): void;
}
+17 -11
View File
@@ -1,13 +1,19 @@
import {DeliveryZone, IMapAdapter, LatLng, MapOptions} from './map-adapter.interface';
import {Address, IMapAdapter, LatLng, MapOptions, Zone} from './map-adapter.interface';
export declare class LibreAdapter implements IMapAdapter {
private map;
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: {
color?: string;
}): void;
destroy(): void;
addZone(zone: DeliveryZone[]): void;
updateZone(one: DeliveryZone[]): void;
private map;
private deliveryCheckMarker?;
private markers?: {};
private popup?;
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: { id?: string; color?: string }): void;
removeMarker(id?: string): void;
destroy(): void;
addZone(zone: Zone[]): void;
updateZone(zone: Zone[]): void;
openZonePopup(zone: Zone) : void
openAddressPopup(address: Address): void;
closePopup(): void;
on(type: string, event: (e: any) => void): void;
}
+41 -22
View File
@@ -1,32 +1,51 @@
import * as maplibregl from 'maplibre-gl';
import * as L from 'leaflet';
export interface MapOptions {
center: LatLng;
zoom: number;
styleUrl: string;
tileUrl: string;
center: LatLng;
zoom: number;
styleUrl: string;
tileUrl: string;
}
export interface GeoPoint {
x: number;
y: number;
x: number;
y: number;
}
export interface DeliveryZone {
id: string;
name?: string;
color?: string;
polygon: GeoPoint[];
export interface Zone {
id: string;
name?: string;
color?: string;
opacity?: number;
polygon: GeoPoint[];
shippingFee?: number;
deliverySchedule?: string;
}
export interface Address {
line1: string;
line2?: string;
postalCode: string;
subdivision: string;
city: string;
country: string;
shippingFee?: number;
deliverySchedule?: string;
}
export type LatLng = [number, number];
export declare function getLngLat(latLng: LatLng): [number, number];
export interface IMapAdapter {
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: {
color?: string;
}): void;
destroy(): void;
addZone(zone: DeliveryZone[]): void;
updateZone(one: DeliveryZone[]): void;
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: { id?: string; color?: string }): void;
removeMarker(id?: string): void;
destroy(): void;
addZone(zone: Zone[]): void;
updateZone(zone: Zone[]): void;
openZonePopup(zone: Zone) : void
openAddressPopup(address: Address): void;
closePopup(): void;
on(
type: string,
event: (e: any) => void,
): void;
}
+16 -13
View File
@@ -1,15 +1,18 @@
import {IMapAdapter, MapOptions, LatLng, DeliveryZone} from './map-adapter.interface';
import {IMapAdapter, MapOptions, LatLng, Zone, Address} from './map-adapter.interface';
export declare class MapFacade implements IMapAdapter {
private readonly adapter;
private readonly leafletZoomOffset;
constructor(forceRaster: boolean, webglAvailable: boolean);
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: {
color?: string;
}): void;
destroy(): void;
addZone(zone: DeliveryZone[]): void;
updateZone(one: DeliveryZone[]): void;
private readonly adapter;
private readonly leafletZoomOffset;
constructor(forceRaster: boolean, webglAvailable: boolean);
init(container: HTMLElement, options: MapOptions): void;
setCenter(latLng: LatLng): void;
setZoom(zoom: number): void;
addMarker(latLng: LatLng, options?: { id?: string; color?: string }): void;
removeMarker(id?: string): void;
destroy(): void;
addZone(zone: Zone[]): void;
updateZone(zone: Zone[]): void;
openZonePopup(zone: Zone) : void
openAddressPopup(address: Address): void;
closePopup(): void;
on(type: string, event: (e: any) => void): void;
}
+13 -13
View File
@@ -3,19 +3,19 @@ import { MapOptions } from '../../adapters/map-adapter.interface';
import { MapFacade } from '../../adapters/map-facade';
import * as i0 from "@angular/core";
export interface OpenMapOptions extends MapOptions {
forceRaster: boolean;
forceRaster: boolean;
}
export declare class OpenMapComponent implements AfterViewInit {
private readonly platformId;
private readonly injector;
webglSupported?: boolean;
map?: MapFacade;
mapContainer: ElementRef<HTMLDivElement>;
options: import("@angular/core").InputSignal<OpenMapOptions>;
mapReady: import("@angular/core").OutputEmitterRef<MapFacade>;
ngAfterViewInit(): void;
webglDetection(supported: boolean): void;
private initializeMap;
static ɵfac: i0.ɵɵFactoryDeclaration<OpenMapComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<OpenMapComponent, "open-map", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "mapReady": "mapReady"; }, never, never, true, never>;
private readonly platformId;
private readonly injector;
webglSupported?: boolean;
map?: MapFacade;
mapContainer: ElementRef<HTMLDivElement>;
options: import("@angular/core").InputSignal<OpenMapOptions>;
mapReady: import("@angular/core").OutputEmitterRef<MapFacade>;
ngAfterViewInit(): void;
webglDetection(supported: boolean): void;
private initializeMap;
static ɵfac: i0.ɵɵFactoryDeclaration<OpenMapComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<OpenMapComponent, "open-map", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "mapReady": "mapReady"; }, never, never, true, never>;
}
+6 -6
View File
@@ -1,10 +1,10 @@
import { OnInit } from '@angular/core';
import * as i0 from "@angular/core";
export declare class WebglDetectionDirective implements OnInit {
private readonly platformId;
webglSupport: import("@angular/core").OutputEmitterRef<boolean>;
ngOnInit(): void;
private checkWebGLSupport;
static ɵfac: i0.ɵɵFactoryDeclaration<WebglDetectionDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<WebglDetectionDirective, "[webglDetection]", never, {}, { "webglSupport": "webglSupport"; }, never, never, true, never>;
private readonly platformId;
webglSupport: import("@angular/core").OutputEmitterRef<boolean>;
ngOnInit(): void;
private checkWebGLSupport;
static ɵfac: i0.ɵɵFactoryDeclaration<WebglDetectionDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<WebglDetectionDirective, "[webglDetection]", never, {}, { "webglSupport": "webglSupport"; }, never, never, true, never>;
}