Interactin diagram was added

This commit is contained in:
Evgeny Redikultsev
2023-12-02 21:50:10 +05:00
parent 8de8c00182
commit 1b635cbf69
47 changed files with 619 additions and 146 deletions

View File

@@ -13,6 +13,11 @@
<Slider x:Name="StrokeSlider" Width="195" Minimum="0" Maximum="{Binding MaxStrokeSize}" Value="{Binding StrokeSize}"/>
<TextBox Width="40" Text="{Binding StrokeSize,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
<TextBlock Text="Filling opacity" Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<Slider x:Name="OpacitySlider" Width="195" Minimum="0" Maximum="1" Value="{Binding Opacity}"/>
<TextBox Width="40" Text="{Binding Opacity,Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
</StackPanel>
</StackPanel>
</GroupBox>
</DataTemplate>

View File

@@ -12,6 +12,9 @@
<Compile Update="Windows\Arrays\ArrayView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -39,7 +42,7 @@
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\UserControls\MultiplyTuple.xaml.cs">
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
@@ -59,6 +62,9 @@
<Page Update="Windows\Arrays\ArrayView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml">
<SubType>Designer</SubType>
</Page>
@@ -86,7 +92,7 @@
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\UserControls\MultiplyTuple.xaml">
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>

View File

@@ -2,8 +2,10 @@
using StructureHelper.Windows.Graphs;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Models.Shapes;
@@ -18,20 +20,18 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
{
internal class InteractionDiagramLogic : ILongProcessLogic
{
const double xmax = 0.7e6d;
const double xmin = -0.7e6d;
const double ymax = 1.5e6d;
const double ymin = -9e6d;
private ArrayParameter<double> arrayParameter;
private IResult result;
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public int StepCount { get; }
public int StepCount => SurroundData.PointCount;
public Action<int> SetProgress { get; set; }
public bool Result { get; set; }
@@ -40,29 +40,40 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public CalcTerms CalcTerm { get; set; }
public ForceTuple ForceTuple { get; set; }
private void Show()
public SurroundData SurroundData { get; set; }
public InteractionDiagramLogic(SurroundData surroundData)
{
var options = new TriangulationOptions() { LimiteState = LimitState, CalcTerm = CalcTerm };
var ndmCollection = NdmPrimitives.SelectMany(x => x.GetNdms(options));
//var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
SurroundData = surroundData;
}
private void DoCalculations()
{
var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
var predicateFactory = new PredicateFactory()
{
My = ForceTuple.My,
My = SurroundData.ConstZ,
Ndms = ndmCollection
};
Predicate<IPoint2D> predicate = predicateFactory.GetResult;
Predicate<IPoint2D> predicate = predicateFactory.IsSectionFailure;
//Predicate<IPoint2D> predicate = predicateFactory.IsSectionCracked;
//var logic = new StabLimitCurveLogic();
var logic = new LimitCurveLogic(predicate);
var calculator = new LimitCurveCalculator(logic);
calculator.SurroundData.XMax = xmax;
calculator.SurroundData.XMin = xmin;
calculator.SurroundData.YMax = ymax;
calculator.SurroundData.YMin = ymin;
calculator.SurroundData.PointCount = 40;
calculator.SurroundData = SurroundData;
calculator.ActionToOutputResults = SetProgressByResult;
SafetyProcessor.RunSafeProcess(() =>
{
CalcResult(calculator);
}, "Errors appeared during showing a graph, see detailed information");
}
private void CalcResult(LimitCurveCalculator calculator)
{
calculator.Run();
var result = calculator.Result;
if (result.IsValid = false) { return; }
result = calculator.Result;
if (result.IsValid == false) { return; }
var interactionResult = result as LimitCurveResult;
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
@@ -73,18 +84,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
for (int i = 0; i < items.Count(); i++)
{
var valueList = new List<double>
{
items[i].X * unitForce.Multiplyer,
items[i].Y * unitMoment.Multiplyer
};
{
items[i].X * unitForce.Multiplyer,
items[i].Y * unitMoment.Multiplyer
};
for (int j = 0; j < valueList.Count; j++)
{
data[i, j] = valueList[j];
}
SetProgress?.Invoke(i);
}
}
private void SetProgressByResult(IResult calcResult)
{
if (calcResult is not LimitCurveResult)
{
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(LimitCurveResult), calcResult));
}
var parameterResult = calcResult as LimitCurveResult;
SetProgress?.Invoke(parameterResult.IterationNumber);
}
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment)
{
return new string[]
@@ -96,19 +116,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public void ShowWindow()
{
Show();
Result = true;
SafetyProcessor.RunSafeProcess(() =>
{
var wnd = new GraphView(arrayParameter);
wnd.ShowDialog();
if (result.IsValid == true)
{
var wnd = new GraphView(arrayParameter);
wnd.ShowDialog();
}
else
{
MessageBox.Show(result.Description);
}
},
"Errors appeared during showing a graph, see detailed information");
}
public void WorkerDoWork(object sender, DoWorkEventArgs e)
{
Show();
DoCalculations();
Result = true;
}

View File

@@ -0,0 +1,52 @@
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic.SurroundDataView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext ="{d:DesignInstance local:SurroundDataViewModel}"
mc:Ignorable="d"
Title="Diagram properties" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="35"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Maximum axial force"/>
<TextBlock Grid.Row="1" Text="Minimum axial force"/>
<TextBlock Grid.Row="2" Text="Maximum bending moment Mx"/>
<TextBlock Grid.Row="3" Text="Minimum bending moment Mx"/>
<TextBlock Grid.Row="4" Text="Minimum bending moment My"/>
<TextBlock Grid.Row="5" Text="Point count"/>
<TextBox Grid.Column="1" Text="{Binding YMax, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding YMin, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding XMax, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding XMin, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding ConstZ, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
<TextBox Grid.Column="1" Grid.Row="5" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="0" ValueChanged="YmaxChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="1" ValueChanged="YminChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="2" ValueChanged="XmaxChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="3" ValueChanged="XminChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="4" ValueChanged="ConstZChanged"/>
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="5" ValueChanged="PointCountChanged"/>
</Grid>
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
</Grid>
</Window>

View File

@@ -0,0 +1,67 @@
using StructureHelper.Windows.UserControls;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
{
/// <summary>
/// Логика взаимодействия для SurroundDataView.xaml
/// </summary>
public partial class SurroundDataView : Window
{
private SurroundDataViewModel viewModel;
public SurroundDataView(SurroundData surroundData) : this(new SurroundDataViewModel(surroundData)) { }
public SurroundDataView(SurroundDataViewModel vm)
{
viewModel = vm;
viewModel.ParentWindow = this;
DataContext = viewModel;
InitializeComponent();
}
private void XmaxChanged(object sender, EventArgs e)
{
viewModel.XMax *= ChangeValue(sender);
}
private void XminChanged(object sender, EventArgs e)
{
viewModel.XMin *= ChangeValue(sender);
}
private void YmaxChanged(object sender, EventArgs e)
{
viewModel.YMax *= ChangeValue(sender);
}
private void YminChanged(object sender, EventArgs e)
{
viewModel.YMin *= ChangeValue(sender);
}
private void ConstZChanged(object sender, EventArgs e)
{
viewModel.ConstZ *= ChangeValue(sender);
}
private void PointCountChanged(object sender, EventArgs e)
{
viewModel.PointCount = Convert.ToInt32(viewModel.PointCount * ChangeValue(sender));
}
private double ChangeValue(object sender)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
return factor;
}
}
}

