update 添加图标 完善地图功能

This commit is contained in:
zk
2023-12-07 18:44:15 +08:00
parent 123b681dc3
commit 622181ac96
14 changed files with 391 additions and 159 deletions
+26 -3
View File
@@ -6,7 +6,7 @@ import { mapIcon1, mapIcon2, mapIcon3, mapIcon4 } from '/@/components/chinaMap/c
export function createIcon({ icon, iconSize, imageSize }) {
return new AMap.Icon({
// 图标尺寸
size: new AMap.Size(21, 44),
size: new AMap.Size(...iconSize),
// 图标的取图地址
image: icon,
// 图标所用图片大小
@@ -19,8 +19,8 @@ export function createIcon({ icon, iconSize, imageSize }) {
* @type 1:油田医院,2:合作医院,3:医疗点
*/
export function typeToIcon(type: string) {
const iconSize = [21, 44];
const imageSize = [21, 44];
const iconSize = [18, 44];
const imageSize = [18, 44];
if (type == '1') {
return createIcon({ icon: mapIcon1, iconSize, imageSize });
}
@@ -33,4 +33,27 @@ export function typeToIcon(type: string) {
if (type == '4') {
return createIcon({ icon: mapIcon3, iconSize, imageSize });
}
}
/**
*
*/
export function createCircle(option) {
const { lon, lat } = option;
return new AMap.Circle({
center: [lon, lat],
radius: 100000, //半径
borderWeight: 3,
strokeColor: '#FF33FF',
strokeOpacity: 1,
// strokeWeight: 6,
strokeOpacity: 0.2,
fillOpacity: 0.4,
strokeStyle: 'dashed',
strokeDasharray: [10, 10],
// 线样式还支持 'dashed'
fillColor: '#1791fc',
zIndex: 50,
...option,
});
}