Surround Data Control was added
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ForceTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/IconDictionary.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/GraphsTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/LimitCurveTemplates.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
<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="320" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls">
|
||||
|
||||
<DataTemplate x:Key="SurroundData">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -29,7 +19,7 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
|
||||
<GroupBox Header="{Binding YLabel}">
|
||||
<Grid Margin="30,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -37,16 +27,19 @@
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Maximum"/>
|
||||
<TextBlock Grid.Row="1" Text="Minimum"/>
|
||||
<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}"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="0" ValueChanged="YmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="1" ValueChanged="YminChanged"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding YMax, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding YMin, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding YUnitLabel}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding YUnitLabel}"/>
|
||||
<!--<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="0" ValueChanged="YmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="1" ValueChanged="YminChanged"/>-->
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{Binding XLabel}">
|
||||
@@ -56,16 +49,19 @@
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Maximum"/>
|
||||
<TextBlock Grid.Row="1" Text="Minimum"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding XMax, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding XMin, Converter={StaticResource ForceConverter}, ValidatesOnDataErrors=True}"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="0" ValueChanged="XmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="1" ValueChanged="XminChanged"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding XMax, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding XMin, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding XUnitLabel}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding XUnitLabel}"/>
|
||||
<!--<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="0" ValueChanged="XmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="1" ValueChanged="XminChanged"/>-->
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{Binding ZLabel}">
|
||||
@@ -74,13 +70,15 @@
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Constant value"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding ConstZ, Converter={StaticResource MomentConverter}, ValidatesOnDataErrors=True}"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="4" Grid.Row="4" ValueChanged="ConstZChanged"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding ConstZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding ZUnitLabel}"/>
|
||||
<!--<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" ValueChanged="ConstZChanged"/>-->
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<Grid Margin="35,0,0,0">
|
||||
@@ -94,10 +92,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Point count"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="3" ValueChanged="PointCountChanged"/>
|
||||
<!--<uc:MultiplyDouble Margin="2" Grid.Column="3" ValueChanged="PointCountChanged"/>-->
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -12,7 +12,10 @@
|
||||
<Compile Update="Windows\Arrays\ArrayView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml.cs">
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml.cs">
|
||||
@@ -56,13 +59,19 @@
|
||||
<Page Update="Infrastructure\UI\Resources\IconDictionary.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\LimitCurveTemplates.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Infrastructure\UI\Resources\Materials.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\Arrays\ArrayView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\SurroundDataView.xaml">
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\ForceResultLogic\LimitCurveDataView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\UserControls\SurroundDataControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\CalculationWindows\CalculatorsViews\GeometryCalculatorViews\GeometryCalculatorResultView.xaml">
|
||||
|
||||
@@ -85,7 +85,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
var valueList = new List<double>
|
||||
{
|
||||
items[i].X * unitForce.Multiplyer,
|
||||
// to do repair multiplay by surround data
|
||||
items[i].X * unitForce.Multiplyer,
|
||||
items[i].Y * unitMoment.Multiplyer
|
||||
};
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic.LimitCurveDataView"
|
||||
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"
|
||||
xmlns:fc="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||
d:DataContext ="{d:DesignInstance local:LimitCurveDataViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Diagram properties" Height="320" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<fc:SurroundDataControl x:Name="SurData" SurroundData="{Binding SurroundData}"/>
|
||||
<!--<ContentControl ContentTemplate="{StaticResource SurroundData}" Content="{Binding SurroundDataViewModel}"/>-->
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,35 @@
|
||||
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 LimitCurveDataView : Window
|
||||
{
|
||||
private LimitCurveDataViewModel viewModel;
|
||||
public LimitCurveDataView(SurroundData surroundData) : this(new LimitCurveDataViewModel(surroundData)) { }
|
||||
public LimitCurveDataView(LimitCurveDataViewModel vm)
|
||||
{
|
||||
viewModel = vm;
|
||||
viewModel.ParentWindow = this;
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
SurData.SurroundData = vm.SurroundData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||
{
|
||||
public class LimitCurveDataViewModel : OkCancelViewModelBase
|
||||
{
|
||||
//public SurroundDataViewModel SurroundDataViewModel { get; private set; }
|
||||
public SurroundData SurroundData { get; set; }
|
||||
|
||||
public LimitCurveDataViewModel(SurroundData surroundData)
|
||||
{
|
||||
//SurroundDataViewModel = new(surroundData);
|
||||
SurroundData = surroundData;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultLogic
|
||||
{
|
||||
public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||
{
|
||||
private readonly SurroundData surroundData;
|
||||
public IValueConverter XValueConverter { get => new Force(); }
|
||||
public IValueConverter YValueConverter { get => new Moment();}
|
||||
public IValueConverter ZValueConverter { get => new Moment(); }
|
||||
public List<ConstOneDirectionConverter> Logics { get; }
|
||||
public ConstOneDirectionConverter Logic
|
||||
{
|
||||
get
|
||||
{
|
||||
var logic = surroundData.ConvertLogicEntity;
|
||||
return logic;
|
||||
}
|
||||
set
|
||||
{
|
||||
surroundData.ConvertLogicEntity = value;
|
||||
OnPropertyChanged(nameof(Logic));
|
||||
OnPropertyChanged(nameof(XLabel));
|
||||
OnPropertyChanged(nameof(YLabel));
|
||||
OnPropertyChanged(nameof(ZLabel));
|
||||
}
|
||||
}
|
||||
|
||||
public string XLabel { get => surroundData.ConvertLogicEntity.XAxisName; }
|
||||
public string YLabel { get => surroundData.ConvertLogicEntity.YAxisName; }
|
||||
public string ZLabel { get => surroundData.ConvertLogicEntity.ConstAxisName; }
|
||||
|
||||
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;
|
||||
Logics = new();
|
||||
Logics.AddRange(ConvertLogics.ConverterLogics);
|
||||
Logic = Logics
|
||||
.Where(x => x.Id == surroundData.ConvertLogicEntity.Id)
|
||||
.Single();
|
||||
OnPropertyChanged(nameof(Logic));
|
||||
}
|
||||
|
||||
internal void RefreshAll()
|
||||
{
|
||||
OnPropertyChanged(nameof(XMax));
|
||||
OnPropertyChanged(nameof(XMin));
|
||||
OnPropertyChanged(nameof(YMax));
|
||||
OnPropertyChanged(nameof(YMin));
|
||||
OnPropertyChanged(nameof(ConstZ));
|
||||
OnPropertyChanged(nameof(PointCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
|
||||
var data = new SurroundData();
|
||||
//data.ConstZ = tuple.My;
|
||||
var wnd = new SurroundDataView(data);
|
||||
var wnd = new LimitCurveDataView(data);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult != true) return;
|
||||
interactionDiagramLogic = new(data)
|
||||
|
||||
@@ -14,10 +14,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Logic">
|
||||
|
||||
</TabItem>
|
||||
<TabItem Header="Limits">
|
||||
|
||||
<!--<local:SorroundDataControl/>-->
|
||||
</TabItem>
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<UserControl x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.SurroundDataControl"
|
||||
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.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="400">
|
||||
<Grid>
|
||||
<StackPanel DataContext="{Binding ViewModel}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="215"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Margin="35,0,0,0" Text="Logic"/>
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding Logics}" SelectedItem="{Binding Logic}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}">
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<GroupBox Header="{Binding YLabel}">
|
||||
<Grid Margin="30,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Maximum"/>
|
||||
<TextBlock Grid.Row="1" Text="Minimum"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding YMax, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding YMin, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding YUnitLabel}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding YUnitLabel}"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="0" ValueChanged="YmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="1" ValueChanged="YminChanged"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{Binding XLabel}">
|
||||
<Grid Margin="30,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Maximum"/>
|
||||
<TextBlock Grid.Row="1" Text="Minimum"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding XMax, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding XMin, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding XUnitLabel}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding XUnitLabel}"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="0" ValueChanged="XmaxChanged"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" Grid.Row="1" ValueChanged="XminChanged"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{Binding ZLabel}">
|
||||
<Grid Margin="30,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Constant value"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding ConstZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding ZUnitLabel}"/>
|
||||
<uc:MultiplyDouble Margin="2,2,2,2" Grid.Column="3" ValueChanged="ConstZChanged"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<Grid Margin="35,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Point count"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding PointCount, ValidatesOnDataErrors=True}"/>
|
||||
<uc:MultiplyDouble Margin="2" Grid.Column="3" ValueChanged="PointCountChanged"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,105 @@
|
||||
using StructureHelper.Windows.UserControls;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для SorroundDataControl.xaml
|
||||
/// </summary>
|
||||
public partial class SurroundDataControl : UserControl
|
||||
{
|
||||
// Using a DependencyProperty as the backing store for SurroundData.
|
||||
// This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty SurroundDataProperty =
|
||||
DependencyProperty.Register(
|
||||
"SurroundData",
|
||||
typeof(SurroundData), // Change to the actual type of SurroundData
|
||||
typeof(SurroundDataControl),
|
||||
new PropertyMetadata(null, OnSurroundDataChanged));
|
||||
|
||||
private static void OnSurroundDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
SurroundDataControl surroundDataControl = (SurroundDataControl)d;
|
||||
SurroundData newValue = (SurroundData)e.NewValue;
|
||||
|
||||
// Handle any additional logic when the SurroundData property changes
|
||||
|
||||
// Example: Update ViewModel.SurroundData
|
||||
surroundDataControl.ViewModel.SurroundData = newValue;
|
||||
}
|
||||
|
||||
private SurroundData surroundData;
|
||||
public SurroundDataViewModel ViewModel { get; private set; }
|
||||
|
||||
public SurroundData SurroundData
|
||||
{
|
||||
get => (SurroundData)GetValue(SurroundDataProperty);
|
||||
set
|
||||
{
|
||||
SetValue(SurroundDataProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public SurroundDataControl()
|
||||
{
|
||||
if (SurroundData is null)
|
||||
{
|
||||
ViewModel = new SurroundDataViewModel(new() { PointCount = 40 });
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewModel = new SurroundDataViewModel(SurroundData);
|
||||
}
|
||||
DataContext = this; // 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
public class SurroundDataViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||
{
|
||||
const string ForceUnitString = "kN";
|
||||
const string MomentUnitString = "kNm";
|
||||
|
||||
public SurroundData SurroundData
|
||||
{
|
||||
get => surroundData; set
|
||||
{
|
||||
surroundData = value;
|
||||
RefreshAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshAll()
|
||||
{
|
||||
OnPropertyChanged(nameof(Logic));
|
||||
OnPropertyChanged(nameof(XMax));
|
||||
OnPropertyChanged(nameof(XMin));
|
||||
OnPropertyChanged(nameof(YMax));
|
||||
OnPropertyChanged(nameof(YMin));
|
||||
OnPropertyChanged(nameof(ConstZ));
|
||||
OnPropertyChanged(nameof(PointCount));
|
||||
OnPropertyChanged(nameof(XLabel));
|
||||
OnPropertyChanged(nameof(YLabel));
|
||||
OnPropertyChanged(nameof(ZLabel));
|
||||
OnPropertyChanged(nameof(XUnitLabel));
|
||||
OnPropertyChanged(nameof(YUnitLabel));
|
||||
OnPropertyChanged(nameof(ZUnitLabel));
|
||||
}
|
||||
|
||||
private static readonly IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
|
||||
private static readonly IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
|
||||
private SurroundData surroundData;
|
||||
|
||||
public IValueConverter ForceConverter { get => new Force(); }
|
||||
public IValueConverter MomentConverter { get => new Moment();}
|
||||
public List<ConstOneDirectionConverter> Logics { get; }
|
||||
public ConstOneDirectionConverter Logic
|
||||
{
|
||||
get
|
||||
{
|
||||
var logic = SurroundData.ConvertLogicEntity;
|
||||
return logic;
|
||||
}
|
||||
set
|
||||
{
|
||||
SurroundData.ConvertLogicEntity = value;
|
||||
OnPropertyChanged(nameof(Logic));
|
||||
OnPropertyChanged(nameof(XLabel));
|
||||
OnPropertyChanged(nameof(YLabel));
|
||||
OnPropertyChanged(nameof(ZLabel));
|
||||
OnPropertyChanged(nameof(XUnitLabel));
|
||||
OnPropertyChanged(nameof(YUnitLabel));
|
||||
OnPropertyChanged(nameof(ZUnitLabel));
|
||||
}
|
||||
}
|
||||
|
||||
public string XLabel { get => SurroundData.ConvertLogicEntity.XAxisName; }
|
||||
public string YLabel { get => SurroundData.ConvertLogicEntity.YAxisName; }
|
||||
public string ZLabel { get => SurroundData.ConvertLogicEntity.ConstAxisName; }
|
||||
public string XUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.XForceType);
|
||||
public string YUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.YForceType);
|
||||
public string ZUnitLabel => GetLabel(SurroundData.ConvertLogicEntity.ZForceType);
|
||||
|
||||
public double XMax
|
||||
{
|
||||
get
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
|
||||
return SurroundData.XMax * factor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
|
||||
SurroundData.XMax = value / factor;
|
||||
OnPropertyChanged(nameof(XMax));
|
||||
}
|
||||
}
|
||||
|
||||
public double XMin
|
||||
{
|
||||
get
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
|
||||
return SurroundData.XMin * factor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.XForceType);
|
||||
SurroundData.XMin = value / factor;
|
||||
OnPropertyChanged(nameof(XMin));
|
||||
}
|
||||
}
|
||||
|
||||
public double YMax
|
||||
{
|
||||
get
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
|
||||
return SurroundData.YMax * factor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
|
||||
SurroundData.YMax = value / factor;
|
||||
OnPropertyChanged(nameof(YMax));
|
||||
}
|
||||
}
|
||||
|
||||
public double YMin
|
||||
{
|
||||
get
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
|
||||
return SurroundData.YMin * factor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.YForceType);
|
||||
SurroundData.YMin = value / factor;
|
||||
OnPropertyChanged(nameof(YMin));
|
||||
}
|
||||
}
|
||||
|
||||
public double ConstZ
|
||||
{
|
||||
get
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
|
||||
return SurroundData.ConstZ * factor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var factor = GetFactor(SurroundData.ConvertLogicEntity.ZForceType);
|
||||
SurroundData.ConstZ = value / factor;
|
||||
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;
|
||||
Logics = new();
|
||||
Logics.AddRange(ConvertLogics.ConverterLogics);
|
||||
Logic = Logics
|
||||
.Where(x => x.Id == surroundData.ConvertLogicEntity.Id)
|
||||
.Single();
|
||||
OnPropertyChanged(nameof(Logic));
|
||||
}
|
||||
private static double GetFactor(ForceTypes forceType)
|
||||
{
|
||||
if (forceType == ForceTypes.Force)
|
||||
{
|
||||
return unitForce.Multiplyer;
|
||||
}
|
||||
else if (forceType == ForceTypes.MomentMx || forceType == ForceTypes.MomentMy)
|
||||
{
|
||||
return unitMoment.Multiplyer;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(forceType));
|
||||
}
|
||||
}
|
||||
private static string GetLabel(ForceTypes forceType)
|
||||
{
|
||||
if (forceType == ForceTypes.Force)
|
||||
{
|
||||
return unitForce.Name;
|
||||
}
|
||||
else if (forceType == ForceTypes.MomentMx || forceType == ForceTypes.MomentMy)
|
||||
{
|
||||
return unitMoment.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(forceType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace StructureHelperCommon.Services.Units
|
||||
return val;
|
||||
}
|
||||
|
||||
private static double GetMultiplyer(UnitTypes unitType, string unitName)
|
||||
public static double GetMultiplyer(UnitTypes unitType, string unitName)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -6,10 +6,21 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for build collection of points by surround points
|
||||
/// </summary>
|
||||
public interface ILimitCurveLogic : IHasActionByResult
|
||||
{
|
||||
List<IPoint2D> GetPoints(List<IPoint2D> points);
|
||||
/// <summary>
|
||||
/// Returns list of points by source collection
|
||||
/// </summary>
|
||||
/// <param name="points"></param>
|
||||
/// <returns></returns>
|
||||
List<IPoint2D> GetPoints(IEnumerable<IPoint2D> points);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
this.limitCurveLogic = limitCurveLogic;
|
||||
SurroundData = new();
|
||||
//SurroundProcLogic = new RoundSurroundProc();
|
||||
SurroundProcLogic = new RectSurroundProc();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
private FindParameterResult result;
|
||||
private List<IPoint2D> resultList;
|
||||
private IPoint2D currentPoint;
|
||||
private ILimitCurveParameterLogic parameterLogic;
|
||||
public Predicate<IPoint2D> LimitPredicate { get; set; }
|
||||
@@ -25,37 +23,46 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
LimitPredicate = limitPredicate;
|
||||
}
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
/// <inheritdoc/>
|
||||
public List<IPoint2D> GetPoints(IEnumerable<IPoint2D> points)
|
||||
{
|
||||
result = new();
|
||||
List<IPoint2D> resultList = new();
|
||||
resultList = new();
|
||||
if (LimitPredicate(new Point2D()) == true)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for zero value is not valid");
|
||||
var range = points.Select(point => new Point2D { X = point.X * 0d, Y = point.Y * 0d }).ToList();
|
||||
resultList.AddRange(range);
|
||||
return resultList;
|
||||
//throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for zero value is not valid");
|
||||
}
|
||||
foreach (var point in points)
|
||||
{
|
||||
double parameter;
|
||||
currentPoint = point.Clone() as IPoint2D;
|
||||
parameterLogic.CurrentPoint = currentPoint;
|
||||
if (LimitPredicate(point) == false)
|
||||
{
|
||||
parameter = 1d;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter = parameterLogic.GetParameter();
|
||||
}
|
||||
var resultPoint = new Point2D()
|
||||
{
|
||||
X = currentPoint.X * parameter,
|
||||
Y = currentPoint.Y * parameter
|
||||
};
|
||||
resultList.Add(resultPoint);
|
||||
result.IterationNumber = resultList.Count;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
FindParameter(point);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
private void FindParameter(IPoint2D point)
|
||||
{
|
||||
double parameter;
|
||||
currentPoint = point.Clone() as IPoint2D;
|
||||
parameterLogic.CurrentPoint = currentPoint;
|
||||
if (LimitPredicate(point) == false)
|
||||
{
|
||||
parameter = 1d;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter = parameterLogic.GetParameter();
|
||||
}
|
||||
var resultPoint = new Point2D()
|
||||
{
|
||||
X = currentPoint.X * parameter,
|
||||
Y = currentPoint.Y * parameter
|
||||
};
|
||||
resultList.Add(resultPoint);
|
||||
result.IterationNumber = resultList.Count;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
public List<IPoint2D> GetPoints(IEnumerable<IPoint2D> points)
|
||||
{
|
||||
var result = new List<IPoint2D>();
|
||||
foreach (var item in points)
|
||||
|
||||
Reference in New Issue
Block a user