2024-11-08 09:23:36 +03:00
|
|
|
|
using VisionClient.Services;
|
|
|
|
|
|
|
|
|
|
namespace RhSolutions.Tools;
|
2023-04-14 08:08:46 +03:00
|
|
|
|
|
|
|
|
|
internal class ToolFactory
|
|
|
|
|
{
|
2024-11-06 23:43:00 +03:00
|
|
|
|
static ReaderFactory readerFactory = RhSolutionsAddIn.ServiceProvider.GetService<ReaderFactory>();
|
|
|
|
|
static WriterFactory writerFactory = RhSolutionsAddIn.ServiceProvider.GetService<WriterFactory>();
|
|
|
|
|
static FittingsCalculatorFactory fittingsCalculatorFactory = RhSolutionsAddIn.ServiceProvider.GetService<FittingsCalculatorFactory>();
|
2024-11-07 23:05:19 +03:00
|
|
|
|
static Application application = RhSolutionsAddIn.ServiceProvider.GetService<Application>();
|
2024-11-08 09:23:36 +03:00
|
|
|
|
static IYandexVisionClient yandexClinet = RhSolutionsAddIn.ServiceProvider.GetService<IYandexVisionClient>();
|
2023-06-20 11:51:52 +03:00
|
|
|
|
|
2024-11-06 23:43:00 +03:00
|
|
|
|
public Tool GetTool(string toolName)
|
|
|
|
|
{
|
|
|
|
|
Tool tool = toolName switch
|
|
|
|
|
{
|
|
|
|
|
"export" => new ExportTool(readerFactory, writerFactory),
|
|
|
|
|
"convert" => new ConvertTool(readerFactory, writerFactory),
|
|
|
|
|
"merge" => new MergeTool(readerFactory, writerFactory),
|
|
|
|
|
"dxfexport" => new DxfTool(readerFactory, writerFactory),
|
|
|
|
|
"guess" => new GuessTool(readerFactory, writerFactory),
|
|
|
|
|
"fillsleeves" => new FittingsTool(readerFactory, writerFactory, fittingsCalculatorFactory, "Sleeves"),
|
|
|
|
|
"fillcouplings" => new FittingsTool(readerFactory, writerFactory, fittingsCalculatorFactory, "Couplings"),
|
2024-11-08 09:23:36 +03:00
|
|
|
|
"ocr" => new OcrTool(readerFactory, writerFactory, application, yandexClinet),
|
2024-11-06 23:43:00 +03:00
|
|
|
|
_ => throw new Exception($"Неизвестный инструмент {toolName}"),
|
|
|
|
|
};
|
|
|
|
|
return tool;
|
|
|
|
|
}
|
2023-04-14 08:08:46 +03:00
|
|
|
|
}
|