Skip to content

Commit 3b20d26

Browse files
committed
【fix/UT/API】 fix webmap sonar bug & 优化 ol,mbgl webmap review by songym
1 parent c86014c commit 3b20d26

File tree

16 files changed

+707
-1059
lines changed

16 files changed

+707
-1059
lines changed

build/webpack.config.openlayers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ module.exports = {
2424
'deck.gl': '(function(){try{return DeckGL}catch(e){return {}}})()',
2525
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
2626
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
27-
'xlsx': "function(){try{return XLSX}catch(e){return {}}}()"
27+
'xlsx': "function(){try{return XLSX}catch(e){return {}}}()",
28+
'canvg': "function(){try{return canvg}catch(e){return {}}}()",
29+
'jsonsql': "function(){try{return jsonsql}catch(e){return {}}}()"
2830
}),
2931

3032
module: {

dist/mapboxgl/iclient9-mapboxgl-es6.js

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -74609,7 +74609,6 @@ class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
7460974609
//大屏需求,或者有加上代理的
7461074610
let urlArray = this.server.split(filter);
7461174611
if (urlArray.length > 1) {
74612-
let url = urlArray[1];
7461374612
mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
7461474613
}
7461574614
}
@@ -74973,7 +74972,7 @@ class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
7497374972
*/
7497474973
_getTiandituUrl(mapInfo) {
7497574974
let re = /t0/gi;
74976-
let tiandituUrls = [];
74975+
let tiandituUrls = {};
7497774976
let layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase();
7497874977
let isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
7497974978
// let isLabel = true;
@@ -76014,71 +76013,6 @@ class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
7601476013
return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
7601576014
}
7601676015

