jgis 1.0.3 → 1.0.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.
@@ -1,3 +1,4 @@
1
+ import { HoverOptions, SelectOptions, UseHoverResult, UseSelectResult } from './interaction';
1
2
  import * as Cesium from 'cesium';
2
3
  export interface flyOptions {
3
4
  heading?: number;
@@ -16,41 +17,52 @@ export interface LayerOptions {
16
17
  opacity?: number;
17
18
  interactive?: boolean;
18
19
  }
19
- export interface SelectResult {
20
- billboard: Cesium.Billboard;
21
- properties: any;
22
- event: Cesium.Cartesian2;
23
- pick: any;
20
+ export interface WmsOptions {
21
+ url: string;
22
+ layers?: string;
23
+ alpha?: number;
24
+ brightness?: number;
25
+ gamma?: number;
26
+ contrast?: number;
24
27
  }
25
- export interface UseSelectResult {
26
- onSelect: (result: (SelectResult: any) => void) => void;
27
- clear: () => void;
28
- destroy: () => void;
28
+ export type ILineOptions = {
29
+ width: number;
30
+ color: string;
31
+ material: Cesium.Material;
32
+ granularity: number;
33
+ };
34
+ export interface optionsMap {
35
+ Point: billboardOptions & {
36
+ getImage?: Function;
37
+ };
38
+ LineString: ILineOptions;
39
+ MultiLineString: ILineOptions;
40
+ Polygon: any;
41
+ MultiPolygon: any;
42
+ Circle: any;
43
+ Wms: WmsOptions;
44
+ Overlay: any;
29
45
  }
46
+ export type billboardOptions = Omit<Cesium.Billboard.ConstructorOptions, 'position'>;
30
47
  export type Coordinates = [number, number, number];
31
48
  export interface MapContext {
32
49
  targetId: string;
33
50
  instance: Cesium.Viewer;
34
- addMarker: (layerName: string, data: any, options?: LayerOptions) => void;
35
- createLayer: (layerName: string, data: any, options?: LayerOptions) => Layer;
51
+ addMarker: (layerName: string, data: any, options?: optionsMap['Point']) => void;
52
+ createLayer: <K extends keyof optionsMap>(layerName: string, data: any, options?: optionsMap[K] & {
53
+ type?: K;
54
+ }) => Cesium.Primitive;
36
55
  removeLayer: (layerName: string) => void;
37
- visibleLayer: (layerName: string, visible: boolean) => Layer;
38
- getLayerByName: (layerName: string) => Layer;
39
- getSourceByName: (layerName: string) => Source;
40
- getLonLat: (data: any) => [number, number];
41
- createBlankLayer: (layerName: string, options: LayerOptions) => Layer;
42
- lightFeature: (layerName: string, feature: FeatureLike, options: HighLightOptions, zoomFlag: boolean) => void;
43
- flashFeature: (layerName: string, feature: FeatureLike & customFeature, options: FlashOptions) => void;
44
- queryFeature: (layerName: string, properties: any) => FeatureLike;
45
- useSelect: (options: any) => UseSelectResult;
46
- useHover: (options: HoverOptions) => UseHoverResult;
56
+ visibleLayer: (layerName: string, visible: boolean) => void;
57
+ getLayerByName: (layerName: string) => Cesium.Primitive;
58
+ createBlankLayer: (layerName: string, options: LayerOptions) => Cesium.Primitive;
59
+ createSelect: (options: SelectOptions) => UseSelectResult;
60
+ createHover: (options: HoverOptions) => UseHoverResult;
47
61
  flyTo: (coordinate: Coordinates, options: flyOptions) => Promise<boolean>;
48
62
  flyHome: (duration?: number) => void;
49
63
  flyToBoundingSphere: (boundingSphere: Cesium.BoundingSphere, options?: flyOptions) => Promise<boolean>;
50
- getProjection: () => void;
51
- getZoom: () => number;
52
64
  setView: (coordinate: Coordinates, options?: flyOptions) => void;
53
65
  getMapContext: (id: string) => Promise<MapContext>;
54
- onMapReady: (id: string, callback: () => void) => void;
66
+ onMapReady: (id: string, callback: (cxt: MapContext) => void) => void;
55
67
  destroyMap: (id: string) => void;
56
68
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 防抖函数
3
+ * @param fn 函数
4
+ * @param wait 等待时间
5
+ * @returns 函数
6
+ */
7
+ export declare function throttle(fn: any, delay?: number): (...args: any[]) => void;
package/package.json CHANGED
@@ -1,70 +1,70 @@
1
- {
2
- "name": "jgis",
3
- "version": "1.0.3",
4
- "description": "快速创建二维、三维工具库",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
8
- "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1",
10
- "lint:prettier": "prettier --write **/*.{js,ts,json,tsx,css,less,scss,vue,html,md}",
11
- "eslint:fix": "eslint --fix",
12
- "build": "vite build"
13
- },
14
- "files": [
15
- "dist",
16
- "README.md",
17
- "LICENSE"
18
- ],
19
- "exports": {
20
- ".": {
21
- "import": "./dist/index.mjs",
22
- "require": "./dist/index.js",
23
- "types": "./dist/index.d.ts"
24
- },
25
- "./2d": {
26
- "import": "./dist/2d/index.mjs",
27
- "require": "./dist/2d/index.js",
28
- "types": "./dist/2d/index.d.ts"
29
- },
30
- "./3d": {
31
- "import": "./dist/3d/index.mjs",
32
- "require": "./dist/3d/index.js",
33
- "types": "./dist/3d/index.d.ts"
34
- }
35
- },
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/Guidozijef/jgis.git"
39
- },
40
- "keywords": [
41
- "gis",
42
- "openlayers",
43
- "cesium",
44
- "typeScript"
45
- ],
46
- "author": "zhangjianfeng",
47
- "license": "ISC",
48
- "bugs": {
49
- "url": "https://github.com/Guidozijef/jgis/issues"
50
- },
51
- "homepage": "https://github.com/Guidozijef/jgis#readme",
52
- "devDependencies": {
53
- "@eslint/js": "^9.39.2",
54
- "@turf/turf": "^7.3.1",
55
- "cesium": "^1.137.0",
56
- "eslint": "^9.39.2",
57
- "eslint-config-prettier": "^10.1.8",
58
- "eslint-plugin-prettier": "^5.5.4",
59
- "eslint-plugin-vue": "^10.6.2",
60
- "globals": "^17.0.0",
61
- "jiti": "^2.6.1",
62
- "ol": "^10.7.0",
63
- "prettier": "^3.7.4",
64
- "ts-loader": "^9.5.4",
65
- "typescript": "^5.9.3",
66
- "typescript-eslint": "^8.51.0",
67
- "vite": "^7.3.0",
68
- "vite-plugin-dts": "^4.5.4"
69
- }
70
- }
1
+ {
2
+ "name": "jgis",
3
+ "version": "1.0.5",
4
+ "description": "快速创建二维、三维工具库",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "lint:prettier": "prettier --write **/*.{js,ts,json,tsx,css,less,scss,vue,html,md}",
11
+ "eslint:fix": "eslint --fix",
12
+ "build": "vite build"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.mjs",
22
+ "require": "./dist/index.js",
23
+ "types": "./dist/index.d.ts"
24
+ },
25
+ "./2d": {
26
+ "import": "./dist/2d/index.mjs",
27
+ "require": "./dist/2d/index.js",
28
+ "types": "./dist/2d/index.d.ts"
29
+ },
30
+ "./3d": {
31
+ "import": "./dist/3d/index.mjs",
32
+ "require": "./dist/3d/index.js",
33
+ "types": "./dist/3d/index.d.ts"
34
+ }
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/Guidozijef/jgis.git"
39
+ },
40
+ "keywords": [
41
+ "gis",
42
+ "openlayers",
43
+ "cesium",
44
+ "typeScript"
45
+ ],
46
+ "author": "zhangjianfeng",
47
+ "license": "ISC",
48
+ "bugs": {
49
+ "url": "https://github.com/Guidozijef/jgis/issues"
50
+ },
51
+ "homepage": "https://github.com/Guidozijef/jgis#readme",
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.39.2",
54
+ "@turf/turf": "^7.3.1",
55
+ "cesium": "^1.137.0",
56
+ "eslint": "^9.39.2",
57
+ "eslint-config-prettier": "^10.1.8",
58
+ "eslint-plugin-prettier": "^5.5.4",
59
+ "eslint-plugin-vue": "^10.6.2",
60
+ "globals": "^17.0.0",
61
+ "jiti": "^2.6.1",
62
+ "ol": "^10.7.0",
63
+ "prettier": "^3.7.4",
64
+ "ts-loader": "^9.5.4",
65
+ "typescript": "^5.9.3",
66
+ "typescript-eslint": "^8.51.0",
67
+ "vite": "^7.3.0",
68
+ "vite-plugin-dts": "^4.5.4"
69
+ }
70
+ }