|
|
@@ -168,56 +168,24 @@ export function useGMapCover() {
|
|
|
}
|
|
|
|
|
|
function updatePinElement(id: string, name: string, coordinates: GeojsonCoordinate, color?: string) {
|
|
|
- const elements = getElementFromMap(id)
|
|
|
- const textElements = getElementFromMap(id + '_text')
|
|
|
- if (elements && elements.length > 0) {
|
|
|
- const element = elements[0]
|
|
|
- const icon = getPinIcon(color)
|
|
|
- element.setPosition(new AMap.LngLat(coordinates[0], coordinates[1]))
|
|
|
- element.setIcon(icon)
|
|
|
- element.setTitle(name)
|
|
|
- textElements[0].setText(name)
|
|
|
- } else {
|
|
|
- init2DPin(name, coordinates, color, {
|
|
|
- id: id,
|
|
|
- name: name
|
|
|
- })
|
|
|
- }
|
|
|
+ init2DPin(name, coordinates, color, {
|
|
|
+ id: id,
|
|
|
+ name: name
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function updatePolylineElement(id: string, name: string, coordinates: GeojsonCoordinate[], color?: string) {
|
|
|
- const elements = getElementFromMap(id)
|
|
|
- const textElements = getElementFromMap(id + '_text')
|
|
|
- if (elements && elements.length > 0) {
|
|
|
- const element = elements[0]
|
|
|
- const options = element.getOptions()
|
|
|
- options.strokeColor = color || normalColor
|
|
|
- element.setOptions(options)
|
|
|
- textElements[0].setText(name)
|
|
|
- } else {
|
|
|
- initPolyline(name, coordinates, color, {
|
|
|
- id: id,
|
|
|
- name: name
|
|
|
- })
|
|
|
- }
|
|
|
+ initPolyline(name, coordinates, color, {
|
|
|
+ id: id,
|
|
|
+ name: name
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function updatePolygonElement(id: string, name: string, coordinates: GeojsonCoordinate[][], color?: string) {
|
|
|
- const elements = getElementFromMap(id)
|
|
|
- const textElements = getElementFromMap(id + '_text')
|
|
|
- if (elements && elements.length > 0) {
|
|
|
- const element = elements[0]
|
|
|
- const options = element.getOptions()
|
|
|
- options.fillColor = color || normalColor
|
|
|
- options.strokeColor = color || normalColor
|
|
|
- element.setOptions(options)
|
|
|
- textElements[0].setText(name)
|
|
|
- } else {
|
|
|
- initPolygon(name, coordinates, color, {
|
|
|
- id: id,
|
|
|
- name: name
|
|
|
- })
|
|
|
- }
|
|
|
+ initPolygon(name, coordinates, color, {
|
|
|
+ id: id,
|
|
|
+ name: name
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function initTextInfo(content: string, coordinates: GeojsonCoordinate, id: string) {
|