diff --git a/SparkClient.sln.DotSettings.user b/SparkClient.sln.DotSettings.user
index 194dd5b..5cf8b2c 100644
--- a/SparkClient.sln.DotSettings.user
+++ b/SparkClient.sln.DotSettings.user
@@ -38,6 +38,7 @@
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs
index 4820137..7d3e9be 100644
--- a/ViewModel/Grading/GradingResultVM.cs
+++ b/ViewModel/Grading/GradingResultVM.cs
@@ -19,6 +19,8 @@ using System.Windows;
using SharpDX;
using SparkClient.Views.UserControl.ViewportData.Entity;
using SparkClient.ViewModel.Configuration.SettingsPages;
+using SparkClient.Views.UserControl.ViewportData.Helper;
+
namespace SparkClient.ViewModel.Grading;
public class GradingResultVM : BaseViewModel
@@ -105,10 +107,10 @@ public class GradingResultVM : BaseViewModel
colorProperty.Add("TABLE_FACET_COLOR", "TableFacetColor");
colorProperty.Add("UPPER_MAIN_FACET_COLOR", "UpperMainFacetColor");
colorProperty.Add("STAR_FACET_COLOR", "StarFacetColor");
- colorProperty.Add("UPPER_GIRDLE_FACET_COLOR", "UpperGridleFacetColor");
+ colorProperty.Add("UPPER_GIRDLE_FACET_COLOR", "UpperGirdleFacetColor");
colorProperty.Add("GIRDLE_FACET_COLOR", "GirdleFacetColor");
colorProperty.Add("PAVILION_MAIN_FACET_COLOR", "PavilionFacetColor");
- colorProperty.Add("LOWER_GIRDLE_FACET_COLOR", "LowerGridleFacetColor");
+ colorProperty.Add("LOWER_GIRDLE_FACET_COLOR", "LowerGirdleFacetColor");
colorProperty.Add("CULET_COLOR", "CuletFacetColor");
ColorConfigEntity colorConfigEntity = new ColorConfigEntity();
@@ -119,7 +121,7 @@ public class GradingResultVM : BaseViewModel
PropertyInfo? p = type.GetProperty(property.Value);
if (p != null && !string.IsNullOrEmpty(value))
{
- p.SetValue(colorConfigEntity, value);
+ p.SetValue(colorConfigEntity, CommonHelper.HexToColor4(value));
}
}
string data = JsonConvert.SerializeObject(result);
diff --git a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
index 2816627..7180a11 100644
--- a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
+++ b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
@@ -10,6 +10,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Threading;
using HelixToolkit.Wpf.SharpDX;
+using log4net;
using NPOI.OpenXmlFormats.Vml.Office;
using SharpDX;
using SharpDX.Direct3D11;
@@ -23,6 +24,7 @@ namespace SparkClient.Views.UserControl.ViewportData.Helper;
public class ViewportHelperPro
{
+ private static readonly ILog Logger = LogManager.GetLogger(typeof(ViewportHelperPro));
///
/// 对指定类型的面进行标色
///
@@ -420,7 +422,25 @@ public class ViewportHelperPro
return result;
}
-
+
+ public static List GenerateLineTextModelsByType(string type, Color4? textColor = null,
+ bool showAll = false)
+ {
+ var planType = ViewportManager.DicValueParamToFacet[type];
+ List entities = new List();
+ string planCode = "";
+ ViewportManager.ViewportTriangle.ForEach(e =>
+ {
+ if (e.PlaneType == planType && (e.PlaneCode==planCode || string.IsNullOrEmpty(planCode)))
+ {
+ planCode = e.PlaneCode;
+ entities.Add(e);
+ }
+ });
+
+ return GenerateLineTextModels(entities, textColor, showAll);
+ }
+
///
/// 显示线段长度mm
///
@@ -431,43 +451,91 @@ public class ViewportHelperPro
public static List GenerateLineTextModels(List entities,
Color4? textColor = null,bool showAll = false)
{
+ Logger.Info("【面文本生成】开始生成面相关文本信息");
var selFacet = entities;
var selFacetType = entities.First().PlaneType;
var result = new List();
if (selFacetType == PlaneType.Girdle)
{
- if (ViewportManager.MainModelGirdleMaxLines != null || ViewportManager.MainModelGirdleMinLines != null ||
- ViewportManager.MainModelGirdleAvgLines != null)
+ Logger.Info($"【面文本生成】 命中面{selFacetType},是腰");
+ // if (ViewportManager.MainModelGirdleMaxLines != null || ViewportManager.MainModelGirdleMinLines != null ||
+ // ViewportManager.MainModelGirdleAvgLines != null)
+ // {
+ // result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleMaxLines}, new Color4(1f, 0, 0, 1f) ));
+ // result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleMinLines}, new Color4(0f, 1f, 0, 1f) ));
+ // result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleAvgLines}, new Color4(1f, 0.5f, 0, 1f) ));
+ // result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleMaxLines)}mm", ViewportManager.MainModelGirdleMaxLines.Item1, textColor));
+ // result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleMinLines)}mm", ViewportManager.MainModelGirdleMinLines.Item1, textColor));
+ // result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleAvgLines)}mm", ViewportManager.MainModelGirdleAvgLines.Item1, textColor));
+ // }
+ List facetTypeAll =
+ ViewportManager.ViewportTriangle.FindAll(e => e.PlaneType == selFacetType);
+ var groupedDic = facetTypeAll.GroupBy(entity => entity.PlaneCode)
+ .ToDictionary(group => group.Key, group => group.ToList());
+ Logger.Info($"【面文本生成】 腰由{groupedDic.Count}个面组成");
+ foreach (var kv in groupedDic)
{
- result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleMaxLines}, new Color4(1f, 0, 0, 1f) ));
- result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleMinLines}, new Color4(0f, 1f, 0, 1f) ));
- result.Add(DisplayLineModel3D(new List>(){ViewportManager.MainModelGirdleAvgLines}, new Color4(1f, 0.5f, 0, 1f) ));
- result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleMaxLines)}mm", ViewportManager.MainModelGirdleMaxLines.Item1, textColor));
- result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleMinLines)}mm", ViewportManager.MainModelGirdleMinLines.Item1, textColor));
- result.Add(DisplayText3D($"{CalculateLength(ViewportManager.MainModelGirdleAvgLines)}mm", ViewportManager.MainModelGirdleAvgLines.Item1, textColor));
+ var value = kv.Value;
+ var key = kv.Key;
+ var facetIndex = -1;
+ int.TryParse(key.Split("_")[1], out facetIndex);
+ List facetPoints = new List();
+ value.ForEach(e => { facetPoints.Add(e.Point1); facetPoints.Add(e.Point2); facetPoints.Add(e.Point3); });
+ /***
+ * 0 1 2 3
+ * 4 5 6 7
+ * 面id-loop4 = 0 - 高亮左边的竖线 - 波峰 -
+ * 面id-loop4 = 1 - 高亮右边的竖线 - 波谷
+ * 面id-loop4 = 2 - 高亮左边的竖线 - 波谷
+ * 面id-loop4 = 3 - 高亮右边的竖线 - 波峰
+ */
+
}
}
else
{
+ Logger.Info($"【面文本生成】 命中面{selFacetType},不是腰");
//查找同类面
List facetTypeAll =
ViewportManager.ViewportTriangle.FindAll(e => e.PlaneType == selFacetType);
var groupedDic = facetTypeAll.GroupBy(entity => entity.PlaneCode)
.ToDictionary(group => group.Key, group => group.ToList());
-
+ Logger.Info($"【面文本生成】 同类面{groupedDic.Count}个");
foreach (var kv in groupedDic)
{
var value = kv.Value;
var key = kv.Key;
- var facetIndex = key.Split("_")[1];
+ var facetIndex = -1;
+ int.TryParse(key.Split("_")[1], out facetIndex);
List facetPoints = new List();
value.ForEach(e => { facetPoints.Add(e.Point1); facetPoints.Add(e.Point2); facetPoints.Add(e.Point3); });
-
-
-
- var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector);
- result.Add(DisplayText3D($"{key.Split("_")[1]} \r\n 12334", facetTextPoint, textColor));
+
+ if (ViewportManager.DiamondData.Count > 1 && facetIndex != -1)
+ {
+ Logger.Info($"【面文本生成】 钻石数据有效,Index有效");
+ facetIndex += 1;
+ var param = ViewportManager.DicFacetToValueParam[selFacetType];
+ var detail = ViewportManager.DiamondData[$"{param}_DETAIL"];
+ if (detail == null)
+ {
+ Logger.Info($"【面文本生成】 {param}_DETAIL Key不存在");
+ continue;
+ }
+ Logger.Info($"【面文本生成】 {param}_DETAIL == {detail}");
+ var paramValue = detail[$"{param}_{facetIndex}"];
+ if (paramValue == null)
+ {
+ Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{facetIndex} Key不存在");
+ continue;
+ }
+ Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{facetIndex} ==={paramValue}");
+
+ var valueFloat = Math.Round(float.Parse(paramValue.ToString()), MidpointRounding.ToZero);
+ Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}");
+ var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector);
+ result.Add(DisplayText3D($" {facetIndex} \r\n {valueFloat}", facetTextPoint, textColor));
+ }
}
/***
diff --git a/Views/UserControl/ViewportData/Helper/ViewportManager.cs b/Views/UserControl/ViewportData/Helper/ViewportManager.cs
index d18470a..cb47df4 100644
--- a/Views/UserControl/ViewportData/Helper/ViewportManager.cs
+++ b/Views/UserControl/ViewportData/Helper/ViewportManager.cs
@@ -134,6 +134,21 @@ public class ViewportManager
}
ChooseAddModels.Clear();
}
+
+ #region 面 - 数据固定绑定
+ // 选中面 -> 数据
+ public static Dictionary DicFacetToValueParam = new Dictionary()
+ {
+ { PlaneType.UpperMainFacet,"CROWN_ANGLE"},
+ { PlaneType.LowerGirdleFact, "PAV_ANGLE"},
+ };
+ // 数据 -> 面
+ public static Dictionary DicValueParamToFacet = new Dictionary()
+ {
+ {"CROWN_ANGLE", PlaneType.UpperMainFacet},
+ {"PAV_ANGLE", PlaneType.LowerGirdleFact},
+ };
+ #endregion
#endregion
#region 统一控制方法