Skip to content

Commit dbe4cd4

Browse files
committed
【update】1) webmap数据上图的道路和铁路样式设置为0,还有的问题
2)铁路样式优化 (reviewed by chengl)
1 parent 0edf1cb commit dbe4cd4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/openlayers/core/StyleUtils.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ export class StyleUtils {
11871187
strokeColorArray && strokeColorArray.push(strokeOpacity);
11881188
var stroke = new Style({
11891189
stroke: new StrokeStyle({
1190-
width: strokeWidth,
1190+
width: strokeWidth || ZERO,
11911191
color: strokeColorArray,
11921192
lineCap: lineCap || 'round',
11931193
lineDash: [0]
@@ -1198,9 +1198,10 @@ export class StyleUtils {
11981198
let outlineColorArray = this.hexToRgb(outlineColor);
11991199
// opacity使用style的透明度。保持两根线透明度一致
12001200
outlineColorArray && outlineColorArray.push(strokeOpacity);
1201+
let outlineWidth = strokeWidth === 0 ? ZERO : strokeWidth + 2; //外部宽度=内部样式宽度 + 2
12011202
var outlineStroke = new Style({
12021203
stroke: new StrokeStyle({
1203-
width: strokeWidth + 2, //外部宽度=内部样式宽度 + 2
1204+
width: outlineWidth, //外部宽度=内部样式宽度 + 2
12041205
color: outlineColorArray,
12051206
lineCap: lineCap || 'round',
12061207
lineDash: [0]
@@ -1222,7 +1223,7 @@ export class StyleUtils {
12221223
strokeColorArray && strokeColorArray.push(strokeOpacity);
12231224
var stroke = new Style({
12241225
stroke: new StrokeStyle({
1225-
width: strokeWidth,
1226+
width: strokeWidth*0.5 || ZERO,
12261227
color: strokeColorArray,
12271228
lineCap,
12281229
lineDash
@@ -1235,11 +1236,9 @@ export class StyleUtils {
12351236
outlineColorArray && outlineColorArray.push(strokeOpacity);
12361237
var outlineStroke = new Style({
12371238
stroke: new StrokeStyle({
1238-
width: strokeWidth,
1239+
width: strokeWidth || ZERO,
12391240
color: outlineColorArray,
1240-
lineCap,
1241-
lineDash,
1242-
lineDashOffset: (lineDash[0] + lineDash[1]) / 2
1241+
lineCap
12431242
})
12441243
});
12451244
return [outlineStroke, stroke];

0 commit comments

Comments
 (0)