当因为算子参数输入不合理,或者执行异常,要在状态栏显示
This commit is contained in:
@@ -37,11 +37,10 @@ namespace XplorePlane.Services
|
||||
if (enabledNodes.Count == 0)
|
||||
return source;
|
||||
|
||||
// 大图像预览缩放
|
||||
var current = ScaleForPreview(source);
|
||||
|
||||
int total = enabledNodes.Count;
|
||||
for (int step = 0; step < total; step++)
|
||||
var total = enabledNodes.Count;
|
||||
for (var step = 0; step < total; step++)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
@@ -53,15 +52,14 @@ namespace XplorePlane.Services
|
||||
|
||||
if (invalidParameters.Count > 0)
|
||||
{
|
||||
var invalidParameterText = string.Join("、", invalidParameters);
|
||||
throw new PipelineExecutionException(
|
||||
$"算子 '{node.DisplayName}' 存在无效参数:{string.Join("、", invalidParameters)}",
|
||||
$"算子 '{node.DisplayName}' 存在无效参数:{invalidParameterText}",
|
||||
node.Order,
|
||||
node.OperatorKey);
|
||||
}
|
||||
|
||||
var parameters = node.Parameters
|
||||
.Where(p => p.IsValueValid)
|
||||
.ToDictionary(p => p.Name, p => p.Value);
|
||||
var parameters = node.Parameters.ToDictionary(p => p.Name, p => p.Value);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -69,9 +67,12 @@ namespace XplorePlane.Services
|
||||
current, node.OperatorKey, parameters, null, cancellationToken);
|
||||
|
||||
if (current == null)
|
||||
{
|
||||
throw new PipelineExecutionException(
|
||||
$"算子 '{node.OperatorKey}' 返回了空图像",
|
||||
node.Order, node.OperatorKey);
|
||||
$"算子 '{node.DisplayName}' 返回了空图像",
|
||||
node.Order,
|
||||
node.OperatorKey);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -85,7 +86,9 @@ namespace XplorePlane.Services
|
||||
{
|
||||
throw new PipelineExecutionException(
|
||||
$"算子 '{node.DisplayName}' 执行失败:{ex.Message}",
|
||||
node.Order, node.OperatorKey, ex);
|
||||
node.Order,
|
||||
node.OperatorKey,
|
||||
ex);
|
||||
}
|
||||
|
||||
progress?.Report(new PipelineProgress(step + 1, total, node.DisplayName));
|
||||
@@ -102,7 +105,7 @@ namespace XplorePlane.Services
|
||||
if (source.PixelWidth <= UhdThreshold && source.PixelHeight <= UhdThreshold)
|
||||
return source;
|
||||
|
||||
double scale = (double)PreviewMaxHeight / source.PixelHeight;
|
||||
var scale = (double)PreviewMaxHeight / source.PixelHeight;
|
||||
if (source.PixelWidth * scale > UhdThreshold)
|
||||
scale = (double)UhdThreshold / source.PixelWidth;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user