|
@@ -525,6 +525,8 @@ const setMarkerCluster = async () => {
|
|
|
let pointers = [];
|
|
|
let weights = weightData.value[tabType.value];
|
|
|
if (serviceList.value.map((i) => i.type).includes(tabType.value)) {
|
|
|
+ // setMapStyle("normal");
|
|
|
+ // map.remove(tilerLayer);
|
|
|
let name = serviceList.value.find((i) => i.type == tabType.value).name;
|
|
|
let res = await searchPos(name);
|
|
|
if (res.length) {
|
|
@@ -541,6 +543,8 @@ const setMarkerCluster = async () => {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
+ // setMapStyle();
|
|
|
+ // map.add(tilerLayer);
|
|
|
mapData.value.forEach((item, j_index) => {
|
|
|
let weight = 1;
|
|
|
if (tabType.value == "3d") {
|
|
@@ -606,7 +610,7 @@ const setMarkerCluster = async () => {
|
|
|
|
|
|
let iconW = 41 * 0.8,
|
|
|
iconH = 57 * 0.8;
|
|
|
- let offset = new AMap.Pixel(-(iconW / 2), -(iconH / 2));
|
|
|
+ let offset = new AMap.Pixel(-(iconW / 2), -iconH);
|
|
|
|
|
|
let tagType = extData.type;
|
|
|
|
|
@@ -699,7 +703,43 @@ const goLocation = () => {
|
|
|
scale: 10, // 地图缩放级别,整形值,范围从1~28。默认为最大
|
|
|
});
|
|
|
};
|
|
|
+//检查是否在岳阳市
|
|
|
+const checkMyLocation = (point) => {
|
|
|
+ var districtSearch = new AMap.DistrictSearch({
|
|
|
+ subdistrict: 0, //返回所属的市
|
|
|
+ extensions: "all", //返回行政区边界坐标等具体信息
|
|
|
+ });
|
|
|
+ // 根据坐标获取行政区域
|
|
|
+ districtSearch.search("岳阳", function (status, result) {
|
|
|
+ console.log(status, result);
|
|
|
+
|
|
|
+ var bounds = result.districtList[0].boundaries; //获取朝阳区的边界信息
|
|
|
+ let array = [];
|
|
|
|
|
|
+ if (bounds) {
|
|
|
+ for (var i = 0; i < bounds.length; i++) {
|
|
|
+ for (var j = 0; j < bounds[i].length; j++) {
|
|
|
+ array.push([bounds[i][j].lng, bounds[i][j].lat]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成行政区划 polygon
|
|
|
+ var polygon = new AMap.Polygon({
|
|
|
+ map: map, //显示该覆盖物的地图对象
|
|
|
+ strokeWeight: 1, //轮廓线宽度
|
|
|
+ path: bounds[i], //多边形轮廓线的节点坐标数组
|
|
|
+ fillOpacity: 0.7, //多边形填充透明度
|
|
|
+ fillColor: "#CCF3FF", //多边形填充颜色
|
|
|
+ strokeColor: "#CC66CC", //线条颜色
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // console.error(array);
|
|
|
+ //判断 p0 是否在 p1-p2-p3 围成的封闭区域内
|
|
|
+ var inRing = AMap.GeometryUtil.isPointInRing(point, array);
|
|
|
+ // console.error("是否在岳阳市", inRing);
|
|
|
+ return inRing;
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
const hanlderClusterEvent = (e) => {
|
|
|
if (e.clusterData.length == 1) {
|
|
|
// dialogData.value = e.clusterData[0].info;
|
|
@@ -718,7 +758,7 @@ const hanlderClusterEvent = (e) => {
|
|
|
infoWindow = new AMap.InfoWindow({
|
|
|
zIndex: 1000,
|
|
|
content: getHtml(data), // 设置弹窗内容为自定义的HTML元素
|
|
|
- offset: new AMap.Pixel(0, -30), // 设置弹窗偏移量,可根据需要调整
|
|
|
+ offset: new AMap.Pixel(0, -60), // 设置弹窗偏移量,可根据需要调整
|
|
|
});
|
|
|
|
|
|
setTimeout(() => {
|
|
@@ -778,7 +818,6 @@ const initMap = async () => {
|
|
|
map.on("moveend", () => {
|
|
|
// var center = map.getCenter(); // 获取当前中心点坐标
|
|
|
// console.log("当前中心点坐标:", center.getLng(), center.getLat());
|
|
|
-
|
|
|
// if (serviceList.value.map((i) => i.type).includes(tabType.value)) {
|
|
|
// if (markers.length) {
|
|
|
// markers.forEach((item) => {
|
|
@@ -797,6 +836,15 @@ const initMap = async () => {
|
|
|
|
|
|
map.add(tilerLayer);
|
|
|
};
|
|
|
+// 设置地图样式
|
|
|
+const setMapStyle = (normal) => {
|
|
|
+ var styleName = "amap://styles/normal";
|
|
|
+ if (!normal) {
|
|
|
+ styleName = mapConfig.mapStyle;
|
|
|
+ }
|
|
|
+
|
|
|
+ map.setMapStyle(styleName);
|
|
|
+};
|
|
|
|
|
|
//*
|
|
|
// *effect 是否false 需要过渡
|