UNPKG

gisviewer-vue3-arcgis

Version:

在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:

79 lines (78 loc) 3.56 kB
import Style from 'ol/style/Style'; /** * 清除样式缓存 */ export declare function clearStyleCache(): void; /** * 获取当前缓存大小 */ export declare function getStyleCacheSize(): number; /** * 获取单点样式 * 支持 symbol 数组配置(icon + text + circle + shape),或单个 symbol 配置 * symbol 为空则显示蓝色圆点 * * @example * // 单个图标配置 * { symbol: { url: '/path/to/icon.png', scale: 1 } } * * // 圆点样式配置 * { symbol: { type: 'circle', radius: 8, fillColor: '#ff0000', strokeColor: '#ffffff', strokeWidth: 2 } } * * // 规则图形样式配置(三角形) * { symbol: { type: 'shape', points: 3, radius: 10, fillColor: 'red', strokeColor: 'black', strokeWidth: 1 } } * * // 规则图形样式配置(正方形,旋转45度) * { symbol: { type: 'shape', points: 4, radius: 10, angle: Math.PI / 4, fillColor: 'blue' } } * * // 规则图形样式配置(五角星) * { symbol: { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' } } * * // 规则图形样式配置(十字形) * { symbol: { type: 'shape', points: 4, radius: 10, radius2: 0, strokeColor: 'red', strokeWidth: 2 } } * * // ArcGIS picture-marker 配置 (转换为 OpenLayers Icon) * { symbol: { type: 'picture-marker', url: '/path/to/icon.png', width: 24, height: 24, angle: 0, xoffset: 0, yoffset: 0 } } * * // ArcGIS simple-marker 配置 (根据 style 返回对应的 OpenLayers 样式) * // style 可选值: 'circle', 'square', 'diamond', 'triangle', 'cross', 'x', 'path' * { symbol: { type: 'simple-marker', style: 'circle', size: 12, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 1 } } } * { symbol: { type: 'simple-marker', style: 'square', size: 12, color: [0, 128, 255, 1], outline: { color: [0, 0, 0, 1], width: 2 } } } * { symbol: { type: 'simple-marker', style: 'diamond', size: 14, color: [255, 215, 0, 1], outline: { color: [139, 69, 19, 1], width: 1 } } } * { symbol: { type: 'simple-marker', style: 'triangle', size: 12, color: [0, 255, 0, 1], outline: { color: [0, 100, 0, 1], width: 1 } } } * { symbol: { type: 'simple-marker', style: 'cross', size: 12, outline: { color: [255, 0, 0, 1], width: 2 } } } * { symbol: { type: 'simple-marker', style: 'x', size: 12, outline: { color: [0, 0, 255, 1], width: 2 } } } * * // 数组配置(图标 + 文字) * { * symbol: [ * { type: 'icon', url: '/path/to/icon.png', scale: 1 }, * { type: 'text', field: 'name', font: '14px Arial', fillColor: [0,0,0], offsetY: 20 } * ] * } * * // 数组配置(圆点 + 文字) * { * symbol: [ * { type: 'circle', radius: 10, fillColor: 'rgba(255,0,0,0.8)', strokeColor: '#fff', strokeWidth: 2 }, * { type: 'text', field: 'label', font: '12px Arial', fillColor: [255,255,255], offsetY: 0 } * ] * } * * // 数组配置(五角星 + 文字) * { * symbol: [ * { type: 'shape', points: 5, radius: 12, radius2: 6, fillColor: 'gold', strokeColor: 'orange' }, * { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 18 } * ] * } * * // 数组配置(ArcGIS simple-marker + 文字) * { * symbol: [ * { type: 'simple-marker', style: 'diamond', size: 16, color: [255, 0, 0, 1], outline: { color: [255, 255, 255, 1], width: 2 } }, * { type: 'text', field: 'name', font: '12px Arial', fillColor: [0,0,0], offsetY: 20 } * ] * } */ export declare function getPointStyle(symbol: any, attributes?: any): Style | Style[];