1
1
/* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved.
2
2
* This program are made available under the terms of the Apache License, Version 2.0
3
3
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4
- import { WebMapService } from './WebMapService' ;
5
- import { transformServerUrl } from './utils/util' ;
6
- import cloneDeep from 'lodash.clonedeep' ;
7
-
8
- const WORLD_WIDTH = 360 ;
9
-
10
- /**
11
- * @class WebMapBase
12
- * @version 9.1.2
13
- * @category iPortal/Online Resources Map
14
- * @classdesc 对接 iPortal/Online 地图类。
15
- * @modulecategory Mapping
16
- * @param {number } id - iPortal|Online 地图 ID。
17
- * @param {Object } options - 基础参数。
18
- * @param {string } [options.target='map'] - 地图容器 ID。
19
- * @param {string } [options.server="https://www.supermapol.com"] - 地图的地址。
20
- * @param {string } [options.credentialKey] - 凭证密钥。
21
- * @param {string } [options.credentialValue] - 凭证值。
22
- * @param {string } [options.tiandituKey] - 用于访问天地图的服务。当设置 `id` 时有效。
23
- * @param {string } [options.googleMapsAPIKey] - 用于访问谷歌地图。当设置 `id` 时有效。
24
- * @param {string } [options.googleMapsLanguage] - 用于定义在谷歌地图图块上显示标签的语言。当设置 `id` 且底图为谷歌地图时有效。
25
- * @param {boolean } [options.withCredentials=false] - 请求是否携带 cookie。当设置 `id` 时有效。
26
- * @param {boolean } [options.excludePortalProxyUrl] - server 传递过来的 URL 是否带有代理。当设置 `id` 时有效。
27
- * @param {boolean } [options.ignoreBaseProjection = false] - 是否忽略底图坐标系和叠加图层坐标系不一致。
28
- * @param {boolean } [options.isSuperMapOnline] - 是否是 SuperMap Online 地图。
29
- * @param {string } [options.iportalServiceProxyUrlPrefix] - iportal的代理服务地址前缀。
30
- * @param {string|boolean } [options.proxy] - HTTP 请求代理地址 。布尔值表示使用 iPortal 默认代理地址。
31
- * @param {Object } mapOptions - 地图参数。
32
- * @param {Array } [mapOptions.center] - 中心点。
33
- * @param {number } [mapOptions.zoom] - 缩放级别。
34
- * @param {number } [mapOptions.bearing] - 旋转角度。
35
- * @param {number } [mapOptions.pitch] - 倾角。
36
- * @param {string|Object } [mapOptions.crs] - 投影。
37
- * @param {boolean } [mapOptions.renderWorldCopies] - 连续渲染。
38
- * @param {number } [mapOptions.rasterTileSize] - 栅格瓦片大小。
39
- * @param {Object } [mapOptions.style] - style 样式。
40
- * @fires WebMapBase#mapinitialized
41
- * @fires WebMapBase#mapcreatesucceeded
42
- * @fires WebMapBase#mapcreatefailed
43
- * @fires WebMapBase#addlayerssucceeded
44
- * @fires WebMapBase#layercreatefailed
45
- * @fires WebMapBase#baidumapnotsupport
46
- * @fires WebMapBase#dataflowfeatureupdated
47
- * @fires WebMapBase#projectionnotmatch
48
- * @fires WebMapBase#mapbeforeremove
49
- * @fires WebMapBase#getmapfailed
50
- * @fires WebMapBase#getlayersfailed
51
- * @usage
52
- */
53
- export function createWebMapBaseExtending ( SuperClass , { mapRepo } ) {
4
+ import { WebMapService } from './WebMapService' ;
5
+ import { transformServerUrl } from './utils/util' ;
6
+ import cloneDeep from 'lodash.clonedeep' ;
7
+
8
+ const WORLD_WIDTH = 360 ;
9
+
10
+ /**
11
+ * @class WebMapBase
12
+ * @version 9.1.2
13
+ * @category iPortal/Online Resources Map
14
+ * @classdesc 对接 iPortal/Online 地图类。
15
+ * @modulecategory Mapping
16
+ * @param {number } id - iPortal|Online 地图 ID。
17
+ * @param {Object } options - 基础参数。
18
+ * @param {string } [options.target='map'] - 地图容器 ID。
19
+ * @param {string } [options.server="https://www.supermapol.com"] - 地图的地址。
20
+ * @param {string } [options.credentialKey] - 凭证密钥。
21
+ * @param {string } [options.credentialValue] - 凭证值。
22
+ * @param {string } [options.tiandituKey] - 用于访问天地图的服务。当设置 `id` 时有效。
23
+ * @param {string } [options.googleMapsAPIKey] - 用于访问谷歌地图。当设置 `id` 时有效。
24
+ * @param {string } [options.googleMapsLanguage] - 用于定义在谷歌地图图块上显示标签的语言。当设置 `id` 且底图为谷歌地图时有效。
25
+ * @param {boolean } [options.withCredentials=false] - 请求是否携带 cookie。当设置 `id` 时有效。
26
+ * @param {boolean } [options.excludePortalProxyUrl] - server 传递过来的 URL 是否带有代理。当设置 `id` 时有效。
27
+ * @param {boolean } [options.ignoreBaseProjection = false] - 是否忽略底图坐标系和叠加图层坐标系不一致。
28
+ * @param {boolean } [options.isSuperMapOnline] - 是否是 SuperMap Online 地图。
29
+ * @param {string } [options.iportalServiceProxyUrlPrefix] - iportal的代理服务地址前缀。
30
+ * @param {string|boolean } [options.proxy] - HTTP 请求代理地址 。布尔值表示使用 iPortal 默认代理地址。
31
+ * @param {Object } mapOptions - 地图参数。
32
+ * @param {Array } [mapOptions.center] - 中心点。
33
+ * @param {number } [mapOptions.zoom] - 缩放级别。
34
+ * @param {number } [mapOptions.bearing] - 旋转角度。
35
+ * @param {number } [mapOptions.pitch] - 倾角。
36
+ * @param {string|Object } [mapOptions.crs] - 投影。
37
+ * @param {boolean } [mapOptions.renderWorldCopies] - 连续渲染。
38
+ * @param {number } [mapOptions.rasterTileSize] - 栅格瓦片大小。
39
+ * @param {Object } [mapOptions.style] - style 样式。
40
+ * @fires WebMapBase#mapinitialized
41
+ * @fires WebMapBase#mapcreatesucceeded
42
+ * @fires WebMapBase#mapcreatefailed
43
+ * @fires WebMapBase#addlayerssucceeded
44
+ * @fires WebMapBase#layercreatefailed
45
+ * @fires WebMapBase#baidumapnotsupport
46
+ * @fires WebMapBase#dataflowfeatureupdated
47
+ * @fires WebMapBase#projectionnotmatch
48
+ * @fires WebMapBase#mapbeforeremove
49
+ * @fires WebMapBase#getmapfailed
50
+ * @fires WebMapBase#getlayersfailed
51
+ * @usage
52
+ */
53
+ export function createWebMapBaseExtending ( SuperClass , { mapRepo } ) {
54
54
return class WebMapBase extends SuperClass {
55
55
constructor (
56
56
id ,
196
196
if ( this . map ) {
197
197
this . mapOptions . crs = crs ;
198
198
if ( this . mapOptions . crs ) {
199
+ if ( this . map . getCRS ( typeof crs === 'string' ? crs : crs . epsgCode ) ) {
200
+ return ;
201
+ }
199
202
if ( crs . epsgCode ) {
200
203
this . mapOptions . crs = new mapRepo . CRS (
201
204
this . mapOptions . crs . epsgCode ,
343
346
this . setServerUrl ( webMapOptions . server ) ;
344
347
this . _createWebMap ( ) ;
345
348
}
346
-
349
+
347
350
/**
348
351
* @deprecated
349
352
* @function WebMapBase.prototype.setMapOptions
416
419
getWebMapType ( ) {
417
420
return this . type ;
418
421
}
419
-
422
+
420
423
/**
421
424
* @version 11.2.1
422
425
* @function WebMapBase.prototype.rectifyLayersOrder
486
489
return ;
487
490
}
488
491
const sourceList = [ ] ;
489
- const layersToClean = this . _cacheCleanLayers . filter ( item => ! item . reused ) ;
492
+ const layersToClean = this . _cacheCleanLayers . filter ( ( item ) => ! item . reused ) ;
490
493
for ( const item of layersToClean ) {
491
494
item . renderLayers . forEach ( ( layerId ) => {
492
495
if ( this . map . getLayer ( layerId ) ) {
726
729
} ) ;
727
730
}
728
731
} ;
729
- }
732
+ }
0 commit comments