| | |
| | | 'white-space: normal', |
| | | 'word-break: break-word', |
| | | ].join(';') |
| | | text.innerHTML = '拖动橙色实心点增加顶点<br />点击白色实心点删除顶点' |
| | | text.innerHTML = `拖动${fenceCreateMode.value ? '橙色' : '蓝色'}实心点增加顶点<br />点击白色实心点删除顶点` |
| | | const arrow = document.createElement('div') |
| | | arrow.style.cssText = [ |
| | | 'position: absolute', |
| | |
| | | return |
| | | } |
| | | fenceEditGuideMarker.value.setPosition([lng, lat]) |
| | | const guideTextElement = fenceEditGuideContentElement?.querySelector?.('.fence-edit-guide__text') as HTMLDivElement | null |
| | | if (guideTextElement) { |
| | | guideTextElement.innerHTML = `拖动${fenceCreateMode.value ? '橙色' : '蓝色'}实心点增加顶点<br />点击白色实心点删除顶点` |
| | | } |
| | | applyFenceEditGuidePlacement(layout.placement, layout.offset) |
| | | } |
| | | |
| | |
| | | const fenceHoverTooltipText = ref('') |
| | | const fenceHoverTooltipType = ref<'enabled' | 'disabled' | 'testing'>('testing') |
| | | const fenceCreateOutsideCurrentCity = ref(false) |
| | | const hoveredFencePolygon = shallowRef<any | null>(null) |
| | | const hoveredFenceBaseStrokeWeight = ref<number | null>(null) |
| | | const cityBoundaryHoverPosition = reactive({ |
| | | x: 0, |
| | | y: 0, |
| | |
| | | } |
| | | } |
| | | |
| | | function resetFenceHoverPolygonStyle() { |
| | | if (hoveredFencePolygon.value && hoveredFenceBaseStrokeWeight.value !== null) { |
| | | hoveredFencePolygon.value.setOptions({ |
| | | strokeWeight: hoveredFenceBaseStrokeWeight.value, |
| | | }) |
| | | } |
| | | hoveredFencePolygon.value = null |
| | | hoveredFenceBaseStrokeWeight.value = null |
| | | } |
| | | |
| | | function highlightFenceHoverPolygon(polygon: any, item: any) { |
| | | if (Number(item?.areaType) !== 1) |
| | | return |
| | | |
| | | if (hoveredFencePolygon.value === polygon) |
| | | return |
| | | |
| | | resetFenceHoverPolygonStyle() |
| | | |
| | | const currentStrokeWeight = Number(polygon?.getExtData?.()?.baseStrokeWeight ?? 2) |
| | | hoveredFencePolygon.value = polygon |
| | | hoveredFenceBaseStrokeWeight.value = currentStrokeWeight |
| | | polygon.setOptions({ |
| | | strokeWeight: currentStrokeWeight + 1, |
| | | }) |
| | | } |
| | | |
| | | function hideFenceHoverTooltip() { |
| | | clearFenceHoverTooltipTimer() |
| | | pendingFenceHoverKey = '' |
| | | pendingFenceHoverPixel = null |
| | | resetFenceHoverPolygonStyle() |
| | | fenceHoverTooltipVisible.value = false |
| | | fenceHoverTooltipText.value = '' |
| | | fenceHoverTooltipType.value = 'testing' |
| | |
| | | ) |
| | | if (activeRestrictedArea) { |
| | | if (activeRestrictedArea.points.length < 3) |
| | | return '请在地图上【橙色运营区域】绘制多边形区域,双击闭合' |
| | | return `请在地图上【${getFenceDraftAccentLabel()}运营区域】绘制多边形区域,双击闭合` |
| | | if (isFenceGeometryLocked.value) |
| | | return '【红色禁行区】已选中' |
| | | return '【红色禁行区】可调整区域点位,请保持在橙色运营区内' |
| | | return `【红色禁行区】可调整区域点位,请保持在${getFenceDraftAccentLabel()}运营区内` |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | function getFenceDraftAccentColor() { |
| | | return fenceCreateMode.value ? '#F19216' : '#2F7BFF' |
| | | } |
| | | |
| | | function getFenceDraftAccentLabel() { |
| | | return fenceCreateMode.value ? '橙色' : '蓝色' |
| | | } |
| | | |
| | | function syncFenceStationWarningState(points: LngLatTuple[] = fenceDraftPoints.value) { |
| | | invalidFenceStationIds.value = [] |
| | | setFenceDraftPolygonStyle(fenceInteractionMode.value === 'operation-edit') |
| | |
| | | function setFenceDraftPolygonStyle(editable: boolean) { |
| | | if (!fenceDraftPolygon.value) |
| | | return |
| | | const accentColor = getFenceDraftAccentColor() |
| | | fenceDraftPolygon.value.setOptions({ |
| | | fillColor: '#F19216', |
| | | strokeColor: '#F19216', |
| | | fillColor: accentColor, |
| | | strokeColor: accentColor, |
| | | strokeWeight: 2, |
| | | strokeOpacity: 1, |
| | | fillOpacity: 0.1, |
| | |
| | | return |
| | | if (fenceDraftPolygon.value) |
| | | map.value.remove(fenceDraftPolygon.value) |
| | | const accentColor = getFenceDraftAccentColor() |
| | | fenceDraftPolygon.value = new (window as any).AMap.Polygon({ |
| | | path: points, |
| | | fillColor: '#F19216', |
| | | strokeColor: '#F19216', |
| | | fillColor: accentColor, |
| | | strokeColor: accentColor, |
| | | strokeWeight: 2, |
| | | strokeOpacity: 1, |
| | | fillOpacity: 0.1, |
| | |
| | | fenceDraftPolygon.value, |
| | | { |
| | | controlPoint: { |
| | | strokeColor: '#F19216', |
| | | strokeColor: getFenceDraftAccentColor(), |
| | | strokeOpacity: 1, |
| | | strokeWeight: 2, |
| | | }, |
| | | midControlPoint: { fillColor: '#F19216' }, |
| | | editOptions: { fillColor: '#F19216' }, |
| | | midControlPoint: { fillColor: getFenceDraftAccentColor() }, |
| | | editOptions: { fillColor: getFenceDraftAccentColor() }, |
| | | }, |
| | | ) |
| | | fencePolyEditor.value.open() |
| | |
| | | return |
| | | cleanupFenceEditorState() |
| | | lastValidFenceDrawingPoints.value = [] |
| | | const accentColor = getFenceDraftAccentColor() |
| | | fenceMouseTool.value = new (window as any).AMap.MouseTool(map.value) |
| | | fenceMouseTool.value.polygon({ |
| | | strokeColor: '#F19216', |
| | | strokeColor: accentColor, |
| | | strokeOpacity: 1, |
| | | strokeWeight: 2, |
| | | fillColor: '#F19216', |
| | | fillColor: accentColor, |
| | | fillOpacity: 0.1, |
| | | strokeStyle: 'solid', |
| | | cursor: 'pointer', |
| | |
| | | // 非启用中的选中围栏使用蓝色选中态;启用中的围栏即使被选中也保持绿色。 |
| | | const isFenceSelectedBlue = isFenceDetailActive && !isFenceEnabled |
| | | const isFenceHighlighted = isFenceDetailActive || isFenceEnabled |
| | | const baseStrokeWeight = areaType === 2 |
| | | ? 0 |
| | | : isFenceSelectedBlue |
| | | ? 3 |
| | | : isFenceFlowCompletedDisabled |
| | | ? 2 |
| | | : isFenceHighlighted |
| | | ? 2 |
| | | : isActive |
| | | ? 3 |
| | | : 2 |
| | | const polygon = new (window as any).AMap.Polygon({ |
| | | path: points, |
| | | // 填充颜色 |
| | |
| | | ? '#171F26' |
| | | : '#AEB0B2', |
| | | // 线宽度 |
| | | strokeWeight: areaType === 2 |
| | | ? 0 |
| | | : isFenceSelectedBlue |
| | | ? 3 |
| | | : isFenceFlowCompletedDisabled |
| | | ? 2 |
| | | : isFenceHighlighted |
| | | ? 2 |
| | | : isActive |
| | | ? 3 |
| | | : 2, |
| | | strokeWeight: baseStrokeWeight, |
| | | // 线透明度 |
| | | strokeOpacity: areaType === 2 ? 0 : isFenceFlowCompletedDisabled ? 0.3 : isFenceHighlighted ? 1 : isFenceReadonlyDimmed ? 0.2 : 1, |
| | | // 填充透明度 |
| | |
| | | handleMapEntityClick('fence', String(item.electronicId)) |
| | | }) |
| | | polygon.on('mouseover', (event: any) => { |
| | | highlightFenceHoverPolygon(polygon, item) |
| | | scheduleFenceHoverTooltip(item, event?.pixel || null) |
| | | }) |
| | | polygon.on('mousemove', (event: any) => { |
| | |
| | | type: 'fence', |
| | | areaType, |
| | | areaId: String(item.id || ''), |
| | | baseStrokeWeight, |
| | | }) |
| | | return polygon |
| | | }) |