76017-
/**
76018-
* @function mapboxgl.supermap.WebMap.prototype._getRootUrl
76019-
* @private
76020-
* @description 返回根rul
76021-
*/
76022-
_getRootUrl(url) {
76023-
if (url) {
76024-
let tempRootUrl = {};
76025-
let onlineUrl = 'https://www.supermapol.com/', itestUrl = 'https://itest.supermapol.com/';
76026-
if (tempRootUrl[url]) {
76027-
return tempRootUrl[url];
76028-
}
76029-
let rootUrl = "";
76030-
if (url.indexOf(onlineUrl) === 0) {
76031-
rootUrl = onlineUrl;
76032-
} else if (url.indexOf(itestUrl) === 0) {
76033-
rootUrl = itestUrl;
76034-
} else {
76035-
let regExp = /\/apps|\/web|\/manager|\/developer|\/services/i,
76036-
index = url.search(regExp);
76037-
let anchor = this._getAnchor(url);
76038-
rootUrl += anchor.protocol + '//' + this._getHost(url) + '/';
76039-
if (index > 0) {
76040-
rootUrl += url.substring(rootUrl.length, index + 1);
76041-
}
76042-
}
76043-
tempRootUrl[url] = rootUrl;
76044-
return rootUrl;
76045-
}
76046-
}
76047-
76048-
/**
76049-
* @function mapboxgl.supermap.WebMap.prototype._getHost
76050-
* @private
76051-
* @description 返回根rul
76052-
*/
76053-
_getHost(url) {
76054-
let anchor = this._getAnchor(url);
76055-
if (!anchor) {
76056-
return null;
76057-
}
76058-
let port = anchor.port, host = anchor.host;
76059-
//IE下会自动给host添加http(80), https(443)
76060-
if (port === "80" || port === "443") {
76061-
return host.split(":")[0];
76062-
}
76063-
return host;
76064-
}
76065-
76066-
/**
76067-
* @private
76068-
* @function mapboxgl.supermap.WebMap.prototype._getAnchor
76069-
* @description 获取https或http域名
76070-
* @param {string} url - 完整地址的url。
76071-
*/
76072-
_getAnchor(url) {
76073-
let tempAnchor = {};
76074-
if (tempAnchor[url]) {
76075-
return tempAnchor[url];
76076-
}
76077-
let anchor = document.createElement('a');
76078-
anchor.href = url;
76079-
tempAnchor[url] = anchor;
76080-
return anchor;
76081-
}
7608276016
/**
7608376017
* @private
7608476018
* @description 判断是否地理X坐标
@@ -76106,13 +76040,13 @@ class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
7610676040
/**
7610776041
* @private
7610876042
* @function mapboxgl.supermap.WebMap.prototype._transformStyleToMapBoxGl
76109-
* @description 根据图层类型将layerInfo中的style属性格式转换为mapboxgl中的style格式
76043+
* @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxgl 中的 style 格式
7611076044
* @param {Object} style - layerInfo中的style属性
7611176045
* @param {String} type - 图层类型
7611276046
* @param {Array} [expression] - 存储颜色值得表达式
7611376047
*/
7611476048
_transformStyleToMapBoxGl(style, type, expression) {
76115-
let transTable;
76049+
let transTable = {};
7611676050
if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') {
7611776051
transTable = {
7611876052
"fillColor": "circle-color",
@@ -76138,7 +76072,7 @@ class WebMap_WebMap extends external_mapboxgl_default.a.Evented {
7613876072

7613976073
let newObj = {}
7614076074
for (let item in style) {
76141-
if (transTable[item]) {
76075+
if (transTable && transTable[item]) {
7614276076
newObj[transTable[item]] = style[item];
7614376077
}
7614476078
}

dist/mapboxgl/iclient9-mapboxgl-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mapboxgl/iclient9-mapboxgl.js

Lines changed: 4 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -53865,7 +53865,6 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5386553865
//大屏需求,或者有加上代理的
5386653866
var urlArray = this.server.split(filter);
5386753867
if (urlArray.length > 1) {
53868-
var url = urlArray[1];
5386953868
mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
5387053869
}
5387153870
}
@@ -54272,7 +54271,7 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5427254271
key: '_getTiandituUrl',
5427354272
value: function _getTiandituUrl(mapInfo) {
5427454273
var re = /t0/gi;
54275-
var tiandituUrls = [];
54274+
var tiandituUrls = {};
5427654275
var layerType = mapInfo.baseLayer.layerType.split('_')[1].toLowerCase();
5427754276
var isLabel = Boolean(mapInfo.baseLayer.labelLayerVisible);
5427854277
// let isLabel = true;
@@ -55408,82 +55407,6 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5540855407
return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
5540955408
}
5541055409

55411-
/**
55412-
* @function mapboxgl.supermap.WebMap.prototype._getRootUrl
55413-
* @private
55414-
* @description 返回根rul
55415-
*/
55416-
55417-
}, {
55418-
key: '_getRootUrl',
55419-
value: function _getRootUrl(url) {
55420-
if (url) {
55421-
var tempRootUrl = {};
55422-
var onlineUrl = 'https://www.supermapol.com/',
55423-
itestUrl = 'https://itest.supermapol.com/';
55424-
if (tempRootUrl[url]) {
55425-
return tempRootUrl[url];
55426-
}
55427-
var rootUrl = "";
55428-
if (url.indexOf(onlineUrl) === 0) {
55429-
rootUrl = onlineUrl;
55430-
} else if (url.indexOf(itestUrl) === 0) {
55431-
rootUrl = itestUrl;
55432-
} else {
55433-
var regExp = /\/apps|\/web|\/manager|\/developer|\/services/i,
55434-
index = url.search(regExp);
55435-
var anchor = this._getAnchor(url);
55436-
rootUrl += anchor.protocol + '//' + this._getHost(url) + '/';
55437-
if (index > 0) {
55438-
rootUrl += url.substring(rootUrl.length, index + 1);
55439-
}
55440-
}
55441-
tempRootUrl[url] = rootUrl;
55442-
return rootUrl;
55443-
}
55444-
}
55445-
55446-
/**
55447-
* @function mapboxgl.supermap.WebMap.prototype._getHost
55448-
* @private
55449-
* @description 返回根rul
55450-
*/
55451-
55452-
}, {
55453-
key: '_getHost',
55454-
value: function _getHost(url) {
55455-
var anchor = this._getAnchor(url);
55456-
if (!anchor) {
55457-
return null;
55458-
}
55459-
var port = anchor.port,
55460-
host = anchor.host;
55461-
//IE下会自动给host添加http(80), https(443)
55462-
if (port === "80" || port === "443") {
55463-
return host.split(":")[0];
55464-
}
55465-
return host;
55466-
}
55467-
55468-
/**
55469-
* @private
55470-
* @function mapboxgl.supermap.WebMap.prototype._getAnchor
55471-
* @description 获取https或http域名
55472-
* @param {string} url - 完整地址的url。
55473-
*/
55474-
55475-
}, {
55476-
key: '_getAnchor',
55477-
value: function _getAnchor(url) {
55478-
var tempAnchor = {};
55479-
if (tempAnchor[url]) {
55480-
return tempAnchor[url];
55481-
}
55482-
var anchor = document.createElement('a');
55483-
anchor.href = url;
55484-
tempAnchor[url] = anchor;
55485-
return anchor;
55486-
}
5548755410
/**
5548855411
* @private
5548955412
* @description 判断是否地理X坐标
@@ -55513,7 +55436,7 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5551355436
/**
5551455437
* @private
5551555438
* @function mapboxgl.supermap.WebMap.prototype._transformStyleToMapBoxGl
55516-
* @description 根据图层类型将layerInfo中的style属性格式转换为mapboxgl中的style格式
55439+
* @description 根据图层类型将 layerInfo 中的 style 属性格式转换为 mapboxgl 中的 style 格式
5551755440
* @param {Object} style - layerInfo中的style属性
5551855441
* @param {String} type - 图层类型
5551955442
* @param {Array} [expression] - 存储颜色值得表达式
@@ -55522,7 +55445,7 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5552255445
}, {
5552355446
key: '_transformStyleToMapBoxGl',
5552455447
value: function _transformStyleToMapBoxGl(style, type, expression) {
55525-
var transTable = void 0;
55448+
var transTable = {};
5552655449
if ((style.type === 'POINT' || style.type === 'BASIC_POINT' || type === 'POINT') && type !== 'LINE') {
5552755450
transTable = {
5552855451
"fillColor": "circle-color",
@@ -55548,7 +55471,7 @@ var WebMap = exports.WebMap = function (_mapboxgl$Evented) {
5554855471

5554955472
var newObj = {};
5555055473
for (var item in style) {
55551-
if (transTable[item]) {
55474+
if (transTable && transTable[item]) {
5555255475
newObj[transTable[item]] = style[item];
5555355476
}
5555455477
}

dist/mapboxgl/iclient9-mapboxgl.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)