Skip to content

Commit 3d5d4b6

Browse files
committed
【bug】1) 修复等级符号,修改为符号样式,半径大小没有根据等级的大小变化
2)图层加载失败,给出错误提示 (reviewed by yuzy)
1 parent dae1142 commit 3d5d4b6

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/openlayers/core/StyleUtils.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -980,14 +980,15 @@ export class StyleUtils {
980980
* @function ol.supermap.StyleUtils.getOpenlayerStyle 获取专题图对应的openlayers格式的style
981981
* @param styleParams {String} 样式参数
982982
* @param featureType {String} feature类型
983+
* @param isRank {Boolean} 是否为等级符号
983984
* @returns {Object} style对象
984985
*/
985-
static getOpenlayersStyle(styleParams, featureType) {
986+
static getOpenlayersStyle(styleParams, featureType, isRank) {
986987
let style;
987988
if(styleParams.type === "BASIC_POINT") {
988989
style = this.toOpenLayersStyle(styleParams, featureType);
989990
} else if(styleParams.type === "SYMBOL_POINT") {
990-
style = this.getSymbolStyle(styleParams);
991+
style = this.getSymbolStyle(styleParams, isRank);
991992
} else if(styleParams.type === "SVG_POINT"){
992993
style = this.getSVGStyle(styleParams);
993994
} else if (styleParams.type === 'IMAGE_POINT') {
@@ -1001,7 +1002,7 @@ export class StyleUtils {
10011002
* @param {object} parameters - 样式参数
10021003
* @returns {Object} style对象
10031004
*/
1004-
static getSymbolStyle(parameters) {
1005+
static getSymbolStyle(parameters, isRank) {
10051006
let text = '';
10061007
if (parameters.unicode) {
10071008
text = String.fromCharCode(parseInt(parameters.unicode.replace(/^&#x/, ''), 16));
@@ -1013,10 +1014,12 @@ export class StyleUtils {
10131014
let strokeColor = StyleUtils.hexToRgb(parameters.strokeColor);
10141015
strokeColor.push(parameters.strokeOpacity);
10151016

1017+
let fontSize = isRank ? 2 * parameters.radius + "px" : parameters.fontSize;
1018+
10161019
return new ol.style.Style({
10171020
text: new ol.style.Text({
10181021
text: text,
1019-
font: parameters.fontSize + " " + "supermapol-icons",
1022+
font: fontSize + " supermapol-icons",
10201023
placement: 'point',
10211024
textAlign: 'center',
10221025
fill: new ol.style.Fill({

src/openlayers/mapping/WebMap.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,10 @@ export class WebMap extends ol.Observable {
991991
that.sendMapToUser(len);
992992
that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
993993
}
994+
}).catch(function(error){
995+
that.layerAdded++;
996+
that.sendMapToUser(len);
997+
that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
994998
})
995999
}
9961000
} else if (layer.layerType === 'SUPERMAP_REST' ||
@@ -2433,7 +2437,7 @@ export class WebMap extends ol.Observable {
24332437
radius = customSettings[i] && customSettings[i].radius ? customSettings[i].radius : radius;
24342438
// 转化成 ol 样式
24352439
style.radius = radius;
2436-
let olStyle = StyleUtils.getOpenlayersStyle(style, featureType);
2440+
let olStyle = StyleUtils.getOpenlayersStyle(style, featureType, true);
24372441
styleGroup.push({ olStyle: olStyle, radius, start, end });
24382442
}
24392443
return styleGroup;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy