Skip to content

Commit 71ae4a8

Browse files
[fix]api优化 ol.source review by xiongjj
1 parent 184003a commit 71ae4a8

28 files changed

+266
-216
lines changed

build/jsdocs/openlayers/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ SuperMap iClient for OpenLayers 是一套基于OpenLayers的云GIS网络客户
2828
<th width="33.3%">可视化</th><th width="33.3%">地图</th><th width="33.3%"></th>
2929
</tr><tr>
3030
<td><p>丰富的可视化效果,矢量瓦片、客户端专题图、开源可视化库[ECharts](https://echarts.baidu.com/),[MapV](https://mapv.baidu.com/)</p>
31-
<a href="ol.source.VectorTileSuperMapRest.html">ol.source.VectorTileSuperMapRest</a><br>
32-
<a href="ol.source.Graphic.html">ol.source.Graphic</a><br>
33-
<a href="ol.source.DataFlow.html">ol.source.DataFlow</a><br>
34-
<a href="ol.source.Range.html">ol.source.Range</a><br>
35-
<a href="ol.source.Unique.html">ol.source.Unique</a><br>
36-
<a href="ol.source.Mapv.html">ol.source.Mapv</a><br>
31+
<a href="VectorTileSuperMapRest.html">VectorTileSuperMapRest</a><br>
32+
<a href="Graphic.html">Graphic</a><br>
33+
<a href="DataFlow.html">DataFlow</a><br>
34+
<a href="Range.html">Range</a><br>
35+
<a href="Unique.html">Unique</a><br>
36+
<a href="Mapv.html">Mapv</a><br>
3737
......</td>
3838
<td><p>丰富地图,iSevrer REST MAP、互联网地图</p>
39-
<a href="ol.source.TileSuperMapRest.html">ol.source.TileSuperMapRest</a><br>
40-
<a href="ol.source.ImageSuperMapRest.html">ol.source.ImageSuperMapRest</a><br>
41-
<a href="ol.source.BaiduMap.html">ol.source.BaiduMap</a><br>
42-
<a href="ol.source.Tianditu.html">ol.source.Tianditu</a><br>
39+
<a href="TileSuperMapRest.html">TileSuperMapRest</a><br>
40+
<a href="ImageSuperMapRest.html">ImageSuperMapRest</a><br>
41+
<a href="BaiduMap.html">BaiduMap</a><br>
42+
<a href="Tianditu.html">Tianditu</a><br>
4343
......</td>
4444
<td><p></p>
4545
</tr></table>

build/jsdocs/plugins/usage.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exports.defineTags = function (dictionary) {
1414
const deprecatedClasses = [];
1515
let aliasClass = '';
1616
let deprecatedClassInstance;
17+
let browserNamespace = '';
1718
if (doclet.tags) {
1819
for (let index = 0; index < doclet.tags.length; index++) {
1920
const tag = doclet.tags[index];
@@ -26,14 +27,18 @@ exports.defineTags = function (dictionary) {
2627
if (tag.title === 'deprecatedclassinstance') {
2728
deprecatedClassInstance = tag.value;
2829
}
30+
if (tag.title === 'browsernamespace') {
31+
browserNamespace = tag.value;
32+
}
2933
}
3034
}
3135
doclet.usage = {
3236
className: doclet.kind === 'class' ? doclet.name : '',
3337
aliasClass: aliasClass,
3438
globalParams,
3539
deprecatedClasses: deprecatedClasses,
36-
deprecatedClassInstance: deprecatedClassInstance
40+
deprecatedClassInstance: deprecatedClassInstance,
41+
browserNamespace: browserNamespace
3742
};
3843
}
3944
}

build/jsdocs/template/tmpl/usage.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<code>// 浏览器
55
&lt;script type="text/javascript" src="<?js= data.globalParams.cdn ?>"&gt;&lt;/script&gt;
66
&lt;script&gt;
7-
<?js= "new {namespace}.{className}({paramsNames});".replace('{className}', data.aliasClass || data.className).replace('{namespace}',data.globalParams.namespace).replace('{paramsNames}',data.paramsNames?data.paramsNames.join(', '):'') ?>
7+
<?js= "new {namespace}.{className}({paramsNames});".replace('{className}', data.aliasClass || data.className).replace('{namespace}',data.browserNamespace || data.globalParams.namespace).replace('{paramsNames}',data.paramsNames?data.paramsNames.join(', '):'') ?>
88
<?js= data.deprecatedClasses.length > 0 || data.deprecatedClassInstance?'\r // 弃用的写法\r\n':'' ?><?jsdata.deprecatedClasses.forEach(deprecatedClass => { ?><?js= " new {deprecatedClass}({paramsNames});\r\n".replace('{deprecatedClass}',deprecatedClass).replace('{paramsNames}',data.paramsNames?data.paramsNames.join(', '):'') ?><?js}); ?><?js if(data.deprecatedClassInstance){ ?><?js= " {deprecatedClassInstance}({paramsNames});".replace('{deprecatedClassInstance}',data.deprecatedClassInstance).replace('{paramsNames}',data.paramsNames?data.paramsNames.join(', '):'') ?>
99
<?js } ?>
1010
&lt;/script&gt;

build/jsdocs/template/typeLinkExt.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var typeLinks = {
3030
"ol.Object": olapi + "module-ol_Object-BaseObject.html",
3131
"ol.source.ImageCanvas": olapi + "module-ol_source_ImageCanvas-ImageCanvasSource.html",
3232
"ol.source.TileImage": olapi + "module-ol_source_TileImage-TileImage.html",
33+
"ol.source.Image": olapi + "module-ol_source_Image-ImageSource.html",
3334
"ol.source.WMTS": olapi + "module-ol_source_WMTS-WMTS.html",
3435
"ol.source.XYZ": olapi + "module-ol_source_XYZ-XYZ.html",
3536
"ol.source.Vector": olapi + "module-ol_source_Vector-VectorSource.html",

src/openlayers/mapping/BaiduMap.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ import TileGrid from 'ol/tilegrid/TileGrid';
77
import { Util } from '../core/Util';
88

99
/**
10-
* @class ol.source.BaiduMap
10+
* @class BaiduMap
11+
* @browsernamespace ol.source
1112
* @category ThirdPartyMap
1213
* @classdesc 百度地图图层源。
1314
* @param {Object} opt_options - 参数。
1415
* @param {string} [opt_options.url='http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408'] - 服务地址。
1516
* @param {string} [opt_options.tileProxy] - 代理地址。
1617
* @param {boolean} [hidpi = false] - 是否使用高分辨率地图。
1718
* @extends {ol.source.TileImage}
19+
* @usage
1820
*/
1921
export class BaiduMap extends TileImage {
2022
constructor(opt_options) {
@@ -80,7 +82,7 @@ export class BaiduMap extends TileImage {
8082

8183
// TODO 确认这个方法是否要开出去
8284
/**
83-
* @function ol.source.BaiduMap.defaultTileGrid
85+
* @function BaiduMap.defaultTileGrid
8486
* @description 获取默认瓦片格网。
8587
* @returns {ol.tilegrid.TileGrid} 返回瓦片格网对象。
8688
*/

src/openlayers/mapping/ImageSuperMapRest.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,23 @@ import GeoJSON from 'ol/format/GeoJSON';
1313
import { containsExtent, getCenter, getHeight, getWidth, getForViewAndSize } from 'ol/extent';
1414

1515
/**
16-
* @class ol.source.ImageSuperMapRest
16+
* @class ImageSuperMapRest
17+
* @browsernamespace ol.source
1718
* @category iServer Map Tile
1819
* @classdesc SuperMap iServer Image 图层源。
1920
* @param {Object} options - 参数。
2021
* @param {string} options.url - 地图服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
21-
* @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
22+
* @param {ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
2223
* @param {boolean} [options.redirect=false] - 是否重定向。
2324
* @param {boolean} [options.transparent=true] - 瓦片是否透明。
2425
* @param {boolean} [options.antialias=false] - 是否反走样地图。
2526
* @param {boolean} [options.cacheEnabled=true] - 是否使用服务端的缓存,true 表示使用服务端的缓存。
2627
* @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时, 系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
2728
* @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。
2829
* @param {boolean} [options.clipRegionEnabled = false] - 是否地图只显示该区域覆盖的部分。true 表示地图只显示该区域覆盖的部分。
29-
* @param {(ol/geom/Geometry|ol/geom/Geometry)} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
30+
* @param {ol.geom.Geometry} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
3031
* @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。如果为 true,则同一范围内的对象会直接压盖;如果为 false 则通过 overlapDisplayedOptions 控制对象不压盖显示。
31-
* @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
32+
* @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
3233
* @param {boolean} [options.markerAngleFixed=false] - 指定点状符号的角度是否固定。
3334
* @param {boolean} [options.textAngleFixed=false] - 文本角度是否固定。
3435
* @param {boolean} [options.textOrientationFixed=false] - 文本朝向是否固定。
@@ -38,11 +39,12 @@ import { containsExtent, getCenter, getHeight, getWidth, getForViewAndSize } fro
3839
* @param {boolean} [options.minVisibleTextSize] - 文本的最小可见尺寸,单位为像素。
3940
* @param {string} [options.tileversion] - 切片版本名称,_cache 为 true 时有效。
4041
* @param {string} [options.tileProxy] - 代理地址。
41-
* @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
42+
* @param {NDVIParameter|HillshadeParameter} [options.rasterfunction] - 栅格分析参数。
4243
* @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片类型。
4344
* @param {Function} [options.imageLoadFunction] - 加载图片的方法。默认为function(imageTile, src) {imageTile.getImage().src = src;};
4445
* @param {string} [options.ratio=1.5] - 请求图片大小比例. 1 表示请求图片大小和地图视窗范围一致, 2 表示请求图片大小是地图视窗范围的2倍,以此类推。
45-
* @extends {ol.source.TileImage}
46+
* @extends {ol.source.Image}
47+
* @usage
4648
*/
4749
export class ImageSuperMapRest extends ImageSource {
4850
constructor(options) {
@@ -202,7 +204,7 @@ import { containsExtent, getCenter, getHeight, getWidth, getForViewAndSize } fro
202204
return imageUrl;
203205
}
204206
/**
205-
* @function ol.source.ImageSuperMapRest.optionsFromMapJSON
207+
* @function ImageSuperMapRest.optionsFromMapJSON
206208
* @param {string} url - 地址。
207209
* @param {Object} mapJSONObj - 地图 JSON。
208210
* @description 获取地图 JSON 信息。

src/openlayers/mapping/ImageTileSuperMapRest.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { SecurityManager } from '@supermap/iclient-common/security/SecurityManag
77
import { Util as CommonUtil } from '@supermap/iclient-common/commontypes/Util';
88

99
/**
10-
* @class ol.source.ImageTileSuperMapRest
10+
* @class ImageTileSuperMapRest
11+
* @browsernamespace ol.source
1112
* @version 10.2.0
1213
* @category iServer Image
1314
* @classdesc iServer影像服务图层源。根据指定的请求参数,返回影像数据栅格瓦片并渲染。
@@ -24,6 +25,7 @@ import { Util as CommonUtil } from '@supermap/iclient-common/commontypes/Util';
2425
* @param {string} [options.tileProxy] - 代理地址
2526
* @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
2627
* @extends {ol.source.XYZ}
28+
* @usage
2729
*/
2830
export class ImageTileSuperMapRest extends XYZ {
2931
constructor(options) {

src/openlayers/mapping/SuperMapCloud.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import XYZ from 'ol/source/XYZ';
66

77
/**
8-
* @class ol.source.SuperMapCloud
8+
* @class SuperMapCloud
9+
* @browsernamespace ol.source
910
* @category ThirdPartyMap
1011
* @classdesc 超图云地图图层源。
1112
* @param {Object} opt_options - 参数。
1213
* @param {string} [opt_options.url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
1314
* @param {string} [opt_options.tileProxy] - 代理地址。
1415
* @extends {ol.source.XYZ}
16+
* @usage
1517
*/
1618
export class SuperMapCloud extends XYZ {
1719

src/openlayers/mapping/Tianditu.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import WMTS from 'ol/source/WMTS';
66
import WMTSTileGrid from 'ol/tilegrid/WMTS';
77

88
/**
9-
* @class ol.source.Tianditu
9+
* @class Tianditu
10+
* @browsernamespace ol.source
1011
* @category ThirdPartyMap
1112
* @classdesc 天地图图层源。
1213
* @param {Object} opt_options - 参数。
@@ -22,6 +23,7 @@ import WMTSTileGrid from 'ol/tilegrid/WMTS';
2223
* @param {boolean} [opt_options.opaque=true] - 是否透明。
2324
* @param {string} [opt_options.tileProxy] - 代理地址。
2425
* @extends {ol.source.WMTS}
26+
* @usage
2527
*/
2628
export class Tianditu extends WMTS {
2729
constructor(opt_options) {
@@ -91,7 +93,7 @@ export class Tianditu extends WMTS {
9193
}
9294

9395
/**
94-
* @function ol.source.Tianditu.getTileGrid
96+
* @function Tianditu.getTileGrid
9597
* @description 获取瓦片网格。
9698
* @param {string} projection - 投影参考对象。
9799
* @returns {ol.tilegrid.WMTS} 返回瓦片网格对象
@@ -104,7 +106,7 @@ export class Tianditu extends WMTS {
104106
}
105107

106108
/**
107-
* @function ol.source.Tianditu.default4326TileGrid
109+
* @function Tianditu.default4326TileGrid
108110
* @description 获取默认 4326 网格瓦片。
109111
* @returns {ol.tilegrid.WMTS} 返回默认 4326 网格瓦片对象。
110112
*/
@@ -126,7 +128,7 @@ export class Tianditu extends WMTS {
126128
}
127129

128130
/**
129-
* @function ol.source.Tianditu.default3857TileGrid
131+
* @function Tianditu.default3857TileGrid
130132
* @description 获取默认 3857 网格瓦片。
131133
* @returns {ol.tilegrid.WMTS} 返回默认 3857 网格瓦片对象。
132134
*/

src/openlayers/mapping/TileSuperMapRest.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import * as olTilegrid from 'ol/tilegrid';
1414
import TileGrid from 'ol/tilegrid/TileGrid';
1515

1616
/**
17-
* @class ol.source.TileSuperMapRest
17+
* @class TileSuperMapRest
18+
* @browsernamespace ol.source
1819
* @category iServer Map Tile
1920
* @classdesc SuperMap iServer TileImage 图层源。
2021
* @param {Object} options - 参数。
@@ -34,6 +35,7 @@ import TileGrid from 'ol/tilegrid/TileGrid';
3435
* @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片类型。
3536
* @param {(NDVIParameter|HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
3637
* @extends {ol.source.TileImage}
38+
* @usage
3739
*/
3840
export class TileSuperMapRest extends TileImage {
3941
constructor(options) {
@@ -75,7 +77,7 @@ export class TileSuperMapRest extends TileImage {
7577
var layerUrl = CommonUtil.urlPathAppend(options.url, 'tileImage.' + options.format);
7678

7779
/**
78-
* @function ol.source.TileSuperMapRest.prototype.getAllRequestParams
80+
* @function TileSuperMapRest.prototype.getAllRequestParams
7981
* @description 获取全部请求参数。
8082
*/
8183
function getAllRequestParams() {
@@ -134,7 +136,7 @@ export class TileSuperMapRest extends TileImage {
134136
}
135137

136138
/**
137-
* @function ol.source.TileSuperMapRest.prototype.getFullRequestUrl
139+
* @function TileSuperMapRest.prototype.getFullRequestUrl
138140
* @description 获取完整的请求地址。
139141
*/
140142
function getFullRequestUrl() {
@@ -146,7 +148,7 @@ export class TileSuperMapRest extends TileImage {
146148
}
147149

148150
/**
149-
* @function ol.source.TileSuperMapRest.prototype.createLayerUrl
151+
* @function TileSuperMapRest.prototype.createLayerUrl
150152
* @description 获取新建图层地址。
151153
*/
152154
function createLayerUrl() {
@@ -215,7 +217,7 @@ export class TileSuperMapRest extends TileImage {
215217
}
216218

217219
/**
218-
* @function ol.source.TileSuperMapRest.prototype.setTileSetsInfo
220+
* @function TileSuperMapRest.prototype.setTileSetsInfo
219221
* @description 设置瓦片集信息。
220222
* @param {Object} tileSets - 瓦片集合。
221223
*/
@@ -237,7 +239,7 @@ export class TileSuperMapRest extends TileImage {
237239
}
238240

239241
/**
240-
* @function ol.source.TileSuperMapRest.prototype.lastTilesVersion
242+
* @function TileSuperMapRest.prototype.lastTilesVersion
241243
* @description 请求上一个版本切片,并重新绘制。
242244
*/
243245
lastTilesVersion() {
@@ -246,7 +248,7 @@ export class TileSuperMapRest extends TileImage {
246248
}
247249

248250
/**
249-
* @function ol.source.TileSuperMapRest.prototype.nextTilesVersion
251+
* @function TileSuperMapRest.prototype.nextTilesVersion
250252
* @description 请求下一个版本切片,并重新绘制。
251253
*/
252254
nextTilesVersion() {
@@ -255,7 +257,7 @@ export class TileSuperMapRest extends TileImage {
255257
}
256258

257259
/**
258-
* @function ol.source.TileSuperMapRest.prototype.changeTilesVersion
260+
* @function TileSuperMapRest.prototype.changeTilesVersion
259261
* @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引。
260262
*/
261263
changeTilesVersion() {
@@ -285,7 +287,7 @@ export class TileSuperMapRest extends TileImage {
285287
}
286288

287289
/**
288-
* @function ol.source.TileSuperMapRest.prototype.updateCurrentTileSetsIndex
290+
* @function TileSuperMapRest.prototype.updateCurrentTileSetsIndex
289291
* @description 更新当前切片集索引,目前主要提供给控件使用。
290292
* @param {number} index - 索引号。
291293
*/
@@ -294,7 +296,7 @@ export class TileSuperMapRest extends TileImage {
294296
}
295297

296298
/**
297-
* @function ol.source.TileSuperMapRest.prototype.mergeTileVersionParam
299+
* @function TileSuperMapRest.prototype.mergeTileVersionParam
298300
* @description 更改 URL 请求参数中的切片版本号,并重绘。
299301
* @param {Object} version - 版本信息。
300302
* @returns {boolean} 是否成功。
@@ -310,7 +312,7 @@ export class TileSuperMapRest extends TileImage {
310312
}
311313

312314
/**
313-
* @function ol.source.TileSuperMapRest.optionsFromMapJSON
315+
* @function TileSuperMapRest.optionsFromMapJSON
314316
* @description 从 MapJSON 中获取参数对象。
315317
* @param {string} url - 服务地址。
316318
* @param {Object} mapJSONObj - 地图 JSON 对象。
@@ -364,7 +366,7 @@ export class TileSuperMapRest extends TileImage {
364366
}
365367

366368
/**
367-
* @function ol.source.TileSuperMapRest.createTileGrid
369+
* @function TileSuperMapRest.createTileGrid
368370
* @description 创建切片网格。
369371
* @param {number} extent - 长度。
370372
* @param {number} maxZoom - 最大的放大级别。

0 commit comments

Comments
 (0)