my-openlayer 1.0.10 → 1.0.11

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/MyOl.js CHANGED
@@ -139,8 +139,8 @@ class MyOl {
139
139
  projection,
140
140
  center: olProjFromLonLat(options.center, projection),
141
141
  zoom: options.zoom ?? MyOl.DefaultOptions.zoom,
142
- minZoom: options.minZoom ?? MyOl.DefaultOptions.minZoom,
143
- maxZoom: options.maxZoom ?? MyOl.DefaultOptions.maxZoom,
142
+ minZoom: options.minZoom,
143
+ maxZoom: options.maxZoom,
144
144
  ...(options.extent && { extent: options.extent })
145
145
  };
146
146
  return new View(viewOptions);
@@ -372,8 +372,6 @@ MyOl.DefaultOptions = {
372
372
  layers: undefined,
373
373
  zoom: 10,
374
374
  center: [119.81, 29.969],
375
- minZoom: 8,
376
- maxZoom: 20,
377
375
  extent: undefined
378
376
  };
379
377
  // 坐标系配置
package/core/Polygon.js CHANGED
@@ -117,11 +117,9 @@ export default class Polygon {
117
117
  */
118
118
  setFeatureStyles(features, options) {
119
119
  features.forEach(feature => {
120
- feature.set('type', options.type || options.layerName);
121
- feature.set('layerName', options.type || options.layerName);
122
- const fillColor = options.fillColorCallBack
123
- ? options.fillColorCallBack(feature)
124
- : options.fillColor;
120
+ feature.set('type', options.layerName);
121
+ feature.set('layerName', options.layerName);
122
+ const fillColor = options.fillColorCallBack ? options.fillColorCallBack(feature) : options.fillColor;
125
123
  const featureStyle = new Style({
126
124
  stroke: new Stroke({
127
125
  color: options.strokeColor,
package/index.d.ts CHANGED
@@ -15,4 +15,4 @@ export { ValidationUtils } from './utils/ValidationUtils';
15
15
  export type { BaseOptions, StyleOptions, TextOptions } from './types';
16
16
  export type { PointOptions, LineOptions, PolygonOptions } from './types';
17
17
  export type { OptionsType } from './types';
18
- export type { MapInitType, MapLayersOptions, HeatMapOptions, ImageLayerData, MaskLayerOptions, ColorMap, FeatureColorUpdateOptions, PointData, LineData, ClusterOptions, MeasureHandlerType, VueTemplatePointOptions, MapJSONData, Feature, AnnotationType, TiandituType, MapLayers, AnnotationLayerOptions } from './types';
18
+ export type { MapInitType, MapLayersOptions, HeatMapOptions, ImageLayerData, MaskLayerOptions, ColorMap, FeatureColorUpdateOptions, PointData, LineData, ClusterOptions, MeasureHandlerType, VueTemplatePointOptions, MapJSONData, FeatureData, AnnotationType, TiandituType, MapLayers, AnnotationLayerOptions } from './types';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "1.0.10",
4
+ "version": "1.0.11",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
package/types.d.ts CHANGED
@@ -2,7 +2,8 @@ import BaseLayer from "ol/layer/Base";
2
2
  import TileLayer from "ol/layer/Tile";
3
3
  import { WMTS } from "ol/source";
4
4
  import View from "ol/View";
5
- export interface Feature {
5
+ import Feature from "ol/Feature";
6
+ export interface FeatureData {
6
7
  type: string;
7
8
  properties: any;
8
9
  geometry: {
@@ -13,7 +14,7 @@ export interface Feature {
13
14
  export interface MapJSONData {
14
15
  type: string;
15
16
  name?: string;
16
- features: Feature[];
17
+ features: FeatureData[];
17
18
  }
18
19
  type LayerItem = BaseLayer | TileLayer<WMTS>;
19
20
  export interface MapInitType {
@@ -82,8 +83,6 @@ export interface BaseOptions {
82
83
  mapClipData?: MapJSONData;
83
84
  /** 投影选项 */
84
85
  projectionOptOptions?: any;
85
- /** 扩展属性 */
86
- [propName: string]: any;
87
86
  }
88
87
  /**
89
88
  * 样式选项接口 - 图形样式相关配置
@@ -100,7 +99,7 @@ export interface StyleOptions {
100
99
  /** 填充颜色 */
101
100
  fillColor?: string;
102
101
  /** 填充颜色回调函数 */
103
- fillColorCallBack?: (feature: any) => string;
102
+ fillColorCallBack?: (feature: Feature) => string;
104
103
  }
105
104
  /**
106
105
  * 文本选项接口 - 文本标注相关配置
@@ -109,7 +108,7 @@ export interface TextOptions {
109
108
  /** 文本可见性 */
110
109
  textVisible?: boolean;
111
110
  /** 文本内容回调函数 */
112
- textCallBack?: (feature: any) => string;
111
+ textCallBack?: (feature: Feature) => string;
113
112
  /** 文本字体 */
114
113
  textFont?: string;
115
114
  /** 文本填充颜色 */