tg-map-vue3 3.9.7 → 3.9.9
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/CHANGELOG.md +3 -0
- package/dist/src/components/TgMap.vue.d.ts +505 -38
- package/dist/src/components/TgMapWidget.vue.d.ts +4 -4
- package/dist/src/components/controls/TgCustomControl.vue.d.ts +6 -6
- package/dist/src/components/controls/TgMapTypeControl.vue.d.ts +13 -13
- package/dist/src/components/controls/TgScaleControl.vue.d.ts +9 -9
- package/dist/src/components/controls/TgStreetViewControl.vue.d.ts +7 -7
- package/dist/src/components/controls/TgZoomControl.vue.d.ts +7 -7
- package/dist/src/components/extra/TgHeatmap.vue.d.ts +5 -5
- package/dist/src/components/extra/TgMarkerClusterer.vue.d.ts +7 -7
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/layers/TgTrafficLayer.vue.d.ts +1 -1
- package/dist/src/components/map-hooks.d.ts +1 -1
- package/dist/src/components/map-mixin.d.ts +1 -1
- package/dist/src/components/overlays/TgCircle.vue.d.ts +18 -18
- package/dist/src/components/overlays/TgElementOverlay.vue.d.ts +9 -9
- package/dist/src/components/overlays/TgInfoBox.vue.d.ts +19 -45
- package/dist/src/components/overlays/TgInfoWindow.vue.d.ts +24 -40
- package/dist/src/components/overlays/TgLabel.vue.d.ts +7 -7
- package/dist/src/components/overlays/TgMarker.vue.d.ts +65 -193
- package/dist/src/components/overlays/TgPolygon.vue.d.ts +45 -70
- package/dist/src/components/overlays/TgPolyline.vue.d.ts +15 -15
- package/dist/src/components/overlays/TgRectangle.vue.d.ts +45 -70
- package/dist/src/map/map/overlay/icon.d.ts +13 -13
- package/dist/src/utils/mapped-types.d.ts +2 -2
- package/dist/src/utils/maps-utils/index.d.ts +2 -0
- package/dist/src/utils/maps-utils/math-util.d.ts +59 -0
- package/dist/src/utils/maps-utils/poly-util.d.ts +103 -0
- package/dist/src/utils/maps-utils/spherical-util.d.ts +67 -0
- package/dist/src/utils/spherical-utils.d.ts +8 -1
- package/dist/tg-map.cjs +7 -7
- package/dist/tg-map.cjs.map +1 -1
- package/dist/tg-map.js +2628 -2303
- package/dist/tg-map.js.map +1 -1
- package/package.json +31 -33
|
@@ -52,19 +52,19 @@ export interface SymbolIcon {
|
|
|
52
52
|
*/
|
|
53
53
|
readonly strokeWeight?: number;
|
|
54
54
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
* baidu地图中Marker的Label的偏移量, 用来保证Label默认对齐到Marker的position
|
|
56
|
+
*
|
|
57
|
+
* 这个值的取值和如下参数相关, 但计算这个值的公式没找到...故只能运行时读取+手动设置:
|
|
58
|
+
* - {@link path}
|
|
59
|
+
* - {@link rotation}
|
|
60
|
+
* - {@link scale}
|
|
61
|
+
* - {@link strokeWeight}
|
|
62
|
+
* - {@link anchor}
|
|
63
|
+
*
|
|
64
|
+
* 详见{@link BaiduLabelOverlay.attachIcon}
|
|
65
|
+
*
|
|
66
|
+
* TODO: 使用矩阵运行时计算偏移量
|
|
67
|
+
*/
|
|
68
68
|
readonly baiduLabelOffset?: Point;
|
|
69
69
|
}
|
|
70
70
|
export declare namespace SymbolIcon {
|
|
@@ -16,9 +16,9 @@ export type Constructor<T = {}> = new (...args: any[]) => T;
|
|
|
16
16
|
*/
|
|
17
17
|
export type AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;
|
|
18
18
|
/** 原始类型=>包装类型 */
|
|
19
|
-
export type PrimitiveToWrapper<T> = T extends boolean ?
|
|
19
|
+
export type PrimitiveToWrapper<T> = T extends boolean ? boolean : T extends string ? string : T extends number ? number : T;
|
|
20
20
|
/** 包装类型=>原始类型 */
|
|
21
|
-
export type WrapperToPrimitive<T> = T extends
|
|
21
|
+
export type WrapperToPrimitive<T> = T extends boolean ? boolean : T extends string ? string : T extends number ? number : T;
|
|
22
22
|
/**
|
|
23
23
|
* `vue instanceof VueConstructor`时`vue`并不会自动转换成`VueConstructor`的子类, 用该方法可以实现这种转换
|
|
24
24
|
*/
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The earth's radius, in meters.
|
|
3
|
+
* Mean radius as defined by IUGG.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EARTH_RADIUS = 6371009;
|
|
6
|
+
/**
|
|
7
|
+
* Restrict x to the range [low, high].
|
|
8
|
+
*/
|
|
9
|
+
export declare function clamp(x: number, low: number, high: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps the given value into the inclusive-exclusive interval between min and max.
|
|
12
|
+
*
|
|
13
|
+
* @param n The value to wrap.
|
|
14
|
+
* @param min The minimum.
|
|
15
|
+
* @param max The maximum.
|
|
16
|
+
*/
|
|
17
|
+
export declare function wrap(n: number, min: number, max: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the non-negative remainder of x / m.
|
|
20
|
+
*
|
|
21
|
+
* @param x The operand.
|
|
22
|
+
* @param m The modulus.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mod(x: number, m: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* Returns mercator Y corresponding to latitude.
|
|
27
|
+
* See http://en.wikipedia.org/wiki/Mercator_projection .
|
|
28
|
+
*/
|
|
29
|
+
export declare function mercator(lat: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* Returns latitude from mercator Y.
|
|
32
|
+
*/
|
|
33
|
+
export declare function inverseMercator(y: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns haversine(angle-in-radians).
|
|
36
|
+
* hav(x) == (1 - cos(x)) / 2 == sin(x / 2)^2.
|
|
37
|
+
*/
|
|
38
|
+
export declare function hav(x: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Computes inverse haversine. Has good numerical stability around 0.
|
|
41
|
+
* arcHav(x) == acos(1 - 2 * x) == 2 * asin(sqrt(x)).
|
|
42
|
+
* The argument must be in [0, 1], and the result is positive.
|
|
43
|
+
*/
|
|
44
|
+
export declare function arcHav(x: number): number;
|
|
45
|
+
export declare function sinFromHav(h: number): number;
|
|
46
|
+
export declare function havFromSin(x: number): number;
|
|
47
|
+
export declare function sinSumFromHav(x: number, y: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Returns hav() of distance from (lat1, lng1) to (lat2, lng2) on the unit sphere.
|
|
50
|
+
*/
|
|
51
|
+
export declare function havDistance(lat1: number, lat2: number, dLng: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Converts degrees to radians.
|
|
54
|
+
*/
|
|
55
|
+
export declare function toRadians(degrees: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* Converts radians to degrees.
|
|
58
|
+
*/
|
|
59
|
+
export declare function toDegrees(radians: number): number;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { LatLngLiteral } from '../../map/lat-lng';
|
|
2
|
+
export declare function containsLocation(point: LatLngLiteral, polygon: LatLngLiteral[], geodesic: boolean): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Computes whether the given point lies inside the specified polygon.
|
|
5
|
+
* The polygon is always considered closed, regardless of whether the last point equals
|
|
6
|
+
* the first or not.
|
|
7
|
+
* Inside is defined as not containing the South Pole -- the South Pole is always outside.
|
|
8
|
+
* The polygon is formed of great circle segments if geodesic is true, and of rhumb
|
|
9
|
+
* (loxodromic) segments otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function containsLocationLatLng(latitude: number, longitude: number, polygon: LatLngLiteral[], geodesic: boolean): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Computes whether the given point lies on or near the edge of a polygon, within a specified
|
|
14
|
+
* tolerance in meters. The polygon edge is composed of great circle segments if geodesic
|
|
15
|
+
* is true, and of Rhumb segments otherwise. The polygon edge is implicitly closed -- the
|
|
16
|
+
* closing segment between the first point and the last point is included.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isLocationOnEdge(point: LatLngLiteral, polygon: LatLngLiteral[], geodesic?: boolean, tolerance?: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Computes whether the given point lies on or near a polyline, within a specified
|
|
21
|
+
* tolerance in meters. The polyline is composed of great circle segments if geodesic
|
|
22
|
+
* is true, and of Rhumb segments otherwise. The polyline is not closed -- the closing
|
|
23
|
+
* segment between the first point and the last point is not included.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isLocationOnPath(point: LatLngLiteral, polyline: LatLngLiteral[], geodesic?: boolean, tolerance?: number): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.
|
|
28
|
+
* The polyline is not closed -- the closing segment between the first point and the last point is not included.
|
|
29
|
+
*
|
|
30
|
+
* @param point our needle
|
|
31
|
+
* @param poly our haystack
|
|
32
|
+
* @param geodesic the polyline is composed of great circle segments if geodesic
|
|
33
|
+
* is true, and of Rhumb segments otherwise
|
|
34
|
+
* @param tolerance tolerance (in meters)
|
|
35
|
+
* @return -1 if point does not lie on or near the polyline.
|
|
36
|
+
* 0 if point is between poly[0] and poly[1] (inclusive),
|
|
37
|
+
* 1 if between poly[1] and poly[2],
|
|
38
|
+
* ...,
|
|
39
|
+
* poly.length-2 if between poly[poly.length - 2] and poly[poly.length - 1]
|
|
40
|
+
*/
|
|
41
|
+
export declare function locationIndexOnPath(point: LatLngLiteral, poly: LatLngLiteral[], geodesic: boolean, tolerance?: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance.
|
|
44
|
+
* If closed, the closing segment between the last and first points of the polyline is not considered.
|
|
45
|
+
*
|
|
46
|
+
* @param point our needle
|
|
47
|
+
* @param poly our haystack
|
|
48
|
+
* @param closed whether the polyline should be considered closed by a segment connecting the last point back to the first one
|
|
49
|
+
* @param geodesic the polyline is composed of great circle segments if geodesic
|
|
50
|
+
* is true, and of Rhumb segments otherwise
|
|
51
|
+
* @param toleranceEarth tolerance (in meters)
|
|
52
|
+
* @return -1 if point does not lie on or near the polyline.
|
|
53
|
+
* 0 if point is between poly[0] and poly[1] (inclusive),
|
|
54
|
+
* 1 if between poly[1] and poly[2],
|
|
55
|
+
* ...,
|
|
56
|
+
* poly.length-2 if between poly[poly.length - 2] and poly[poly.length - 1]
|
|
57
|
+
*/
|
|
58
|
+
export declare function locationIndexOnEdgeOrPath(point: LatLngLiteral, poly: LatLngLiteral[], closed: boolean, geodesic: boolean, toleranceEarth: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation
|
|
61
|
+
* algorithm. Increasing the tolerance will result in fewer points in the simplified polyline
|
|
62
|
+
* or polygon.
|
|
63
|
+
*
|
|
64
|
+
* When the providing a polygon as input, the first and last point of the list MUST have the
|
|
65
|
+
* same latitude and longitude (i.e., the polygon must be closed). If the input polygon is not
|
|
66
|
+
* closed, the resulting polygon may not be fully simplified.
|
|
67
|
+
*
|
|
68
|
+
* The time complexity of Douglas-Peucker is O(n^2), so take care that you do not call this
|
|
69
|
+
* algorithm too frequently in your code.
|
|
70
|
+
*
|
|
71
|
+
* @param poly polyline or polygon to be simplified. Polygon should be closed (i.e.,
|
|
72
|
+
* first and last points should have the same latitude and longitude).
|
|
73
|
+
* @param tolerance in meters. Increasing the tolerance will result in fewer points in the
|
|
74
|
+
* simplified poly.
|
|
75
|
+
* @return a simplified poly produced by the Douglas-Peucker algorithm
|
|
76
|
+
*/
|
|
77
|
+
export declare function simplify(poly: LatLngLiteral[], tolerance: number): LatLngLiteral[];
|
|
78
|
+
/**
|
|
79
|
+
* Returns true if the provided list of points is a closed polygon (i.e., the first and last
|
|
80
|
+
* points are the same), and false if it is not
|
|
81
|
+
*
|
|
82
|
+
* @param poly polyline or polygon
|
|
83
|
+
* @return true if the provided list of points is a closed polygon (i.e., the first and last
|
|
84
|
+
* points are the same), and false if it is not
|
|
85
|
+
*/
|
|
86
|
+
export declare function isClosedPolygon(poly: LatLngLiteral[]): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Computes the distance on the sphere between the point p and the line segment start to end.
|
|
89
|
+
*
|
|
90
|
+
* @param p the point to be measured
|
|
91
|
+
* @param start the beginning of the line segment
|
|
92
|
+
* @param end the end of the line segment
|
|
93
|
+
* @return the distance in meters (assuming spherical earth)
|
|
94
|
+
*/
|
|
95
|
+
export declare function distanceToLine(p: LatLngLiteral, start: LatLngLiteral, end: LatLngLiteral): number;
|
|
96
|
+
/**
|
|
97
|
+
* Decodes an encoded path string into a sequence of LatLngs.
|
|
98
|
+
*/
|
|
99
|
+
export declare function decode(encodedPath: string): LatLngLiteral[];
|
|
100
|
+
/**
|
|
101
|
+
* Encodes a sequence of LatLngs into an encoded path string.
|
|
102
|
+
*/
|
|
103
|
+
export declare function encode(path: LatLngLiteral[]): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { LatLngLiteral } from '../../map/lat-lng';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the heading from one LatLng to another LatLng. Headings are
|
|
4
|
+
* expressed in degrees clockwise from North within the range [-180,180).
|
|
5
|
+
*
|
|
6
|
+
* @return The heading in degrees clockwise from north.
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeHeading(from: LatLngLiteral, to: LatLngLiteral): number;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the LatLng resulting from moving a distance from an origin
|
|
11
|
+
* in the specified heading (expressed in degrees clockwise from north).
|
|
12
|
+
*
|
|
13
|
+
* @param from The LatLng from which to start.
|
|
14
|
+
* @param distance The distance to travel.
|
|
15
|
+
* @param heading The heading in degrees clockwise from north.
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeOffset(from: LatLngLiteral, distance: number, heading: number): LatLngLiteral;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the location of origin when provided with a LatLng destination,
|
|
20
|
+
* meters travelled and original heading. Headings are expressed in degrees
|
|
21
|
+
* clockwise from North. This function returns null when no solution is
|
|
22
|
+
* available.
|
|
23
|
+
*
|
|
24
|
+
* @param to The destination LatLng.
|
|
25
|
+
* @param distance The distance travelled, in meters.
|
|
26
|
+
* @param heading The heading in degrees clockwise from north.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeOffsetOrigin(to: LatLngLiteral, distance: number, heading: number): LatLngLiteral | null;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the LatLng which lies the given fraction of the way between the
|
|
31
|
+
* origin LatLng and the destination LatLng.
|
|
32
|
+
*
|
|
33
|
+
* @param from The LatLng from which to start.
|
|
34
|
+
* @param to The LatLng toward which to travel.
|
|
35
|
+
* @param fraction A fraction of the distance to travel.
|
|
36
|
+
* @return The interpolated LatLng.
|
|
37
|
+
*/
|
|
38
|
+
export declare function interpolate(from: LatLngLiteral, to: LatLngLiteral, fraction: number): LatLngLiteral;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the angle between two LatLngs, in radians. This is the same as the distance
|
|
41
|
+
* on the unit sphere.
|
|
42
|
+
*/
|
|
43
|
+
export declare function computeAngleBetween(from: LatLngLiteral, to: LatLngLiteral): number;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the distance between two LatLngs, in meters.
|
|
46
|
+
*/
|
|
47
|
+
export declare function computeDistanceBetween(from: LatLngLiteral, to: LatLngLiteral): number;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the length of the given path, in meters, on Earth.
|
|
50
|
+
*/
|
|
51
|
+
export declare function computeLength(path: LatLngLiteral[]): number;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the area of a closed path on Earth.
|
|
54
|
+
*
|
|
55
|
+
* @param path A closed path.
|
|
56
|
+
* @return The path's area in square meters.
|
|
57
|
+
*/
|
|
58
|
+
export declare function computeArea(path: LatLngLiteral[]): number;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the signed area of a closed path on Earth. The sign of the area may be used to
|
|
61
|
+
* determine the orientation of the path.
|
|
62
|
+
* "inside" is the surface that does not contain the South Pole.
|
|
63
|
+
*
|
|
64
|
+
* @param path A closed path.
|
|
65
|
+
* @return The loop's area in square meters.
|
|
66
|
+
*/
|
|
67
|
+
export declare function computeSignedArea(path: LatLngLiteral[], radius?: number): number;
|
|
@@ -12,9 +12,16 @@ declare function getDistance(p1: LatLngLiteral, p2: LatLngLiteral): number;
|
|
|
12
12
|
* @param dist 距离
|
|
13
13
|
*/
|
|
14
14
|
export declare function getDestination(pt: LatLngLiteral, angle: number, dist: number): LatLngLiteral;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* 球面工具
|
|
17
|
+
*
|
|
18
|
+
* 代码copy自[CityBus-vue-admin](https://github.com/TranscodeGroup/CityBus-vue-admin/blob/8b8db7e23e94423747141084eb78ce3331965a4c/src/utils/index.js#L773), 实现似乎有些问题
|
|
19
|
+
* @deprecated 使用{@link SphericalUtil}替代
|
|
20
|
+
*/
|
|
16
21
|
export declare const SphericalUtils: {
|
|
22
|
+
/** @deprecated Use {@link SphericalUtil.computeDistanceBetween} instead */
|
|
17
23
|
getDistance: typeof getDistance;
|
|
24
|
+
/** @deprecated Use {@link SphericalUtil.computeOffset} instead */
|
|
18
25
|
getDestination: typeof getDestination;
|
|
19
26
|
};
|
|
20
27
|
export {};
|