MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / dashStyle

Method dashStyle

src/openlayers/core/StyleUtils.js:426–455  ·  view source on GitHub ↗

* @function StyleUtils.dashStyle * @description 符号样式。 * @param {Object} style - 样式参数。 * @param {number} widthFactor - 宽度系数。

(style, widthFactor)

Source from the content-addressed store, hash-verified

424 * @param {number} widthFactor - 宽度系数。
425 */
426 static dashStyle(style, widthFactor) {
427 if (!style) {
428 return [];
429 }
430 var w = style.strokeWidth * widthFactor;
431 var str = style.strokeDashstyle || style.lineDash;
432 switch (str) {
433 case 'solid':
434 return [0];
435 case 'dot':
436 return [1, 4 * w];
437 case 'dash':
438 return [4 * w, 4 * w];
439 case 'dashdot':
440 return [4 * w, 4 * w, 1, 4 * w];
441 case 'longdash':
442 return [8 * w, 4 * w];
443 case 'longdashdot':
444 return [8 * w, 4 * w, 1, 4 * w];
445 default:
446 if (!str) {
447 return [];
448 }
449 if (CommonUtil.isArray(str)) {
450 return str;
451 }
452 str = StringExt.trim(str).replace(/\s+/g, ",");
453 return str.replace(/\[|\]/gi, "").split(",");
454 }
455 }
456
457 /**
458 * @function StyleUtils.getStyleFromiPortalMarker

Callers 3

toOpenLayersStyleMethod · 0.95
StyleUtils2Spec.jsFile · 0.45

Calls 1

trimMethod · 0.80

Tested by

no test coverage detected