PathServiceInstaller.cs 1.13 KB
using Microsoft.Extensions.DependencyInjection;
using Rcs.Application.Services;
using Rcs.Application.Services.PathFind;
using Rcs.Infrastructure.PathFinding;
using Rcs.Infrastructure.PathFinding.Services;

namespace Rcs.Infrastructure.Installs;

/// <summary>
/// 路径相关服务注册
/// </summary>
public static class PathInstaller
{
    /// <summary>
    /// 安装HttpClient服务
    /// </summary>
    public static IServiceCollection InstallerPathService(
        this IServiceCollection services)
    {
        // 地图映射服务(按MapCode合并多厂商地图)
        services.AddSingleton<IMapMappingService, MapMappingService>();

        // 统一交通管制服务(基于 MapCode:NodeCode/EdgeCode)
        services.AddSingleton<IUnifiedTrafficControlService, UnifiedTrafficControlService>();

        // 导航服务
        services.AddSingleton<NavigationService>();

        // AGV寻路服务
        services.AddSingleton<IAgvPathService, AgvPathService>();

        // 启动时自动初始化合并映射和逆向边关系
        services.AddHostedService<PathServiceInitializer>();

        return services;
    }
}