도면에서 표 추출

This commit is contained in:
horu2day
2025-08-12 14:33:18 +09:00
parent 3abb3c07ce
commit f114b8b642
26 changed files with 4877 additions and 2566 deletions

View File

@@ -8,37 +8,37 @@ using System.Text.Json.Serialization;
public class MappingTableData
{
[JsonPropertyName("mapping_table")]
public MappingTable MappingTable { get; set; }
public MappingTable MappingTable { get; set; } = default!;
}
public class MappingTable
{
[JsonPropertyName("ailabel_to_systems")]
public Dictionary<string, SystemFields> AilabelToSystems { get; set; }
public Dictionary<string, SystemFields> AilabelToSystems { get; set; } = default!;
[JsonPropertyName("system_mappings")]
public SystemMappings SystemMappings { get; set; }
public SystemMappings SystemMappings { get; set; } = default!;
}
public class SystemFields
{
[JsonPropertyName("molit")]
public string Molit { get; set; }
public string Molit { get; set; } = default!;
[JsonPropertyName("expressway")]
public string Expressway { get; set; }
public string Expressway { get; set; } = default!;
[JsonPropertyName("railway")]
public string Railway { get; set; }
public string Railway { get; set; } = default!;
[JsonPropertyName("docaikey")]
public string DocAiKey { get; set; }
public string DocAiKey { get; set; } = default!;
}
public class SystemMappings
{
[JsonPropertyName("expressway_to_transportation")]
public Dictionary<string, string> ExpresswayToTransportation { get; set; }
public Dictionary<string, string> ExpresswayToTransportation { get; set; } = default!;
}
// 필드 매퍼 클래스
@@ -73,7 +73,7 @@ public class FieldMapper
var mappingData = JsonSerializer.Deserialize<MappingTableData>(jsonContent, options);
Console.WriteLine($"[DEBUG] 매핑 테이블 로드 성공: {mappingData?.MappingTable?.AilabelToSystems?.Count ?? 0}개 항목");
return new FieldMapper(mappingData);
return new FieldMapper(mappingData!);
}
catch (JsonException jsonEx)
{
@@ -213,7 +213,7 @@ public class FieldMapper
/// <summary>
/// AI 라벨을 고속도로공사 필드명으로 변환
/// </summary>
public string AilabelToExpressway(string ailabel)
public string? AilabelToExpressway(string ailabel)
{
if (_mappingData.MappingTable.AilabelToSystems.TryGetValue(ailabel, out var systemFields))
{
@@ -225,7 +225,7 @@ public class FieldMapper
/// <summary>
/// AI 라벨을 DocAiKey 값으로 변환
/// </summary>
public string AilabelToDocAiKey(string ailabel)
public string? AilabelToDocAiKey(string ailabel)
{
if (_mappingData.MappingTable.AilabelToSystems.TryGetValue(ailabel, out var systemFields))
{
@@ -237,7 +237,7 @@ public class FieldMapper
/// <summary>
/// 고속도로공사 필드명을 교통부 필드명으로 변환
/// </summary>
public string ExpresswayToTransportation(string expresswayField)
public string? ExpresswayToTransportation(string expresswayField)
{
if (_mappingData.MappingTable.SystemMappings.ExpresswayToTransportation.TryGetValue(expresswayField, out var transportationField))
{
@@ -249,7 +249,7 @@ public class FieldMapper
/// <summary>
/// DocAiKey 값으로부터 해당하는 AI 라벨을 반환
/// </summary>
public string DocAiKeyToAilabel(string docAiKey)
public string? DocAiKeyToAilabel(string docAiKey)
{
if (string.IsNullOrEmpty(docAiKey))
{
@@ -269,7 +269,7 @@ public class FieldMapper
/// <summary>
/// Expressway 필드값으로부터 해당하는 AI 라벨을 반환
/// </summary>
public string ExpresswayToAilabel(string expresswayField)
public string? ExpresswayToAilabel(string expresswayField)
{
if (string.IsNullOrEmpty(expresswayField))
{
@@ -289,7 +289,7 @@ public class FieldMapper
/// <summary>
/// AI 라벨 → 고속도로공사 → 교통부 순서로 변환
/// </summary>
public string AilabelToTransportationViaExpressway(string ailabel)
public string? AilabelToTransportationViaExpressway(string ailabel)
{
var expresswayField = AilabelToExpressway(ailabel);
if (!string.IsNullOrEmpty(expresswayField))
@@ -302,7 +302,7 @@ public class FieldMapper
/// <summary>
/// AI 라벨에 해당하는 모든 시스템의 필드명을 반환
/// </summary>
public SystemFields GetAllSystemFields(string ailabel)
public SystemFields? GetAllSystemFields(string ailabel)
{
if (_mappingData.MappingTable.AilabelToSystems.TryGetValue(ailabel, out var systemFields))
{
@@ -314,9 +314,9 @@ public class FieldMapper
/// <summary>
/// 여러 AI 라벨을 한번에 고속도로공사 필드명으로 변환
/// </summary>
public Dictionary<string, string> BatchConvertAilabelToExpressway(IEnumerable<string> ailabels)
public Dictionary<string, string?> BatchConvertAilabelToExpressway(IEnumerable<string> ailabels)
{
var results = new Dictionary<string, string>();
var results = new Dictionary<string, string?>();
foreach (var label in ailabels)
{
results[label] = AilabelToExpressway(label);
@@ -327,9 +327,9 @@ public class FieldMapper
/// <summary>
/// 여러 고속도로공사 필드를 한번에 교통부 필드명으로 변환
/// </summary>
public Dictionary<string, string> BatchConvertExpresswayToTransportation(IEnumerable<string> expresswayFields)
public Dictionary<string, string?> BatchConvertExpresswayToTransportation(IEnumerable<string> expresswayFields)
{
var results = new Dictionary<string, string>();
var results = new Dictionary<string, string?>();
foreach (var field in expresswayFields)
{
results[field] = ExpresswayToTransportation(field);