Logic for interaction diagram was added
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
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;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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 string ForceUnitString = "kN";
|
||||
const string MomentUnitString = "kNm";
|
||||
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private IResult result;
|
||||
private IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, ForceUnitString);
|
||||
private IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, MomentUnitString);
|
||||
|
||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
public IEnumerable<INdmPrimitive> NdmPrimitives { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public ForceTuple ForceTuple { get; set; }
|
||||
//public ForceTuple ForceTuple { get; set; }
|
||||
|
||||
|
||||
public SurroundData SurroundData { get; set; }
|
||||
|
||||
@@ -50,11 +51,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
private void DoCalculations()
|
||||
{
|
||||
var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
|
||||
|
||||
var convertLogic = SurroundData.ConvertLogicEntity;
|
||||
convertLogic.ConstDirectionValue = SurroundData.ConstZ;
|
||||
var predicateFactory = new PredicateFactory()
|
||||
{
|
||||
My = SurroundData.ConstZ,
|
||||
Ndms = ndmCollection
|
||||
Ndms = ndmCollection,
|
||||
ConvertLogic = convertLogic.ConvertLogic,
|
||||
};
|
||||
Predicate<IPoint2D> predicate = predicateFactory.IsSectionFailure;
|
||||
//Predicate<IPoint2D> predicate = predicateFactory.IsSectionCracked;
|
||||
@@ -75,9 +77,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
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");
|
||||
string[] labels = GetLabels(unitForce, unitMoment);
|
||||
string[] labels = GetLabels();
|
||||
var items = interactionResult.Points;
|
||||
arrayParameter = new ArrayParameter<double>(items.Count(), labels.Count(), labels);
|
||||
var data = arrayParameter.Data;
|
||||
@@ -105,13 +105,32 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
SetProgress?.Invoke(parameterResult.IterationNumber);
|
||||
}
|
||||
|
||||
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment)
|
||||
private string[] GetLabels()
|
||||
{
|
||||
return new string[]
|
||||
string[] strings = new string[2];
|
||||
strings[0] = GetLabel(SurroundData.ConvertLogicEntity.XForceType);
|
||||
strings[1] = GetLabel(SurroundData.ConvertLogicEntity.YForceType);
|
||||
return strings;
|
||||
}
|
||||
|
||||
private string GetLabel(ForceTypes forceType)
|
||||
{
|
||||
if (forceType == ForceTypes.Force)
|
||||
{
|
||||
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
|
||||
$"{GeometryNames.LongForceName}, {unitForce.Name}"
|
||||
};
|
||||
return $"{GeometryNames.LongForceName}, {unitForce.Name}";
|
||||
}
|
||||
else if (forceType == ForceTypes.MomentMx)
|
||||
{
|
||||
return $"{GeometryNames.MomFstName}, {unitMoment.Name}";
|
||||
}
|
||||
else if (forceType == ForceTypes.MomentMy)
|
||||
{
|
||||
return $"{GeometryNames.MomSndName}, {unitMoment.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(forceType));
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowWindow()
|
||||
|
||||
@@ -7,46 +7,97 @@
|
||||
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">
|
||||
Title="Diagram properties" Height="320" 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>
|
||||
<StackPanel>
|
||||
<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="150"/>
|
||||
<ColumnDefinition/>
|
||||
<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"/>
|
||||
</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="150"/>
|
||||
<ColumnDefinition/>
|
||||
<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"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{Binding ZLabel}">
|
||||
<Grid Margin="30,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition/>
|
||||
<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"/>
|
||||
</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>
|
||||
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,17 +1,45 @@
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
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
|
||||
{
|
||||
@@ -92,6 +120,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
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()
|
||||
|
||||
@@ -76,13 +76,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
var tuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
|
||||
var data = new SurroundData();
|
||||
data.ConstZ = tuple.My;
|
||||
//data.ConstZ = tuple.My;
|
||||
var wnd = new SurroundDataView(data);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult != true) return;
|
||||
interactionDiagramLogic = new(data)
|
||||
{
|
||||
ForceTuple = tuple,
|
||||
//ForceTuple = tuple,
|
||||
LimitState = SelectedResult.DesignForceTuple.LimitState,
|
||||
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
|
||||
NdmPrimitives = ndmPrimitives
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
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"
|
||||
d:DataContext ="{d:DesignInstance local:InteractionDiagramCalculatorViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="InteractionDiagramCalculatorView" Height="350" Width="400">
|
||||
Title="Interaction Diagram Calculator" Height="300" Width="400" MinHeight="300" MinWidth="400">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Logic">
|
||||
@@ -17,16 +18,20 @@
|
||||
</TabItem>
|
||||
<TabItem Header="Limits">
|
||||
|
||||
</TabItem>
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Predicates">
|
||||
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="States">
|
||||
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Terms">
|
||||
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding YItems}"/>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
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 StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class InteractionDiagramCalculatorViewModel : OkCancelViewModelBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -30,5 +30,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
InitializeComponent();
|
||||
//DataContext = this.viewModel;
|
||||
}
|
||||
|
||||
private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelper.Windows.PrimitivePropertiesWindow
|
||||
{
|
||||
var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
|
||||
Items = new SelectItemsViewModel<PrimitiveBase>(primitiveViews) { ShowButtons = true };
|
||||
Items.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||
Items.ItemDataTemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||
|
||||
@@ -100,7 +100,9 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
CodeList.Add(item);
|
||||
}
|
||||
CodeEntity = codes.Where(x => x == selectedMaterialKind.Code).Single();
|
||||
CodeEntity = codes
|
||||
.Where(x => x == selectedMaterialKind.Code)
|
||||
.Single();
|
||||
MaterialEntity = MaterialLibrary
|
||||
.Single(x => x.Id == selectedMaterialKind.Id);
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -8,14 +9,22 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a ViewModel for selecting items from a collection.
|
||||
/// </summary>
|
||||
/// <typeparam name="TItem">The type of items in the collection.</typeparam>
|
||||
public class SelectItemsViewModel<TItem> : ViewModelBase
|
||||
where TItem : class
|
||||
{
|
||||
private ICommand? selectAllCommand;
|
||||
private ICommand? unSelectAllCommand;
|
||||
private ICommand? invertSelectionCommand;
|
||||
private IEnumerable<TItem> selectedItems;
|
||||
|
||||
public class CollectionItem : ViewModelBase
|
||||
{
|
||||
@@ -35,7 +44,7 @@ namespace StructureHelper.Windows.ViewModels
|
||||
public TItem Item { get; set; }
|
||||
}
|
||||
|
||||
public DataTemplate ItemDataDemplate { get; set; }
|
||||
public DataTemplate ItemDataTemplate { get; set; }
|
||||
public bool ShowButtons { get; set; }
|
||||
public ObservableCollection<CollectionItem> CollectionItems { get; }
|
||||
|
||||
@@ -43,34 +52,31 @@ namespace StructureHelper.Windows.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectAllCommand ??= new RelayCommand(o => setIsSelected(true));
|
||||
return selectAllCommand ??= new RelayCommand(o => SetIsSelected(true));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand UnSelectAllCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return unSelectAllCommand ??= new RelayCommand(o => setIsSelected(false));
|
||||
}
|
||||
}
|
||||
public ICommand UnSelectAllCommand => unSelectAllCommand ??= new RelayCommand(o => SetIsSelected(false));
|
||||
|
||||
public ICommand InvertSelectionCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return invertSelectionCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
item.IsSelected = !item.IsSelected;
|
||||
}
|
||||
}
|
||||
);
|
||||
return invertSelectionCommand ??= new RelayCommand(o => InvertSelection());
|
||||
}
|
||||
}
|
||||
|
||||
private void setIsSelected(bool isSelected)
|
||||
private void InvertSelection()
|
||||
{
|
||||
{
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
item.IsSelected = !item.IsSelected;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void SetIsSelected(bool isSelected)
|
||||
{
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
@@ -80,16 +86,43 @@ namespace StructureHelper.Windows.ViewModels
|
||||
|
||||
public SelectItemsViewModel(IEnumerable<TItem> items)
|
||||
{
|
||||
CollectionItems = new ObservableCollection<CollectionItem>();
|
||||
foreach (var item in items)
|
||||
{
|
||||
CollectionItems.Add(new CollectionItem() { IsSelected = true, Item = item });
|
||||
}
|
||||
CollectionItems = new ObservableCollection<CollectionItem>(
|
||||
items
|
||||
.Select(item => new CollectionItem
|
||||
{
|
||||
IsSelected = true,
|
||||
Item = item
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets collection of items which are selected
|
||||
/// </summary>
|
||||
public IEnumerable<TItem> SelectedItems
|
||||
{
|
||||
get => CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item);
|
||||
set
|
||||
{
|
||||
// Check if all provided items are contained in the main collection
|
||||
if (value.All(item => CollectionItems.Any(ci => ci.Item.Equals(item))))
|
||||
{
|
||||
selectedItems = value;
|
||||
|
||||
// Update the IsSelected property based on the provided selected items
|
||||
foreach (var item in CollectionItems)
|
||||
{
|
||||
item.IsSelected = selectedItems.Contains(item.Item);
|
||||
}
|
||||
|
||||
OnPropertyChanged(nameof(SelectedItems));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle the case where not all items are in the main collection
|
||||
// You might throw an exception or log a message
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Not all items are contained in the main collection");
|
||||
}
|
||||
}
|
||||
}
|
||||
public int SelectedCount => SelectedItems.Count();
|
||||
}
|
||||
|
||||
15
StructureHelperCommon/Infrastructures/Enums/ForceTypes.cs
Normal file
15
StructureHelperCommon/Infrastructures/Enums/ForceTypes.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
{
|
||||
public enum ForceTypes
|
||||
{
|
||||
Force,
|
||||
MomentMx,
|
||||
MomentMy
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
set
|
||||
{
|
||||
natSystem = value;
|
||||
codesList = CodeFactory.GetCodeEntities()
|
||||
codesList = CodeFactory
|
||||
.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == natSystem)
|
||||
.ToList();
|
||||
materialRepository = new MaterialRepository(codesList);
|
||||
@@ -38,7 +39,8 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
public static List<ICodeEntity> CodesList
|
||||
{ get
|
||||
{
|
||||
codesList ??= CodeFactory.GetCodeEntities()
|
||||
codesList ??= CodeFactory
|
||||
.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
return codesList;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointShapeUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new Point2DUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
31
StructureHelperCommon/Models/Shapes/IPoint3D.cs
Normal file
31
StructureHelperCommon/Models/Shapes/IPoint3D.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for geometry point in 3D space
|
||||
/// </summary>
|
||||
public interface IPoint3D : ISaveable, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate along X-axis
|
||||
/// </summary>
|
||||
double X { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate along Y-axis
|
||||
/// </summary>
|
||||
double Y { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate along Z-axis
|
||||
/// </summary>
|
||||
double Z { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class ConstOneDirectionConverter : IConvertPointLogicEntity
|
||||
{
|
||||
private ConstOneDirectionLogic convertLogic;
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public Directions Direction { get; private set; }
|
||||
public double ConstDirectionValue {get;set;}
|
||||
public string XAxisName { get; set; }
|
||||
public string YAxisName { get; set; }
|
||||
public string ConstAxisName { get; set; }
|
||||
public ForceTypes XForceType { get; set; }
|
||||
public ForceTypes YForceType { get; set; }
|
||||
public ForceTypes ZForceType { get; set; }
|
||||
|
||||
public IConvert2DPointTo3DPointLogic ConvertLogic
|
||||
{
|
||||
get
|
||||
{
|
||||
convertLogic.ConstDirectionValue = ConstDirectionValue;
|
||||
return convertLogic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ConstOneDirectionConverter(Directions direction, Guid guid)
|
||||
{
|
||||
Id = guid;
|
||||
convertLogic = new ConstOneDirectionLogic(direction, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ConstOneDirectionLogic : IConvert2DPointTo3DPointLogic
|
||||
{
|
||||
private Directions constDirections;
|
||||
/// <summary>
|
||||
/// Direction, for which canstant value is assigned
|
||||
/// </summary>
|
||||
public Directions ConstDirections
|
||||
{
|
||||
get => constDirections;
|
||||
set
|
||||
{
|
||||
var availableDirections = new List<Directions>() { Directions.X, Directions.Y, Directions.Z };
|
||||
if (availableDirections.Contains(value) == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(value));
|
||||
}
|
||||
constDirections = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Constant value for assigned direction
|
||||
/// </summary>
|
||||
public double ConstDirectionValue { get; set; }
|
||||
public ConstOneDirectionLogic(Directions constDirection, double constValue)
|
||||
{
|
||||
ConstDirections = constDirection;
|
||||
ConstDirectionValue = constValue;
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public IPoint3D GetPoint3D(IPoint2D point2D)
|
||||
{
|
||||
IPoint3D point;
|
||||
if (ConstDirections == Directions.X)
|
||||
{
|
||||
point = new Point3D() { X = ConstDirectionValue, Y = - point2D.X, Z = point2D.Y };
|
||||
}
|
||||
else if (ConstDirections == Directions.Y)
|
||||
{
|
||||
point = new Point3D() { X = point2D.X, Y = ConstDirectionValue, Z = point2D.Y };
|
||||
}
|
||||
else if (ConstDirections == Directions.Z)
|
||||
{
|
||||
point = new Point3D() { X = point2D.Y, Y = point2D.X, Z = ConstDirectionValue };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(ConstDirections));
|
||||
}
|
||||
return point;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for convert 2DPoint of some plane to point of 3DSpace
|
||||
/// </summary>
|
||||
public interface IConvert2DPointTo3DPointLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns point in 3D-space by 2D point in some workplane
|
||||
/// </summary>
|
||||
/// <param name="point2D"></param>
|
||||
/// <returns></returns>
|
||||
IPoint3D GetPoint3D(IPoint2D point2D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IConvertPointLogicEntity : ISaveable
|
||||
{
|
||||
string Name { get; set; }
|
||||
IConvert2DPointTo3DPointLogic ConvertLogic { get;}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class LineShapeUpdateStrategy : IUpdateStrategy<ILineShape>
|
||||
{
|
||||
readonly PointShapeUpdateStrategy pointUpdateStrategy = new();
|
||||
readonly Point2DUpdateStrategy pointUpdateStrategy = new();
|
||||
public void Update(ILineShape targetObject, ILineShape sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Point2DUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.X = sourceObject.X;
|
||||
targetObject.Y = sourceObject.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,15 @@ using System.Threading.Tasks;
|
||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PointShapeUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
public class Point3DUpdateStrategy : IUpdateStrategy<IPoint3D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
public void Update(IPoint3D targetObject, IPoint3D sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.X = sourceObject.X;
|
||||
targetObject.Y = sourceObject.Y;
|
||||
targetObject.Z = sourceObject.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,16 @@
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using System;
|
||||
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Point2D : IPoint2D
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointShapeUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new Point2DUpdateStrategy();
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
|
||||
43
StructureHelperCommon/Models/Shapes/Point3D.cs
Normal file
43
StructureHelperCommon/Models/Shapes/Point3D.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
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 StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class Point3D : IPoint3D
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint3D> updateStrategy = new Point3DUpdateStrategy();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public double X { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double Y { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double Z { get; set; }
|
||||
|
||||
public Point3D(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Point3D() : this(Guid.NewGuid()) { }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new Point3D();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
{
|
||||
public enum ForceCurveLogic
|
||||
{
|
||||
N_Mx,
|
||||
N_My,
|
||||
Mx_My
|
||||
}
|
||||
public static class ConvertLogicFactory
|
||||
{
|
||||
public static ConstOneDirectionConverter GetLogic(ForceCurveLogic logic)
|
||||
{
|
||||
var strings = ProgramSetting.GeometryNames;
|
||||
if (logic == ForceCurveLogic.N_Mx)
|
||||
{
|
||||
return new ConstOneDirectionConverter(Directions.Y, Guid.Parse("4d8637b6-98bc-4e7f-8006-01fc679c21ee"))
|
||||
{
|
||||
Name = "N-Mx",
|
||||
XAxisName = strings.FullMomFstName,
|
||||
YAxisName = strings.FullLongForceName,
|
||||
ConstAxisName = strings.FullMomSndName,
|
||||
XForceType = ForceTypes.MomentMx,
|
||||
YForceType = ForceTypes.Force,
|
||||
ZForceType = ForceTypes.MomentMy,
|
||||
};
|
||||
}
|
||||
else if (logic == ForceCurveLogic.N_My)
|
||||
{
|
||||
return new ConstOneDirectionConverter(Directions.X, Guid.Parse("119ff666-7121-4a34-b76c-5ada3bd490f3"))
|
||||
{
|
||||
Name = "N-My",
|
||||
XAxisName = strings.FullMomSndName,
|
||||
YAxisName = strings.FullLongForceName,
|
||||
ConstAxisName = strings.FullMomFstName,
|
||||
XForceType = ForceTypes.MomentMy,
|
||||
YForceType = ForceTypes.Force,
|
||||
ZForceType = ForceTypes.MomentMx,
|
||||
};
|
||||
}
|
||||
else if (logic == ForceCurveLogic.Mx_My)
|
||||
{
|
||||
return new ConstOneDirectionConverter(Directions.Z, Guid.Parse("58020401-bedf-4b79-9131-86f7078d6c49"))
|
||||
{
|
||||
Name = "Mx-My",
|
||||
XAxisName = strings.FullMomFstName,
|
||||
YAxisName = strings.FullMomSndName,
|
||||
ConstAxisName = strings.FullLongForceName,
|
||||
XForceType = ForceTypes.MomentMx,
|
||||
YForceType = ForceTypes.MomentMy,
|
||||
ZForceType = ForceTypes.Force,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(logic));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve
|
||||
{
|
||||
public static class ConvertLogics
|
||||
{
|
||||
private static readonly List<ConstOneDirectionConverter> converterLogics;
|
||||
public static List<ConstOneDirectionConverter> ConverterLogics => converterLogics ??
|
||||
new List<ConstOneDirectionConverter>()
|
||||
{
|
||||
ConvertLogicFactory.GetLogic(ForceCurveLogic.N_Mx),
|
||||
ConvertLogicFactory.GetLogic(ForceCurveLogic.N_My),
|
||||
ConvertLogicFactory.GetLogic(ForceCurveLogic.Mx_My),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -18,19 +18,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private ForceTuple tuple;
|
||||
private ForceTupleInputData inputData;
|
||||
public IEnumerable<INdm> Ndms { get; set; }
|
||||
public double My { get; set; }
|
||||
public IConvert2DPointTo3DPointLogic ConvertLogic { get; set; }
|
||||
public PredicateFactory()
|
||||
{
|
||||
inputData = new();
|
||||
calculator = new() { InputData = inputData };
|
||||
}
|
||||
public bool IsSectionFailure(IPoint2D point)
|
||||
public bool IsSectionFailure(IPoint2D point2D)
|
||||
{
|
||||
var point3D = ConvertLogic.GetPoint3D(point2D);
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
Nz = point3D.Z,
|
||||
Mx = point3D.X,
|
||||
My = point3D.Y
|
||||
};
|
||||
inputData.Tuple = tuple;
|
||||
inputData.NdmCollection = Ndms;
|
||||
@@ -39,14 +40,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
return !result.IsValid;
|
||||
}
|
||||
|
||||
public bool IsSectionCracked(IPoint2D point)
|
||||
public bool IsSectionCracked(IPoint2D point2D)
|
||||
{
|
||||
var logic = new HoleSectionCrackedLogic();
|
||||
var point3D = ConvertLogic.GetPoint3D(point2D);
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
Nz = point3D.Z,
|
||||
Mx = point3D.X,
|
||||
My = point2D.Y
|
||||
};
|
||||
logic.Tuple = tuple;
|
||||
logic.NdmCollection = Ndms;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -13,6 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public double YMax { get; set; }
|
||||
public double YMin { get; set; }
|
||||
public double ConstZ { get; set; }
|
||||
public ConstOneDirectionConverter ConvertLogicEntity { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public SurroundData()
|
||||
{
|
||||
@@ -21,6 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
YMax = 1e7d;
|
||||
YMin = -1e7d;
|
||||
PointCount = 80;
|
||||
ConvertLogicEntity = ConvertLogics.ConverterLogics[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
@@ -12,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class BaseUpdateStrategy : IUpdateStrategy<INdmPrimitive>
|
||||
{
|
||||
static readonly PointShapeUpdateStrategy pointShapeUpdateStrategy = new();
|
||||
static readonly Point2DUpdateStrategy point2DUpdateStrategy = new();
|
||||
readonly ForceTupleUpdateStrategy tupleUpdateStrategy = new();
|
||||
readonly VisualPropsUpdateStrategy visualPropsUpdateStrategy = new();
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
targetObject.Name = sourceObject.Name;
|
||||
if (sourceObject.HeadMaterial != null) targetObject.HeadMaterial = sourceObject.HeadMaterial;
|
||||
targetObject.Triangulate = sourceObject.Triangulate;
|
||||
pointShapeUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
visualPropsUpdateStrategy.Update(targetObject.VisualProperty, sourceObject.VisualProperty);
|
||||
tupleUpdateStrategy.Update(targetObject.UsersPrestrain, sourceObject.UsersPrestrain);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user