Initial commit

This commit is contained in:
2026-07-13 09:25:40 +07:00
parent c08ff54676
commit bccfb156d7
1938 changed files with 641646 additions and 0 deletions

View File

@@ -0,0 +1,183 @@
@using RobotNet10.Shared.Detection
@using RobotNet10.Shared.Enum
@using RobotNet10.Shared.Numbers
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h6">Create Markers Search Request</MudText>
</TitleContent>
<DialogContent>
<MudGrid Spacing="2">
<MudItem xs="4">
<MudNumericField @bind-Value="_request.X" Label="X (m)" Variant="Variant.Outlined" Step="0.1" />
</MudItem>
<MudItem xs="4">
<MudNumericField @bind-Value="_request.Y" Label="Y (m)" Variant="Variant.Outlined" Step="0.1" />
</MudItem>
<MudItem xs="4">
<MudNumericField @bind-Value="_request.Yaw" Label="Yaw (rad)" Variant="Variant.Outlined" Step="0.1" />
</MudItem>
<MudItem xs="6">
<MudNumericField @bind-Value="_request.Width" Label="Width (m)" Variant="Variant.Outlined" Step="0.1" />
</MudItem>
<MudItem xs="6">
<MudNumericField @bind-Value="_request.Length" Label="Length (m)" Variant="Variant.Outlined" Step="0.1" />
</MudItem>
</MudGrid>
<MudStack Row AlignItems="AlignItems.Center" Class="mt-4 mb-2">
<MudText Typo="Typo.subtitle1">Marker Entries</MudText>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Add" Color="Color.Primary" OnClick="AddMarkerEntry" />
</MudStack>
@for (int i = 0; i < _entries.Count; i++)
{
var index = i;
<MudPaper Class="pa-3 mb-2" Outlined>
<MudStack Row AlignItems="AlignItems.Center">
<MudText Typo="Typo.subtitle2">Marker @(index + 1)</MudText>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Delete" Color="Color.Error" Size="Size.Small"
OnClick="() => RemoveMarkerEntry(index)" />
</MudStack>
<MudGrid Spacing="2" Class="mt-1">
<MudItem xs="6">
<MudTextField @bind-Value="_entries[index].MarkerId" Label="Marker ID" Variant="Variant.Outlined" />
</MudItem>
<MudItem xs="6">
<MudSelect @bind-Value="_entries[index].Type" Label="Type" Variant="Variant.Outlined">
@foreach (var type in System.Enum.GetValues<MarkerType>())
{
<MudSelectItem Value="type">@type</MudSelectItem>
}
</MudSelect>
</MudItem>
<MudItem xs="4">
<MudNumericField @bind-Value="_entries[index].Priority" Label="Priority" Variant="Variant.Outlined" Min="1" />
</MudItem>
<MudItem xs="4">
<MudTextField @bind-Value="_entries[index].DeviceId" Label="Device ID" Variant="Variant.Outlined" />
</MudItem>
<MudItem xs="4">
<MudTextField @bind-Value="_entries[index].Code" Label="Code" Variant="Variant.Outlined" />
</MudItem>
</MudGrid>
<MudStack Row AlignItems="AlignItems.Center" Class="mt-2">
<MudText Typo="Typo.body2">Reference Points</MudText>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.AddCircleOutline" Color="Color.Primary" Size="Size.Small"
OnClick="() => AddReferencePoint(index)" />
</MudStack>
@for (int j = 0; j < _entries[index].ReferencePoints.Count; j++)
{
var ptIndex = j;
<MudStack Row AlignItems="AlignItems.Center" Spacing="2" Class="mt-1">
<MudNumericField @bind-Value="_entries[index].ReferencePoints[ptIndex].X" Label="X" Variant="Variant.Outlined"
Step="0.01" Margin="Margin.Dense" />
<MudNumericField @bind-Value="_entries[index].ReferencePoints[ptIndex].Y" Label="Y" Variant="Variant.Outlined"
Step="0.01" Margin="Margin.Dense" />
<MudIconButton Icon="@Icons.Material.Filled.RemoveCircleOutline" Color="Color.Error" Size="Size.Small"
OnClick="() => RemoveReferencePoint(index, ptIndex)" />
</MudStack>
}
</MudPaper>
}
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">Create</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter] IMudDialogInstance Dialog { get; set; } = null!;
private MarkersSearchRequest _request = new()
{
X = -0.611,
Y = 5.063,
Yaw = 180.0,
Width = 0.3,
Length = 0.3,
MarkerSearchRequests = []
};
private readonly List<MarkerEntryModel> _entries = [
new MarkerEntryModel(){
MarkerId = "trolley-legs",
DeviceId = "sick-lidar-001",
Priority = 1,
Type = MarkerType.ShapeReflective,
ReferencePoints = [
new Vector2Model(){ X=-1.13, Y = 0.55 },
new Vector2Model(){X=1.13, Y=0.55 }
]
},
new MarkerEntryModel(){
MarkerId = "trolley-qr",
DeviceId = "hik-qr-001",
Priority = 2,
Type = MarkerType.QRCode,
Code = "PHENIKAAX",
ReferencePoints = []
}
];
private void AddMarkerEntry()
{
_entries.Add(new MarkerEntryModel { Priority = _entries.Count + 1 });
}
private void RemoveMarkerEntry(int index)
{
_entries.RemoveAt(index);
}
private void AddReferencePoint(int entryIndex)
{
_entries[entryIndex].ReferencePoints.Add(new Vector2Model());
}
private void RemoveReferencePoint(int entryIndex, int ptIndex)
{
_entries[entryIndex].ReferencePoints.RemoveAt(ptIndex);
}
private void Submit()
{
_request.MarkerSearchRequests = _entries.Select(e => new MarkerEntry
{
MarkerId = e.MarkerId ?? string.Empty,
Type = e.Type,
Priority = e.Priority,
DeviceId = e.DeviceId ?? string.Empty,
Code = e.Code ?? string.Empty,
ReferencePoints = e.ReferencePoints.Select(p => new Vector2 { X = p.X, Y = p.Y }).ToArray()
}).ToArray();
Dialog.Close(DialogResult.Ok(_request));
}
private void Cancel() => Dialog.Cancel();
private class MarkerEntryModel
{
public string? MarkerId { get; set; }
public MarkerType Type { get; set; }
public int Priority { get; set; } = 1;
public string? DeviceId { get; set; }
public string? Code { get; set; }
public List<Vector2Model> ReferencePoints { get; set; } = [];
}
private class Vector2Model
{
public double X { get; set; }
public double Y { get; set; }
}
}