|
|
@@ -855,25 +855,29 @@ export default defineComponent({
|
|
|
setLayers(req)
|
|
|
const coordinates = req.resource.content.geometry.coordinates
|
|
|
updateCoordinates('gcj02-wgs84', req);
|
|
|
- (req.resource.content.geometry.coordinates as GeojsonCoordinate).push((coordinates as GeojsonCoordinate)[2])
|
|
|
await postElementsReq(shareId.value, req)
|
|
|
obj.setExtData({ id: req.id, name: req.name })
|
|
|
- const title = coordinates.slice(0, 2);
|
|
|
+ const title = coordinates.map((item: any, index: number) => {
|
|
|
+ if (index < 2) {
|
|
|
+ return item.toFixed(4)
|
|
|
+ }
|
|
|
+ });
|
|
|
obj.setTitle(title)
|
|
|
store.state.coverMap[req.id] = [obj]
|
|
|
const map = root.$map
|
|
|
const AMap = root.$aMap
|
|
|
const text = new AMap.Text({
|
|
|
position: new AMap.LngLat(coordinates[0], coordinates[1]),
|
|
|
- offset: new AMap.Pixel(30, 0),
|
|
|
+ offset: new AMap.Pixel(20, -2),
|
|
|
text: req.name,
|
|
|
style: {
|
|
|
backgroundColor: 'transparent',
|
|
|
borderColor: 'transparent',
|
|
|
}
|
|
|
})
|
|
|
- map.add(text);
|
|
|
- store.state.coverMap[req.id + '_other'] = [text]
|
|
|
+ const other = [text]
|
|
|
+ map.add(other);
|
|
|
+ store.state.coverMap[req.id + '_other'] = other
|
|
|
obj.on('click', function () {
|
|
|
store.commit('SET_MAP_CLICK_ELEMENT', {
|
|
|
id: req.id,
|
|
|
@@ -887,16 +891,27 @@ export default defineComponent({
|
|
|
req.element_from = 1
|
|
|
req.resource.user_name = userName
|
|
|
setLayers(req)
|
|
|
- const coordinatesList = req.resource.content.geometry.coordinates
|
|
|
updateCoordinates('gcj02-wgs84', req)
|
|
|
await postElementsReq(shareId.value, req)
|
|
|
obj.setExtData({ id: req.id, name: req.name })
|
|
|
store.state.coverMap[req.id] = [obj]
|
|
|
const map = root.$map
|
|
|
const AMap = root.$aMap
|
|
|
+ const coordinatesList = req.resource.content.geometry.coordinates.map((item: any) => wgs84togcj02(item[0], item[1]))
|
|
|
if (coordinatesList.length < 2) {
|
|
|
return
|
|
|
}
|
|
|
+ const color = req.resource.content.properties.color
|
|
|
+ const circles = coordinatesList.map((item: any) => {
|
|
|
+ return new AMap.Circle({
|
|
|
+ center: new AMap.LngLat(item[0], item[1]),
|
|
|
+ radius: 8, // 半径
|
|
|
+ strokeColor: color,
|
|
|
+ fillColor: color,
|
|
|
+ fillOpacity: 1,
|
|
|
+ strokeWeight: 8,
|
|
|
+ });
|
|
|
+ })
|
|
|
const coordinates = coordinatesList[0];
|
|
|
const text = new AMap.Text({
|
|
|
position: new AMap.LngLat(coordinates[0], coordinates[1]),
|
|
|
@@ -930,8 +945,8 @@ export default defineComponent({
|
|
|
});
|
|
|
distances.push(distanceText);
|
|
|
}
|
|
|
- const other = [text, ...distances]
|
|
|
- map.add([text, ...distances]);
|
|
|
+ const other = [...circles, text, ...distances]
|
|
|
+ map.add(other);
|
|
|
store.state.coverMap[req.id + '_other'] = other;
|
|
|
obj.on('click', function () {
|
|
|
store.commit('SET_MAP_CLICK_ELEMENT', {
|
|
|
@@ -946,16 +961,27 @@ export default defineComponent({
|
|
|
req.element_from = 1
|
|
|
req.resource.user_name = userName
|
|
|
setLayers(req)
|
|
|
- const coordinatesList = req.resource.content.geometry.coordinates[0]
|
|
|
updateCoordinates('gcj02-wgs84', req)
|
|
|
await postElementsReq(shareId.value, req)
|
|
|
obj.setExtData({ id: req.id, name: req.name })
|
|
|
store.state.coverMap[req.id] = [obj]
|
|
|
const map = root.$map
|
|
|
const AMap = root.$aMap
|
|
|
+ const coordinatesList = req.resource.content.geometry.coordinates[0].map((item: any) => wgs84togcj02(item[0], item[1]))
|
|
|
if (coordinatesList.length < 3) {
|
|
|
return
|
|
|
}
|
|
|
+ const color = req.resource.content.properties.color
|
|
|
+ const circles = coordinatesList.map((item: any) => {
|
|
|
+ return new AMap.Circle({
|
|
|
+ center: new AMap.LngLat(item[0], item[1]),
|
|
|
+ radius: 8, // 半径
|
|
|
+ strokeColor: color,
|
|
|
+ fillColor: color,
|
|
|
+ fillOpacity: 1,
|
|
|
+ strokeWeight: 8,
|
|
|
+ });
|
|
|
+ })
|
|
|
const coordinates = coordinatesList[0];
|
|
|
const text = new AMap.Text({
|
|
|
position: new AMap.LngLat(coordinates[0], coordinates[1]),
|
|
|
@@ -990,8 +1016,8 @@ export default defineComponent({
|
|
|
});
|
|
|
distances.push(distanceText);
|
|
|
}
|
|
|
- const other = [text, ...distances]
|
|
|
- map.add([text, ...distances]);
|
|
|
+ const other = [...circles, text, ...distances]
|
|
|
+ map.add(other);
|
|
|
store.state.coverMap[req.id + '_other'] = other;
|
|
|
obj.on('click', function () {
|
|
|
store.commit('SET_MAP_CLICK_ELEMENT', {
|