36 lines
1013 B
TypeScript
36 lines
1013 B
TypeScript
import { mapIcon1, mapIcon2, mapIcon3, mapIcon4 } from '/@/components/chinaMap/chinaHooks.ts';
|
|
|
|
/**
|
|
* @desc 创建icon
|
|
* */
|
|
export function createIcon({ icon, iconSize, imageSize }) {
|
|
return new AMap.Icon({
|
|
// 图标尺寸
|
|
size: new AMap.Size(21, 44),
|
|
// 图标的取图地址
|
|
image: icon,
|
|
// 图标所用图片大小
|
|
imageSize: new AMap.Size(...imageSize),
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @desc 根据类型创建Icon
|
|
* @type 1:油田医院,2:合作医院,3:医疗点
|
|
*/
|
|
export function typeToIcon(type: string) {
|
|
const iconSize = [21, 44];
|
|
const imageSize = [21, 44];
|
|
if (type == '1') {
|
|
return createIcon({ icon: mapIcon1, iconSize, imageSize });
|
|
}
|
|
if (type == '2') {
|
|
return createIcon({ icon: mapIcon4, iconSize, imageSize });
|
|
}
|
|
if (type == '3') {
|
|
return createIcon({ icon: mapIcon2, iconSize, imageSize });
|
|
}
|
|
if (type == '4') {
|
|
return createIcon({ icon: mapIcon3, iconSize, imageSize });
|
|
}
|
|
} |