| | |
| | | * 文本标记 |
| | | * 可修改position |
| | | */ |
| | | function textMaker(position, text, anchor) { |
| | | function textMaker(position, text, anchor, type) { |
| | | let style = {}; |
| | | if (type == 'data') { |
| | | style = { |
| | | 'font-size': '12px', |
| | | 'text-align': 'center', |
| | | color: 'white', |
| | | background: '#122b54a9', |
| | | 'text-shadow': 'black 2px 2px 2px', |
| | | border: '0px', |
| | | 'margin-top': '4px' |
| | | }; |
| | | } else if (type == 'rank') { |
| | | style = { |
| | | 'font-size': '14px', |
| | | 'text-align': 'center', |
| | | color: 'white', |
| | | background: 'transparent', |
| | | 'text-shadow': 'black 2px 2px 2px', |
| | | 'border-radius': '2px', |
| | | border: '1px solid #122b54a9', |
| | | 'margin-bottom': '4px' |
| | | }; |
| | | } |
| | | // eslint-disable-next-line no-undef |
| | | return new AMap.Text({ |
| | | text: text, |
| | | anchor, |
| | | position: position, |
| | | style: { |
| | | 'font-size': '13px', |
| | | 'text-align': 'center', |
| | | color: 'white', |
| | | 'background-color': 'transparent', |
| | | 'text-shadow': 'black 2px 2px 2px', |
| | | 'border-radius': '2px', |
| | | border: '1px', |
| | | padding: '4px' |
| | | } |
| | | style: style |
| | | }); |
| | | } |
| | | |
| | |
| | | return gridViews; |
| | | }, |
| | | |
| | | drawGridText(points, textViews, anchor) { |
| | | drawGridText(points, textViews, anchor, type) { |
| | | if (textViews) { |
| | | points.forEach((p, i) => { |
| | | textViews[i].setPosition(p.lnglat_GD); |
| | |
| | | } else { |
| | | const _textViews = []; |
| | | points.forEach((p) => { |
| | | const m = textMaker(p.lnglat_GD, p.data, anchor); |
| | | const m = textMaker(p.lnglat_GD, p.data, anchor, type); |
| | | _textViews.push(m); |
| | | }); |
| | | map.add(_textViews); |