Repository navigation
Expand file tree
/
Copy pathStyleUtils.js
More file actions
executable file
·64 lines (59 loc) · 1.67 KB
/
Copy pathStyleUtils.js
File metadata and controls
executable file
·64 lines (59 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* MapView辅助工具类
*/
import { SMap, GeoStyle } from 'imobile_for_reactnative'
/**
* 设置选择集样式
* @param layerPath
* @param geoStyle
* @returns {Promise.<void>}
*/
async function setSelectionStyle(layerPath = '', geoStyle) {
if (!geoStyle) {
geoStyle = new GeoStyle()
geoStyle.setFillForeColor(0, 255, 0, 0.5)
geoStyle.setLineWidth(1)
geoStyle.setLineColor(70, 128, 223)
geoStyle.setMarkerHeight(1)
geoStyle.setMarkerWidth(1)
geoStyle.setMarkerSize(5)
// geoStyle.setMarkerColor(255, 0, 0)
}
SMap.setSelectionStyle(layerPath, geoStyle)
}
/** 点选(单选)选择集样式 */
async function setSingleSelectionStyle(layerPath = '') {
let geoStyle = new GeoStyle()
geoStyle.setFillOpaqueRate(0)
geoStyle.setLineWidth(0.1)
geoStyle.setLineColor(0, 0, 255)
geoStyle.setMarkerSize(2.4)
SMap.setSelectionStyle(layerPath, geoStyle)
}
async function setDefaultMapControlStyle() {
let nodeStyle = new GeoStyle()
// nodeStyle.setFillForeColor(250, 20, 20, 1)
// nodeStyle.setLineWidth(1)
// nodeStyle.setLineColor(70, 128, 223)
// nodeStyle.setMarkerHeight(1)
// nodeStyle.setMarkerWidth(1)
// nodeStyle.setMarkerSize(5)
// geoStyle.setMarkerColor(255, 0, 0)
let style = {
nodeStyle: JSON.stringify(nodeStyle),
nodeColor: [250, 20, 20, 1],
nodeSize: 1,
strokeColor: [90, 90, 90, 1],
// strokeColor: colorRgb2Hex(255, 0, 0, 1),
strokeFillColor: [200, 200, 200, 127 / 255],
strokeWidth: 1,
objectColor: [0, 255, 255, 255],
objectWidth: 1,
}
return SMap.setMapControlStyle(style)
}
export default {
setSelectionStyle,
setSingleSelectionStyle,
setDefaultMapControlStyle,
}