|
|
@ -521,16 +521,6 @@ public class ViewportHelperPro |
|
|
|
if (selFacetType == PlaneType.Girdle && string.IsNullOrWhiteSpace(valKey)) |
|
|
|
if (selFacetType == PlaneType.Girdle && string.IsNullOrWhiteSpace(valKey)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Logger.Info($"【面文本生成】 命中面{selFacetType},是腰"); |
|
|
|
Logger.Info($"【面文本生成】 命中面{selFacetType},是腰"); |
|
|
|
// if (ViewportManager.MainModelGirdleMaxLines != null || ViewportManager.MainModelGirdleMinLines != null || |
|
|
|
|
|
|
|
// ViewportManager.MainModelGirdleAvgLines != null) |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// result.Add(DisplayLineModel3D(new List<Tuple<Vector3,Vector3>>(){ViewportManager.MainModelGirdleMaxLines}, new Color4(1f, 0, 0, 1f) )); |
|
|
|
|
|
|
|
// result.Add(DisplayLineModel3D(new List<Tuple<Vector3,Vector3>>(){ViewportManager.MainModelGirdleMinLines}, new Color4(0f, 1f, 0, 1f) )); |
|
|
|
|
|
|
|
// result.Add(DisplayLineModel3D(new List<Tuple<Vector3,Vector3>>(){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<Viewport3DTriangleEntity> facetTypeAll = |
|
|
|
List<Viewport3DTriangleEntity> facetTypeAll = |
|
|
|
ViewportManager.ViewportTriangle.FindAll(e => e.PlaneType == selFacetType); |
|
|
|
ViewportManager.ViewportTriangle.FindAll(e => e.PlaneType == selFacetType); |
|
|
|
var groupedDic = facetTypeAll.GroupBy(entity => entity.PlaneCode) |
|
|
|
var groupedDic = facetTypeAll.GroupBy(entity => entity.PlaneCode) |
|
|
@ -615,27 +605,7 @@ public class ViewportHelperPro |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {valueIndex}"); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {valueIndex}"); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint)); |
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint)); |
|
|
|
// foreach (var kv in groupedDic) |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// var value = kv.Value; |
|
|
|
|
|
|
|
// var key = kv.Key; |
|
|
|
|
|
|
|
// var facetIndex = -1; |
|
|
|
|
|
|
|
// int.TryParse(key.Split("_")[1], out facetIndex); |
|
|
|
|
|
|
|
// List<Vector3> facetPoints = new List<Vector3>(); |
|
|
|
|
|
|
|
// value.ForEach(e => { facetPoints.Add(e.Point1); facetPoints.Add(e.Point2); facetPoints.Add(e.Point3); }); |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// int linePointType = facetIndex % 4; |
|
|
|
|
|
|
|
// /*** |
|
|
|
|
|
|
|
// * 0 1 2 3 |
|
|
|
|
|
|
|
// * 4 5 6 7 |
|
|
|
|
|
|
|
// * 面index+1 % 4 = 0 |
|
|
|
|
|
|
|
// * 面id-loop4 = 0 - 高亮左边的竖线 - 波峰 - |
|
|
|
|
|
|
|
// * 面id-loop4 = 1 - 高亮右边的竖线 - 波谷 |
|
|
|
|
|
|
|
// * 面id-loop4 = 2 - 高亮左边的竖线 - 波谷 |
|
|
|
|
|
|
|
// * 面id-loop4 = 3 - 高亮右边的竖线 - 波峰 |
|
|
|
|
|
|
|
// */ |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} else if (selFacetType == PlaneType.Girdle && !string.IsNullOrWhiteSpace(valKey)) |
|
|
|
} else if (selFacetType == PlaneType.Girdle && !string.IsNullOrWhiteSpace(valKey)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Logger.Info($"【面文本生成】 命中面{selFacetType},是腰,显示值{valKey}"); |
|
|
|
Logger.Info($"【面文本生成】 命中面{selFacetType},是腰,显示值{valKey}"); |
|
|
@ -697,8 +667,8 @@ public class ViewportHelperPro |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
result.Add(DisplayLineModel3D(new List<Tuple<Vector3, Vector3>>() { showLine }, new Color4(1f, 0, 0, 1f), 2f)); |
|
|
|
result.Add(DisplayLineModel3D(new List<Tuple<Vector3, Vector3>>() { showLine }, new Color4(1f, 0, 0, 1f), 2f)); |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), valKey); |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), valKey, true); |
|
|
|
result.Add(DisplayText3D($" {resIndex} \r\n {valueFloat}", facetTextPoint)); |
|
|
|
result.Add(DisplayText3D($"{valueFloat} \r\n {resIndex}", facetTextPoint)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -712,6 +682,36 @@ public class ViewportHelperPro |
|
|
|
.ToDictionary(group => group.Key, group => group.ToList()); |
|
|
|
.ToDictionary(group => group.Key, group => group.ToList()); |
|
|
|
Logger.Info($"【面文本生成】 同类面{groupedDic.Count}个"); |
|
|
|
Logger.Info($"【面文本生成】 同类面{groupedDic.Count}个"); |
|
|
|
var valueIndex = 1; |
|
|
|
var valueIndex = 1; |
|
|
|
|
|
|
|
//台面显示 |
|
|
|
|
|
|
|
if (selFacetType == PlaneType.TableFacet) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
List<Vector3> tablePointList = new List<Vector3>(); |
|
|
|
|
|
|
|
foreach (var entity in groupedDic["11_0"]) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tablePointList.Add(entity.Point1); |
|
|
|
|
|
|
|
tablePointList.Add(entity.Point2); |
|
|
|
|
|
|
|
tablePointList.Add(entity.Point3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
HashSet<Vector3> tablePointSet = new HashSet<Vector3>(tablePointList); |
|
|
|
|
|
|
|
tablePointList = VectorClockwiseSort(tablePointSet.ToList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Tuple<Vector3, Vector3>> line = new List<Tuple<Vector3, Vector3>>(); |
|
|
|
|
|
|
|
for (int i = 0; i < tablePointList.Count / 2; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
line.Add(new Tuple<Vector3, Vector3>(tablePointList[i], tablePointList[i+tablePointList.Count / 2])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
string param = "TABLE"; |
|
|
|
|
|
|
|
var detail = ViewportManager.DiamondData[$"{param}_DETAIL"]; |
|
|
|
|
|
|
|
for (int i = 0; i < line.Count; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Vector3 point = line[i].Item2; |
|
|
|
|
|
|
|
var valueFloat = ValueFormat(detail[$"{param}_{i+1}"].ToString(), param, true); |
|
|
|
|
|
|
|
result.Add(DisplayText3D($"{valueFloat}", new Vector3(point.X, point.Y - 0.4f, point.Z))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
result.Add( DisplayLineModel3D(line, new Color4(1f, 0, 0, 1f), 0.7f)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (var kv in groupedDic) |
|
|
|
foreach (var kv in groupedDic) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var value = kv.Value; |
|
|
|
var value = kv.Value; |
|
|
@ -734,7 +734,7 @@ public class ViewportHelperPro |
|
|
|
Logger.Info($"【面文本生成】 {param} Key不存在"); |
|
|
|
Logger.Info($"【面文本生成】 {param} Key不存在"); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param); |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param, true); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint)); |
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint)); |
|
|
@ -758,10 +758,10 @@ public class ViewportHelperPro |
|
|
|
} |
|
|
|
} |
|
|
|
Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{valueIndex} ==={paramValue}"); |
|
|
|
Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{valueIndex} ==={paramValue}"); |
|
|
|
|
|
|
|
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param); |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param, true); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {valueIndex}"); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {valueIndex}"); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
result.Add(DisplayText3D($" {facetIndex} \r\n {valueFloat}", new Vector3(facetTextPoint.X, facetTextPoint.Y + 0.1f, facetTextPoint.Z))); |
|
|
|
result.Add(DisplayText3D($"{valueFloat} \r\n {facetIndex}", new Vector3(facetTextPoint.X, facetTextPoint.Y + 0.1f, facetTextPoint.Z))); |
|
|
|
|
|
|
|
|
|
|
|
} else if (ViewportManager.DiamondData.Count > 1 && facetIndex != -1) |
|
|
|
} else if (ViewportManager.DiamondData.Count > 1 && facetIndex != -1) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -782,53 +782,12 @@ public class ViewportHelperPro |
|
|
|
} |
|
|
|
} |
|
|
|
Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{facetIndex} ==={paramValue}"); |
|
|
|
Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{facetIndex} ==={paramValue}"); |
|
|
|
|
|
|
|
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param); |
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), param, true); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
result.Add(DisplayText3D($" {facetIndex} \r\n {valueFloat}", facetTextPoint)); |
|
|
|
result.Add(DisplayText3D($"{valueFloat} \r\n {facetIndex}", facetTextPoint)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|
|
|
* 思路: |
|
|
|
|
|
|
|
* 1、以面分组,1组为台面、底面,8组、16组、64组、other |
|
|
|
|
|
|
|
* 2、每组数据区别 |
|
|
|
|
|
|
|
* 1组:取第一个数据 |
|
|
|
|
|
|
|
* 8组:按索引0-7 -> 1-8 |
|
|
|
|
|
|
|
* 16组:1-2、3-4、5-6、7-8、9-10、11-12、13-14、15-0共享数据 |
|
|
|
|
|
|
|
* 64组:这组特殊理论上是腰,按照else里的东西来 |
|
|
|
|
|
|
|
* 3、这个方法是主动点击,被动触发理论上通用 |
|
|
|
|
|
|
|
* 4、主动触发:循环遍历面组,根据面类型获取算法存储的数据,在Manager里制定面-参数的一对多关系,主动触发时,取参数的首位为默认 |
|
|
|
|
|
|
|
* 5、被动触发:根据结果页传入的参数编号,找到对应的面,循环遍历面组,根据面类型获取算法存储的数据,根据被动传入参数找到值 |
|
|
|
|
|
|
|
* 6、 ①组面可能由至少两个三角形组成,计算出三角形拼接出的多边形的中心作为文字显示的中心 |
|
|
|
|
|
|
|
* ②在从算法结果数据对应好面组的索引,做成值-组面id的文本,计算出这个文本的大小 |
|
|
|
|
|
|
|
* ③在拼接的图片中心,平行于平面,向中心点外偏移“文本大小高度+0.1"个单位 显示文本
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var selFaceVector = entities |
|
|
|
|
|
|
|
// .SelectMany(entity => new[] { entity.Point1, entity.Point2, entity.Point3 }) |
|
|
|
|
|
|
|
// .Distinct() |
|
|
|
|
|
|
|
// .ToList(); |
|
|
|
|
|
|
|
// var uniqueLines = new HashSet<string>(); |
|
|
|
|
|
|
|
// var sortedVectors = VectorClockwiseSort(selFaceVector); |
|
|
|
|
|
|
|
// for (int i = 0; i < sortedVectors.Count; i++) |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// var current = sortedVectors[i]; |
|
|
|
|
|
|
|
// var next = sortedVectors[(i + 1) % sortedVectors.Count]; |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// double length = (next - current).Length(); |
|
|
|
|
|
|
|
// string lineKey = $"{length:F2}"; |
|
|
|
|
|
|
|
// if (showAll == false) |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// if (uniqueLines.Contains(lineKey)) continue; |
|
|
|
|
|
|
|
// uniqueLines.Add(lineKey); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// var midPoint = (current + next) / 2; |
|
|
|
|
|
|
|
// var text = $"{length:F2}mm"; |
|
|
|
|
|
|
|
// var textY = midPoint.Y > ViewportManager.CenterVector.Y ? midPoint.Y + 0.3f : midPoint.Y - 0.3f; |
|
|
|
|
|
|
|
// var lengthTextModel = DisplayText3D(text, new Vector3(midPoint.X, textY, midPoint.Z),next - current, textColor); |
|
|
|
|
|
|
|
// result.Add(lengthTextModel); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2103,6 +2062,9 @@ public class ViewportHelperPro |
|
|
|
v = Math.Floor(v * 10) / 10; |
|
|
|
v = Math.Floor(v * 10) / 10; |
|
|
|
return hasUnit ? $"{v.ToString("F1")}mm" : v.ToString("F1"); |
|
|
|
return hasUnit ? $"{v.ToString("F1")}mm" : v.ToString("F1"); |
|
|
|
case "PAV_ANGLE": |
|
|
|
case "PAV_ANGLE": |
|
|
|
|
|
|
|
case "STAR_ANGLE": |
|
|
|
|
|
|
|
case "UPPER_HALF_ANGLE": |
|
|
|
|
|
|
|
case "LOWER_HALF_ANGLE": |
|
|
|
case "TWIST": |
|
|
|
case "TWIST": |
|
|
|
v = Math.Floor(v * 10) / 10; |
|
|
|
v = Math.Floor(v * 10) / 10; |
|
|
|
return hasUnit ? $"{v.ToString("F1")}°" : v.ToString("F1"); |
|
|
|
return hasUnit ? $"{v.ToString("F1")}°" : v.ToString("F1"); |
|
|
@ -2113,7 +2075,7 @@ public class ViewportHelperPro |
|
|
|
// case "CROWN HEIGHT": |
|
|
|
// case "CROWN HEIGHT": |
|
|
|
// case "PAV DEPTH": |
|
|
|
// case "PAV DEPTH": |
|
|
|
v *= 100; |
|
|
|
v *= 100; |
|
|
|
return hasUnit ? $"{(Math.Round(v / 0.5) * 0.5).ToString("F1")}%" : (Math.Round(v / 0.5) * 0.5).ToString("F1"); |
|
|
|
return hasUnit ? $"{v.ToString("F1")}%" : v.ToString("F1"); |
|
|
|
default: |
|
|
|
default: |
|
|
|
v = Math.Floor(v * 1000) / 1000; |
|
|
|
v = Math.Floor(v * 1000) / 1000; |
|
|
|
return hasUnit ? $"{(v*100).ToString("F1")}%" : (v*100).ToString("F1"); |
|
|
|
return hasUnit ? $"{(v*100).ToString("F1")}%" : (v*100).ToString("F1"); |
|
|
|