feat: add s9

master
tongg 8 months ago
parent 5985161bee
commit 1cafae3de8
  1. 26
      Model/Services/SOCClientService.cs
  2. 1
      ViewModel/Grading/DiamondSelectVM.cs
  3. 1
      ViewModel/Grading/GradingLoadingVM.cs
  4. 1
      Views/UserControl/Viewport3D.xaml.cs
  5. 2
      Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
  6. 12
      Views/UserControl/ViewportData/Helper/ViewportManager.cs

@ -125,30 +125,32 @@ namespace SparkClient.Model.Services
int lightLevel = 0; int lightLevel = 0;
string halfCircle = string.Empty; string halfCircle = string.Empty;
// 查询光照度和半圆配置 // 查询光照度和半圆配置
string sql = $"SELECT KEY, VALUE FROM CUTTER_CONFIG WHERE KEY IN ('light_level', 'half_circle')"; string sql = $"SELECT KEY, VALUE FROM CUTTER_CONFIG ";
DataTable table = DataBaseHelper.ExecuteQuery(sql); DataTable table = DataBaseHelper.ExecuteQuery(sql);
if (table == null || table.Rows.Count == 0) if (table == null || table.Rows.Count == 0)
{ {
throw new Exception("No data found for the specified keys."); throw new Exception("No data found for the specified keys.");
} }
StringBuilder sbParams = new StringBuilder();
foreach (DataRow row in table.Rows) foreach (DataRow row in table.Rows)
{ {
string key = row["Key"].ToString() ?? string.Empty; string key = row["Key"].ToString() ?? string.Empty;
string value = row["Value"].ToString() ?? string.Empty; string value = row["Value"].ToString() ?? string.Empty;
if (key == "light_level" && int.TryParse(value, out int parsedLightLevel)) // if (key == "light_level" && int.TryParse(value, out int parsedLightLevel))
{ // {
lightLevel = parsedLightLevel; // 光照度 // lightLevel = parsedLightLevel; // 光照度
} // }
else if (key == "half_circle") // else if (key == "half_circle")
{ // {
halfCircle = value; // 半圆 // halfCircle = value; // 半圆
} // }
sbParams.Append($"{key}={value}&");
} }
string url = $"{_baseUrl}/collect_images?light_level={lightLevel}&half_circle={halfCircle}"; // string url = $"{_baseUrl}/collect_images?light_level={lightLevel}&half_circle={halfCircle}";
string url = $"{_baseUrl}/collect_images?{sbParams.ToString().Substring(0, sbParams.ToString().Length - 1)}";
var response = await SendGetRequestAsync<ResponseStatus>(url); var response = await SendGetRequestAsync<ResponseStatus>(url);
@ -196,7 +198,7 @@ namespace SparkClient.Model.Services
int lightLevel = 0; int lightLevel = 0;
string halfCircle = string.Empty; string halfCircle = string.Empty;
// 查询光照度和半圆配置 // 查询光照度和半圆配置
string sql = $"SELECT KEY, VALUE FROM CUTTER_CONFIG WHERE KEY IN ('light_level', 'half_circle')"; string sql = $"SELECT KEY, VALUE FROM CUTTER_CONFIG ";
DataTable table = DataBaseHelper.ExecuteQuery(sql); DataTable table = DataBaseHelper.ExecuteQuery(sql);
if (table == null || table.Rows.Count == 0) if (table == null || table.Rows.Count == 0)

@ -136,6 +136,7 @@ public class DiamondSelectVM : BaseViewModel
new ButtonViewModel() { Text = "P8-P8 Stage 6", ImageSource = bitmap, Type = "ROUND P8 P8 S6", Command = StartGradingCommand, IsFocused = true}, new ButtonViewModel() { Text = "P8-P8 Stage 6", ImageSource = bitmap, Type = "ROUND P8 P8 S6", Command = StartGradingCommand, IsFocused = true},
new ButtonViewModel() { Text = "P8-P8 Stage 7", ImageSource = bitmap_p8p8s7, Type = "ROUND P8 P8 S7", Command = StartGradingCommand, IsFocused = true}, new ButtonViewModel() { Text = "P8-P8 Stage 7", ImageSource = bitmap_p8p8s7, Type = "ROUND P8 P8 S7", Command = StartGradingCommand, IsFocused = true},
new ButtonViewModel() { Text = "P8-P8 Stage 8", ImageSource = bitmap_p8p8s8, Type = "ROUND P8 P8 S8", Command = StartGradingCommand, IsFocused = true}, new ButtonViewModel() { Text = "P8-P8 Stage 8", ImageSource = bitmap_p8p8s8, Type = "ROUND P8 P8 S8", Command = StartGradingCommand, IsFocused = true},
new ButtonViewModel() { Text = "P8-P8 Stage 9", ImageSource = bitmap, Type = "ROUND P8 P8 S9", Command = StartGradingCommand, IsFocused = true},
new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}, new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true},
}; };

