tg-map-core 4.1.4 → 4.1.5

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.
Files changed (46) hide show
  1. package/dist/src/index.d.ts +3 -2
  2. package/dist/src/map/event-target.d.ts +2 -3
  3. package/dist/src/map/lat-lng.d.ts +2 -0
  4. package/dist/src/map/map/baidu-map.d.ts +2 -0
  5. package/dist/src/map/map/controls/control.d.ts +17 -0
  6. package/dist/src/map/map/controls/map-type.control.d.ts +5 -1
  7. package/dist/src/map/map/controls/scale.control.d.ts +3 -2
  8. package/dist/src/map/map/controls/zoom.control.d.ts +15 -2
  9. package/dist/src/map/map/extra/marker-clusterer.d.ts +75 -5
  10. package/dist/src/map/map/google-map.d.ts +2 -0
  11. package/dist/src/map/map/here-map.d.ts +2 -0
  12. package/dist/src/map/map/map-options.d.ts +24 -2
  13. package/dist/src/map/map/map.d.ts +7 -3
  14. package/dist/src/map/map/overlay/baidu-info-box.d.ts +15 -6
  15. package/dist/src/map/map/overlay/circle.d.ts +10 -1
  16. package/dist/src/map/map/overlay/icon.d.ts +34 -2
  17. package/dist/src/map/map/overlay/info-box.d.ts +36 -4
  18. package/dist/src/map/map/overlay/info-window.d.ts +28 -2
  19. package/dist/src/map/map/overlay/label.d.ts +19 -4
  20. package/dist/src/map/map/overlay/marker-label.d.ts +7 -0
  21. package/dist/src/map/map/overlay/marker.d.ts +46 -5
  22. package/dist/src/map/map/overlay/overlay.d.ts +9 -1
  23. package/dist/src/map/map/overlay/polygon.d.ts +8 -1
  24. package/dist/src/map/map/overlay/polyline.d.ts +8 -1
  25. package/dist/src/map/map/overlay/rectangle.d.ts +9 -1
  26. package/dist/src/map/map/overlay/shape.d.ts +12 -2
  27. package/dist/src/map/map/talks-map.d.ts +33 -29
  28. package/dist/src/map/map-config.d.ts +11 -2
  29. package/dist/src/map/map-factory.d.ts +5 -1
  30. package/dist/src/map/unions.d.ts +5 -1
  31. package/dist/src/utils/arrays.d.ts +8 -0
  32. package/dist/src/utils/baidu-utils.d.ts +25 -0
  33. package/dist/src/utils/objects.d.ts +2 -2
  34. package/dist/src/{map/talks → utils}/talks-layers.d.ts +3 -3
  35. package/dist/src/utils/talks-utils.d.ts +24 -0
  36. package/dist/src/utils/utils.d.ts +5 -0
  37. package/dist/src/utils/values.d.ts +6 -0
  38. package/dist/tg-map-core.cjs +6761 -5498
  39. package/dist/tg-map-core.css +1 -2
  40. package/dist/tg-map-core.mjs +6747 -5499
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +5 -3
  43. package/src/map/dts/baidu.d.ts +9 -0
  44. package/src/map/dts/maptalks.d.ts +74 -2
  45. package/src/map/dts/maptalks.markercluster.d.ts +35 -0
  46. package/dist/src/map/talks/talks-utils.d.ts +0 -7
@@ -1,16 +1,19 @@
1
+ import * as maptalks from 'maptalks';
1
2
  import type { Tg } from '../../event';
2
3
  import { AbstractEventTargetDelegate } from '../../event-target';
3
4
  import { LatLng } from '../../lat-lng';
4
- import type { Point } from '../../types';
5
+ import { Point } from '../../types';
5
6
  import type { UnionInfoWindow } from '../../unions';
6
7
  import type { BaiduMap } from '../baidu-map';
7
8
  import type { GoogleMap } from '../google-map';
9
+ import type { TalksMap } from '../talks-map';
8
10
  import './google-info.scss';
9
- import type { BaiduMarker, GoogleMarker, Marker } from './marker';
11
+ import type { BaiduMarker, GoogleMarker, Marker, TalksMarker } from './marker';
10
12
  /**
11
13
  * ## InfoWindow的初始偏移, 不同实现
12
14
  * - baidu: 根据Icon的infoWindowAnchor选项, 确定相对Icon左上角的偏移
13
15
  * - google: 根据Marker的anchorPoint选项, 确定相对marker的position的偏移
16
+ * - talks: 默认定位到Icon的顶部
14
17
  *
15
18
  * 统一成: InfoWindow的底部中点对齐Marker的position, 需要多少偏移使用offset选项来设置
16
19
  */
@@ -109,3 +112,26 @@ export declare class GoogleInfoWindow extends InfoWindow {
109
112
  getPosition(): LatLng;
110
113
  setPosition(position: LatLng): void;
111
114
  }
