gisviewer-vue3-arcgis
Version:
在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:
65 lines (64 loc) • 2.57 kB
TypeScript
import Style from 'ol/style/Style';
/**
* 根据 ArcGIS simple-line 的 style 获取 lineDash 配置
* @param style ArcGIS line style
* @param width 线宽,用于计算 dash 长度
*/
export declare function getLineDashByStyle(style: string, width: number): number[] | undefined;
/**
* 清除样式缓存
*/
export declare function clearStyleCache(): void;
/**
* 获取当前缓存大小
*/
export declare function getStyleCacheSize(): number;
/**
* 获取线样式
* 支持 symbol 数组配置(line + text),或单个 symbol 配置
* 若 symbol 为空则显示蓝色线
*
* @example
* // 简单线样式配置
* { symbol: { strokeColor: '#ff0000', strokeWidth: 3 } }
*
* // 虚线样式配置
* { symbol: { strokeColor: '#2563eb', strokeWidth: 2, lineDash: [10, 5] } }
*
* // 带边框的线样式配置
* { symbol: { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#000000', borderWidth: 1 } }
*
* // 数组配置(线 + 文字)
* {
* symbol: [
* { type: 'line', strokeColor: '#2563eb', strokeWidth: 3 },
* { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], placement: 'line' }
* ]
* }
*
* // 数组配置(带边框线 + 文字)
* {
* symbol: [
* { type: 'bordered', strokeColor: '#ffffff', strokeWidth: 4, borderColor: '#333333', borderWidth: 1 },
* { type: 'text', field: 'roadName', font: '12px Arial', fillColor: [0,0,0], placement: 'line', overflow: true }
* ]
* }
*
* // ArcGIS simple-line 配置
* // style 可选值: 'solid', 'dash', 'dot', 'dash-dot', 'long-dash', 'long-dash-dot',
* // 'long-dash-dot-dot', 'short-dash', 'short-dot', 'short-dash-dot', 'short-dash-dot-dot', 'none'
* { symbol: { type: 'simple-line', style: 'solid', color: [255, 0, 0, 1], width: 2 } }
* { symbol: { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3 } }
* { symbol: { type: 'simple-line', style: 'dot', color: [0, 128, 0, 1], width: 2 } }
* { symbol: { type: 'simple-line', style: 'dash-dot', color: [255, 128, 0, 1], width: 2 } }
* { symbol: { type: 'simple-line', style: 'long-dash-dot-dot', color: [128, 0, 128, 1], width: 2 } }
*
* // 数组配置(ArcGIS simple-line + 文字)
* {
* symbol: [
* { type: 'simple-line', style: 'dash', color: [0, 0, 255, 1], width: 3, cap: 'butt', join: 'miter' },
* { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], placement: 'line' }
* ]
* }
*/
export declare function getLineStyle(symbol: any, attributes?: any): Style | Style[];