View File

@@ -0,0 +1,107 @@
using StructureHelper.Windows.ViewModels;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
{
public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
{
private readonly SurroundData surroundData;
public double XMax
{
get => surroundData.XMax; set
{
surroundData.XMax = value;
OnPropertyChanged(nameof(XMax));
}
}
public double XMin
{
get => surroundData.XMin; set
{
surroundData.XMin = value;
OnPropertyChanged(nameof(XMin));
}
}
public double YMax
{
get => surroundData.YMax; set
{
surroundData.YMax = value;
OnPropertyChanged(nameof(YMax));
}
}
public double YMin
{
get => surroundData.YMin; set
{
surroundData.YMin = value;
OnPropertyChanged(nameof(YMin));
}
}
public double ConstZ
{
get => surroundData.ConstZ; set
{
surroundData.ConstZ = value;
OnPropertyChanged(nameof(ConstZ));
}
}
public int PointCount
{
get => surroundData.PointCount; set
{
try
{
surroundData.PointCount = value;
}
catch (Exception)
{
surroundData.PointCount = 40;
}
OnPropertyChanged(nameof(PointCount));
}
}
public string Error => throw new NotImplementedException();
public string this[string columnName]
{
get
{
string error = String.Empty;
switch (columnName)
{
case nameof(PointCount):
if (PointCount < 24)
{
error = "Point count must be greater than 24";
}
break;
}
return error;
}
}
public SurroundDataViewModel(SurroundData surroundData)
{
this.surroundData = surroundData;
}
internal void RefreshAll()
{
OnPropertyChanged(nameof(XMax));
OnPropertyChanged(nameof(XMin));
OnPropertyChanged(nameof(YMax));
OnPropertyChanged(nameof(YMin));
OnPropertyChanged(nameof(ConstZ));
OnPropertyChanged(nameof(PointCount));
}
}
}

