my-openlayer 0.1.0 → 0.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/dist/MyOl.d.ts CHANGED
@@ -3,6 +3,7 @@ import Map from "ol/Map";
3
3
  import Polygon from "./core/Polygon";
4
4
  import Point from "./core/Point";
5
5
  import Line from "./core/Line";
6
+ import MapBaseLayers from "./core/MapBaseLayers";
6
7
  import MapTools from "./core/MapTools";
7
8
  import { MapInitType } from './types';
8
9
  export default class MyOl {
@@ -31,7 +32,7 @@ export default class MyOl {
31
32
  * @returns Polygon
32
33
  */
33
34
  getPolygon(): Polygon;
34
- getMapBaseLayers(): any;
35
+ getMapBaseLayers(): MapBaseLayers;
35
36
  /**
36
37
  * 获取 地图 点 操作
37
38
  * @returns Point
@@ -14,7 +14,7 @@ export default class MapBaseLayers {
14
14
  constructor(map: Map, options: MapLayersOptions);
15
15
  switchBaseLayer(type: TiandituType): void;
16
16
  initLayer(): void;
17
- addAnnotationLayer(options: AnnotationLayerOptions): void;
17
+ addAnnotationLayer(options: Omit<AnnotationLayerOptions, 'token'>): void;
18
18
  static addAnnotationLayer(map: Map, options: AnnotationLayerOptions): TileLayer<XYZ>;
19
19
  addMapLayer(): void;
20
20
  createLayer(layer: any): any;
@@ -76,15 +76,18 @@ export default class MapBaseLayers {
76
76
  }
77
77
  //添加注记图层
78
78
  addAnnotationLayer(options) {
79
- MapBaseLayers.addAnnotationLayer(this.map, options);
79
+ MapBaseLayers.addAnnotationLayer(this.map, {
80
+ ...options,
81
+ token: this.options.token || ''
82
+ });
80
83
  }
81
84
  //添加注记图层
82
85
  static addAnnotationLayer(map, options) {
83
86
  const layer = MapBaseLayers.getAnnotationLayer({
84
87
  type: options.type,
85
88
  token: options.token,
86
- zIndex: options.zIndex,
87
- visible: options.visible
89
+ zIndex: options.zIndex ?? 10,
90
+ visible: options.visible ?? true
88
91
  });
89
92
  map.addLayer(layer);
90
93
  return layer;
package/dist/types.d.ts CHANGED
@@ -45,8 +45,8 @@ export interface MapLayersOptions {
45
45
  export interface AnnotationLayerOptions {
46
46
  type: AnnotationType;
47
47
  token: string;
48
- zIndex: number;
49
- visible: boolean;
48
+ zIndex?: number;
49
+ visible?: boolean;
50
50
  }
51
51
  export interface OptionsType {
52
52
  type?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",