< Summary

Information
Class: CounterDrone.Core.Algorithms.DefenseSolution
Assembly: CounterDrone.Core
File(s): C:\Users\Tellme\apps\CounterDroneBackend\src\CounterDrone.Core\Algorithms\AlgorithmTypes.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 78
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_RecommendedAerosolType()100%11100%
get_AerosolRationale()100%11100%
get_RecommendedCloud()100%11100%
get_CloudSalvo()100%11100%
get_Platforms()100%11100%
get_Detections()100%11100%
get_InterceptProbability()100%11100%
get_SummaryRationale()100%11100%

File(s)

C:\Users\Tellme\apps\CounterDroneBackend\src\CounterDrone.Core\Algorithms\AlgorithmTypes.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using CounterDrone.Core.Models;
 3
 4namespace CounterDrone.Core.Algorithms
 5{
 6    /// <summary>威胁画像 — 防御推荐算法的输入</summary>
 7    public class ThreatProfile
 8    {
 9        public CombatScene Environment { get; set; } = new();
 10        public List<TargetConfig> Targets { get; set; } = new();
 11        public RoutePlan Route { get; set; } = new();
 12        public List<Waypoint> Waypoints { get; set; } = new();
 13        public List<ControlZone> ControlZones { get; set; } = new();
 14    }
 15
 16    /// <summary>防御推荐方案</summary>
 17    public class DefenseRecommendation
 18    {
 19        public DefenseSolution Best { get; set; } = new();
 20        public DefenseSolution Critical { get; set; } = new();
 21    }
 22
 23    /// <summary>单套防御方案</summary>
 24    public class DefenseSolution
 25    {
 4626        public AerosolType RecommendedAerosolType { get; set; }
 9927        public string AerosolRationale { get; set; } = string.Empty;
 11928        public CloudDispersal RecommendedCloud { get; set; } = new();
 29        /// <summary>多轮次云团列表(含主云团)</summary>
 9630        public List<CloudDispersal> CloudSalvo { get; set; } = new();
 31
 11532        public List<RecommendedPlatform> Platforms { get; set; } = new();
 9933        public List<RecommendedDetection> Detections { get; set; } = new();
 34
 3235        public float InterceptProbability { get; set; }
 11336        public string SummaryRationale { get; set; } = string.Empty;
 37    }
 38
 39    public class RecommendedPlatform
 40    {
 41        public PlatformType Type { get; set; }
 42        public Vector3 Position { get; set; }
 43        public int Quantity { get; set; }
 44        public int MunitionCount { get; set; }
 45        public float CoverageVolume { get; set; }
 46        public float Cooldown { get; set; } = 5f;
 47        public float MuzzleVelocity { get; set; } = 800f;
 48    }
 49
 50    public class RecommendedDetection
 51    {
 52        public Vector3 Position { get; set; }
 53        public float DetectionRadius { get; set; }
 54        public int Quantity { get; set; }
 55    }
 56
 57    /// <summary>三维向量(纯 C#,不依赖 UnityEngine)</summary>
 58    public struct Vector3
 59    {
 60        public float X, Y, Z;
 61        public Vector3(float x, float y, float z) { X = x; Y = y; Z = z; }
 62
 63        public static Vector3 operator +(Vector3 a, Vector3 b) => new(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
 64        public static Vector3 operator -(Vector3 a, Vector3 b) => new(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
 65        public static Vector3 operator *(Vector3 a, float s) => new(a.X * s, a.Y * s, a.Z * s);
 66        public float Length => (float)System.Math.Sqrt(X * X + Y * Y + Z * Z);
 67        public float DistanceTo(Vector3 other) => (this - other).Length;
 68    }
 69
 70    /// <summary>粒子渲染参数</summary>
 71    public class ParticleParams
 72    {
 73        public float EmitRate { get; set; } = 100;
 74        public float Opacity { get; set; } = 1.0f;
 75        public string ColorHex { get; set; } = "#FFFFFF";
 76        public float SizeMultiplier { get; set; } = 1.0f;
 77    }
 78}