115
+ /**
116
+ * TODO: 2025/12/18 ipcjs 添加open/close事件
117
+ * @see TalksInfoBoxOverlay
118
+ */
119
+ export declare class TalksInfoWindow extends InfoWindow {
120
+ inner: maptalks.ui.InfoWindow;
121
+ private map;
122
+ private state;
123
+ static create(this: TalksMap, options: InfoWindowOptions): TalksInfoWindow;
124
+ private marker;
125
+ private pendingShowAction;
126
+ private onVisibleChangeInCluster;
127
+ constructor(inner: maptalks.ui.InfoWindow, map: TalksMap, state: {
128
+ position?: LatLng;
129
+ offset: Point;
130
+ });
131
+ open(anchor?: TalksMarker): void;
132
+ private detachMarker;
133
+ close(): void;
134
+ getPosition(): LatLng;
135
+ setPosition(position: LatLng): void;
136
+ isOpen(): boolean;
137
+ }
@@ -1,12 +1,15 @@
1
+ import * as maptalks from 'maptalks';
2
+ import { type Nullable } from 'tg-commons';
1
3
  import type { Tg } from '../../event';
2
4
  import { CoordType, LatLng } from '../../lat-lng';
3
5
  import { Point } from '../../types';
4
6
  import type { BaiduMap } from '../baidu-map';
5
7
  import type { GoogleMap } from '../google-map';
8
+ import type { TalksMap } from '../talks-map';
6
9
  import { MapPane } from './element-overlay';
7
10
  import { type GoogleLabel } from './google-label';
8
11
  import type { BaiduUnionIcon } from './icon';
9
- import { BaiduOverlay, GoogleOverlay, Overlay } from './overlay';
12
+ import { BaiduOverlay, GoogleOverlay, Overlay, TalksOverlay } from './overlay';
10
13
  export type BaiduLabel = BMap.Label & {
11
14
  __label__?: BaiduLabelOverlay;
12
15
  };