View File

@@ -5,6 +5,7 @@ using StructureHelper.Services.Exports;
using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Forces;
@@ -38,7 +39,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ForceCalculator forceCalculator;
private ILongProcessLogic progressLogic;
private ShowProgressLogic showProgressLogic;
private InteractionDiagramLogic interactionDiagramLogic = new();
private InteractionDiagramLogic interactionDiagramLogic;
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
private IForcesResults forcesResults;
@@ -73,11 +74,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
return showInteractionDiagramCommand ??
(showInteractionDiagramCommand = new RelayCommand(o =>
{
interactionDiagramLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
interactionDiagramLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
interactionDiagramLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
interactionDiagramLogic.NdmPrimitives = ndmPrimitives;
interactionDiagramLogic.ShowWindow();
var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
var data = new SurroundData();
data.ConstZ = tuple.My;
var wnd = new SurroundDataView(data);
wnd.ShowDialog();
if (wnd.DialogResult != true) return;
interactionDiagramLogic = new(data)
{
ForceTuple = tuple,
LimitState = SelectedResult.DesignForceTuple.LimitState,
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
NdmPrimitives = ndmPrimitives
};
showProgressLogic = new(interactionDiagramLogic)
{
WindowTitle = "Diagram creating...",
ShowResult = interactionDiagramLogic.ShowWindow
};
showProgressLogic.Show();
}, o => SelectedResult != null && SelectedResult.IsValid));
}
}

View File

@@ -8,7 +8,7 @@
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:InterpolateTuplesViewModel}"
mc:Ignorable="d"
Title="Interpolate Combinations" Height="200" Width="400" MinHeight="180" MinWidth="400" WindowStartupLocation="CenterScreen">
Title="Interpolate Combinations" Height="200" Width="460" MinHeight="180" MinWidth="460" WindowStartupLocation="CenterScreen">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<Style TargetType="Button">
@@ -40,7 +40,7 @@
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
@@ -99,8 +99,9 @@
<TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<uc:MultiplyTuple Grid.Column="4" Grid.Row="1" ForceTuple="{Binding StartDesignForce.ForceTuple}" ValueChanged="StartValueChanged"/>
<uc:MultiplyTuple Grid.Column="4" Grid.Row="3" ForceTuple="{Binding FinishDesignForce.ForceTuple}" ValueChanged="FinishValueChanged"/>
<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"/>
</Grid>
</Grid>

