1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Newtonsoft.Json;
- using System;
- using System.IO;
- using UnityEngine;
- namespace Assets.StreetLight
- {
- public sealed class Configuration
- {
- //private string outputCalibrationFilesDirectory;
- ///// <summary>
- ///// The directory path where new calibration files are saved when the calibration is run.
- ///// </summary>
- //[JsonRequired]
- //public string OutputCalibrationFilesDirectory
- //{
- // get => outputCalibrationFilesDirectory;
- // set
- // {
- // if (!Directory.Exists(value))
- // {
- // throw new InvalidOperationException($"Directory \"{value}\" does not exist.");
- // }
- // outputCalibrationFilesDirectory = value;
- // }
- //}
- //private string inputCalibrationFilePath;
- ///// <summary>
- ///// The file path to the calibration file that is used as input for the actual calibration.
- ///// </summary>
- //[JsonRequired]
- //public string InputCalibrationFilePath
- //{
- // get => inputCalibrationFilePath;
- // set
- // {
- // if (!File.Exists(value))
- // {
- // throw new InvalidOperationException($"File \"{value}\" does not exist.");
- // }
- // inputCalibrationFilePath = value;
- // }
- //}
- private string homographyFilePath;
- /// <summary>
- /// The file path to the csv file containing the homography for mapping world coodrinates to Unity coordinates.
- /// </summary>
- [JsonRequired]
- public string HomographyFilePath
- {
- get => homographyFilePath;
- set
- {
- if (!File.Exists(value))
- {
- throw new InvalidOperationException($"File \"{value}\" does not exist.");
- }
- homographyFilePath = value;
- }
- }
- private static readonly Lazy<Configuration> lazy = new(() => JsonConvert.DeserializeObject<Configuration>(File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "Configuration.json"))));
- public static Configuration Instance => lazy.Value;
- private Configuration() { }
- }
- }
|