Skip to content

Commit e055b1c

Browse files
committed
【feature】mapextend setLayoutProperty优化;docs优化
1 parent 5fe8cee commit e055b1c

File tree

11 files changed

+53
-52
lines changed

11 files changed

+53
-52
lines changed

build/jsdocs/leaflet/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"src/common/iServer/ProcessingServiceBase",
3737
"src/common/iServer/PointWithMeasure",
3838
"src/common/iServer/ServerTheme",
39+
"src/common/iServer/QueryService",
3940
"src/common/overlay/RankSymbol",
4041
"src/common/overlay/ThemeVector",
4142
"src/common/overlay/Graph",

build/jsdocs/mapboxgl/docs.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"src/common/iServer/ProcessingServiceBase",
3737
"src/common/iServer/PointWithMeasure",
3838
"src/common/iServer/ServerTheme",
39+
"src/common/iServer/QueryService",
3940
"src/common/overlay/RankSymbol",
4041
"src/common/overlay/ThemeVector",
4142
"src/common/overlay/Graph",
@@ -66,7 +67,8 @@
6667
"src/common/components/templates/TemplateBase",
6768
"src/mapboxgl/core/Util",
6869
"src/mapboxgl/overlay/L7/l7-render",
69-
"src/mapboxgl/mapping/utils"
70+
"src/mapboxgl/mapping/utils",
71+
"src/mapboxgl/mapping/webmap/v3/WebMap"
7072
]
7173
},
7274
"plugins": ["plugins/markdown","../plugins/usage", "../plugins/moduleCategories"],

build/jsdocs/maplibregl/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"src/common/iServer/ProcessingServiceBase",
3535
"src/common/iServer/PointWithMeasure",
3636
"src/common/iServer/ServerTheme",
37+
"src/common/iServer/QueryService",
3738
"src/common/overlay/RankSymbol",
3839
"src/common/overlay/ThemeVector",
3940
"src/common/overlay/Graph",

build/jsdocs/openlayers/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"src/common/iServer/ProcessingServiceBase",
3636
"src/common/iServer/PointWithMeasure",
3737
"src/common/iServer/ServerTheme",
38+
"src/common/iServer/QueryService",
3839
"src/common/overlay/RankSymbol",
3940
"src/common/overlay/Graph",
4041
"src/common/overlay/ThemeVector",

src/common/iServer/GetFeaturesParametersBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Util } from '../commontypes/Util';
99
* @category iServer Data FeatureResults
1010
* @classdesc 要素查询参数基类。此类存储了进行要素查询的数据集列表以及一些通用的查询参数,
1111
* 包括:是否返回查询结果、查询结果的最大/最小索引号、动态投影的目标坐标系、聚合查询相关参数等。
12-
* * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
12+
* <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
1313
* <p style="color: #ce4844">Notice</p>
1414
* <p style="font-size: 13px">推荐设置 returnFeaturesOnly 配置为 true 来提升性能,如果需要获取总数量与数据集信息,FeatureService 提供了 getFeaturesCount 和 getFeaturesDatasetInfo 方法</p>
1515
* </div>

src/common/iServer/InitMapServiceBase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class InitMapServiceBase {
7070
}
7171

7272
/**
73-
* @function getMapInfo
73+
* @function getWKT
7474
* @description 获取坐标投影的 WKT。
7575
* @returns {Promise}
7676
*/
@@ -149,7 +149,7 @@ export function getTileset(tilesets = [], targets) {
149149

150150
/**
151151
* @private
152-
* @function createMapOptions
152+
* @function scalesToResolutions
153153
* @description mapboxgl maplibregl 获取地图resolutions。
154154
* @returns {Array} resolutions
155155
*/

src/leaflet/core/Util.js

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
getMeterPerMapUnit as MeterPerMapUnit,
88
getZoomByResolution,
99
scalesToResolutions,
10-
getDpi
10+
getDpi,
11+
scaleToResolution as transformScaleToResolution
1112
} from '@supermapgis/iclient-common/util/MapCalculateUtil';
1213