View File

@@ -1,5 +1,7 @@
using StructureHelper.Windows.ViewModels.Forces;
using StructureHelper.Windows.UserControls;
using StructureHelper.Windows.ViewModels.Forces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -38,12 +40,28 @@ namespace StructureHelper.Windows.Forces
private void StartValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.StartDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, viewModel.StartDesignForce.ForceTuple, 1d);
viewModel.RefreshStartTuple();
}
private void FinishValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(viewModel.FinishDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, viewModel.FinishDesignForce.ForceTuple, 1d);
viewModel.RefreshFinishTuple();
}
private void StepCountValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
if (factor > 0d)
{
viewModel.StepCount = Convert.ToInt32(viewModel.StepCount * factor);
}
}
}
}

View File

@@ -11,10 +11,15 @@ namespace StructureHelper.Windows.Forces
private RelayCommand invertForcesCommand;
private RelayCommand copyToStartCommand;
private RelayCommand copyToFinishCommand;
private int stepCount;
public IDesignForceTuple StartDesignForce { get; set; }
public IDesignForceTuple FinishDesignForce { get; set; }
public double StartFactor { get; set; }
public double FinishFactor { get; set; }
public double StepCountFactor { get; set; }
public bool StepCountVisible { get; set; }
public double StartMx
{
@@ -70,23 +75,27 @@ namespace StructureHelper.Windows.Forces
OnPropertyChanged(nameof(FinishNz));
}
}
public int StepCount { get; set; }
public int StepCount
{
get => stepCount; set
{
stepCount = value;
OnPropertyChanged(nameof(StepCount));
}
}
public ICommand InvertForcesCommand
{
get => invertForcesCommand ??= new RelayCommand(o => InvertForces());
}
public ICommand CopyToStartCommand
{
get => copyToStartCommand ??= new RelayCommand(o => CopyFinishToStart());
}
public ICommand CopyToFinishCommand
{
get => copyToFinishCommand ??= new RelayCommand(o => CopyStartToFinish());
}
public InterpolateTuplesResult Result
{
get => new()

View File

@@ -0,0 +1,23 @@
using LiveCharts.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Ink;
using System.Windows.Media;
namespace StructureHelper.Windows.Graphs
{
internal static class GraphService
{
public static void SetVisualProps(LineSeries lineSeries, GraphVisualProps visualProps, Color color)
{
lineSeries.Stroke = new SolidColorBrush(color);
lineSeries.Fill = new SolidColorBrush(color) { Opacity = visualProps.Opacity };
lineSeries.LineSmoothness = visualProps.LineSmoothness;
lineSeries.PointGeometry = DefaultGeometries.Circle;
lineSeries.PointGeometrySize = visualProps.StrokeSize;
}
}
}

View File

@@ -7,7 +7,7 @@
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
d:DataContext="{d:DesignInstance local:GraphViewModel}"
mc:Ignorable="d"
Title="Graph" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
Title="Graph" Height="550" Width="800" MinHeight="500" MinWidth="600" WindowStartupLocation="CenterScreen">
<DockPanel>
<!--<ToolBarTray DockPanel.Dock="Top">
<ToolBar>
@@ -30,7 +30,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition/>
<RowDefinition Height="120"/>
<RowDefinition Height="170"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="X-axis values">
<StackPanel>

View File

@@ -165,13 +165,8 @@ namespace StructureHelper.Windows.Graphs
.X(point => point.X)
.Y(point => point.Y),
Title = yParameter.Name,
//PointGeometry = null,
Stroke = new SolidColorBrush(yParameter.Color),
Fill = Brushes.Transparent,
LineSmoothness = VisualProps.LineSmoothness,
PointGeometry = DefaultGeometries.Circle,
PointGeometrySize = VisualProps.StrokeSize
};
GraphService.SetVisualProps(lineSeries, VisualProps, yParameter.Color);
_ = valueList.TryGetValue(xParameter, out double[] xValues);
_ = valueList.TryGetValue(yParameter, out double[] yValues);
var chartValues = new ChartValues<Point2D>();