@@ -18,6 +21,7 @@ export type LabelEventMap = {
18
21
  */
19
22
  export interface LabelOptions {
20
23
  content: LabelContent;
24
+ /** label可以关联到marker上, 故可以不显式设置position */
21
25
  position?: LatLng;
22
26
  offset?: Point;
23
27
  /**
@@ -31,6 +35,7 @@ export interface LabelOptions {
31
35
  * ## 不同行为
32
36
  * - baidu: 不支持该属性
33
37
  * - google: 支持, 默认为{@link MapPane.overlayMouseTarget}
38
+ * - talks: 不支持
34
39
  */
35
40
  mapPane?: MapPane;
36
41
  }
@@ -60,7 +65,7 @@ export interface Label {
60
65
  getPosition(): LatLng;
61
66
  setPosition(position: LatLng): void;
62
67
  getOffset(): Point;
63
- setOffset(offset: Point): void;
68
+ setOffset(offset: Nullable<Point>): void;
64
69
  setZIndex(zIndex: number): void;
65
70
  }
66
71
  export type LabelOverlay = Label & Overlay;
@@ -82,7 +87,7 @@ export declare class BaiduLabelOverlay extends BaiduOverlay<BaiduLabel> implemen
82
87
  getPosition(): LatLng;
83
88
  setPosition(position: LatLng): void;
84
89
  getOffset(): Point;
85
- setOffset(offset: Point): void;
90
+ setOffset(offset: Nullable<Point>): void;
86
91
  setContent(content: LabelContent): void;
87
92
  /**
88
93
  * 关联新的Icon, 内部使用的方法
@@ -97,6 +102,16 @@ export declare class GoogleLabelOverlay extends GoogleOverlay<GoogleLabel> imple
97
102
  getPosition(): LatLng;
98
103
  setPosition(position: LatLng): void;
99
104
  getOffset(): Point;
100
- setOffset(offset: Point): void;
105
+ setOffset(offset: Nullable<Point>): void;
106
+ }
107
+ export type TalksLabel = maptalks.ui.UIMarker;
108
+ export declare class TalksLabelOverlay extends TalksOverlay<TalksLabel> implements Label {
109
+ static create(this: TalksMap, options: LabelOptions): TalksLabelOverlay;
110
+ setContent(content: LabelContent): void;
111
+ getPosition(): LatLng;
112
+ setPosition(position: LatLng): void;
113
+ getOffset(): Point;
114
+ setOffset(offset: Nullable<Point>): void;
115
+ setZIndex(zIndex: number): void;
101
116
  }
102
117
  export {};
@@ -1,3 +1,4 @@
1
+ import type * as maptalks from 'maptalks';
1
2
  import './marker-label.scss';
2
3
  /**
3
4
  * 和Marker关联的标签
@@ -16,4 +17,10 @@ export interface MarkerLabel {
16
17
  export declare const MarkerLabel: {
17
18
  toBaidu: (label: MarkerLabel) => BMap.Label;
18
19
  toGoogle: (label: MarkerLabel) => google.maps.MarkerLabel;
20
+ toTalks: (label: MarkerLabel, options: Pick<maptalks.TextSymbol, "textDx" | "textDy">) => {
21
+ properties: {
22
+ label: string;
23
+ };
24
+ symbol: maptalks.TextSymbol;
25
+ };
19
26
  };
@@ -1,14 +1,17 @@
1
+ import * as maptalks from 'maptalks';
1
2
  import type { Nullable } from '../../../utils/mapped-types';
2
3
  import type { Tg } from '../../event';
3
4
  import { CoordType, LatLng } from '../../lat-lng';
4
- import type { UnionBaiduIcon, UnionGoogleIcon } from '../../unions';
5
+ import { Point } from '../../types';
6
+ import type { UnionBaiduIcon, UnionGoogleIcon, UnionTalksIcon } from '../../unions';
5
7
  import type { BaiduMap } from '../baidu-map';
6
8
  import type { GoogleMap } from '../google-map';
9
+ import type { TalksMap } from '../talks-map';
7
10
  import type { BaiduInfoBox } from './baidu-info-box';
8
11
  import { UnionIcon } from './icon';
9
- import type { BaiduLabelOverlay, GoogleLabelOverlay, LabelOverlay } from './label';
12
+ import type { BaiduLabelOverlay, GoogleLabelOverlay, LabelOverlay, TalksLabelOverlay } from './label';
10
13
  import { MarkerLabel } from './marker-label';
11
- import { BaiduOverlay, GoogleOverlay, Overlay, type OverlayOptions } from './overlay';
14
+ import { BaiduOverlay, GoogleOverlay, Overlay, TalksOverlay, type OverlayOptions } from './overlay';
12
15
  export interface MarkerOptions extends OverlayOptions {
13
16
  position: LatLng;
14
17
  /**
@@ -20,6 +23,14 @@ export interface MarkerOptions extends OverlayOptions {
20
23
  * {@macro latlng_normalize}
21
24
  */
22
25
  normalizePositionForBaidu?: boolean;
26
+ /**
27
+ * hover时显示的文字
28
+ *
29
+ * ## 不同行为
30
+ * - baidu: 支持
31
+ * - google: 支持
32
+ * - talks: 不支持
33
+ */
23
34
  title?: string;
24
35
  /** @see MarkerLabel */
25
36
  label?: MarkerLabel;
@@ -66,8 +77,8 @@ export interface Marker extends Tg.EventTargetTyped<Marker, MarkerEventMap> {
66
77
  /** @see MarkerLabel */
67
78
  setLabel(label: MarkerLabel): void;
68
79
  setIcon(icon: UnionIcon): void;
69
- /** 感觉并没有读取Icon的必要, 直接返回内部的Icon, 懒得写包装类_(:3」∠)_ */
70
- getIcon(): Nullable<UnionGoogleIcon | UnionBaiduIcon>;
80
+ /** @deprecated 感觉并没有读取Icon的必要, 直接返回内部的Icon, 懒得写包装类_(:3」∠)_ */
81
+ getIcon(): Nullable<UnionGoogleIcon | UnionBaiduIcon | UnionTalksIcon>;
71
82
  /**
72
83
  * ## 不同行为
73
84
  * - baidu: 不支持设置clickable
@@ -142,3 +153,33 @@ export declare class GoogleMarker extends GoogleOverlay<google.maps.Marker> impl
142
153
  setLabel(label: MarkerLabel): void;
143
154
  attachLabelOverlay(label: GoogleLabelOverlay | undefined): void;
144
155
  }
156
+ export declare class TalksMarker extends TalksOverlay<maptalks.Marker> implements Marker {
157
+ private state;
158
+ static create(this: TalksMap, options: MarkerOptions): TalksMarker;
159
+ private static createSymbolOptions;
160
+ private label;
161
+ private labelPositionListener;
162
+ private labelVisibleListener;
163
+ private labelMapChangedListener;
164
+ private labelVisibleChangeInCluster;
165
+ constructor(innerOverlay: maptalks.Marker, coordType: CoordType, map: TalksMap, state: Pick<MarkerOptions, 'icon' | 'label' | 'title'>);
166
+ getPosition(): LatLng;
167
+ setPosition(position: LatLng): void;
168
+ setTitle(title: string): void;
169
+ getTitle(): string;
170
+ setLabel(label: MarkerLabel): void;
171
+ setIcon(icon: UnionIcon): void;
172
+ getIcon(): Nullable<UnionTalksIcon>;
173
+ setClickable(enable: boolean): void;
174
+ isClickable(): boolean;
175
+ setDraggable(enable: boolean): void;
176
+ isDraggable(): boolean;
177
+ setZIndex(zIndex?: number): void;
178
+ getZIndex(): number | undefined;
179
+ /**
180
+ * maptalks.InfoWindow关联到Marker之后, InfoWindow会偏移到Marker的图标上方, 该方法返回这个偏移量
181
+ * @see https://github.com/maptalks/maptalks.js/blob/e204e3bafe5855f38399f7bca502460b1e0bb269/packages/maptalks/src/ui/InfoWindow.ts#L255
182
+ */
183
+ getInfoWindowOffset(): Point | undefined;
184
+ attachLabelOverlay(label: TalksLabelOverlay | undefined): void;
185
+ }
@@ -1,10 +1,11 @@
1
1
  import type { Tg } from '../../event';
2
2
  import { type EventTargetDelegate } from '../../event-target';
3
3
  import type { CoordType } from '../../lat-lng';
4
- import type { UnionBaiduOverlay, UnionGoogleOverlay } from '../../unions';
4
+ import type { UnionBaiduOverlay, UnionGoogleOverlay, UnionTalksOverlay } from '../../unions';
5
5
  import type { BaiduMap } from '../baidu-map';
6
6
  import type { GoogleMap } from '../google-map';
7
7
  import type { BaseMap } from '../map';
8
+ import type { TalksMap } from '../talks-map';
8
9
  export interface OverlayOptions {
9
10
  /** @default true */
10
11
  visible?: boolean;
@@ -44,3 +45,10 @@ export declare class BaiduOverlay<T extends UnionBaiduOverlay = UnionBaiduOverla
44
45
  /** 在创建BaiduOverlay时, 设置options.visible, 仅内部使用 */
45
46
  visibleOptionInternal(visible: boolean | undefined): this;
46
47
  }
48
+ export declare class TalksOverlay<T extends UnionTalksOverlay = UnionTalksOverlay> extends Overlay<T> {
49
+ protected map: TalksMap;
50
+ constructor(innerOverlay: T, coordType: CoordType, map: TalksMap);
51
+ protected createDelegate(): EventTargetDelegate;
52
+ isVisible(): boolean;
53
+ setVisible(visible: boolean): void;
54
+ }
@@ -1,11 +1,13 @@
1
+ import * as maptalks from 'maptalks';
1
2
  import type { Tg } from '../../event';
2
3
  import { EventHubEventTargetDelegate } from '../../event-target';
3
4
  import { LatLng } from '../../lat-lng';
4
5
  import type { BaiduMap } from '../baidu-map';
5
6
  import type { GoogleMap } from '../google-map';
7
+ import type { TalksMap } from '../talks-map';
6
8
  import type { Overlay } from './overlay';
7
9
  import { BaiduPolyShape } from './polyline';
8
- import { GoogleShape, type Shape, type ShapeOptions } from './shape';
10
+ import { GoogleShape, TalksShape, type Shape, type ShapeOptions } from './shape';
9
11
  export type PolygonEventMap = {
10
12
  click: Tg.Event;
11
13
  dblclick: Tg.Event;
@@ -40,3 +42,8 @@ export declare class GooglePolygon extends GoogleShape<google.maps.Polygon> impl
40
42
  getPaths(): LatLng[][];
41
43
  setPaths(paths: LatLng[][]): void;
42
44
  }
45
+ export declare class TalksPolygon extends TalksShape<maptalks.Polygon> implements Polygon {
46
+ static create(this: TalksMap, options: PolygonOptions): TalksPolygon;
47
+ getPaths(): LatLng[][];
48
+ setPaths(paths: LatLng[][]): void;
49
+ }
@@ -1,11 +1,13 @@
1
+ import * as maptalks from 'maptalks';
1
2
  import type { Tg } from '../../event';
2
3
  import { EventHubEventTargetDelegate } from '../../event-target';
3
4
  import { LatLng } from '../../lat-lng';
4
5
  import type { BaiduMap } from '../baidu-map';
5
6
  import type { GoogleMap } from '../google-map';
7
+ import type { TalksMap } from '../talks-map';
6
8
  import { IconSequence } from './icon';
7
9
  import type { Overlay } from './overlay';
8
- import { BaiduShape, GoogleShape, type NotFillableShape, type NotFillableShapeOptions } from './shape';
10
+ import { BaiduShape, GoogleShape, TalksShape, type NotFillableShape, type NotFillableShapeOptions } from './shape';
9
11
  export type PolylineEventMap = {
10
12
  click: Tg.Event;
11
13
  dblclick: Tg.Event;
@@ -69,3 +71,8 @@ export declare class GooglePolyline extends GoogleShape<google.maps.Polyline> im
69
71
  getPath(): LatLng[];
70
72
  setPath(path: LatLng[]): void;
71
73
  }
74
+ export declare class TalksPolyline extends TalksShape<maptalks.LineString> implements Polyline {
75
+ static create(this: TalksMap, options: PolylineOptions): TalksPolyline;
76
+ getPath(): LatLng[];
77
+ setPath(path: LatLng[]): void;
78
+ }
@@ -1,10 +1,12 @@
1
+ import * as maptalks from 'maptalks';
1
2
  import type { Tg } from '../../event';
2
3
  import { CoordType, LatLngBounds } from '../../lat-lng';
3
4
  import type { BaiduMap } from '../baidu-map';
4
5
  import type { GoogleMap } from '../google-map';
6
+ import type { TalksMap } from '../talks-map';
5
7
  import type { Overlay } from './overlay';
6
8
  import { BaiduPolyShape } from './polyline';
7
- import { GoogleShape, type Shape, type ShapeOptions } from './shape';
9
+ import { GoogleShape, TalksShape, type Shape, type ShapeOptions } from './shape';
8
10
  export type RectangleEventMap = {
9
11
  click: Tg.Event;
10
12
  dblclick: Tg.Event;
@@ -48,3 +50,9 @@ export declare class GoogleRectangle extends GoogleShape<google.maps.Rectangle>
48
50
  getBounds(): LatLngBounds;
49
51
  setBounds(bounds: LatLngBounds): void;
50
52
  }
53
+ export declare class TalksRectangle extends TalksShape<maptalks.Rectangle> implements Rectangle {
54
+ static create(this: TalksMap, options: RectangleOptions): TalksRectangle;
55
+ private static convertBoundsToRect;
56
+ getBounds(): LatLngBounds;
57
+ setBounds(bounds: LatLngBounds): void;
58
+ }
@@ -1,8 +1,8 @@
1
1
  import type { CoordType } from '../../lat-lng';
2
- import type { UnionBaiduShape, UnionGoogleShape } from '../../unions';
2
+ import type { UnionBaiduShape, UnionGoogleShape, UnionTalksShape } from '../../unions';
3
3
  import type { BaiduMap } from '../baidu-map';
4
4
  import type { SymbolIcon } from './icon';
5
- import { BaiduOverlay, GoogleOverlay, type OverlayOptions } from './overlay';
5
+ import { BaiduOverlay, GoogleOverlay, TalksOverlay, type OverlayOptions } from './overlay';
6
6
  export interface ShapeOptions extends OverlayOptions {
7
7
  clickable?: boolean;
8
8
  editable?: boolean;
@@ -74,3 +74,13 @@ export declare abstract class GoogleShape<T extends UnionGoogleShape> extends Go
74
74
  setFillOpacity(opacity: number): void;
75
75
  setZIndex(zIndex: number): void;
76
76
  }
77
+ export declare abstract class TalksShape<T extends UnionTalksShape> extends TalksOverlay<T> implements Shape {
78
+ isEditable(): boolean;
79
+ setEditable(editable: boolean): void;
80
+ setStrokeColor(color: string): void;
81
+ setStrokeOpacity(opacity: number): void;
82
+ setStrokeWeight(weight: number): void;
83
+ setFillColor(color: string): void;
84
+ setFillOpacity(opacity: number): void;
85
+ setZIndex(zIndex: number): void;
86
+ }
@@ -1,42 +1,46 @@
1
1
  import type { Property } from 'csstype';
2
2
  import * as maptalks from 'maptalks';
3
3
  import 'maptalks/dist/maptalks.css';
4
- import { LatLng, type CoordType, type LatLngBounds } from '../lat-lng';
5
- import { type TalksBaseLayerId } from '../talks/talks-layers';
4
+ import { type TalksBaseLayerId } from '../../utils/talks-layers';
5
+ import { LatLng, LatLngBounds, type CoordType } from '../lat-lng';
6
6
  import type { Padding, Point } from '../types';
7
- import type { CustomControl } from './controls/control';
8
- import type { MapTypeControl, MapTypeControlOptions } from './controls/map-type.control';
7
+ import { type CustomControl } from './controls/control';
8
+ import { TalksMapTypeControl } from './controls/map-type.control';
9
9
  import { TalksScaleControl } from './controls/scale.control';
10
10
  import { TalksStreetViewControl } from './controls/street-view.control';
11
11
  import { TalksZoomControl } from './controls/zoom.control';
12
12
  import type { Autocomplete, AutocompleteOptions } from './extra/autocomplete';
13
13
  import type { Heatmap, HeatmapOptions } from './extra/heatmap';
14
14
  import type { MapUrls, MapUrlsOptions } from './extra/map-urls';
15
- import type { MarkerClusterer, MarkerClustererOptions } from './extra/marker-clusterer';
15
+ import { type MarkerClusterer, type MarkerClustererOptions } from './extra/marker-clusterer';
16
16
  import type { PlacesService, PlacesServiceOptions } from './extra/places-service';
17
17
  import type { SearchBox, SearchBoxOptions } from './extra/search-box';
18
18
  import { BaseMap } from './map';
19
- import type { GestureHandlingOptions, MapOptions, MapStyle } from './map-options';
20
- import { BuildInMapTypeId, type Layer, type MapType } from './map-type';
21
- import type { CircleOptions, CircleOverlay } from './overlay/circle';
19
+ import { GestureHandlingOptions, type MapOptions, type MapStyle } from './map-options';
20
+ import { BuildInMapTypeId, MapType, type Layer } from './map-type';
21
+ import { TalksCircle } from './overlay/circle';
22
22
  import type { ElementOverlay } from './overlay/element-overlay';
23
- import type { InfoBoxOptions, InfoBoxOverlay } from './overlay/info-box';
24
- import type { InfoWindowOptions, InfoWindowOverlay } from './overlay/info-window';
25
- import type { LabelOptions, LabelOverlay } from './overlay/label';
26
- import type { MarkerOptions, MarkerOverlay } from './overlay/marker';
27
- import type { Overlay } from './overlay/overlay';
28
- import type { PolygonOptions, PolygonOverlay } from './overlay/polygon';
29
- import type { PolylineOptions, PolylineOverlay } from './overlay/polyline';
30
- import type { RectangleOptions, RectangleOverlay } from './overlay/rectangle';
23
+ import { TalksInfoBoxOverlay } from './overlay/info-box';
24
+ import { TalksInfoWindow } from './overlay/info-window';
25
+ import { TalksLabelOverlay } from './overlay/label';
26
+ import { TalksMarker } from './overlay/marker';
27
+ import type { TalksOverlay } from './overlay/overlay';
28
+ import { TalksPolygon } from './overlay/polygon';
29
+ import { TalksPolyline } from './overlay/polyline';
30
+ import { TalksRectangle } from './overlay/rectangle';
31
31
  export declare class TalksMap extends BaseMap {
32
+ mapOptions: MapOptions;
32
33
  private map;
33
- private currentBaseLayerId;
34
+ protected markerLayer: maptalks.VectorLayer;
35
+ protected overlayLayer: maptalks.VectorLayer;
34
36
  constructor(element: HTMLElement, mapOptions: MapOptions, baseLayoutIds: [normal: TalksBaseLayerId] | [normal: TalksBaseLayerId, satellite: TalksBaseLayerId] | [normal: TalksBaseLayerId, satellite: TalksBaseLayerId, hybrid: TalksBaseLayerId]);
35
- setGestureHandling(gestureHandling: GestureHandlingOptions): void;
37
+ setGestureHandling(gestureHandling?: GestureHandlingOptions): void;
36
38
  get innerMap(): maptalks.Map;
37
39
  get coordType(): CoordType;
38
40
  fromContainerPointToLatLng(point: Point): LatLng;
39
41
  fromLatLngToContainerPoint(latLng: LatLng): Point;
42
+ setHideLogo(hideLogo: boolean): void;
43
+ setFractionalZoom(enabled: boolean): void;
40
44
  setDefaultCursor(cursor: Property.Cursor): void;
41
45
  setDraggable(draggable: boolean): void;
42
46
  setDoubleClickZoom(enable: boolean): void;
@@ -56,25 +60,25 @@ export declare class TalksMap extends BaseMap {
56
60
  getBounds(): LatLngBounds;
57
61
  addElementOverlay(overlay: ElementOverlay): void;
58
62
  removeElementOverlay(overlay: ElementOverlay): void;
59
- addOverlay(overlay: Overlay): void;
60
- removeOverlay(overlay: Overlay): void;
61
- createMarker(options: MarkerOptions): MarkerOverlay;
63
+ addOverlay(overlay: TalksOverlay): void;
64
+ removeOverlay(overlay: TalksOverlay): void;
65
+ createMarker: typeof TalksMarker.create;
62
66
  createMarkerClusterer(options: MarkerClustererOptions): MarkerClusterer;
63
67
  createHeatmap(options: HeatmapOptions): Heatmap;
64
68
  createAutocomplete(options: AutocompleteOptions): Autocomplete;
65
69
  createSearchBox(options: SearchBoxOptions): SearchBox;
66
70
  createPlacesService(options: PlacesServiceOptions): PlacesService;
67
71
  createMapUrls(options: MapUrlsOptions): MapUrls;
68
- createInfoWindow(options: InfoWindowOptions): InfoWindowOverlay;
69
- createInfoBox(options: InfoBoxOptions): InfoBoxOverlay;
70
- createPolyline(options: PolylineOptions): PolylineOverlay;
71
- createPolygon(options: PolygonOptions): PolygonOverlay;
72
- createRectangle(options: RectangleOptions): RectangleOverlay;
73
- createCircle(options: CircleOptions): CircleOverlay;
74
- createLabel(options: LabelOptions): LabelOverlay;
72
+ createInfoWindow: typeof TalksInfoWindow.create;
73
+ createInfoBox: typeof TalksInfoBoxOverlay.create;
74
+ createPolyline: typeof TalksPolyline.create;
75
+ createPolygon: typeof TalksPolygon.create;
76
+ createRectangle: typeof TalksRectangle.create;
77
+ createCircle: typeof TalksCircle.create;
78
+ createLabel: typeof TalksLabelOverlay.create;
75
79
  addCustomControl(control: CustomControl): void;
76
80
  removeCustomControl(control: CustomControl): void;
77
- createMapTypeControl(options: MapTypeControlOptions): MapTypeControl;
81
+ createMapTypeControl: typeof TalksMapTypeControl.create;
78
82
  createZoomControl: typeof TalksZoomControl.create;
79
83
  createStreetViewControl: typeof TalksStreetViewControl.create;
80
84
  createScaleControl: typeof TalksScaleControl.create;
@@ -1,5 +1,6 @@
1
1
  import { HERE_SUPPORTED_VERSIONS } from '../utils/here-utils';
2
2
  import type { DeepPartial, EmptyObject } from '../utils/mapped-types';
3
+ import type { TalksBaseLayerId } from '../utils/talks-layers';
3
4
  export interface MapConfig {
4
5
  key: string;
5
6
  version: string;
@@ -12,17 +13,25 @@ export interface TgMapConfig {
12
13
  /** @see https://developers.google.com/maps/documentation/javascript/libraries */
13
14
  libraries: ('drawing' | 'geometry' | 'journeySharing' | 'localContext' | 'marker' | 'places' | 'visualization')[];
14
15
  };
15
- baidu: MapConfig & {
16
+ baidu: MapConfig & ({
16
17
  /** @see https://lbsyun.baidu.com/index.php?title=jspopular3.0/theupdatelog */
17
18
  version: '3.0';
18
- };
19
+ } | {
20
+ type: 'webgl';
21
+ version: '1.0';
22
+ });
19
23
  here: MapConfig & {
20
24
  version: typeof HERE_SUPPORTED_VERSIONS[number];
21
25
  };
22
26
  baiduFree: EmptyObject;
27
+ googleFree: EmptyObject;
23
28
  yandex: EmptyObject;
24
29
  amap: EmptyObject;
25
30
  osm: EmptyObject;
31
+ talks: {
32
+ /** @default bing */
33
+ layerId?: TalksBaseLayerId | '';
34
+ };
26
35
  }
27
36
  export type PartialTgMapConfig = DeepPartial<TgMapConfig>;
28
37
  export declare function getTgMapConfig(): TgMapConfig;
@@ -21,12 +21,16 @@ export declare enum TgMapType {
21
21
  here = "here",
22
22
  /** Baidu免费地图, 使用maptalks */
23
23
  baiduFree = "baiduFree",
24
+ /** Google免费地图, 使用maptalks */
25
+ googleFree = "googleFree",
24
26
  /** Yandex地图, 使用maptalks */
25
27
  yandex = "yandex",
26
28
  /** 高德地图, 使用maptalks */
27
29
  amap = "amap",
28
30
  /** 开源地图, 使用maptalks */
29
- osm = "osm"
31
+ osm = "osm",
32
+ /** 使用maptalks, 实际使用的layerId, 可在外部设置, 方便测试 */
33
+ talks = "talks"
30
34
  }
31
35
  export declare namespace TgMapFactory {
32
36
  function createMap(type: TgMapType, $map: HTMLElement, mapOptions?: Partial<MapOptions>): BaseMap;
@@ -7,14 +7,18 @@ import type { GoogleLabel } from './map/overlay/google-label';
7
7
  export type UnionMap = google.maps.Map | BMap.Map | H.Map | maptalks.Map;
8
8
  export type UnionBaiduIcon = BMap.Icon | BMap.Symbol;
9
9
  export type UnionGoogleIcon = google.maps.Icon | google.maps.Symbol | google.maps.UrlIcon;
10
- export type UnionInfoWindow = google.maps.InfoWindow | BMap.InfoWindow;
10
+ export type UnionTalksIcon = maptalks.AnyMarkerSymbol | maptalks.AnyMarkerSymbol[];
11
+ export type UnionInfoWindow = google.maps.InfoWindow | BMap.InfoWindow | maptalks.ui.InfoWindow;
11
12
  export type UnionAutocomplete = google.maps.places.Autocomplete | BMap.Autocomplete;
12
13
  export type UnionPlacesService = google.maps.places.PlacesService | BMap.LocalSearch;
13
14
  export type UnionGoogleOverlay = google.maps.Marker | google.maps.Polyline | google.maps.Polygon | google.maps.Circle | google.maps.Rectangle | GoogleLabel;
14
15
  export type UnionBaiduOverlay = BMap.Marker | BMap.Polyline | BMap.Polygon | BMap.Circle | BMap.Label | BaiduInfoBox;
16
+ export type UnionTalksOverlay = maptalks.Geometry | maptalks.ui.UIMarker;
15
17
  export type UnionGoogleEventTarget = google.maps.MVCObject;
16
18
  export type UnionBaiduEventTarget = UnionBaiduOverlay | BMap.InfoWindow | BMap.Autocomplete | BMap.Map;
19
+ export type UnionTalksEventTarget = maptalks.Eventable;
17
20
  export type UnionBaiduShape = BMap.Polyline | BMap.Polygon | BMap.Circle;
18
21
  export type UnionGoogleShape = google.maps.Polyline | google.maps.Polygon | google.maps.Circle | google.maps.Rectangle;
22
+ export type UnionTalksShape = maptalks.LineString | maptalks.Polygon | maptalks.Circle | maptalks.Rectangle;
19
23
  export type UnionControl = BMap.Control | HTMLElement;
20
24
  export type GoogleLayer = google.maps.TrafficLayer | google.maps.TransitLayer | google.maps.KmlLayer | google.maps.BicyclingLayer;
@@ -7,6 +7,14 @@ export declare namespace Arrays {
7
7
  function at<T>(arr: T[], index: number, value: T): void;
8
8
  /** 获取 指定位置的值 */
9
9
  function at<T>(arr: T[], index: number): T | undefined;
10
+ /**
11
+ * 取子数组, 对参数的范围几乎没有任何限制
12
+ *
13
+ * @param from 开始索引, 可以是负数
14
+ * @param length 取出多少个元素, 可以大于{@link arr}的长度
15
+ * @param step 步长, 可以是负数
16
+ */
17
+ function subarray<T>(arr: T[], from: number, length: number, step?: number): T[];
10
18
  }
11
19
  export declare namespace MVCArrays {
12
20
  function indexOf<T>(arr: google.maps.MVCArray<T>, item: T): number;
@@ -3,6 +3,23 @@
3
3
  * @see http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b0
4
4
  */
5
5
  export declare function ensureBaiduV3(): void;
6
+ /**
7
+ * Baidu地图GL版使用BaiduGL作为命名空间, V3版使用BMap作为命名空间
8
+ * 目前的代码基于V3版编写, 为了兼容GL版,将BaiduGL重命名成BMap
9
+ * 这种方式只是勉强能够让代码可以跑起来, 不要用于生产环境, 要完全支持GL版, 还是需要做彻底的升级
10
+ *
11
+ * @see https://lbsyun.baidu.com/index.php?title=jspopularGL
12
+ * @see https://mapopen-pub-jsapi.bj.bcebos.com/jsapi/reference/jsapi_webgl_1_0.html#a0b0
13
+ */
14
+ export declare function adaptBaiduGLToV3(): void;
15
+ export declare function isBaiduGL(): boolean;
16
+ /**
17
+ * {@link BMapGL.SVGSymbol}对应{@link BMap.Symbol}, 该工具用于兼容V3版和GL版
18
+ */
19
+ export declare const BMapSymbol: {
20
+ create: (path: string | BMap.SymbolShapeType, opts?: BMap.SymbolOptions) => BMap.Symbol;
21
+ is: (obj: any) => obj is BMap.Symbol;
22
+ };
6
23
  /**
7
24
  * 尝试修复baidu内存占用会越来越大的问题
8
25
  *
@@ -17,6 +34,14 @@ export declare function ensureBaiduV3(): void;
17
34
  * 保证该方法能够执行成功
18
35
  */
19
36
  export declare function tryFixBaiduOutOfMemory(): void;
37
+ /**
38
+ * 拦截Baidu地图, 前端JSONP的返回值, 移除"未完成商用授权"的提示
39
+ * - 需要尽可能早调用, 才能生效
40
+ * - 只起到隐藏提示作用, 地图瓦片依然会加载不出来...
41
+ * - V3版大部分瓦片加载不出来
42
+ * - GL版好一些, 虽然会报大量请求错误, 但似乎是因为它存在重试机制, 最终还是能够加载出来
43
+ */
44
+ export declare function hideBaiduMapUnauthWarn(): void;
20
45
  export declare const BMapPoints: {
21
46
  /** {@link BMap.Point.equals} 无效, 故需要自己写一个 */
22
47
  equals(a: BMap.Point, b: BMap.Point): boolean;
@@ -7,7 +7,7 @@ export declare namespace Objects {
7
7
  };
8
8
  function toJsonSafely(value: any): string;
9
9
  /** 删除obj中纯对象上的值为undefined的属性 */
10
- function deleteUndefinedPropertyOnPlainObjectDeeply(obj: any): void;
10
+ function deleteUndefinedPropertyOnPlainObjectDeeply<T = any>(_obj: T): T;
11
11
  /** 存在则返回, 不存在则新建 */
12
12
  function putIfAbsent<K extends keyof any, V>(obj: Record<K, V>, key: K, ifAbsent: () => Exclude<V, undefined>): Exclude<V, undefined>;
13
13
  /** @see Omit */
@@ -20,7 +20,7 @@ export declare namespace Objects {
20
20
  * @param keyPath `.`分隔的字段名 或 字段名数组
21
21
  * @returns 若字段不存在, 则返回`undefined`
22
22
  */
23
- function get(obj: any, keyPath: string | string[]): any;
23
+ function get(obj: any, keyPath: string | readonly string[]): any;
24
24
  function del(obj: any, keyPath: string | string[]): any;
25
25
  }
26
26
  /** 用于替代Vue2中的filter, 直接交给模板使用 */
@@ -1,9 +1,9 @@
1
1
  import * as maptalks from 'maptalks';
2
- import { CoordType } from '../lat-lng';
3
- export declare const talksBaseLayerIds: readonly ["osm", "osm-simple", "google", "baidu", "amap", "tencent", "geoq", "tianditu", "yandex", "bing"];
2
+ import { CoordType } from '../map/lat-lng';
3
+ export declare const talksBaseLayerIds: readonly ["osm", "osm-simple", "google", "baidu", "baidu-detail", "amap", "tencent", "geoq", "tianditu", "yandex", "bing"];
4
4
  export type TalksBaseLayerId = typeof talksBaseLayerIds[number];
5
5
  export declare function talksBaseLayerIdToCoordType(layerId: TalksBaseLayerId): CoordType;
6
6
  export declare function createTalksBaseLayer(layerId: TalksBaseLayerId, { id, visible, }?: {
7
- id?: "google" | "osm" | "osm-simple" | "baidu" | "amap" | "tencent" | "geoq" | "tianditu" | "yandex" | "bing" | undefined;
7
+ id?: "osm" | "osm-simple" | "google" | "baidu" | "baidu-detail" | "amap" | "tencent" | "geoq" | "tianditu" | "yandex" | "bing" | undefined;
8
8
  visible?: boolean | undefined;
9
9
  }): maptalks.TileLayer;
@@ -0,0 +1,24 @@
1
+ import * as maptalks from 'maptalks';
2
+ export declare namespace Talks {
3
+ function setVisible(that: {
4
+ isVisible(): boolean;
5
+ show(): void;
6
+ hide(): void;
7
+ }, visible: boolean): void;
8
+ /**
9
+ * 临时的坐标对象
10
+ *
11
+ * maptalks的很多方法支持传入可选的out参数, 避免在方法内部新建对象,
12
+ * 如果调用方也只是临时使用这个对象(不向外传递), 由于JS是单线程的, 因此可以全局共享这个临时对象
13
+ * */
14
+ const tempCoordinate: maptalks.Coordinate;
15
+ /** @see tempCoordinate */
16
+ const tempPoint: maptalks.Point;
17
+ /** @see https://github.com/maptalks/maptalks.js/blob/f69bc41cb3cc48c456c71a62dc953bdc582a4146/packages/maptalks/src/geometry/Path.ts#L479 */
18
+ function extentFromCoordinates(coordinates: maptalks.Coordinate[], projection?: maptalks.Projection): maptalks.Extent;
19
+ }
20
+ export declare const TalksConst: {
21
+ /** maptalks的Polygon默认是没有填充色的, 这里统一指定一个填充色, 方便和Polyline区分 */
22
+ readonly FILL_COLOR_TG: "white";
23
+ readonly FILL_OPACITY_TG: 0.5;
24
+ };
@@ -12,3 +12,8 @@ export declare function isEntryValueDef<K, V>(entry: [K, V]): entry is [K, NonNu
12
12
  * 创建一个异步初始化的单例, 保证只初始化成功一次
13
13
  */
14
14
  export declare function createAsyncSingleton<T>(creator: () => Promise<T>): () => Promise<T>;
15
+ /**
16
+ * 简单版的去抖动函数
17
+ * @see https://lodash.com/docs/4.17.21#debounce
18
+ */
19
+ export declare function debounce<T extends (...args: any[]) => void>(func: T, wait?: number): (...args: Parameters<T>) => void;