feat: read Plant 3D Ortho context and viewports
This commit is contained in:
@@ -1,5 +1,117 @@
|
||||
namespace PRecAnnot.Abstractions;
|
||||
|
||||
public sealed record RuntimeDiagnostic
|
||||
{
|
||||
public required string Code { get; init; }
|
||||
public required string Message { get; init; }
|
||||
public string Severity { get; init; } = "Warning";
|
||||
}
|
||||
|
||||
public enum OrthoDetectionStatus { Confirmed, NotOrtho, Ambiguous, Unsupported, Failed }
|
||||
|
||||
public sealed record OrthoDetectionResult
|
||||
{
|
||||
public required OrthoDetectionStatus Status { get; init; }
|
||||
public required IReadOnlyList<string> Evidence { get; init; }
|
||||
public required IReadOnlyList<RuntimeDiagnostic> Diagnostics { get; init; }
|
||||
}
|
||||
|
||||
public readonly record struct Point2Dto(double X, double Y);
|
||||
public readonly record struct Point3Dto(double X, double Y, double Z);
|
||||
public readonly record struct Vector2Dto(double X, double Y);
|
||||
public sealed record Bounds2Dto(Point2Dto Minimum, Point2Dto Maximum);
|
||||
|
||||
public sealed record GeometrySnapshot
|
||||
{
|
||||
public Point3Dto? WorldPosition { get; init; }
|
||||
public Point2Dto? PaperPosition { get; init; }
|
||||
public Bounds2Dto? ProjectedBounds { get; init; }
|
||||
public double? Rotation { get; init; }
|
||||
public double? Elevation { get; init; }
|
||||
}
|
||||
|
||||
public sealed record OrthoViewportInfo
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DisplayName { get; init; }
|
||||
public double CenterX { get; init; }
|
||||
public double CenterY { get; init; }
|
||||
public double Width { get; init; }
|
||||
public double Height { get; init; }
|
||||
public double Scale { get; init; }
|
||||
public double TwistAngle { get; init; }
|
||||
public bool IsOn { get; init; }
|
||||
public bool IsLocked { get; init; }
|
||||
public string? SourceDrawingName { get; init; }
|
||||
public string? ViewName { get; init; }
|
||||
}
|
||||
|
||||
public sealed record PlantObjectSnapshot
|
||||
{
|
||||
public required string SnapshotId { get; init; }
|
||||
public required string ObjectClass { get; init; }
|
||||
public string? Tag { get; init; }
|
||||
public string? LineNumber { get; init; }
|
||||
public string? SupportNumber { get; init; }
|
||||
public string? EquipmentNumber { get; init; }
|
||||
public required GeometrySnapshot Geometry { get; init; }
|
||||
public IReadOnlyDictionary<string, string?> Properties { get; init; } = new Dictionary<string, string?>();
|
||||
public IReadOnlyList<string> Diagnostics { get; init; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
public sealed record PlantRuntimeContext
|
||||
{
|
||||
public bool HasActiveDocument { get; init; }
|
||||
public bool HasPlantProject { get; init; }
|
||||
public bool IsOrthoDrawing { get; init; }
|
||||
public string? DrawingName { get; init; }
|
||||
public string? ProjectDisplayName { get; init; }
|
||||
public IReadOnlyList<OrthoViewportInfo> Viewports { get; init; } = Array.Empty<OrthoViewportInfo>();
|
||||
public IReadOnlyList<RuntimeDiagnostic> Diagnostics { get; init; } = Array.Empty<RuntimeDiagnostic>();
|
||||
public OrthoDetectionResult Detection { get; init; } = new() { Status = OrthoDetectionStatus.Unsupported, Evidence = Array.Empty<string>(), Diagnostics = Array.Empty<RuntimeDiagnostic>() };
|
||||
}
|
||||
|
||||
public interface IPlantRuntimeContextReader { PlantRuntimeContext ReadCurrentContext(); }
|
||||
public interface IOrthoViewportReader { IReadOnlyList<OrthoViewportInfo> ReadViewports(CancellationToken cancellationToken); }
|
||||
|
||||
public enum AnnotationOperationKind { Create, Update, Skip, Conflict, Unsupported }
|
||||
|
||||
public sealed record AnnotationOperationPlan
|
||||
{
|
||||
public required string SourceSnapshotId { get; init; }
|
||||
public required AnnotationOperationKind Kind { get; init; }
|
||||
public string? AnnotationType { get; init; }
|
||||
public string? Text { get; init; }
|
||||
public Point2Dto? Position { get; init; }
|
||||
public double? Rotation { get; init; }
|
||||
public string? ExistingAnnotationId { get; init; }
|
||||
public required IReadOnlyList<string> Reasons { get; init; }
|
||||
}
|
||||
|
||||
public sealed record AnnotationPlanSummary
|
||||
{
|
||||
public int ObjectsExamined { get; init; }
|
||||
public int CreateCount { get; init; }
|
||||
public int UpdateCount { get; init; }
|
||||
public int SkipCount { get; init; }
|
||||
public int ConflictCount { get; init; }
|
||||
public int UnsupportedCount { get; init; }
|
||||
public int WarningCount { get; init; }
|
||||
public int ErrorCount { get; init; }
|
||||
}
|
||||
|
||||
public sealed record AnnotationPlanningRequest
|
||||
{
|
||||
public required string CommandName { get; init; }
|
||||
public required OrthoViewportInfo Viewport { get; init; }
|
||||
public IReadOnlyList<PlantObjectSnapshot> Objects { get; init; } = Array.Empty<PlantObjectSnapshot>();
|
||||
public IReadOnlyList<ExistingAnnotation> Existing { get; init; } = Array.Empty<ExistingAnnotation>();
|
||||
}
|
||||
|
||||
public interface IAnnotationPlanBuilder { AnnotationPlan Build(AnnotationPlanningRequest request); }
|
||||
public enum PRecAnnotExecutionMode { Smoke, DryRun, Apply }
|
||||
public interface IRuntimeWriteGuard { void EnsureWriteAllowed(string operation); }
|
||||
|
||||
public sealed record OrthoViewportRef(string DrawingId, string ViewportId);
|
||||
|
||||
public sealed record PlantObjectData
|
||||
@@ -36,6 +148,11 @@ public sealed record AnnotationIntent
|
||||
|
||||
public sealed record AnnotationPlan
|
||||
{
|
||||
public string PlanId { get; init; } = string.Empty;
|
||||
public string CommandName { get; init; } = string.Empty;
|
||||
public IReadOnlyList<AnnotationOperationPlan> Operations { get; init; } = Array.Empty<AnnotationOperationPlan>();
|
||||
public IReadOnlyList<RuntimeDiagnostic> Diagnostics { get; init; } = Array.Empty<RuntimeDiagnostic>();
|
||||
public AnnotationPlanSummary Summary { get; init; } = new();
|
||||
public required IReadOnlyList<AnnotationIntent> Create { get; init; }
|
||||
public required IReadOnlyList<AnnotationIntent> Update { get; init; }
|
||||
public required IReadOnlyList<string> Delete { get; init; }
|
||||
@@ -58,7 +175,7 @@ public interface IOrthoDrawingContext
|
||||
|
||||
public interface IPlantObjectReader
|
||||
{
|
||||
IReadOnlyList<PlantObjectData> ReadObjects(OrthoViewportRef viewport, CancellationToken cancellationToken);
|
||||
IReadOnlyList<PlantObjectSnapshot> ReadObjects(OrthoViewportInfo viewport, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IAnnotationRepository
|
||||
|
||||
Reference in New Issue
Block a user