View File

@@ -7,6 +7,7 @@ namespace StructureHelper.Windows.Graphs
{
private double lineSmoothness;
private double strokeSize;
private double opacity;
public double LineSmoothness
{
@@ -37,6 +38,18 @@ namespace StructureHelper.Windows.Graphs
public double MaxLineSmoothness { get; }
public double MaxStrokeSize { get; }
public double Opacity
{
get => opacity; set
{
value = Math.Max(value, 0d);
value = Math.Min(value, 1d);
value = Math.Round(value, 2);
opacity = value;
OnPropertyChanged(nameof(Opacity));
}
}
public GraphVisualProps()
{
MaxLineSmoothness = 1d;
@@ -44,6 +57,7 @@ namespace StructureHelper.Windows.Graphs
lineSmoothness = 0.3;
strokeSize = 0;
Opacity = 0d;
}
}
}

View File

@@ -7,7 +7,7 @@
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
d:DataContext="{d:DesignInstance local:MaterialDiagramViewModel}"
mc:Ignorable="d"
Title="Material Diagram" Height="450" Width="800" WindowStartupLocation="CenterScreen">
Title="Material Diagram" Height="550" Width="800" MinHeight="550" MinWidth="800" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
@@ -16,7 +16,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="120"/>
<RowDefinition Height="170"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto">

View File

@@ -6,6 +6,7 @@ using StructureHelper.Models.Materials;
using StructureHelper.Windows.ViewModels;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Services.ColorServices;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -212,15 +213,14 @@ namespace StructureHelper.Windows.Graphs
var lineSeries = new LineSeries()
{
Title = $"{material.Name} ({calcTerm.ShortName} {limitState.ShortName})",
//Stroke = new SolidColorBrush(material.Color),
Fill = Brushes.Transparent,
LineSmoothness = VisualProps.LineSmoothness,
PointGeometry = DefaultGeometries.Circle,
PointGeometrySize = VisualProps.StrokeSize
};
if (limitStates.Count() == 1 && calcTerms.Count() == 1)
{
lineSeries.Stroke = new SolidColorBrush(material.Color);
GraphService.SetVisualProps(lineSeries, VisualProps, material.Color);
}
else
{
GraphService.SetVisualProps(lineSeries, VisualProps, ColorProcessor.GetRandomColor());
}
var chartValues = new ChartValues<double>();
for (double s = minValue; s < maxValue; s += step)

View File

@@ -16,6 +16,7 @@ using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services;
using StructureHelperLogics.Services.NdmCalculations;
using StructureHelperLogics.Services.NdmPrimitives;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -35,7 +36,7 @@ namespace StructureHelper.Windows.MainWindow
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
public ICalculationProperty CalculationProperty { get; private set; }
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
{
this.primitiveRepository = primitiveRepository;
@@ -47,16 +48,16 @@ namespace StructureHelper.Windows.MainWindow
HeadMaterials = new List<IHeadMaterial>();
HeadMaterialRepository = new HeadMaterialRepository(this);
}
public IEnumerable<INdm> GetNdms(ICalculationProperty calculationProperty)
{
var ndmPrimitives = Section.SectionRepository.Primitives;
return NdmPrimitivesService.GetNdms(ndmPrimitives, calculationProperty.LimitState, calculationProperty.CalcTerm);
////Настройки триангуляции, пока опции могут быть только такие
//ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
//Настройки триангуляции, пока опции могут быть только такие
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
return ndmPrimitives.SelectMany(x => x.GetNdms(options));
////Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
//return ndmPrimitives.SelectMany(x => x.GetNdms(options));
}
}
}

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.PrimitivePropertiesWindow"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance vm:SelectPrimitivesViewModel}"
d:DataContext="{d:DesignInstance local:SelectPrimitivesViewModel}"
Title="Select Primitives" Height="250" Width="250" MinHeight="250" MinWidth="250" MaxHeight="500" MaxWidth="500" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>