@ -166,6 +166,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
_progressCts.Cancel(); _progressCts.Cancel();
this.Dispose(); this.Dispose();
_monitorTimer.Dispose(); _monitorTimer.Dispose();
SOCClientService.Service.OpenPump(false);
return; return;
} }
_monitorTimer.Change(500, Timeout.Infinite); _monitorTimer.Change(500, Timeout.Infinite);

@ -106,6 +106,7 @@ public partial class Viewport3D
switch (step) switch (step)
{ {
case "S1": case "S1":
case "S9":
case "S4": case "S4":
ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete);
ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete);

@ -2491,6 +2491,7 @@ public class ViewportHelperPro
Dictionary<string, HashSet<PlaneType>> stepPlaneMappings = new() Dictionary<string, HashSet<PlaneType>> stepPlaneMappings = new()
{ {
["S1"] = new() { PlaneType.CrownIncomplete }, ["S1"] = new() { PlaneType.CrownIncomplete },
["S9"] = new() { PlaneType.CrownIncomplete },
["S2"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet }, ["S2"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet },
["S3"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet }, ["S3"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet },
["S4"] = new() { PlaneType.CrownIncomplete }, ["S4"] = new() { PlaneType.CrownIncomplete },
@ -2512,6 +2513,7 @@ public class ViewportHelperPro
Dictionary<string, Dictionary<PlaneType, string[]>> stepPlaneMappings = new() Dictionary<string, Dictionary<PlaneType, string[]>> stepPlaneMappings = new()
{ {
["S1"] = new (){[PlaneType.CrownIncomplete] = ["CROWN_ANGLE", "CROWN_HEIGHT"]}, ["S1"] = new (){[PlaneType.CrownIncomplete] = ["CROWN_ANGLE", "CROWN_HEIGHT"]},
["S9"] = new (){[PlaneType.CrownIncomplete] = ["CROWN_ANGLE", "CROWN_HEIGHT"]},
["S2"] = new() { ["S2"] = new() {
[PlaneType.CrownIncomplete] = ["CROWN_ANGLE", "CROWN_HEIGHT"], [PlaneType.CrownIncomplete] = ["CROWN_ANGLE", "CROWN_HEIGHT"],
[PlaneType.StarFacet] = ["STAR_ANGLE","STAR"] [PlaneType.StarFacet] = ["STAR_ANGLE","STAR"]

@ -392,12 +392,16 @@ public class ViewportManager
var center = ViewportManager.ModelBounds.Center; var center = ViewportManager.ModelBounds.Center;
var maxDimension = ViewportManager.ModelBounds.Size.Length(); var maxDimension = ViewportManager.ModelBounds.Size.Length();
var distance = maxDimension * 1.2; // 调整相机到模型的距离,保证视野范围内 var distance = maxDimension * 1.0; // 调整相机到模型的距离,保证视野范围内
var camera = _viewport.Camera as HelixToolkit.Wpf.SharpDX.OrthographicCamera; var camera = _viewport.Camera as HelixToolkit.Wpf.SharpDX.OrthographicCamera;
camera.Position = new Point3D(center.X, center.Y - distance, center.Z); // 从底部看,Y轴负方向 // camera.Position = new Point3D(center.X, center.Y - distance, center.Z); // 从底部看,Y轴负方向
camera.UpDirection = new Vector3D(0, 0, -1); // camera.UpDirection = new Vector3D(0, 0, -1);
camera.LookDirection = new Vector3D(center.X - camera.Position.X, center.Y - camera.Position.Y, center.Z - camera.Position.Z); // camera.LookDirection = new Vector3D(center.X - camera.Position.X, center.Y - camera.Position.Y, center.Z - camera.Position.Z);
camera.LookDirection = new Vector3D(0,141.818f,0);
camera.UpDirection = new Vector3D(-1, 0, 0);
camera.Position = new Point3D(0.005f, -139.954f, 0.005f);
_viewport.RenderHost.MSAA = MSAALevel.Maximum; _viewport.RenderHost.MSAA = MSAALevel.Maximum;
InitMeshLines(); InitMeshLines();
} }

Loading…
Cancel
Save