ty-element 1.1.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/README.md +23 -0
- package/dist/components/animate-container/index.d.ts +9 -0
- package/dist/components/animate-container/type.d.ts +67 -0
- package/dist/components/button/count/index.d.ts +3 -0
- package/dist/components/button/count/type.d.ts +16 -0
- package/dist/components/button/glow/index.d.ts +9 -0
- package/dist/components/button/glow/type.d.ts +21 -0
- package/dist/components/button/ripple/index.d.ts +9 -0
- package/dist/components/button/ripple/type.d.ts +30 -0
- package/dist/components/button/streamer/index.d.ts +3 -0
- package/dist/components/button/streamer/type.d.ts +11 -0
- package/dist/components/carousel/index.d.ts +10 -0
- package/dist/components/carousel/type.d.ts +18 -0
- package/dist/components/globe/entity-collection.d.ts +22 -0
- package/dist/components/globe/entity.d.ts +12 -0
- package/dist/components/globe/globe.d.ts +106 -0
- package/dist/components/globe/index.d.ts +3 -0
- package/dist/components/globe/sat-util.d.ts +26 -0
- package/dist/components/globe/satellite.d.ts +107 -0
- package/dist/components/globe/type.d.ts +71 -0
- package/dist/components/globe/wide-line/geometry.d.ts +22 -0
- package/dist/components/globe/wide-line/index.d.ts +7 -0
- package/dist/components/globe/wide-line/material.d.ts +22 -0
- package/dist/components/globe/wide-line/type.d.ts +10 -0
- package/dist/components/loading/progress/index.d.ts +8 -0
- package/dist/components/loading/progress/type.d.ts +80 -0
- package/dist/components/loading/tick/index.d.ts +8 -0
- package/dist/components/loading/tick/type.d.ts +36 -0
- package/dist/components/loading/water-progress/index.d.ts +8 -0
- package/dist/components/loading/water-progress/type.d.ts +31 -0
- package/dist/components/map/compare-map/index.d.ts +38 -0
- package/dist/components/map/compare-map/type.d.ts +52 -0
- package/dist/components/map/data-selector-map/index.d.ts +30 -0
- package/dist/components/map/data-selector-map/type.d.ts +99 -0
- package/dist/components/map/gis-map/index.d.ts +9 -0
- package/dist/components/map/gis-map/type.d.ts +132 -0
- package/dist/components/map/gis-maplibre/crepuscule/index.d.ts +49 -0
- package/dist/components/map/gis-maplibre/custom-layers/atmosphere-layer/index.d.ts +5 -0
- package/dist/components/map/gis-maplibre/custom-layers/atmosphere-layer/type.d.ts +20 -0
- package/dist/components/map/gis-maplibre/custom-layers/index.d.ts +40 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/clock.d.ts +17 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/index.d.ts +135 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/source.d.ts +65 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/type.d.ts +75 -0
- package/dist/components/map/gis-maplibre/custom-layers/star-layer/index.d.ts +6 -0
- package/dist/components/map/gis-maplibre/custom-layers/star-layer/type.d.ts +14 -0
- package/dist/components/map/gis-maplibre/custom-layers/sync-camera.d.ts +2 -0
- package/dist/components/map/gis-maplibre/custom-layers/type.d.ts +7 -0
- package/dist/components/map/gis-maplibre/index.d.ts +8 -0
- package/dist/components/map/gis-maplibre/type.d.ts +236 -0
- package/dist/components/map/gis-marker/index.d.ts +12 -0
- package/dist/components/map/gis-marker/type.d.ts +36 -0
- package/dist/components/map/multi-map/index.d.ts +8 -0
- package/dist/components/map/multi-map/syncMaps.d.ts +3 -0
- package/dist/components/map/multi-map/type.d.ts +2 -0
- package/dist/components/map/stac-data-map/index.d.ts +46 -0
- package/dist/components/map/stac-data-map/type.d.ts +78 -0
- package/dist/components/radar/index.d.ts +3 -0
- package/dist/components/radar/radar-instance.d.ts +34 -0
- package/dist/components/radar/type.d.ts +58 -0
- package/dist/components/ripple-container/index.d.ts +8 -0
- package/dist/components/ripple-container/type.d.ts +23 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/type.d.ts +114 -0
- package/dist/components/third-part/delete-button/index.d.ts +8 -0
- package/dist/components/third-part/delete-button/type.d.ts +28 -0
- package/dist/components/third-part/dragger-upload/index.d.ts +8 -0
- package/dist/components/third-part/dragger-upload/type.d.ts +8 -0
- package/dist/components/third-part/key-value/index.d.ts +8 -0
- package/dist/components/third-part/key-value/type.d.ts +47 -0
- package/dist/components/third-part/slider-input/index.d.ts +8 -0
- package/dist/components/third-part/slider-input/type.d.ts +40 -0
- package/dist/components/timeline/index.d.ts +8 -0
- package/dist/components/timeline/type.d.ts +105 -0
- package/dist/constants/index.d.ts +39 -0
- package/dist/draco/README.md +32 -0
- package/dist/draco/draco_decoder.js +34 -0
- package/dist/draco/draco_decoder.wasm +0 -0
- package/dist/draco/draco_encoder.js +33 -0
- package/dist/draco/draco_wasm_wrapper.js +117 -0
- package/dist/draco/gltf/draco_decoder.js +33 -0
- package/dist/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/draco/gltf/draco_encoder.js +33 -0
- package/dist/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/earth.jpg +0 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +33146 -0
- package/dist/shaders/program/index.d.ts +30 -0
- package/dist/shaders/shader.d.ts +16 -0
- package/dist/style.css +7 -0
- package/dist/types/geometry.d.ts +39 -0
- package/dist/types/stac.d.ts +69 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/utils/css/index.d.ts +8 -0
- package/dist/utils/io/index.d.ts +4 -0
- package/dist/utils/object/index.d.ts +6 -0
- package/dist/utils/random/index.d.ts +13 -0
- package/dist/utils/sat/index.d.ts +11 -0
- package/dist/utils/sat/type.d.ts +22 -0
- package/dist/utils/tle/index.d.ts +49 -0
- package/dist/utils/tle/type.d.ts +36 -0
- package/dist/utils/unit/index.d.ts +6 -0
- package/package.json +105 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare class Clock {
|
|
2
|
+
_date: Date;
|
|
3
|
+
_timer: number;
|
|
4
|
+
_speed: number;
|
|
5
|
+
_lastTimestamp: number;
|
|
6
|
+
constructor(date?: Date);
|
|
7
|
+
setSpeed(speed: number): void;
|
|
8
|
+
getDate(): Date;
|
|
9
|
+
setDate(date: Date): this;
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
addSeconds(s: number): this;
|
|
13
|
+
addMinutes(m: number): this;
|
|
14
|
+
addHours(h: number): this;
|
|
15
|
+
addDays(d: number): this;
|
|
16
|
+
}
|
|
17
|
+
export default Clock;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { CustomRenderMethodInput, Map, MapMouseEvent, MapProjectionEvent } from 'maplibre-gl';
|
|
2
|
+
import { default as CustomLayer } from '..';
|
|
3
|
+
import { default as SatelliteSource } from './source';
|
|
4
|
+
import { PointData, SatelliteLayerOptions } from './type';
|
|
5
|
+
import { LineMaterial, LineMaterialParameters } from 'three/examples/jsm/lines/LineMaterial';
|
|
6
|
+
import { AmbientLight, DirectionalLight, Group, Mesh, MeshBasicMaterial, MeshBasicMaterialParameters, PlaneGeometry, Quaternion } from 'three';
|
|
7
|
+
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';
|
|
8
|
+
import { Line2 } from 'three/examples/jsm/lines/Line2';
|
|
9
|
+
/**
|
|
10
|
+
* @description 卫星轨道2、3维度一体图层
|
|
11
|
+
* @author tiancheng.xia
|
|
12
|
+
* @since 2025-04-22
|
|
13
|
+
*/
|
|
14
|
+
declare class SatelliteLayer extends CustomLayer {
|
|
15
|
+
_source?: SatelliteSource;
|
|
16
|
+
_options: SatelliteLayerOptions;
|
|
17
|
+
_light?: AmbientLight;
|
|
18
|
+
_geometry: LineGeometry;
|
|
19
|
+
_line?: Line2;
|
|
20
|
+
_realTime: boolean;
|
|
21
|
+
_optionPaint: SatelliteLayerOptions["paint"];
|
|
22
|
+
_optionLayout: SatelliteLayerOptions["layout"];
|
|
23
|
+
_dirLight: DirectionalLight;
|
|
24
|
+
_originColors: Record<string, string>;
|
|
25
|
+
_groundLine: Line2 | null;
|
|
26
|
+
_groundGeometry: LineGeometry | null;
|
|
27
|
+
_groundMaterial: LineMaterial | null;
|
|
28
|
+
_groundLineHeight: number;
|
|
29
|
+
_dirLine2Ground: Line2 | null;
|
|
30
|
+
_dirLine2GroundGeometry: LineGeometry | null;
|
|
31
|
+
_dirLine2GroundMaterial: LineMaterial | null;
|
|
32
|
+
_groundPlane: Mesh | null;
|
|
33
|
+
_groundPlaneGeometry: PlaneGeometry | null;
|
|
34
|
+
_groundPlaneMaterial: MeshBasicMaterial | null;
|
|
35
|
+
_isMouseEnter: boolean;
|
|
36
|
+
constructor(options: SatelliteLayerOptions);
|
|
37
|
+
get _paint(): {
|
|
38
|
+
"line-color"?: import('react').CSSProperties["color"] | import('react').CSSProperties["color"][];
|
|
39
|
+
"line-width"?: number;
|
|
40
|
+
"line-dasharray"?: [number, number];
|
|
41
|
+
"line-opacity"?: number;
|
|
42
|
+
"object-light-color"?: import('react').CSSProperties["color"];
|
|
43
|
+
"object-light-intensity"?: number;
|
|
44
|
+
};
|
|
45
|
+
interpolateColors(color0: string, color1: string, t: number): number[];
|
|
46
|
+
get _vertexColors(): number[];
|
|
47
|
+
get _visible(): any;
|
|
48
|
+
get _trackPaint(): LineMaterial;
|
|
49
|
+
get _layout(): {
|
|
50
|
+
"object-heading"?: number;
|
|
51
|
+
"object-pitch"?: number;
|
|
52
|
+
"object-roll"?: number;
|
|
53
|
+
"object-size"?: import('../type').InterpolateExpression<number>;
|
|
54
|
+
"image-follow-bearing"?: boolean;
|
|
55
|
+
};
|
|
56
|
+
get _currentXYZ(): {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
z: number;
|
|
60
|
+
};
|
|
61
|
+
get _nextXYZ(): {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
z: number;
|
|
65
|
+
};
|
|
66
|
+
get _originOrentation(): Quaternion;
|
|
67
|
+
get _object(): Group<import('three').Object3DEventMap> | undefined;
|
|
68
|
+
get _objectSize(): number;
|
|
69
|
+
get _objectHeading(): number;
|
|
70
|
+
get _objectPitch(): number;
|
|
71
|
+
get _objectRoll(): number;
|
|
72
|
+
get _2dLineLayerId(): string;
|
|
73
|
+
get _2dModelLayerId(): string;
|
|
74
|
+
get _shouldRender3D(): boolean;
|
|
75
|
+
get _isBackFace(): boolean | 0 | undefined;
|
|
76
|
+
static disposeDRACOLoader(): void;
|
|
77
|
+
static createDRACOLoader(): void;
|
|
78
|
+
static getDRACOLoader(): import('three/examples/jsm/loaders/DRACOLoader').DRACOLoader | null;
|
|
79
|
+
getSource(): SatelliteSource | undefined;
|
|
80
|
+
getTrack2dPaint(): any;
|
|
81
|
+
_onObjectLoaded: () => void;
|
|
82
|
+
getPointData(point: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}): PointData;
|
|
86
|
+
_onObjectMousemove: (e: MapMouseEvent) => void;
|
|
87
|
+
_onObjectClick: (e: MapMouseEvent) => void;
|
|
88
|
+
_onProjChanged: (e: MapProjectionEvent) => void;
|
|
89
|
+
get2dLayerIds(): {
|
|
90
|
+
line: string;
|
|
91
|
+
model: string;
|
|
92
|
+
};
|
|
93
|
+
_removeLayerAndSource(id: string): void;
|
|
94
|
+
get _groundCoords(): number[] | undefined;
|
|
95
|
+
get _dirLine2GroundCoords(): number[];
|
|
96
|
+
setGroundLine(options: LineMaterialParameters & {
|
|
97
|
+
height?: number;
|
|
98
|
+
}): this;
|
|
99
|
+
setDirLine2Ground(paint: LineMaterialParameters): this;
|
|
100
|
+
setGroundPlane(size: number, paint: MeshBasicMaterialParameters): this;
|
|
101
|
+
removeGroundPlane(): this;
|
|
102
|
+
removeDirLine2Ground(): this;
|
|
103
|
+
removeGroundLine(): this;
|
|
104
|
+
addDirLight(): void;
|
|
105
|
+
removeDirLight(): void;
|
|
106
|
+
setRealTime(realTime: boolean): this;
|
|
107
|
+
getRealTime(): boolean;
|
|
108
|
+
setPaint(paint: SatelliteLayerOptions["paint"]): this;
|
|
109
|
+
getPaint(): {
|
|
110
|
+
"line-color"?: import('react').CSSProperties["color"] | import('react').CSSProperties["color"][];
|
|
111
|
+
"line-width"?: number;
|
|
112
|
+
"line-dasharray"?: [number, number];
|
|
113
|
+
"line-opacity"?: number;
|
|
114
|
+
"object-light-color"?: import('react').CSSProperties["color"];
|
|
115
|
+
"object-light-intensity"?: number;
|
|
116
|
+
};
|
|
117
|
+
setLayout(layout: SatelliteLayerOptions["layout"]): this;
|
|
118
|
+
getLayout(): {
|
|
119
|
+
"object-heading"?: number;
|
|
120
|
+
"object-pitch"?: number;
|
|
121
|
+
"object-roll"?: number;
|
|
122
|
+
"object-size"?: import('../type').InterpolateExpression<number>;
|
|
123
|
+
"image-follow-bearing"?: boolean;
|
|
124
|
+
};
|
|
125
|
+
getClock(): import('./clock').default | undefined;
|
|
126
|
+
updateTrack(): this;
|
|
127
|
+
remove(): void;
|
|
128
|
+
onRemove(): void;
|
|
129
|
+
addAxesHelper(tree?: boolean): void;
|
|
130
|
+
_update2d(): void;
|
|
131
|
+
_onMapMove: () => void;
|
|
132
|
+
onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
|
|
133
|
+
render(gl: WebGLRenderingContext | WebGL2RenderingContext, args: CustomRenderMethodInput): void;
|
|
134
|
+
}
|
|
135
|
+
export default SatelliteLayer;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SatelliteSourceOptions } from './type';
|
|
2
|
+
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
3
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
|
|
4
|
+
import { Group } from 'three';
|
|
5
|
+
import { Map } from 'maplibre-gl';
|
|
6
|
+
import { default as Clock } from './clock';
|
|
7
|
+
declare class SatelliteSource {
|
|
8
|
+
private _tle;
|
|
9
|
+
private _modelUrl?;
|
|
10
|
+
private _imageUrl?;
|
|
11
|
+
private _imageId?;
|
|
12
|
+
private _pointNumber;
|
|
13
|
+
private _dracoPath;
|
|
14
|
+
private _map;
|
|
15
|
+
private _userData;
|
|
16
|
+
private _clock;
|
|
17
|
+
private _times;
|
|
18
|
+
private _object?;
|
|
19
|
+
constructor(options: SatelliteSourceOptions & {
|
|
20
|
+
map: Map;
|
|
21
|
+
});
|
|
22
|
+
_loadModel(): void;
|
|
23
|
+
_loadImage: () => Promise<void>;
|
|
24
|
+
getImageId(): string | undefined;
|
|
25
|
+
get _lngLatAlt(): import('../../../../../utils/sat/type').Position[];
|
|
26
|
+
getLngLatAltCoords(): import('../../../../../utils/sat/type').Position[];
|
|
27
|
+
get _XYZ(): number[];
|
|
28
|
+
getUserData(): Record<string, any>;
|
|
29
|
+
setUserData(userData: Record<string, any>): void;
|
|
30
|
+
getXYZCoords(height?: number | null): number[];
|
|
31
|
+
getLineFeature(properties?: Record<string, any>): {
|
|
32
|
+
type: string;
|
|
33
|
+
properties: {
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
};
|
|
36
|
+
geometry: {
|
|
37
|
+
type: string;
|
|
38
|
+
coordinates: any;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
getPointFeature(properties?: Record<string, any>): {
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
bearing: number;
|
|
45
|
+
};
|
|
46
|
+
geometry: {
|
|
47
|
+
type: string;
|
|
48
|
+
coordinates: number[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
setTLE(tle: [string, string] | string[]): void;
|
|
52
|
+
getTLE(): string[] | [string, string];
|
|
53
|
+
getClock(): Clock;
|
|
54
|
+
setPointNumber(pointNumber: number): void;
|
|
55
|
+
getPointNumber(): number;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
static getGLTFLoader(): GLTFLoader;
|
|
58
|
+
static getDRACOLoader(): DRACOLoader | null;
|
|
59
|
+
static createDRACOLoader(): void;
|
|
60
|
+
static disposeDRACOLoader(): void;
|
|
61
|
+
getObject(): Group<import('three').Object3DEventMap> | undefined;
|
|
62
|
+
isLoaded(): boolean;
|
|
63
|
+
_calcCoords(coordinates: number[][]): any;
|
|
64
|
+
}
|
|
65
|
+
export default SatelliteSource;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { InterpolateExpression } from '../type';
|
|
3
|
+
import { default as Clock } from './clock';
|
|
4
|
+
import { Group } from 'three';
|
|
5
|
+
import { Position } from '../../../../../utils/sat/type';
|
|
6
|
+
import { default as SatelliteLayer } from '.';
|
|
7
|
+
export type SatelliteSourceOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* @description TLE两行轨道数据
|
|
10
|
+
*/
|
|
11
|
+
tle: [string, string] | string[];
|
|
12
|
+
/**
|
|
13
|
+
* @description 卫星的三维模型,glb或者gltf其他的不支持
|
|
14
|
+
*/
|
|
15
|
+
modelUrl?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description 卫星的二维图片
|
|
18
|
+
*/
|
|
19
|
+
imageUrl?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @description 如果是glb文件的话需要解压缩文件路径
|
|
22
|
+
*/
|
|
23
|
+
dracoPath?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description 轨道插值点的数量
|
|
26
|
+
*/
|
|
27
|
+
pointNumber?: number;
|
|
28
|
+
/**
|
|
29
|
+
* @description 用户自定义数据,用在和卫星模型交互的时候
|
|
30
|
+
*/
|
|
31
|
+
userData?: Record<string, any>;
|
|
32
|
+
/**
|
|
33
|
+
* @description 用户定义的时刻类
|
|
34
|
+
*/
|
|
35
|
+
clock?: Clock;
|
|
36
|
+
times?: number;
|
|
37
|
+
};
|
|
38
|
+
export type PointData = {
|
|
39
|
+
point: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
data: Group;
|
|
44
|
+
lnglatalt: Position;
|
|
45
|
+
userData: Record<string, string>;
|
|
46
|
+
origin: SatelliteLayer;
|
|
47
|
+
};
|
|
48
|
+
export type SatelliteLayerOptions = {
|
|
49
|
+
id: string;
|
|
50
|
+
source: SatelliteSourceOptions;
|
|
51
|
+
paint?: {
|
|
52
|
+
"line-color"?: CSSProperties["color"] | CSSProperties["color"][];
|
|
53
|
+
"line-width"?: number;
|
|
54
|
+
"line-dasharray"?: [number, number];
|
|
55
|
+
"line-opacity"?: number;
|
|
56
|
+
"object-light-color"?: CSSProperties["color"];
|
|
57
|
+
"object-light-intensity"?: number;
|
|
58
|
+
};
|
|
59
|
+
layout?: {
|
|
60
|
+
"object-heading"?: number;
|
|
61
|
+
"object-pitch"?: number;
|
|
62
|
+
"object-roll"?: number;
|
|
63
|
+
"object-size"?: InterpolateExpression<number>;
|
|
64
|
+
"image-follow-bearing"?: boolean;
|
|
65
|
+
};
|
|
66
|
+
realTime?: boolean;
|
|
67
|
+
};
|
|
68
|
+
export declare const SatelliteEvents: {
|
|
69
|
+
readonly OBJECT_LOAD: "object.load";
|
|
70
|
+
readonly OBJECT_MOUSEENTER: "object.mouseenter";
|
|
71
|
+
readonly OBJECT_MOUSELEAVE: "object.mouseleave";
|
|
72
|
+
readonly OBJECT_CLICK: "object.click";
|
|
73
|
+
};
|
|
74
|
+
export declare const DEFAULT_PAINT: SatelliteLayerOptions["paint"];
|
|
75
|
+
export declare const DEFAULT_LAYOUT: SatelliteLayerOptions["layout"];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StarOptions, StarRenderPrepares } from './type';
|
|
2
|
+
import { CustomLayer } from '../type';
|
|
3
|
+
export declare const createSkyCanvas: (width: number, height: number, maxStars?: number, starColor?: string, starScale?: number) => HTMLCanvasElement;
|
|
4
|
+
export declare const STAR_LAYER_ID = "sv-cps-star-layer";
|
|
5
|
+
declare const getStarLayer: (starOptions?: StarOptions) => CustomLayer<StarRenderPrepares>;
|
|
6
|
+
export default getStarLayer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as Program } from '../../../../../shaders/program';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export type StarOptions = {
|
|
4
|
+
color?: CSSProperties["color"];
|
|
5
|
+
maxCount?: number;
|
|
6
|
+
scale?: number;
|
|
7
|
+
};
|
|
8
|
+
export type StarRenderPrepares = {
|
|
9
|
+
aLocations: {
|
|
10
|
+
[k: string]: number;
|
|
11
|
+
};
|
|
12
|
+
programInstance: Program;
|
|
13
|
+
positionBuffer: WebGLBuffer;
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomLayerInterface, CustomRenderMethodInput } from 'maplibre-gl';
|
|
2
|
+
export type CustomLayer<T> = CustomLayerInterface & {
|
|
3
|
+
renderPrepares?: T;
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export type InterpolateExpression<T> = ["interpolate", ["linear"], ["zoom"], ...T[]] | T;
|
|
7
|
+
export type RenderLoop = (gl: WebGLRenderingContext | WebGL2RenderingContext, args: CustomRenderMethodInput) => boolean | void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GISMaplibreProps, GISMaplibreRef } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @description GIS maplibre component
|
|
4
|
+
* @author tiancheng.xia
|
|
5
|
+
* @since 2025-01-16
|
|
6
|
+
*/
|
|
7
|
+
declare const GISMaplibre: import('react').ForwardRefExoticComponent<GISMaplibreProps & import('react').RefAttributes<GISMaplibreRef>>;
|
|
8
|
+
export default GISMaplibre;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { Feature, FeatureCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from '../../../types/geometry';
|
|
2
|
+
import { default as maplibregl } from 'maplibre-gl';
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
import { StarOptions } from './custom-layers/star-layer/type';
|
|
5
|
+
import { AtmosphereOptions } from './custom-layers/atmosphere-layer/type';
|
|
6
|
+
export type GISMaplibreProps = {
|
|
7
|
+
/**
|
|
8
|
+
* @description 地图初始化配置
|
|
9
|
+
*/
|
|
10
|
+
mapOptions?: Omit<maplibregl.MapOptions, "container"> & {
|
|
11
|
+
starOptions?: StarOptions;
|
|
12
|
+
atmosphereOptions?: AtmosphereOptions;
|
|
13
|
+
projection?: "globe" | "mercator";
|
|
14
|
+
disabledBaseLayer?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @description 地图加载完成回调
|
|
18
|
+
*/
|
|
19
|
+
onLoad?: (map: maplibregl.Map) => void | Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* @description 容器的类名
|
|
22
|
+
*/
|
|
23
|
+
rootClassName?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description 容器的样式
|
|
26
|
+
*/
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
/**
|
|
29
|
+
* @description 容器是否禁用
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type Bounds = [number, number, number, number];
|
|
34
|
+
export type AddPolygonLayerOptions = Partial<{
|
|
35
|
+
fill: {
|
|
36
|
+
color?: string;
|
|
37
|
+
opacity?: number;
|
|
38
|
+
};
|
|
39
|
+
line: {
|
|
40
|
+
color?: string;
|
|
41
|
+
width?: number;
|
|
42
|
+
};
|
|
43
|
+
beforeId: string;
|
|
44
|
+
}>;
|
|
45
|
+
export type AddCircleLayerOptions = Partial<{
|
|
46
|
+
color: string;
|
|
47
|
+
radius: number;
|
|
48
|
+
outlineColor: string;
|
|
49
|
+
outlineWidth: number;
|
|
50
|
+
beforeId: string;
|
|
51
|
+
}>;
|
|
52
|
+
export type MapCursor = "auto" | "pointer" | "grabbing" | "crosshair" | "se-resize" | "sw-resize" | "s-resize" | "w-resize" | "move" | "default" | "text" | "wait" | "help" | "progress" | "not-allowed" | "no-drop" | "alias" | "copy" | "zoom-in" | "zoom-out";
|
|
53
|
+
export type GISMaplibreRef = {
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @description 获取地图实例
|
|
57
|
+
*/
|
|
58
|
+
getMap: () => maplibregl.Map | null;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @description 获取地图是否发光
|
|
62
|
+
*/
|
|
63
|
+
getLighting: () => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @description 地图自适应
|
|
66
|
+
*/
|
|
67
|
+
fitBounds: (bounds: maplibregl.LngLatBoundsLike, options?: maplibregl.FitBoundsOptions) => void;
|
|
68
|
+
/**
|
|
69
|
+
* @description 设置地图视图
|
|
70
|
+
*/
|
|
71
|
+
setView: (options: maplibregl.CameraOptions & maplibregl.AnimationOptions) => void;
|
|
72
|
+
/**
|
|
73
|
+
* @description 移除地图数据源
|
|
74
|
+
*/
|
|
75
|
+
removeSource: (sourceId: string) => void;
|
|
76
|
+
/**
|
|
77
|
+
* @description 移除图层
|
|
78
|
+
*/
|
|
79
|
+
removeLayer: (layerId: string) => void;
|
|
80
|
+
/**
|
|
81
|
+
* @description 移除地图数据源和图层,前提是数据源与图层是一对一的关系
|
|
82
|
+
*/
|
|
83
|
+
removeSourceAndLayer: (id: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* @description 添加栅格图层
|
|
86
|
+
*/
|
|
87
|
+
addRasterLayer: (id: string, tileUrl: string, beforeId?: string) => void;
|
|
88
|
+
/**
|
|
89
|
+
* @description 添加图片图层
|
|
90
|
+
*/
|
|
91
|
+
addImageLayer: (id: string, imageUrl: string, coordinates: maplibregl.ImageSourceSpecification["coordinates"], beforeId?: string) => void;
|
|
92
|
+
/**
|
|
93
|
+
* @description 添加 GeoJson面和线图层
|
|
94
|
+
*/
|
|
95
|
+
addGeoJsonPolygonLayer: (id: string, geojson: FeatureCollection<Polygon | MultiPolygon> | FeatureCollection<LineString | MultiLineString>, options?: AddPolygonLayerOptions) => void;
|
|
96
|
+
/**
|
|
97
|
+
* @description 添加 GeoJson点图层
|
|
98
|
+
*/
|
|
99
|
+
addGeoJsonCircleLayer: (id: string, geojson: FeatureCollection<Point | MultiPoint>, options?: AddCircleLayerOptions) => void;
|
|
100
|
+
/**
|
|
101
|
+
* @description 设置 GeoJson数据
|
|
102
|
+
*/
|
|
103
|
+
setGeoJsonData: <T>(id: string, geojson: FeatureCollection<T>) => void;
|
|
104
|
+
/**
|
|
105
|
+
* @description 获取 GeoJson数据
|
|
106
|
+
*/
|
|
107
|
+
getGeoJsonData: <T>(id: string) => FeatureCollection<T> | Feature<T> | null;
|
|
108
|
+
/**
|
|
109
|
+
* @description 变化尺寸
|
|
110
|
+
*/
|
|
111
|
+
resize: () => void;
|
|
112
|
+
/**
|
|
113
|
+
* @description 移除地图
|
|
114
|
+
*/
|
|
115
|
+
remove: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* @description 添加图层
|
|
118
|
+
*/
|
|
119
|
+
addLayer: (layer: maplibregl.LayerSpecification, beforeId?: string) => void;
|
|
120
|
+
/**
|
|
121
|
+
* @description 获取图层
|
|
122
|
+
*/
|
|
123
|
+
getLayer: maplibregl.Map["getLayer"];
|
|
124
|
+
/**
|
|
125
|
+
* @description 添加数据源
|
|
126
|
+
*/
|
|
127
|
+
addSource: (id: string, source: maplibregl.SourceSpecification) => void;
|
|
128
|
+
/**
|
|
129
|
+
* @description 获取数据源
|
|
130
|
+
*/
|
|
131
|
+
getSource: maplibregl.Map["getSource"];
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @description 移除地图底图
|
|
135
|
+
*/
|
|
136
|
+
removeBaseLayer: () => void;
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @description 设置底图
|
|
140
|
+
*/
|
|
141
|
+
setBaseLayer: (url: string) => void;
|
|
142
|
+
/**
|
|
143
|
+
* @description 设置图层可见性
|
|
144
|
+
*/
|
|
145
|
+
setLayerVisible: (id: string, visible: boolean) => void;
|
|
146
|
+
/**
|
|
147
|
+
* @description 设置地图上的鼠标状态
|
|
148
|
+
*/
|
|
149
|
+
setCursor: (cursor: MapCursor) => void;
|
|
150
|
+
/**
|
|
151
|
+
* @description 获取当前地图上的比例尺距离,单位是m
|
|
152
|
+
*/
|
|
153
|
+
getScale: (domSize: number) => number;
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* @description 获取当前地图是否加载完毕
|
|
157
|
+
*/
|
|
158
|
+
loaded: () => boolean;
|
|
159
|
+
/**
|
|
160
|
+
* @description 将当前的canvas转为blob流
|
|
161
|
+
*/
|
|
162
|
+
toBlob: HTMLCanvasElement["toBlob"];
|
|
163
|
+
/**
|
|
164
|
+
* @description 下载当前的canvas
|
|
165
|
+
*/
|
|
166
|
+
download: (format: "png" | "jpg", fileName?: string) => void;
|
|
167
|
+
/**
|
|
168
|
+
* @description 设置布局属性
|
|
169
|
+
*/
|
|
170
|
+
setLayoutProperty: (id: string, property: string, value: any) => void;
|
|
171
|
+
/**
|
|
172
|
+
* @description 设置样式属性
|
|
173
|
+
*/
|
|
174
|
+
setPaintProperty: (id: string, property: string, value: any) => void;
|
|
175
|
+
/**
|
|
176
|
+
* @description 为基础地图添加label,可以切换中英文,为空时候移除label
|
|
177
|
+
*/
|
|
178
|
+
setBaseLayerLabel: (language?: "en" | "cn") => void;
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* @description 开启大气效果
|
|
182
|
+
*/
|
|
183
|
+
enableAtmosphere: () => void;
|
|
184
|
+
/**
|
|
185
|
+
*
|
|
186
|
+
* @description 关闭大气效果
|
|
187
|
+
*/
|
|
188
|
+
disableAtmosphere: () => void;
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @description 开启昼夜效果
|
|
192
|
+
*/
|
|
193
|
+
enableLighting: () => void;
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
* @description 关闭昼夜效果
|
|
197
|
+
*/
|
|
198
|
+
disableLighting: () => void;
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @description date 设置昼夜效果的时间
|
|
202
|
+
*/
|
|
203
|
+
setLighting: (date: Date) => void;
|
|
204
|
+
/**
|
|
205
|
+
*
|
|
206
|
+
* @description 启用交互
|
|
207
|
+
*/
|
|
208
|
+
enableInteractive: () => void;
|
|
209
|
+
/**
|
|
210
|
+
*
|
|
211
|
+
* @description 禁用交互
|
|
212
|
+
*/
|
|
213
|
+
disableInteractive: () => void;
|
|
214
|
+
/**
|
|
215
|
+
*
|
|
216
|
+
* @description 设置大气层
|
|
217
|
+
*/
|
|
218
|
+
setAtmosphere: (options: AtmosphereOptions) => void;
|
|
219
|
+
};
|
|
220
|
+
export declare const GISMAPLIBRE_INTERACTIVES: string[];
|
|
221
|
+
export declare const GISMAPLIBRE_DISPLAY_NAME = "SV-CPS-GISMAPLIBRE";
|
|
222
|
+
export declare const CrepusculeLayerId = "crepuscule-mercator";
|
|
223
|
+
export declare const getTerminatorGeoJSON: (date?: Date, density?: number) => {
|
|
224
|
+
type: string;
|
|
225
|
+
geometry: {
|
|
226
|
+
type: string;
|
|
227
|
+
coordinates: [number, number][];
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
export declare const getNightPolygonGeoJSON: (date?: Date, density?: number) => {
|
|
231
|
+
type: string;
|
|
232
|
+
geometry: {
|
|
233
|
+
type: string;
|
|
234
|
+
coordinates: [number, number][][];
|
|
235
|
+
};
|
|
236
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as maplibregl } from 'maplibre-gl';
|
|
2
|
+
import { GISMarkerRef } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* @description 地图标记组件
|
|
5
|
+
* @author tiancheng.xia
|
|
6
|
+
* @since 2025-02-07
|
|
7
|
+
*/
|
|
8
|
+
declare const GISMarker: import('react').ForwardRefExoticComponent<{
|
|
9
|
+
children?: import('react').ReactNode;
|
|
10
|
+
rootClassName?: string;
|
|
11
|
+
} & Omit<maplibregl.MarkerOptions, "element"> & import('react').RefAttributes<GISMarkerRef>>;
|
|
12
|
+
export default GISMarker;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { default as maplibregl } from 'maplibre-gl';
|
|
3
|
+
export type GISMarkerProps = {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
rootClassName?: string;
|
|
6
|
+
} & Omit<maplibregl.MarkerOptions, "element">;
|
|
7
|
+
export type GISMarkerRef = {
|
|
8
|
+
addClassName: maplibregl.Marker["addClassName"];
|
|
9
|
+
addTo: maplibregl.Marker["addTo"];
|
|
10
|
+
getElement: maplibregl.Marker["getElement"];
|
|
11
|
+
getLngLat: maplibregl.Marker["getLngLat"];
|
|
12
|
+
getOffset: maplibregl.Marker["getOffset"];
|
|
13
|
+
getPitchAlignment: maplibregl.Marker["getPitchAlignment"];
|
|
14
|
+
getPopup: maplibregl.Marker["getPopup"];
|
|
15
|
+
getRotation: maplibregl.Marker["getRotation"];
|
|
16
|
+
getRotationAlignment: maplibregl.Marker["getRotationAlignment"];
|
|
17
|
+
isDraggable: maplibregl.Marker["isDraggable"];
|
|
18
|
+
listens: maplibregl.Marker["listens"];
|
|
19
|
+
off: maplibregl.Marker["off"];
|
|
20
|
+
on: maplibregl.Marker["on"];
|
|
21
|
+
once: maplibregl.Marker["once"];
|
|
22
|
+
remove: maplibregl.Marker["remove"];
|
|
23
|
+
removeClassName: maplibregl.Marker["removeClassName"];
|
|
24
|
+
setDraggable: maplibregl.Marker["setDraggable"];
|
|
25
|
+
setEventedParent: maplibregl.Marker["setEventedParent"];
|
|
26
|
+
setLngLat: maplibregl.Marker["setLngLat"];
|
|
27
|
+
setOffset: maplibregl.Marker["setOffset"];
|
|
28
|
+
setOpacity: maplibregl.Marker["setOpacity"];
|
|
29
|
+
setPitchAlignment: maplibregl.Marker["setPitchAlignment"];
|
|
30
|
+
setPopup: maplibregl.Marker["setPopup"];
|
|
31
|
+
setRotation: maplibregl.Marker["setRotation"];
|
|
32
|
+
setRotationAlignment: maplibregl.Marker["setRotationAlignment"];
|
|
33
|
+
setSubpixelPositioning: maplibregl.Marker["setSubpixelPositioning"];
|
|
34
|
+
toggleClassName: maplibregl.Marker["toggleClassName"];
|
|
35
|
+
togglePopup: maplibregl.Marker["togglePopup"];
|
|
36
|
+
};
|