Compare commits

...

2 Commits

Author SHA1 Message Date
5b1d2ae100 Merge branch 'main' of http://10.0.0.99:4000/Ren/airport-qingdao-vue3 2025-07-16 15:31:27 +08:00
0244c8166d icon 2025-07-16 15:31:22 +08:00
3 changed files with 91 additions and 18 deletions

View File

@ -529,6 +529,11 @@ onUnmounted(() => {
// //
function emitSet(type) { function emitSet(type) {
console.log(`LayerSwitcher: 设置分类 ${type} 可见性`, {
visible: props.categories[type].visible,
showLabel: props.categories[type].showLabel
});
emit('setCategoryVisibility', type, { emit('setCategoryVisibility', type, {
visible: props.categories[type].visible, visible: props.categories[type].visible,
showLabel: props.categories[type].showLabel showLabel: props.categories[type].showLabel

View File

@ -148,6 +148,11 @@ const vehicleCategories = ref({
'SHUTTLE_VEHICLE': { visible: true, showLabel: true, name: '摆渡车' } 'SHUTTLE_VEHICLE': { visible: true, showLabel: true, name: '摆渡车' }
}); });
// vehicleCategories
watch(vehicleCategories, (newCategories) => {
console.log('VehicleMovementControl: vehicleCategories 发生变化:', newCategories);
}, { deep: true });
// / // /
const alertMessage = ref(''); const alertMessage = ref('');
const alertType = ref(''); const alertType = ref('');
@ -365,6 +370,9 @@ function updateVehiclePosition(vehicleData) {
if (labelSystem.value) { if (labelSystem.value) {
labelSystem.value.updateVehicleLabel(object_id, coordinates, speed); labelSystem.value.updateVehicleLabel(object_id, coordinates, speed);
} }
//
applyCurrentCategorySettings(object_id);
} else { } else {
// //
if (animationSystem.value) { if (animationSystem.value) {
@ -1088,6 +1096,58 @@ function clearSpeedViolationStatus(vehicleId) {
console.log(`已成功清除车辆${vehicleId}的超速状态`); console.log(`已成功清除车辆${vehicleId}的超速状态`);
} }
//
function getVehicleTypeKey(vehicle) {
if (!vehicle || !vehicle.type) return 'UNMANNED_VEHICLE';
const vehicleType = vehicle.type.toUpperCase();
//
if (vehicleType === 'AIRCRAFT') {
return 'AIRCRAFT';
} else if (vehicle.isAircraft) {
return 'AIRCRAFT';
} else if (vehicleType === 'UNMANNED_VEHICLE' || vehicle.isUnmannedVehicle) {
return 'UNMANNED_VEHICLE';
} else if (vehicleType === 'SPECIAL_VEHICLE' || vehicle.isSpecialVehicle) {
return 'AIRPORT_VEHICLE';
} else if (vehicleType === 'SHUTTLE_VEHICLE' || vehicle.isShuttleVehicle) {
return 'SHUTTLE_VEHICLE';
}
//
return 'UNMANNED_VEHICLE';
}
//
function getDefaultVehicleStyle(vehicle) {
if (!vehicle) return new Style({});
const isAircraft = vehicle.isAircraft || vehicle.type?.toUpperCase() === 'AIRCRAFT';
const iconSrc = isAircraft ? aircraftIcon : carIcon;
const heading = vehicle.heading || 0;
//
const rotationRad = ((heading - 72) * Math.PI) / 180;
return new Style({
image: new Icon({
src: iconSrc,
scale: 1.5,
anchor: [0.5, 0.5],
rotation: rotationRad,
})
});
}
//
// function defaultGetVehicleStyle(vehicleId, speed, heading) {
// const vehicle = vehicles.value[vehicleId];
// if (!vehicle) return new Style({});
// return getDefaultVehicleStyle(vehicle);
// }
// //
function clearVehicleAlertStatus(vehicleData) { function clearVehicleAlertStatus(vehicleData) {
const { object_id, speed } = vehicleData; const { object_id, speed } = vehicleData;
@ -1328,43 +1388,51 @@ defineExpose({
} }
}, },
setCategoryVisibility(type, { visible, showLabel }) { setCategoryVisibility(type, { visible, showLabel }) {
console.log(`VehicleMovementControl: 设置分类 ${type} 可见性`, { visible, showLabel });
if (vehicleCategories.value[type]) { if (vehicleCategories.value[type]) {
// //
vehicleCategories.value[type].visible = visible; vehicleCategories.value[type].visible = visible;
vehicleCategories.value[type].showLabel = showLabel; vehicleCategories.value[type].showLabel = showLabel;
console.log(`更新分类设置完成: ${type}`, vehicleCategories.value[type]);
// - // -
Object.values(vehicles.value).forEach(vehicle => { Object.values(vehicles.value).forEach(vehicle => {
let vehicleTypeKey = vehicle.type; let vehicleTypeKey = getVehicleTypeKey(vehicle);
//
if (vehicle.isAircraftIn) vehicleTypeKey = 'AIRCRAFT_IN';
else if (vehicle.isAircraftOut) vehicleTypeKey = 'AIRCRAFT_OUT';
else if (vehicle.isUnmannedVehicle) vehicleTypeKey = 'UNMANNED_VEHICLE';
else if (vehicle.isSpecialVehicle) vehicleTypeKey = 'AIRPORT_VEHICLE';
else if (vehicle.isShuttleVehicle) vehicleTypeKey = 'SHUTTLE_VEHICLE';
// //
if (vehicleTypeKey === type) { if (vehicleTypeKey === type) {
// - console.log(`更新车辆 ${vehicle.id} (${vehicleTypeKey}) 的显示状态:`, { visible, showLabel });
//
if (vehicle.feature) { if (vehicle.feature) {
if (visible) { if (visible) {
// - styleManager.value //
if (styleManager.value) { if (styleManager.value) {
vehicle.feature.setStyle(styleManager.value.getVehicleStyle(vehicle.id, vehicle.speed, vehicle.heading)); vehicle.feature.setStyle(styleManager.value.getVehicleStyle(vehicle.id, vehicle.speed, vehicle.heading));
} else { } else {
// // 使
vehicle.feature.setStyle(defaultGetVehicleStyle(vehicle.id, vehicle.speed, vehicle.heading)); vehicle.feature.setStyle(getDefaultVehicleStyle(vehicle));
} }
} else { } else {
// 使null //
vehicle.feature.setStyle(new Style({})); vehicle.feature.setStyle(new Style({}));
} }
} }
// //
if (labelSystem.value) { if (labelSystem.value) {
labelSystem.value.setLabelVisibility(vehicle.id, showLabel); if (labelSystem.value.setLabelVisibility) {
labelSystem.value.setLabelVisibility(vehicle.id, showLabel);
} else if (labelSystem.value.updateVehicleLabel) {
// setLabelVisibility使updateVehicleLabel
if (showLabel && vehicle.position) {
labelSystem.value.updateVehicleLabel(vehicle.id, vehicle.position, vehicle.speed);
} else {
labelSystem.value.removeVehicleLabel(vehicle.id);
}
}
} }
} }
}); });

View File

@ -147,7 +147,7 @@ defineExpose({
}); });
</script> </script>
<style scoped> <style lang="scss" scoped>
.alarm-notification-container { .alarm-notification-container {
position: absolute; position: absolute;
left:70px; left:70px;
@ -283,13 +283,13 @@ defineExpose({
object-fit: contain; object-fit: contain;
} }
.alarm-icon.high { /* .alarm-icon.high {
background-color: rgba(255, 77, 79, 0.2); background-color: rgba(255, 77, 79, 0.2);
} }
.alarm-icon.medium { .alarm-icon.medium {
background-color: rgba(255, 153, 0, 0.2); background-color: rgba(255, 153, 0, 0.2);
} } */
.alarm-dot { .alarm-dot {
width: 10px; width: 10px;