测量工具标号:各类测量标签显示序号,删除后自动重编号
This commit is contained in:
@@ -456,6 +456,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
var g = CreatePPGroup(_pendingPoint.Value, pos);
|
||||
_ppGroups.Add(g);
|
||||
_measureOverlay.Children.Remove(_pendingDot);
|
||||
RenumberAll();
|
||||
_pendingDot = null; _pendingPoint = null;
|
||||
RaiseMeasureCompleted(g.P1, g.P2, g.Distance, MeasureCount, "PointDistance");
|
||||
CurrentMeasureMode = Models.MeasureMode.None;
|
||||
@@ -506,7 +507,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
// 完成:创建正式组,移除临时元素
|
||||
var g = CreatePTLGroup(_ptlTempL1.Value, _ptlTempL2.Value, pos);
|
||||
_ptlGroups.Add(g);
|
||||
|
||||
RenumberAll();
|
||||
if (_ptlTempDot1 != null) _measureOverlay.Children.Remove(_ptlTempDot1);
|
||||
if (_ptlTempDot2 != null) _measureOverlay.Children.Remove(_ptlTempDot2);
|
||||
if (_ptlTempLine != null) _measureOverlay.Children.Remove(_ptlTempLine);
|
||||
@@ -568,6 +569,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
{
|
||||
var g = CreateAngleGroup(_angleTempV.Value, _angleTempA.Value, pos);
|
||||
_angleGroups.Add(g);
|
||||
RenumberAll();
|
||||
|
||||
// 移除临时元素
|
||||
if (_angleTempVDot != null) _measureOverlay.Children.Remove(_angleTempVDot);
|
||||
@@ -611,6 +613,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
|
||||
var g = CreateFillRateGroup(e1, e2, e3, e4);
|
||||
_frGroups.Add(g);
|
||||
RenumberAll();
|
||||
|
||||
double rate = g.FillRate;
|
||||
RaiseMeasureCompleted(g.E3, g.E4, rate, MeasureCount, "FillRate");
|
||||
@@ -808,6 +811,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
foreach (var el in new UIElement[] { g.Dot1, g.Dot2, g.Line, g.Label })
|
||||
_measureOverlay.Children.Remove(el);
|
||||
_ppGroups.Remove(g);
|
||||
RenumberAll();
|
||||
RaiseMeasureStatusChanged($"已删除测量 | 剩余 {MeasureCount} 条");
|
||||
e.Handled = true; return;
|
||||
}
|
||||
@@ -820,6 +824,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
foreach (var el in new UIElement[] { g.DotL1, g.DotL2, g.DotP, g.MainLine, g.ExtLine, g.PerpLine, g.FootDot, g.Label })
|
||||
_measureOverlay.Children.Remove(el);
|
||||
_ptlGroups.Remove(g);
|
||||
RenumberAll();
|
||||
RaiseMeasureStatusChanged($"已删除测量 | 剩余 {MeasureCount} 条");
|
||||
e.Handled = true; return;
|
||||
}
|
||||
@@ -832,6 +837,7 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
foreach (var el in new UIElement[] { g.DotV, g.DotA, g.DotB, g.LineA, g.LineB, g.Arc, g.Label })
|
||||
_measureOverlay.Children.Remove(el);
|
||||
_angleGroups.Remove(g);
|
||||
RenumberAll();
|
||||
RaiseMeasureStatusChanged($"已删除测量 | 剩余 {MeasureCount} 条");
|
||||
e.Handled = true; return;
|
||||
}
|
||||
@@ -847,12 +853,40 @@ namespace XP.ImageProcessing.RoiControl.Controls
|
||||
foreach (var el in g.AllElements)
|
||||
_measureOverlay.Children.Remove(el);
|
||||
_frGroups.Remove(g);
|
||||
RenumberAll();
|
||||
RaiseMeasureStatusChanged($"已删除测量 | 剩余 {MeasureCount} 条");
|
||||
e.Handled = true; return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── 重编号 ──
|
||||
|
||||
private void RenumberAll()
|
||||
{
|
||||
for (int i = 0; i < _ppGroups.Count; i++)
|
||||
{
|
||||
_ppGroups[i].Index = i + 1;
|
||||
_ppGroups[i].UpdateLine();
|
||||
_ppGroups[i].UpdateLabel(FormatDistance(_ppGroups[i].Distance));
|
||||
}
|
||||
for (int i = 0; i < _ptlGroups.Count; i++)
|
||||
{
|
||||
_ptlGroups[i].Index = i + 1;
|
||||
_ptlGroups[i].UpdateVisuals(FormatDistance(_ptlGroups[i].Distance));
|
||||
}
|
||||
for (int i = 0; i < _angleGroups.Count; i++)
|
||||
{
|
||||
_angleGroups[i].Index = i + 1;
|
||||
_angleGroups[i].UpdateVisuals();
|
||||
}
|
||||
for (int i = 0; i < _frGroups.Count; i++)
|
||||
{
|
||||
_frGroups[i].Index = i + 1;
|
||||
_frGroups[i].UpdateVisuals();
|
||||
}
|
||||
}
|
||||
|
||||
// ── 填锡率阈值编辑 ──
|
||||
|
||||
private TextBox _thtEditBox;
|
||||
|
||||
Reference in New Issue
Block a user