Trace logging for sorce of cracking was added

This commit is contained in:
Evgeny Redikultsev
2024-02-01 23:01:50 +05:00
parent 79ef8c5304
commit 783d5e0591
16 changed files with 212 additions and 59 deletions

View File

@@ -1,8 +1,11 @@
using StructureHelper.Windows.Errors;
using LoaderCalculator;
using StructureHelper.Windows.CalculationWindows.ProgressViews;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Forces;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Cracking;
using StructureHelperLogics.NdmCalculations.Primitives;
@@ -14,6 +17,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
{
internal class ShowCrackResultLogic
{
private CrackForceCalculator calculator;
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
@@ -33,7 +38,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private void FindCrackFactor(IForceTuple finishDesignTuple, IForceTuple startDesignTuple)
{
var calculator = new CrackForceCalculator();
calculator = new CrackForceCalculator();
calculator.TraceLogger = new ShiftTraceLogger();
calculator.StartTuple = startDesignTuple;
calculator.EndTuple = finishDesignTuple;
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, LimitState, CalcTerm);
@@ -41,7 +47,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
var result = (CrackForceResult)calculator.Result;
if (result.IsValid)
{
ShowResult(result);
ShowTraceResult();
//ShowResult(result);
}
else
{
@@ -80,5 +87,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
private void ShowTraceResult()
{
if (calculator.TraceLogger is not null)
{
var wnd = new TraceDocumentView(calculator.TraceLogger.TraceLoggerEntries);
wnd.ShowDialog();
}
}
}
}

View File

@@ -12,7 +12,6 @@ using StructureHelper.Windows.Forces;
using StructureHelper.Windows.PrimitivePropertiesWindow;
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
@@ -22,7 +21,6 @@ using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
using StructureHelperLogics.NdmCalculations.Primitives;

View File

@@ -16,7 +16,7 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
{
public class TraceDocumentVM : ViewModelBase
{
const int tabFactor = 500;
const double tabFactor = 500d;
private readonly IEnumerable<ITraceLoggerEntry> loggerEntries;
private IEnumerable<ITraceLoggerEntry> selectedLoggerEntries;
private FlowDocument document;
@@ -110,13 +110,13 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(traceEntry));
}
block.Margin = new Thickness(traceEntry.Priority / tabFactor * tabGap, 7, 0, 7);
return block;
}
private Block GetBlockByStringEntry(StringLogEntry stringEntry)
{
var paragraph = new Paragraph(new Run(stringEntry.Message));
paragraph.Margin = new Thickness(stringEntry.Priority / tabFactor * tabGap, 7, 0, 7);
if (stringEntry.Priority <= LoggerService.GetPriorityByStatus(TraceLogStatuses.Fatal))
{
paragraph.FontSize = 14;

View File

@@ -101,7 +101,7 @@
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged"/>
<uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</Grid>