View File

@@ -1,5 +1,4 @@
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View File

@@ -1,4 +1,5 @@
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.ViewModels;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
@@ -7,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
namespace StructureHelper.Windows.PrimitivePropertiesWindow
{
public class SelectPrimitivesViewModel : OkCancelViewModelBase
{

View File

@@ -1,18 +1,22 @@
<UserControl x:Class="StructureHelper.Windows.UserControls.MultiplyTuple"
<UserControl x:Class="StructureHelper.Windows.UserControls.MultiplyDouble"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
mc:Ignorable="d"
d:DesignHeight="25" d:DesignWidth="60">
d:DesignHeight="25" d:DesignWidth="120">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button x:Name="Multy0_5" Grid.Column="0" Content="*0.5" Click="Multy0_5_Click"/>
<Button x:Name="Multy2_0" Grid.Column="1" Content="*2.0" Click="Multy2_0_Click"/>
<Button x:Name="MultyM1_2" Grid.Column="0" Content="*-1" Click="MultyM1_2_Click"/>
<Button x:Name="Multy0_0" Grid.Column="1" Content="*0" Click="Multy0_Click"/>
<Button x:Name="Multy0_5" Grid.Column="2" Content="*0.5" Click="Multy0_5_Click"/>
<Button x:Name="Multy2_0" Grid.Column="3" Content="*2.0" Click="Multy2_0_Click"/>
<!--<Grid.ToolTip>
<StackPanel Orientation="Horizontal">
<Button x:Name="MultyM1_2" Grid.Column="1" Content="*(-1)" Click="MultyM1_2_Click"/>

View File

@@ -23,11 +23,11 @@ namespace StructureHelper.Windows.UserControls
/// <summary>
/// Логика взаимодействия для MultiplyTuple.xaml
/// </summary>
public partial class MultiplyTuple : UserControl
public partial class MultiplyDouble : UserControl
{
public event EventHandler ValueChanged;
public MultiplyTuple()
public MultiplyDouble()
{
InitializeComponent();
//DataContext = this;
@@ -51,15 +51,28 @@ namespace StructureHelper.Windows.UserControls
}
public static readonly DependencyProperty ForceTupleProperty = DependencyProperty.Register(
"ForceTuple", typeof(ForceTuple), typeof(MultiplyTuple), new PropertyMetadata(new ForceTuple()));
public double DoubleValue
{
get { return (double)GetValue(DoubleValueProperty); }
set { SetValue(DoubleValueProperty, value); }
}
// Using a DependencyProperty as the backing store for DoubleValue. This enables animation, styling, binding, etc...
public static readonly DependencyProperty DoubleValueProperty =
DependencyProperty.Register("DoubleValue", typeof(double), typeof(MultiplyDouble), new PropertyMetadata(new double()));
public static readonly DependencyProperty DoubleFactorProperty = DependencyProperty.Register(
"DoubleFactor", typeof(double), typeof(MultiplyDouble), new PropertyMetadata(new double()));
private RelayCommand muliplyByFactor;
public ForceTuple ForceTuple
public double DoubleFactor
{
get { return (ForceTuple)GetValue(ForceTupleProperty); }
set { SetValue(ForceTupleProperty, value); }
get { return (double)GetValue(DoubleFactorProperty); }
set { SetValue(DoubleFactorProperty, value); }
}
private void Multy0_5_Click(object sender, RoutedEventArgs e)
@@ -73,8 +86,8 @@ namespace StructureHelper.Windows.UserControls
private void ChangeValue(double factor)
{
var tmpTuple = ForceTupleService.MultiplyTuples(ForceTuple, factor);
ForceTupleService.CopyProperties(tmpTuple, ForceTuple, 1d);
DoubleValue *= factor;
DoubleFactor = factor;
ValueChanged?.Invoke(this, EventArgs.Empty);
}