1314
/**
@@ -136,36 +137,7 @@ export var resolutionToScale = function(resolution, dpi, mapUnit) {
136137
return scale;
137138
};
138139

139-
/**
140-
* @function scaleToResolution
141-
* @category BaseTypes Util
142-
* @description 通过比例尺计算分辨率。
143-
* @param {number} scale - 比例尺。
144-
* @param {number} dpi - 屏幕分辨率。
145-
* @param {string} mapUnit - 地图单位。
146-
* @returns {number} 分辨率。
147-
* @usage
148-
* ```
149-
* // 浏览器
150-
* <script type="text/javascript" src="{cdn}"></script>
151-
* <script>
152-
* const result = {namespace}.Util.scaleToResolution(scale, dpi, mapUnit);
153-
*
154-
* </script>
155-
*
156-
* // ES6 Import
157-
* import { scaleToResolution } from '{npm}';
158-
*
159-
* const result = scaleToResolution(scale, dpi, mapUnit);
160-
* ```
161-
*/
162-
export var scaleToResolution = function(scale, dpi, mapUnit) {
163-
var inchPerMeter = 1 / 0.0254;
164-
var meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
165-
var resolution = scale * dpi * inchPerMeter * meterPerMapUnitValue;
166-
resolution = 1 / resolution;
167-
return resolution;
168-
};
140+
export var scaleToResolution = transformScaleToResolution;
169141

170142
/**
171143
* @function normalizeScale

src/mapboxgl/core/MapExtend.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ export var MapExtend = (function () {
173173
if (overlayLayer.setLayoutProperty) {
174174
overlayLayer.setLayoutProperty(name, value);
175175
this.style.fire('data', { dataType: 'style' });
176+
} else if (name === 'visibility' && overlayLayer.setVisibility) {
177+
overlayLayer.setVisibility(value === 'visible');
178+
this.style.fire('data', { dataType: 'style' });
176179
}
177180
return this;
178181
}

src/mapboxgl/mapping/webmap/v2/WebMap.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ export class WebMap extends mapboxgl.Evented {
7373
this._canvgsV = [];
7474
}
7575

76-
/**
77-
* @function WebMap.prototype.initializeMap
78-
* @description 登陆窗口后添加地图图层。
79-
* @param {Object} mapInfo - map 信息。
80-
*/
8176
initializeMap(mapInfo) {
8277
const projectionMap = ['EPSG:4490', 'EPSG:4214', 'EPSG:4610', 'EPSG:3857', 'EPSG:4326'];
8378
// 坐标系异常处理

test/mapboxgl/overlay/GraticuleLayerSpec.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('mapboxgl_GraticuleLayer', () => {
4545
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
4646
if (!map.getLayer('graticuleLayer_1')) {
4747
graticuleLayer = new GraticuleLayer({ layerID: 'graticuleLayer_1' });
48-
graticuleLayer.onAdd(map);
48+
map.addLayer(graticuleLayer);
4949
}
5050
});
5151

@@ -92,6 +92,20 @@ describe('mapboxgl_GraticuleLayer', () => {
9292
expect(visible).toBe('visible');
9393
});
9494

95+
it('setLayoutProperty', () => {
96+
let visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility');
97+
expect(visible).toBe('visible');
98+
expect(graticuleLayer.visible).toBeTruthy();
99+
map.setLayoutProperty(graticuleLayer.id, 'visibility', 'none');
100+
visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility');
101+
expect(visible).toBe('none');
102+
expect(graticuleLayer.visible).toBeFalsy();
103+
map.setLayoutProperty(graticuleLayer.id, 'visibility', 'visible');
104+
visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility');
105+
expect(visible).toBe('visible');
106+
expect(graticuleLayer.visible).toBeTruthy();
107+
});
108+
95109
it('setMinZoom', () => {
96110
graticuleLayer.setMinZoom(0);
97111
expect(graticuleLayer.options.minZoom).toEqual(0);
@@ -108,12 +122,12 @@ describe('mapboxgl_GraticuleLayer', () => {
108122
});
109123

110124
it('setExtent', () => {
111-
graticuleLayer.setExtent([
112-
[0, 0],
113-
[50, 50]
114-
]);
115-
expect(graticuleLayer.options.extent[0]).toEqual(0);
116-
expect(graticuleLayer.options.extent[3]).toEqual(50);
125+
graticuleLayer.setExtent([
126+
[0, 0],
127+
[50, 50]
128+
]);
129+
expect(graticuleLayer.options.extent[0]).toEqual(0);
130+
expect(graticuleLayer.options.extent[3]).toEqual(50);
117131
});
118132

119133
it('setStrokeStyle', () => {
@@ -132,8 +146,8 @@ describe('mapboxgl_GraticuleLayer', () => {
132146
});
133147

134148
it('setIntervals', () => {
135-
graticuleLayer.setIntervals(5);
136-
expect(graticuleLayer.renderer.options.interval).toEqual(5);
149+
graticuleLayer.setIntervals(5);
150+
expect(graticuleLayer.renderer.options.interval).toEqual(5);
137151
});
138152

139153
it('getDefaultExtent must return degree', () => {

0 commit comments

Comments
 (0)