117 lines
3.6 KiB
C#
117 lines
3.6 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace TellmePdmsPluging.Models
|
|
{
|
|
public class ShrinkwrapModelRequest
|
|
{
|
|
public string ExecutionId { get; set; }
|
|
public string execution_id { get { return ExecutionId; } set { ExecutionId = value; } }
|
|
|
|
public bool DryRun { get; set; } = false;
|
|
|
|
public bool SkipLinkedElements { get; set; } = false;
|
|
|
|
public double Padding { get; set; } = 500.0;
|
|
|
|
public double TouchTolerance { get; set; } = 1.0;
|
|
|
|
public List<string> ZoneFilters
|
|
{
|
|
get { return _zoneFilters; }
|
|
set { _zoneFilters = NormalizeList(value); }
|
|
}
|
|
|
|
public List<string> KeepTypes
|
|
{
|
|
get { return _keepTypes; }
|
|
set { _keepTypes = NormalizeList(value); }
|
|
}
|
|
|
|
private List<string> _zoneFilters;
|
|
private List<string> _keepTypes;
|
|
|
|
public void ApplyDefaults()
|
|
{
|
|
if (_keepTypes == null || _keepTypes.Count == 0)
|
|
{
|
|
_keepTypes = new List<string> { "SITE", "ZONE", "STRU", "FRAME", "SHELL", "PLAT", "WALL" };
|
|
}
|
|
|
|
if (_zoneFilters == null)
|
|
{
|
|
_zoneFilters = new List<string>();
|
|
}
|
|
}
|
|
|
|
private static List<string> NormalizeList(IEnumerable<string> source)
|
|
{
|
|
if (source == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var normalized = new List<string>();
|
|
|
|
foreach (var item in source)
|
|
{
|
|
if (IsNullOrWhiteSpace(item))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var formatted = item.Trim().ToUpperInvariant();
|
|
if (!normalized.Contains(formatted))
|
|
{
|
|
normalized.Add(formatted);
|
|
}
|
|
}
|
|
|
|
return normalized;
|
|
}
|
|
|
|
private static bool IsNullOrWhiteSpace(string value)
|
|
{
|
|
if (value == null)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
for (int i = 0; i < value.Length; i++)
|
|
{
|
|
if (!char.IsWhiteSpace(value[i]))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public class ShrinkwrapModelResult
|
|
{
|
|
public bool Success { get; set; }
|
|
public bool DryRun { get; set; }
|
|
public bool SkipLinkedElements { get; set; }
|
|
public double Padding { get; set; }
|
|
public string DeletionMode { get; set; }
|
|
public bool UsedExactSpatial { get; set; }
|
|
public int TotalVisited { get; set; }
|
|
public int RemovedCount { get; set; }
|
|
public int KeptCount { get; set; }
|
|
public int ShellKeptCount { get; set; }
|
|
public int SkippedLinkedCount { get; set; }
|
|
public int SkippedUnsafeCount { get; set; }
|
|
public List<string> RemovedElements { get; set; } = new List<string>();
|
|
public List<string> SkippedLinkedElements { get; set; } = new List<string>();
|
|
public List<string> SkippedUnsafeElements { get; set; } = new List<string>();
|
|
public List<string> Errors { get; set; } = new List<string>();
|
|
public List<string> FatalErrors { get; set; } = new List<string>();
|
|
public List<string> ProcessedDbNames { get; set; } = new List<string>();
|
|
public List<string> ZoneSummaries { get; set; } = new List<string>();
|
|
public System.DateTime StartedAt { get; set; }
|
|
public System.DateTime CompletedAt { get; set; }
|
|
public string Message { get; set; }
|
|
}
|
|
}
|