@dullcat/ol-helper 0.0.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/ol-helper.cjs.js +12 -0
- package/dist/ol-helper.d.ts +6 -0
- package/dist/ol-helper.es.js +15244 -0
- package/dist/ol-helper.umd.js +12 -0
- package/dist/olHelper.d.ts +74 -0
- package/package.json +96 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { default as olMap } from 'ol/Map';
|
|
2
|
+
import { ViewOptions } from 'ol/View';
|
|
3
|
+
import { default as VectorLayer } from 'ol/layer/Vector';
|
|
4
|
+
import { default as VectorSource } from 'ol/source/Vector';
|
|
5
|
+
import { default as olSelect, Options as OlSelectOptions, SelectEvent } from 'ol/interaction/Select';
|
|
6
|
+
import { StyleLike } from 'ol/style/Style';
|
|
7
|
+
import { default as Feature } from 'ol/Feature';
|
|
8
|
+
import { default as Geometry } from 'ol/geom/Geometry';
|
|
9
|
+
import { drawTypeEnum, HighlightInfoType, LayerHandlesObject, mapViewInfoType } from './type';
|
|
10
|
+
import { Options as BaseVectorOptions } from 'ol/layer/BaseVector';
|
|
11
|
+
import { default as Draw, DrawEvent, Options as DrawOptions } from 'ol/interaction/Draw.js';
|
|
12
|
+
import { default as Modify, ModifyEvent, Options as ModifyOptions } from 'ol/interaction/Modify.js';
|
|
13
|
+
export * from './presetConfig';
|
|
14
|
+
export * from './presetStyle';
|
|
15
|
+
export default class olHelper {
|
|
16
|
+
map: olMap;
|
|
17
|
+
layerHandles: Map<string, LayerHandlesObject>;
|
|
18
|
+
selectHandles: Map<string, olSelect>;
|
|
19
|
+
highLightLayer: VectorLayer<VectorSource<Geometry>>;
|
|
20
|
+
private highlightInfo;
|
|
21
|
+
constructor(target: string, viewOptions?: {});
|
|
22
|
+
/**
|
|
23
|
+
* 初始化地图
|
|
24
|
+
* @param target
|
|
25
|
+
* @param viewOptions
|
|
26
|
+
*/
|
|
27
|
+
initMap(target: string, viewOptions?: ViewOptions): void;
|
|
28
|
+
refreshMap(): void;
|
|
29
|
+
setMapCenter(center: [number, number], zoom: number | null): void;
|
|
30
|
+
toWkt(wkt: string): void;
|
|
31
|
+
getLayerByName(name: string): import('ol/layer/Base').default | null;
|
|
32
|
+
getLayerByProperty(key: string, value: string): import('ol/layer/Base').default[];
|
|
33
|
+
createUniLayer(layerName: string, features?: Feature[], options?: BaseVectorOptions<VectorSource>): VectorLayer<VectorSource<Geometry>>;
|
|
34
|
+
wktTempRender(wkt: string | string[], properties?: object, style?: StyleLike): void;
|
|
35
|
+
/**
|
|
36
|
+
* @description: 创建图层
|
|
37
|
+
* @param layerName 图层名称
|
|
38
|
+
* @param update 更新函数
|
|
39
|
+
* @param options 选项,可以覆盖和融合没有预设的值
|
|
40
|
+
*/
|
|
41
|
+
createUpdateLayer(layerName: string, update?: (_layer: VectorLayer<VectorSource>) => void, options?: BaseVectorOptions<VectorSource>): void;
|
|
42
|
+
updateLayerFromFeatures(newFeatures: Feature[], layer: VectorLayer<VectorSource>): void;
|
|
43
|
+
getMapInfo(options?: object): mapViewInfoType;
|
|
44
|
+
compareMapInfo(mapInfo1: mapViewInfoType, mapInfo2: mapViewInfoType): boolean;
|
|
45
|
+
private setHighlightFeature;
|
|
46
|
+
resetHighLightInfo(): void;
|
|
47
|
+
locateAndHighlight(highlightInfo: HighlightInfoType, wkt?: string): void;
|
|
48
|
+
locateFeature(f: Feature | Feature[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* 自定义点击事件
|
|
51
|
+
* @param name 事件名称,用于管理事件
|
|
52
|
+
* @param options 可选选项
|
|
53
|
+
*/
|
|
54
|
+
useSelect(name: string, options?: OlSelectOptions): {
|
|
55
|
+
remove: () => void;
|
|
56
|
+
setSelectMod: (mod: "click" | "multiSelect") => void;
|
|
57
|
+
getSelectMod: () => "click" | "multiSelect";
|
|
58
|
+
setEventFunc: (func: (event: SelectEvent) => void) => void;
|
|
59
|
+
selectInstance: olSelect;
|
|
60
|
+
};
|
|
61
|
+
setSelectActive(activeLayerNameArray?: string[], inactiveLayerNameArray?: string[]): void;
|
|
62
|
+
clearAllSelect(): void;
|
|
63
|
+
useDraw(type: drawTypeEnum, options?: Partial<DrawOptions>): {
|
|
64
|
+
drawInstance: Draw;
|
|
65
|
+
setEventFunc: (func: (event: DrawEvent) => void) => void;
|
|
66
|
+
remove: () => void;
|
|
67
|
+
};
|
|
68
|
+
useModify(options?: ModifyOptions): {
|
|
69
|
+
modifyInstance: Modify;
|
|
70
|
+
setEventFunc: (func: (event: ModifyEvent) => void) => void;
|
|
71
|
+
remove: () => void;
|
|
72
|
+
};
|
|
73
|
+
clearHighLightSource(): void;
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dullcat/ol-helper",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./dist/ol-helper.es.js",
|
|
5
|
+
"types": "./dist/ol-helper.d.ts",
|
|
6
|
+
"homepage": "https://dullcat-c.github.io/ol-helper/",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"openlayers",
|
|
9
|
+
"utils"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"private": false,
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/DullCat-c/ol-helper"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepare": "husky",
|
|
21
|
+
"docs:dev": "vitepress dev docs",
|
|
22
|
+
"type:check": "vue-tsc --noEmit --skipLibCheck",
|
|
23
|
+
"lint:eslint": "eslint . --fix",
|
|
24
|
+
"lint:prettier": "prettier --write \"*.{js,json,tsx,css,less,scss,vue,html,md}\"",
|
|
25
|
+
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
|
|
26
|
+
"lint:lint-staged": "lint-staged",
|
|
27
|
+
"docs:build": "vitepress build docs",
|
|
28
|
+
"docs:preview": "vitepress preview docs",
|
|
29
|
+
"build": "vite build"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/ol-helper.es.js",
|
|
34
|
+
"require": "./dist/ol-helper.umd.cjs",
|
|
35
|
+
"types": "./dist/ol-helper.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"lint-staged": {
|
|
40
|
+
"*.{html,ts,js,json,jsx,tsx}": [
|
|
41
|
+
"eslint --fix",
|
|
42
|
+
"prettier --write",
|
|
43
|
+
"stylelint --fix"
|
|
44
|
+
],
|
|
45
|
+
"*.{js,ts,jsx,tsx,json,mjs}": [
|
|
46
|
+
"eslint --fix"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"author": "John Tsai",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"description": "",
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@codemirror/commands": "^6.10.1",
|
|
54
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
55
|
+
"@codemirror/language": "^6.12.1",
|
|
56
|
+
"@codemirror/lint": "^6.9.2",
|
|
57
|
+
"@commitlint/cli": "^20.2.0",
|
|
58
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
59
|
+
"@eslint/js": "^9.39.1",
|
|
60
|
+
"@types/node": "^18.19.70",
|
|
61
|
+
"@unocss/preset-attributify": "^66.3.3",
|
|
62
|
+
"@unocss/preset-icons": "^66.3.3",
|
|
63
|
+
"@unocss/preset-wind4": "^66.3.3",
|
|
64
|
+
"@vitejs/plugin-vue": "^3.2.0",
|
|
65
|
+
"eslint": "^9.39.1",
|
|
66
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
67
|
+
"globals": "^16.5.0",
|
|
68
|
+
"husky": "^9.1.7",
|
|
69
|
+
"jiti": "^2.6.1",
|
|
70
|
+
"lint-staged": "^16.2.7",
|
|
71
|
+
"postcss-html": "^1.8.0",
|
|
72
|
+
"prettier": "^3.4.2",
|
|
73
|
+
"stylelint": "^16.26.1",
|
|
74
|
+
"stylelint-config-standard": "^39.0.1",
|
|
75
|
+
"stylelint-order": "^7.0.0",
|
|
76
|
+
"typescript": "^5.9.3",
|
|
77
|
+
"typescript-eslint": "^8.48.0",
|
|
78
|
+
"unocss": "^66.3.3",
|
|
79
|
+
"unplugin-auto-import": "^0.14.4",
|
|
80
|
+
"unplugin-vue-components": "^0.22.12",
|
|
81
|
+
"vite": "^3.2.11",
|
|
82
|
+
"vite-plugin-compression": "^0.5.1",
|
|
83
|
+
"vite-plugin-dts": "^4.5.4",
|
|
84
|
+
"vitepress": "2.0.0-alpha.13",
|
|
85
|
+
"vue-codemirror": "^6.1.1",
|
|
86
|
+
"vue-tsc": "^3.1.8"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"element-plus": "^2.13.0",
|
|
90
|
+
"ol": "^7.5.2",
|
|
91
|
+
"vue": "^3.5.24"
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">21"
|
|
95
|
+
}
|
|
96
|
+
}
|