Skip to content

Commit ea0a798

Browse files
committed
【update】 mapboxgl.supermap.Util 新增系列静态方法 review by songym
1 parent b03fb14 commit ea0a798

File tree

5 files changed

+69
-3
lines changed

5 files changed

+69
-3
lines changed

dist/mapboxgl/iclient9-mapboxgl-es6.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65492,6 +65492,9 @@ class core_Util_Util {
6549265492
return !isNaN(mdata);
6549365493
}
6549465494

65495+
static isString(str) {
65496+
return (typeof str === 'string') && str.constructor === String;
65497+
}
6549565498
/**
6549665499
* 随机生成id
6549765500
* @param attr
@@ -65530,6 +65533,24 @@ class core_Util_Util {
6553065533
rgba.push(opacity);
6553165534
return "rgba(" + rgba.join(",") + ")";
6553265535
}
65536+
65537+
/**
65538+
* @function ol.supermap.Util.isMatchAdministrativeName
65539+
* @param {string} featureName 原始数据中的地名
65540+
* @param {string} fieldName 需要匹配的地名
65541+
* @returns {boolean} 是否匹配
65542+
*/
65543+
static isMatchAdministrativeName(featureName, fieldName) {
65544+
if (this.isString(fieldName)) {
65545+
let shortName = featureName.substr(0, 2);
65546+
// 张家口市和张家界市 特殊处理
65547+
if (shortName === '张家') {
65548+
shortName = featureName.substr(0, 3);
65549+
}
65550+
return !!fieldName.match(new RegExp(shortName));
65551+
}
65552+
return false;
65553+
}
6553365554
}
6553465555

6553565556
external_mapboxgl_default.a.supermap.Util = core_Util_Util;

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: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4301,7 +4301,11 @@ var Util = exports.Util = function () {
43014301
}
43024302
return !isNaN(mdata);
43034303
}
4304-
4304+
}, {
4305+
key: "isString",
4306+
value: function isString(str) {
4307+
return typeof str === 'string' && str.constructor === String;
4308+
}
43054309
/**
43064310
* 随机生成id
43074311
* @param attr
@@ -4346,6 +4350,27 @@ var Util = exports.Util = function () {
43464350
rgba.push(opacity);
43474351
return "rgba(" + rgba.join(",") + ")";
43484352
}
4353+
4354+
/**
4355+
* @function ol.supermap.Util.isMatchAdministrativeName
4356+
* @param {string} featureName 原始数据中的地名
4357+
* @param {string} fieldName 需要匹配的地名
4358+
* @returns {boolean} 是否匹配
4359+
*/
4360+
4361+
}, {
4362+
key: "isMatchAdministrativeName",
4363+
value: function isMatchAdministrativeName(featureName, fieldName) {
4364+
if (this.isString(fieldName)) {
4365+
var shortName = featureName.substr(0, 2);
4366+
// 张家口市和张家界市 特殊处理
4367+
if (shortName === '张家') {
4368+
shortName = featureName.substr(0, 3);
4369+
}
4370+
return !!fieldName.match(new RegExp(shortName));
4371+
}
4372+
return false;
4373+
}
43494374
}]);
43504375

43514376
return Util;

0 commit comments

Comments
 (0)