165 lines
5.3 KiB
C#
165 lines
5.3 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace RobotNet10.MapManager.Data;
|
|
|
|
/// <summary>
|
|
/// Editor-specific settings for each layout level
|
|
/// NOT part of VDMA LIF standard - UI/Editor extensions only
|
|
/// </summary>
|
|
[Table("LayoutLevelEditorSettings")]
|
|
public class LayoutLevelEditorSettings
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Parent layout level reference (1-to-1 relationship)
|
|
/// </summary>
|
|
[Required]
|
|
public Guid LevelId { get; set; }
|
|
|
|
// ==========================================
|
|
// EDGE SETTINGS
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// Minimum edge length (in METERS) required to create an edge
|
|
/// Prevents accidental creation of very short edges
|
|
/// Default: 0.1 meters (10 cm)
|
|
/// </summary>
|
|
[Required]
|
|
public double EdgeMinLengthCreate { get; set; } = 0.5;
|
|
|
|
/// <summary>
|
|
/// Auto-generate edge names when creating new edges
|
|
/// Uses 8-character GUID: "Edge_a7f2e3b1"
|
|
/// </summary>
|
|
[Required]
|
|
public bool EdgeNameAutoGenerate { get; set; } = false;
|
|
|
|
// ==========================================
|
|
// NODE SETTINGS
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// Auto-generate node names when creating new nodes
|
|
/// Uses 8-character GUID: "Node_a7f2e3b1"
|
|
/// </summary>
|
|
[Required]
|
|
public bool NodeNameAutoGenerate { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Node proximity radius (in METERS) for edge creation
|
|
/// When creating an edge, if start/end point is within this radius of an existing node,
|
|
/// the edge will connect to that existing node instead of creating a new one
|
|
/// Default: 0.35 meters (35 cm)
|
|
/// </summary>
|
|
[Required]
|
|
public double NodeProximityRadius { get; set; } = 0.35;
|
|
|
|
// ==========================================
|
|
// COORDINATE SYSTEM SETTINGS
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// World coordinate origin X in METERS
|
|
/// Defines where the world coordinate system (0, 0) is located
|
|
/// Default: 0.0
|
|
/// </summary>
|
|
[Required]
|
|
public double OriginX { get; set; } = 0.0;
|
|
|
|
/// <summary>
|
|
/// World coordinate origin Y in METERS
|
|
/// Defines where the world coordinate system (0, 0) is located
|
|
/// Default: 0.0
|
|
/// </summary>
|
|
[Required]
|
|
public double OriginY { get; set; } = 0.0;
|
|
|
|
/// <summary>
|
|
/// Resolution: Meters per pixel
|
|
/// Conversion factor between world coordinates (meters) and image coordinates (pixels)
|
|
/// Example: 0.05 means 1 pixel = 5 cm in real world
|
|
/// Default: 0.05 (5 cm per pixel)
|
|
/// </summary>
|
|
[Required]
|
|
public double Resolution { get; set; } = 0.05;
|
|
|
|
// ==========================================
|
|
// COORDINATE BOUNDS (World Coordinates)
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// Minimum X boundary in METERS (world coordinates)
|
|
/// Defines the leftmost valid coordinate for this level
|
|
/// Optional: null means no limit
|
|
/// </summary>
|
|
public double? BoundsMinX { get; set; }
|
|
|
|
/// <summary>
|
|
/// Maximum X boundary in METERS (world coordinates)
|
|
/// Defines the rightmost valid coordinate for this level
|
|
/// Optional: null means no limit
|
|
/// </summary>
|
|
public double? BoundsMaxX { get; set; }
|
|
|
|
/// <summary>
|
|
/// Minimum Y boundary in METERS (world coordinates)
|
|
/// Defines the bottom valid coordinate for this level
|
|
/// Optional: null means no limit
|
|
/// </summary>
|
|
public double? BoundsMinY { get; set; }
|
|
|
|
/// <summary>
|
|
/// Maximum Y boundary in METERS (world coordinates)
|
|
/// Defines the top valid coordinate for this level
|
|
/// Optional: null means no limit
|
|
/// </summary>
|
|
public double? BoundsMaxY { get; set; }
|
|
|
|
// ==========================================
|
|
// BACKGROUND IMAGE SETTINGS
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// Background image width in PIXELS
|
|
/// Represents the actual pixel dimensions of the image file
|
|
/// Used for rendering and coordinate conversion
|
|
/// </summary>
|
|
public double? ImageWidth { get; set; }
|
|
|
|
/// <summary>
|
|
/// Background image height in PIXELS
|
|
/// Represents the actual pixel dimensions of the image file
|
|
/// Used for rendering and coordinate conversion
|
|
/// </summary>
|
|
public double? ImageHeight { get; set; }
|
|
|
|
// ==========================================
|
|
// METADATA
|
|
// ==========================================
|
|
|
|
/// <summary>
|
|
/// When these settings were created
|
|
/// </summary>
|
|
[Required]
|
|
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
|
|
|
/// <summary>
|
|
/// Last time these settings were modified
|
|
/// </summary>
|
|
[Required]
|
|
public DateTime ModifiedDate { get; set; } = DateTime.UtcNow;
|
|
|
|
// ==========================================
|
|
// NAVIGATION PROPERTIES
|
|
// ==========================================
|
|
|
|
[ForeignKey(nameof(LevelId))]
|
|
public virtual LayoutLevel Level { get; set; } = null!;
|
|
}
|
|
|