Add import of forces from excel
This commit is contained in:
BIN
StructureHelper/Documentation/FilesForImport/Forces/DCF.xlsx
Normal file
BIN
StructureHelper/Documentation/FilesForImport/Forces/DCF.xlsx
Normal file
Binary file not shown.
@@ -9,6 +9,7 @@ namespace StructureHelper.Infrastructure.Enums
|
|||||||
public enum ActionType
|
public enum ActionType
|
||||||
{
|
{
|
||||||
ForceCombination,
|
ForceCombination,
|
||||||
ForceCombinationByFactor
|
ForceCombinationByFactor,
|
||||||
|
ForceCombinationFromFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,40 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<DataTemplate x:Key="ForceActionTemplate">
|
<DataTemplate x:Key="ForceActionNameTemplate">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ForceActionPointTemplate">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="200"/>
|
<ColumnDefinition Width="200"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="Name"/>
|
<TextBlock Grid.Row="0" Text="Set force into initial Gravity Center"/>
|
||||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
<CheckBox Grid.Row="0" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
||||||
<TextBlock Grid.Row="1" Text="Set force into initial Gravity Center"/>
|
<TextBlock Grid.Row="1" Text="Center X"/>
|
||||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="3,5,3,5" IsChecked="{Binding SetInGravityCenter}"/>
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
||||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
<TextBlock Grid.Row="2" Text="Center Y"/>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterX}" IsEnabled="{Binding CoordEnable}"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
||||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CenterY}" IsEnabled="{Binding CoordEnable}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ForceActionTemplate">
|
||||||
|
<StackPanel Height="100">
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ForceActionNameTemplate}" Content="{Binding}"/>
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ForceActionPointTemplate}" Content="{Binding}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="CombinationListTemplate">
|
<DataTemplate x:Key="CombinationListTemplate">
|
||||||
<Grid Grid.Row="1" DataContext="{Binding DesignForces}">
|
<Grid Grid.Row="1" DataContext="{Binding DesignForces}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Documentation\FilesForImport\Forces\" />
|
||||||
<Folder Include="Documentation\Manuals\" />
|
<Folder Include="Documentation\Manuals\" />
|
||||||
<Folder Include="Documentation\Examples\" />
|
<Folder Include="Documentation\Examples\" />
|
||||||
<Folder Include="Documentation\PreviousFileVersions\" />
|
<Folder Include="Documentation\PreviousFileVersions\" />
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
|
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\Forces\ForceCombinationFromFileView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Windows\Forces\ForceFilePropertyView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\Forces\ForceInterpolationControl.xaml.cs">
|
<Compile Update="Windows\Forces\ForceInterpolationControl.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -87,6 +93,9 @@
|
|||||||
<Compile Update="Windows\UserControls\Forces\FactoredCombination.xaml.cs">
|
<Compile Update="Windows\UserControls\Forces\FactoredCombination.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\UserControls\ListOfFileControl.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
|
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -152,6 +161,12 @@
|
|||||||
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
|
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ForceCombinationFromFileView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Windows\Forces\ForceFilePropertyView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\Forces\ForceInterpolationControl.xaml">
|
<Page Update="Windows\Forces\ForceInterpolationControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -194,6 +209,9 @@
|
|||||||
<Page Update="Windows\UserControls\Forces\FactoredCombination.xaml">
|
<Page Update="Windows\UserControls\Forces\FactoredCombination.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\UserControls\ListOfFileControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
|
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding TupleResults}" SelectedItem="{Binding SelectedResult}">
|
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding TupleResults}" SelectedItem="{Binding SelectedResult}">
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
@@ -114,6 +115,26 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
||||||
|
<StatusBar Grid.Row="2">
|
||||||
|
<StatusBarItem>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="Valid result(s): "/>
|
||||||
|
<TextBlock Text="{Binding ValidResultCount}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StatusBarItem>
|
||||||
|
<StatusBarItem>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="Invalid result(s): "/>
|
||||||
|
<TextBlock Text="{Binding InvalidResultCount}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StatusBarItem>
|
||||||
|
<StatusBarItem>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="Total: "/>
|
||||||
|
<TextBlock Text="{Binding TotalResultCount}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StatusBarItem>
|
||||||
|
</StatusBar>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -12,10 +12,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
public class CrackResultViewModel : ViewModelBase
|
public class CrackResultViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||||
private CrackResult crackResult;
|
private CrackResult resultModel;
|
||||||
private RelayCommand? showIsoFieldCommand;
|
private RelayCommand? showIsoFieldCommand;
|
||||||
private RelayCommand? showRebarsCommand;
|
private RelayCommand? showRebarsCommand;
|
||||||
|
|
||||||
|
public int ValidResultCount => resultModel.TupleResults.Count(x => x.IsValid == true);
|
||||||
|
public int InvalidResultCount => resultModel.TupleResults.Count(x => x.IsValid == false);
|
||||||
|
public int TotalResultCount => resultModel.TupleResults.Count;
|
||||||
|
|
||||||
public TupleCrackResult SelectedResult { get; set; }
|
public TupleCrackResult SelectedResult { get; set; }
|
||||||
public List<ITupleCrackResult> TupleResults => CrackResult.TupleResults;
|
public List<ITupleCrackResult> TupleResults => CrackResult.TupleResults;
|
||||||
public ICommand ShowRebarsCommand
|
public ICommand ShowRebarsCommand
|
||||||
@@ -41,11 +45,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrackResult CrackResult => crackResult;
|
public CrackResult CrackResult => resultModel;
|
||||||
|
|
||||||
public CrackResultViewModel(CrackResult crackResult)
|
public CrackResultViewModel(CrackResult crackResult)
|
||||||
{
|
{
|
||||||
this.crackResult = crackResult;
|
this.resultModel = crackResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
private InteractionDiagramLogic interactionDiagramLogic;
|
private InteractionDiagramLogic interactionDiagramLogic;
|
||||||
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
|
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
|
||||||
//private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
|
//private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
|
||||||
private IForcesResults forcesResults;
|
private IForcesResults resultModel;
|
||||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||||
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
|
private IEnumerable<INdmPrimitive> selectedNdmPrimitives;
|
||||||
private IEnumerable<INdm> ndms;
|
private IEnumerable<INdm> ndms;
|
||||||
@@ -67,13 +67,13 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
private ICommand? graphValuepointsCommand;
|
private ICommand? graphValuepointsCommand;
|
||||||
private ICommand showForceResultCommand;
|
private ICommand showForceResultCommand;
|
||||||
|
|
||||||
public int ValidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == true);
|
public int ValidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == true);
|
||||||
public int InvalidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == false);
|
public int InvalidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == false);
|
||||||
public int TotalResultCount => forcesResults.ForcesResultList.Count;
|
public int TotalResultCount => resultModel.ForcesResultList.Count;
|
||||||
|
|
||||||
public IForcesResults ForcesResults
|
public IForcesResults ForcesResults
|
||||||
{
|
{
|
||||||
get => forcesResults;
|
get => resultModel;
|
||||||
}
|
}
|
||||||
public ICommand ShowInteractionDiagramCommand
|
public ICommand ShowInteractionDiagramCommand
|
||||||
{
|
{
|
||||||
@@ -150,7 +150,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
Filter = "csv |*.csv",
|
Filter = "csv |*.csv",
|
||||||
Title = "Save in *.csv File"
|
Title = "Save in *.csv File"
|
||||||
};
|
};
|
||||||
var logic = new ExportForcesResultToCSVLogic(forcesResults);
|
var logic = new ExportForcesResultToCSVLogic(resultModel);
|
||||||
var exportService = new ExportToFileService(inputData, logic);
|
var exportService = new ExportToFileService(inputData, logic);
|
||||||
exportService.Export();
|
exportService.Export();
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
public ForcesResultsViewModel(ForceCalculator forceCalculator)
|
public ForcesResultsViewModel(ForceCalculator forceCalculator)
|
||||||
{
|
{
|
||||||
this.forceCalculator = forceCalculator;
|
this.forceCalculator = forceCalculator;
|
||||||
forcesResults = forceCalculator.Result as IForcesResults;
|
resultModel = forceCalculator.Result as IForcesResults;
|
||||||
ndmPrimitives = forceCalculator.InputData.Primitives;
|
ndmPrimitives = forceCalculator.InputData.Primitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace StructureHelper.Windows.Forces
|
namespace StructureHelper.Windows.Forces
|
||||||
{
|
{
|
||||||
public class FactoredCombinationPropertyVM : ViewModelBase, IFactoredCombinationProperty
|
public class FactoredCombinationPropertyVM : ViewModelBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
private IFactoredCombinationProperty sourceProperty;
|
private IFactoredCombinationProperty sourceProperty;
|
||||||
|
|
||||||
@@ -63,18 +63,29 @@ namespace StructureHelper.Windows.Forces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdateCombinationProperty(IFactoredCombinationProperty? newValue)
|
public string Error => throw new NotImplementedException();
|
||||||
{
|
|
||||||
sourceProperty = newValue;
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Refresh()
|
public string this[string columnName]
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(ULSFactor));
|
get
|
||||||
OnPropertyChanged(nameof(LongTermFactor));
|
{
|
||||||
OnPropertyChanged(nameof(CalcTerm));
|
string error = null;
|
||||||
OnPropertyChanged(nameof(LimitState));
|
if (columnName == nameof(ULSFactor))
|
||||||
|
{
|
||||||
|
if (ULSFactor <= 0)
|
||||||
|
{
|
||||||
|
error = "Safety factor for ULS must be greater than zero";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnName == nameof(LongTermFactor))
|
||||||
|
{
|
||||||
|
if (LongTermFactor < 0d || LongTermFactor > 1d)
|
||||||
|
{
|
||||||
|
error = "Long term factor must be between 0.0 and 1.0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,21 @@ namespace StructureHelper.Windows.Forces
|
|||||||
{
|
{
|
||||||
public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
|
public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
|
||||||
{
|
{
|
||||||
IForceFactoredList forceAction;
|
IForceFactoredList model;
|
||||||
ForceTupleVM forceTupleVM;
|
ForceTupleVM forceTupleVM;
|
||||||
|
private FactoredCombinationPropertyVM combinationProperty;
|
||||||
|
|
||||||
public ForceTupleVM ForceTupleVM => forceTupleVM;
|
public ForceTupleVM ForceTupleVM => forceTupleVM;
|
||||||
public IFactoredCombinationProperty CombinationProperty
|
public FactoredCombinationPropertyVM CombinationProperty
|
||||||
{
|
{
|
||||||
get
|
get => combinationProperty; set
|
||||||
{
|
{
|
||||||
return forceAction.CombinationProperty;
|
combinationProperty = value;
|
||||||
|
OnPropertyChanged(nameof(CombinationProperty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string Error => throw new NotImplementedException();
|
public string Error => throw new NotImplementedException();
|
||||||
|
|
||||||
public string this[string columnName]
|
public string this[string columnName]
|
||||||
@@ -31,29 +34,15 @@ namespace StructureHelper.Windows.Forces
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
string error = null;
|
string error = null;
|
||||||
|
|
||||||
//if (columnName == nameof(ULSFactor))
|
|
||||||
//{
|
|
||||||
// if (ULSFactor <= 0)
|
|
||||||
// {
|
|
||||||
// error = "Safety factor for ULS must be greater than zero";
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//if (columnName == nameof(LongTermFactor))
|
|
||||||
//{
|
|
||||||
// if (LongTermFactor < 0d || LongTermFactor > 1d)
|
|
||||||
// {
|
|
||||||
// error = "Long term factor must be between 0.0 and 1.0";
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCombinationByFactorVM(IForceFactoredList forceAction) : base(forceAction)
|
public ForceCombinationByFactorVM(IForceFactoredList model) : base(model)
|
||||||
{
|
{
|
||||||
this.forceAction = forceAction;
|
this.model = model;
|
||||||
forceTupleVM = new ForceTupleVM(this.forceAction.ForceTuples[0]);
|
forceTupleVM = new ForceTupleVM(this.model.ForceTuples[0]);
|
||||||
|
CombinationProperty = new FactoredCombinationPropertyVM(model.CombinationProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,17 @@
|
|||||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}"
|
d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Force Combination By Factor" Height="340" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
Title="Force Combination By Factor" Height="220" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="95"/>
|
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="35"/>
|
<RowDefinition Height="35"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="Main">
|
||||||
|
<StackPanel>
|
||||||
<!--ForceTemplates.xaml-->
|
<!--ForceTemplates.xaml-->
|
||||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionTemplate}" Content="{Binding}"/>
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionNameTemplate}" Content="{Binding}"/>
|
||||||
<StackPanel Grid.Row="1">
|
|
||||||
<uc:FactoredCombination x:Name="FactoredCombination" CombinationProperty="{Binding CombinationProperty}"/>
|
|
||||||
<TextBlock Text="Load combination"/>
|
<TextBlock Text="Load combination"/>
|
||||||
<Grid DataContext="{Binding ForceTupleVM}">
|
<Grid DataContext="{Binding ForceTupleVM}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -37,6 +37,16 @@
|
|||||||
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Force point">
|
||||||
|
|
||||||
|
<!--ForceTemplates.xaml-->
|
||||||
|
<ContentControl VerticalAlignment="Top" ContentTemplate="{StaticResource ResourceKey=ForceActionPointTemplate}" Content="{Binding}"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Partial factors">
|
||||||
|
<uc:FactoredCombination DataContext="{Binding CombinationProperty}"/>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -20,14 +20,15 @@ namespace StructureHelper.Windows.Forces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ForceCombinationByFactorView : Window
|
public partial class ForceCombinationByFactorView : Window
|
||||||
{
|
{
|
||||||
ForceCombinationByFactorVM viewModel;
|
readonly ForceCombinationByFactorVM viewModel;
|
||||||
public ForceCombinationByFactorView(IForceFactoredList forceCombination)
|
public ForceCombinationByFactorView(IForceFactoredList forceCombination)
|
||||||
{
|
{
|
||||||
viewModel = new ForceCombinationByFactorVM(forceCombination);
|
viewModel = new ForceCombinationByFactorVM(forceCombination)
|
||||||
|
{
|
||||||
|
ParentWindow = this
|
||||||
|
};
|
||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
viewModel.ParentWindow = this;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
FactoredCombination.CombinationProperty = viewModel.CombinationProperty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
44
StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs
Normal file
44
StructureHelper/Windows/Forces/ForceCombinationFromFileVM.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelper.Windows.ViewModels.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ForceCombinationFromFileVM : ForceActionVMBase
|
||||||
|
{
|
||||||
|
private readonly IForceCombinationFromFile model;
|
||||||
|
private ListOfFilesVM files;
|
||||||
|
private FactoredCombinationPropertyVM combinationProperty;
|
||||||
|
|
||||||
|
public FactoredCombinationPropertyVM CombinationProperty
|
||||||
|
{
|
||||||
|
get => combinationProperty; set
|
||||||
|
{
|
||||||
|
combinationProperty = value;
|
||||||
|
OnPropertyChanged(nameof(CombinationProperty));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListOfFilesVM Files
|
||||||
|
{
|
||||||
|
get => files; set
|
||||||
|
{
|
||||||
|
files = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationFromFileVM(IForceCombinationFromFile model) : base(model)
|
||||||
|
{
|
||||||
|
this.model = model;
|
||||||
|
files = new(this.model.ForceFiles);
|
||||||
|
CombinationProperty = new FactoredCombinationPropertyVM(model.CombinationProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.Forces.ForceCombinationFromFileView"
|
||||||
|
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.Forces"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
d:DataContext="{d:DesignInstance local:ForceCombinationFromFileVM}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Force Combination By Files" Height="280" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="Main">
|
||||||
|
<StackPanel>
|
||||||
|
<!--ForceTemplates.xaml-->
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionNameTemplate}" Content="{Binding}"/>
|
||||||
|
<TextBlock Text="List of Files"/>
|
||||||
|
<Grid>
|
||||||
|
<uc:ListOfFileControl DataContext="{Binding Files}"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Force Point">
|
||||||
|
<!--ForceTemplates.xaml-->
|
||||||
|
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionPointTemplate}" Content="{Binding}" Height="70" VerticalAlignment="Top"/>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Partial factors">
|
||||||
|
<uc:FactoredCombination DataContext="{Binding CombinationProperty}"/>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
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.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ForceCombinationFromFile.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ForceCombinationFromFileView : Window
|
||||||
|
{
|
||||||
|
ForceCombinationFromFileVM viewModel;
|
||||||
|
|
||||||
|
public ForceCombinationFromFileView(ForceCombinationFromFileVM viewModel)
|
||||||
|
{
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = this.viewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationFromFileView(IForceCombinationFromFile model) : this (new ForceCombinationFromFileVM(model))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
65
StructureHelper/Windows/Forces/ForceFilePropertyVM.cs
Normal file
65
StructureHelper/Windows/Forces/ForceFilePropertyVM.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ForceFilePropertyVM : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
private IForceFileProperty model;
|
||||||
|
|
||||||
|
public ForceFilePropertyVM(IForceFileProperty model)
|
||||||
|
{
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SkipRowBeforeHeaderCount
|
||||||
|
{
|
||||||
|
get => model.SkipRowBeforeHeaderCount;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
model.SkipRowBeforeHeaderCount = value;
|
||||||
|
OnPropertyChanged(nameof(SkipRowBeforeHeaderCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int SkipRowHeaderCount
|
||||||
|
{
|
||||||
|
get => model.SkipRowHeaderCount;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
model.SkipRowHeaderCount = value;
|
||||||
|
OnPropertyChanged(nameof(SkipRowHeaderCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public double GlobalFactor
|
||||||
|
{
|
||||||
|
get => model.GlobalFactor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
model.GlobalFactor = value;
|
||||||
|
OnPropertyChanged(nameof(GlobalFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string FilePath
|
||||||
|
{
|
||||||
|
get => model.FilePath;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
model.FilePath = value;
|
||||||
|
OnPropertyChanged(nameof(FilePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IForceFileProperty Model
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
StructureHelper/Windows/Forces/ForceFilePropertyView.xaml
Normal file
52
StructureHelper/Windows/Forces/ForceFilePropertyView.xaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.Forces.ForceFilePropertyView"
|
||||||
|
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.Forces"
|
||||||
|
d:DataContext="{d:DesignInstance local:ForceFilePropertyVM}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="File import properties" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
|
<Window.Resources>
|
||||||
|
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="35"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem Header="Main">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="File name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding FilePath}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Skip row(s) before header"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SkipRowBeforeHeaderCount, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Skip row(s) of header"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SkipRowHeaderCount, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Global factor value"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding GlobalFactor, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Columns">
|
||||||
|
<ScrollViewer>
|
||||||
|
<Expander Header="Nz">
|
||||||
|
|
||||||
|
</Expander>
|
||||||
|
</ScrollViewer>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
27
StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs
Normal file
27
StructureHelper/Windows/Forces/ForceFilePropertyView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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.Forces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ForceFilePropertyView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ForceFilePropertyView : Window
|
||||||
|
{
|
||||||
|
public ForceFilePropertyView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
StructureHelper/Windows/Forces/ListOfFilesVM.cs
Normal file
59
StructureHelper/Windows/Forces/ListOfFilesVM.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Services.FileServices;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms.Design;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.Forces
|
||||||
|
{
|
||||||
|
public class ListOfFilesVM : SelectItemVM<IForceFileProperty>
|
||||||
|
{
|
||||||
|
private ICommand openFileCommand;
|
||||||
|
public IShiftTraceLogger? TraceLogger;
|
||||||
|
|
||||||
|
public ICommand FileOpen => openFileCommand ?? (
|
||||||
|
openFileCommand = new RelayCommand(param =>
|
||||||
|
{
|
||||||
|
OpenFileMethod(param);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
private void OpenFileMethod(object param)
|
||||||
|
{
|
||||||
|
var result = GetFilePath();
|
||||||
|
if (result.IsValid == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ForceFileProperty fileProperty = new()
|
||||||
|
{
|
||||||
|
FilePath = result.FilePath,
|
||||||
|
};
|
||||||
|
Collection.Add(fileProperty);
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListOfFilesVM(List<IForceFileProperty> collection) : base(collection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpenFileResult GetFilePath()
|
||||||
|
{
|
||||||
|
var inputData = new OpenFileInputData()
|
||||||
|
{
|
||||||
|
FilterString = "MS Excel file (*.xlsx)|*.xlsx|All Files (*.*)|*.*",
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
var fileDialog = new FileOpener(inputData);
|
||||||
|
var fileDialogResult = fileDialog.OpenFile();
|
||||||
|
return fileDialogResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public double Height => AxisCanvasVM.Height;
|
public double Height => AxisCanvasVM.Height;
|
||||||
public double HalfOfWidth => AxisCanvasVM.Width / 2d;
|
public double HalfOfWidth => AxisCanvasVM.Width / 2d;
|
||||||
public double HalfOfHeight => AxisCanvasVM.Height / 2d;
|
public double HalfOfHeight => AxisCanvasVM.Height / 2d;
|
||||||
|
public int MainTextFontSize => 14;
|
||||||
|
public double TextScaleValue => 1 / scaleValue;
|
||||||
|
|
||||||
public string CanvasViewportSize
|
public string CanvasViewportSize
|
||||||
{
|
{
|
||||||
@@ -63,6 +65,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
OnPropertyChanged(value, ref scaleValue);
|
OnPropertyChanged(value, ref scaleValue);
|
||||||
OnPropertyChanged(nameof(AxisLineThickness));
|
OnPropertyChanged(nameof(AxisLineThickness));
|
||||||
OnPropertyChanged(nameof(GridLineThickness));
|
OnPropertyChanged(nameof(GridLineThickness));
|
||||||
|
OnPropertyChanged(nameof(TextScaleValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,8 +210,9 @@
|
|||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Add">
|
<MenuItem Header="Add">
|
||||||
<Button Content="Combination" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombination}"/>
|
<MenuItem Header="Combination" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombination}"/>
|
||||||
<Button Content="Combination By Factors" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombinationByFactor}"/>
|
<MenuItem Header="Combination By Factors" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombinationByFactor}"/>
|
||||||
|
<MenuItem Header="Combination From File" Command="{Binding Add}" CommandParameter="{x:Static enums:ActionType.ForceCombinationFromFile}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Expander.ContextMenu>
|
</Expander.ContextMenu>
|
||||||
@@ -442,12 +443,44 @@
|
|||||||
</VisualBrush>
|
</VisualBrush>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
<!--Horizontal axis line-->
|
<!--Horizontal axis line-->
|
||||||
|
<TextBlock Canvas.Left="0" Canvas.Top="{Binding HalfOfHeight}"
|
||||||
|
Margin="0,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||||
|
Background="AliceBlue"
|
||||||
|
Foreground="{Binding XAxisColorBrush}">
|
||||||
|
<TextBlock.RenderTransform>
|
||||||
|
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||||
|
</TextBlock.RenderTransform>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Canvas.Left="{Binding Width}" Canvas.Top="{Binding HalfOfHeight}"
|
||||||
|
Margin="-0.02,0,0,0" Text="X" FontSize="{Binding MainTextFontSize}"
|
||||||
|
Background="AliceBlue"
|
||||||
|
Foreground="{Binding XAxisColorBrush}">
|
||||||
|
<TextBlock.RenderTransform>
|
||||||
|
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||||
|
</TextBlock.RenderTransform>
|
||||||
|
</TextBlock>
|
||||||
<Line
|
<Line
|
||||||
X1="0" X2="{Binding Width}"
|
X1="0" X2="{Binding Width}"
|
||||||
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
Y1="{Binding HalfOfHeight}" Y2="{Binding HalfOfHeight}"
|
||||||
Stroke="{Binding XAxisColorBrush}"
|
Stroke="{Binding XAxisColorBrush}"
|
||||||
StrokeThickness="{Binding AxisLineThickness}"/>
|
StrokeThickness="{Binding AxisLineThickness}"/>
|
||||||
<!--Vertical axis line-->
|
<!--Vertical axis line-->
|
||||||
|
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="0"
|
||||||
|
Margin="0.01,0,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||||
|
Background="AliceBlue"
|
||||||
|
Foreground="{Binding YAxisColorBrush}">
|
||||||
|
<TextBlock.RenderTransform>
|
||||||
|
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}"/>
|
||||||
|
</TextBlock.RenderTransform>
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Canvas.Left="{Binding HalfOfWidth}" Canvas.Top="{Binding Height}"
|
||||||
|
Margin="0.01,-0.05,0,0" Text="Y" FontSize="{Binding MainTextFontSize}"
|
||||||
|
Background="AliceBlue"
|
||||||
|
Foreground="{Binding YAxisColorBrush}">
|
||||||
|
<TextBlock.RenderTransform>
|
||||||
|
<ScaleTransform ScaleX="{Binding TextScaleValue}" ScaleY="{Binding TextScaleValue}" />
|
||||||
|
</TextBlock.RenderTransform>
|
||||||
|
</TextBlock>
|
||||||
<Line
|
<Line
|
||||||
X1="{Binding HalfOfWidth}" X2="{Binding HalfOfWidth}"
|
X1="{Binding HalfOfWidth}" X2="{Binding HalfOfWidth}"
|
||||||
Y1="0" Y2="{Binding Height}"
|
Y1="0" Y2="{Binding Height}"
|
||||||
|
|||||||
@@ -34,10 +34,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
private ICrossSectionRepository repository => Section.SectionRepository;
|
private ICrossSectionRepository repository => Section.SectionRepository;
|
||||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
|
|
||||||
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||||
|
|
||||||
public AnalysisViewModelLogic CalculatorsLogic { get; private set; }
|
public AnalysisViewModelLogic CalculatorsLogic { get; private set; }
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
xmlns:forces="clr-namespace:StructureHelper.Windows.Forces"
|
xmlns:forces="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
x:Name="FactoredCombinationControl"
|
||||||
d:DataContext="{d:DesignInstance forces:FactoredCombinationPropertyVM}"
|
d:DataContext="{d:DesignInstance forces:FactoredCombinationPropertyVM}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="100" d:DesignWidth="350">
|
d:DesignHeight="100" d:DesignWidth="350">
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Row="0" Text="Limit State"/>
|
<TextBlock Grid.Row="0" Text="Limit state"/>
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding LimitStateList}" SelectedItem="{Binding LimitState}"/>
|
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding LimitStateList}" SelectedItem="{Binding LimitState}"/>
|
||||||
<TextBlock Grid.Row="1" Text="Calculation term"/>
|
<TextBlock Grid.Row="1" Text="Calculation term"/>
|
||||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding CalcTermList}" SelectedItem="{Binding CalcTerm}"/>
|
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding CalcTermList}" SelectedItem="{Binding CalcTerm}"/>
|
||||||
|
|||||||
@@ -13,50 +13,9 @@ namespace StructureHelper.Windows.UserControls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FactoredCombination : UserControl
|
public partial class FactoredCombination : UserControl
|
||||||
{
|
{
|
||||||
FactoredCombinationPropertyVM viewModel;
|
|
||||||
|
|
||||||
// Registering the Dependency Property
|
|
||||||
public static readonly DependencyProperty CombinationPropertyProperty =
|
|
||||||
DependencyProperty.Register(
|
|
||||||
nameof(CombinationProperty), // Property name
|
|
||||||
typeof(IFactoredCombinationProperty), // Property type
|
|
||||||
typeof(FactoredCombination), // Owner class
|
|
||||||
new PropertyMetadata(
|
|
||||||
default(IFactoredCombinationProperty),
|
|
||||||
OnCombinationPropertyChanged // PropertyChangedCallback
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// CLR Wrapper
|
|
||||||
public IFactoredCombinationProperty CombinationProperty
|
|
||||||
{
|
|
||||||
get => (IFactoredCombinationProperty)GetValue(CombinationPropertyProperty);
|
|
||||||
set => SetValue(CombinationPropertyProperty, value);
|
|
||||||
}
|
|
||||||
public FactoredCombination()
|
public FactoredCombination()
|
||||||
{
|
{
|
||||||
if (CombinationProperty is not null)
|
|
||||||
{
|
|
||||||
viewModel = new(CombinationProperty);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewModel = new(new FactoredCombinationProperty());
|
|
||||||
}
|
|
||||||
DataContext = viewModel;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnCombinationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
var control = d as FactoredCombination;
|
|
||||||
var newValue = e.NewValue as IFactoredCombinationProperty;
|
|
||||||
|
|
||||||
if (control?.viewModel != null)
|
|
||||||
{
|
|
||||||
// Update the ViewModel with the new property value
|
|
||||||
control.viewModel.UpdateCombinationProperty(newValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
43
StructureHelper/Windows/UserControls/ListOfFileControl.xaml
Normal file
43
StructureHelper/Windows/UserControls/ListOfFileControl.xaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<UserControl x:Class="StructureHelper.Windows.UserControls.ListOfFileControl"
|
||||||
|
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"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:forces="clr-namespace:StructureHelper.Windows.Forces"
|
||||||
|
d:DataContext="{d:DesignInstance forces:ListOfFilesVM}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<DockPanel>
|
||||||
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding FileOpen}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Open file"
|
||||||
|
IconContent="{StaticResource FileOpen}"
|
||||||
|
DescriptionText="Open exsisting project from file"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource FileOpen}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<Grid>
|
||||||
|
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Delete" Command="{Binding Delete}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding FilePath}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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.UserControls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ListOfFileControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ListOfFileControl : UserControl
|
||||||
|
{
|
||||||
|
public ListOfFileControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,10 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
{
|
{
|
||||||
NewItem = new ForceFactoredList() { Name = "New Factored Combination" };
|
NewItem = new ForceFactoredList() { Name = "New Factored Combination" };
|
||||||
}
|
}
|
||||||
|
else if (paramType == ActionType.ForceCombinationFromFile)
|
||||||
|
{
|
||||||
|
NewItem = new ForceCombinationFromFile { Name = "New Combination from file" };
|
||||||
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
|
||||||
//GlobalRepository.Actions.Create(NewItem);
|
//GlobalRepository.Actions.Create(NewItem);
|
||||||
base.AddMethod(parameter);
|
base.AddMethod(parameter);
|
||||||
@@ -60,20 +64,22 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
{
|
{
|
||||||
//var copyObject = GlobalRepository.Actions.GetById(SelectedItem.Id).Clone() as IAction;
|
//var copyObject = GlobalRepository.Actions.GetById(SelectedItem.Id).Clone() as IAction;
|
||||||
var copyObject = SelectedItem.Clone() as IAction;
|
var copyObject = SelectedItem.Clone() as IAction;
|
||||||
System.Windows.Window wnd;
|
System.Windows.Window modelEditorWindow;
|
||||||
if (SelectedItem is IForceCombinationList)
|
if (SelectedItem is IForceCombinationList combinationList)
|
||||||
{
|
{
|
||||||
var item = (IForceCombinationList)SelectedItem;
|
modelEditorWindow = new ForceCombinationView(combinationList);
|
||||||
wnd = new ForceCombinationView(item);
|
|
||||||
}
|
}
|
||||||
else if (SelectedItem is IForceFactoredList)
|
else if (SelectedItem is IForceFactoredList factoredList)
|
||||||
{
|
{
|
||||||
var item = (IForceFactoredList)SelectedItem;
|
modelEditorWindow = new ForceCombinationByFactorView(factoredList);
|
||||||
wnd = new ForceCombinationByFactorView(item);
|
}
|
||||||
|
else if (SelectedItem is IForceCombinationFromFile fileCombination)
|
||||||
|
{
|
||||||
|
modelEditorWindow = new ForceCombinationFromFileView(fileCombination);
|
||||||
}
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}");
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}");
|
||||||
wnd.ShowDialog();
|
modelEditorWindow.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (modelEditorWindow.DialogResult == true)
|
||||||
{
|
{
|
||||||
//GlobalRepository.Actions.Update(SelectedItem);
|
//GlobalRepository.Actions.Update(SelectedItem);
|
||||||
}
|
}
|
||||||
@@ -100,11 +106,15 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
|||||||
var forceCombinations = forceCalculator.InputData as IHasForceActions;
|
var forceCombinations = forceCalculator.InputData as IHasForceActions;
|
||||||
result = DeleteActionFromHost(result, calc, forceCombinations);
|
result = DeleteActionFromHost(result, calc, forceCombinations);
|
||||||
}
|
}
|
||||||
else if (calc is CrackCalculator calculator)
|
else if (calc is CrackCalculator crackCalculator)
|
||||||
{
|
{
|
||||||
var forceCombinations = calculator.InputData as IHasForceActions;
|
var forceCombinations = crackCalculator.InputData as IHasForceActions;
|
||||||
result = DeleteActionFromHost(result, calc, forceCombinations);
|
result = DeleteActionFromHost(result, calc, forceCombinations);
|
||||||
}
|
}
|
||||||
|
else if (calc is ILimitCurvesCalculator)
|
||||||
|
{
|
||||||
|
//nothing to do
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ICalculator), calc));
|
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ICalculator), calc));
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -8,9 +10,13 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
internal class ForceCombinationFromFile : IForceCombinationFromFile
|
public class ForceCombinationFromFile : IForceCombinationFromFile
|
||||||
{
|
{
|
||||||
private IForceFactoredCombination factoredCombination;
|
IUpdateStrategy<IForceCombinationFromFile> updateStrategy;
|
||||||
|
IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy;
|
||||||
|
IGetTupleFromFileLogic getTupleFromFileLogic;
|
||||||
|
|
||||||
|
private IForceFactoredList factoredCombination;
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public List<IForceFileProperty> ForceFiles { get; set; } = new();
|
public List<IForceFileProperty> ForceFiles { get; set; } = new();
|
||||||
@@ -21,12 +27,25 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
ForceCombinationFromFile newItem = new();
|
||||||
|
updateStrategy ??= new ForceCombinationFromFileUpdateStrategy();
|
||||||
|
updateStrategy.Update(newItem, this);
|
||||||
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IForceCombinationList> GetCombinations()
|
public List<IForceCombinationList> GetCombinations()
|
||||||
{
|
{
|
||||||
|
getTupleFromFileLogic ??= new GetTupleFromFileLogic() { TraceLogger = new ShiftTraceLogger()};
|
||||||
factoredCombination = new ForceFactoredList();
|
factoredCombination = new ForceFactoredList();
|
||||||
|
factoredCombination.ForceTuples.Clear();
|
||||||
|
propertyUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy();
|
||||||
|
propertyUpdateStrategy.Update(factoredCombination.CombinationProperty, CombinationProperty);
|
||||||
|
foreach (var file in ForceFiles)
|
||||||
|
{
|
||||||
|
getTupleFromFileLogic.ForceFileProperty = file;
|
||||||
|
var tuples = getTupleFromFileLogic.GetTuples();
|
||||||
|
factoredCombination.ForceTuples.AddRange(tuples);
|
||||||
|
}
|
||||||
return factoredCombination.GetCombinations();
|
return factoredCombination.GetCombinations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,15 +10,13 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
public class ForceFileProperty : IForceFileProperty
|
public class ForceFileProperty : IForceFileProperty
|
||||||
{
|
{
|
||||||
public Guid Id { get; private set; }
|
public Guid Id { get; private set; }
|
||||||
public LimitStates LimitState { get; set; } = LimitStates.ULS;
|
|
||||||
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
|
|
||||||
public string FilePath { get; set; } = string.Empty;
|
public string FilePath { get; set; } = string.Empty;
|
||||||
public int SkipRowBeforeHeaderCount { get; set; } = 2;
|
public int SkipRowBeforeHeaderCount { get; set; } = 2;
|
||||||
public int SkipRowHeaderCount { get; set; } = 1;
|
public int SkipRowHeaderCount { get; set; } = 1;
|
||||||
public double GlobalFactor { get; set; } = 1d;
|
public double GlobalFactor { get; set; } = 1d;
|
||||||
public IColumnProperty Mx { get; set; } = new ColumnProperty("N");
|
public IColumnProperty Nz { get; set; } = new ColumnProperty("N") { ColumnIndex = 6};
|
||||||
public IColumnProperty My { get; set; } = new ColumnProperty("My");
|
public IColumnProperty Mx { get; set; } = new ColumnProperty("My") { ColumnIndex = 8};
|
||||||
public IColumnProperty Nz { get; set; } = new ColumnProperty("Mz");
|
public IColumnProperty My { get; set; } = new ColumnProperty("Mz") { ColumnIndex = 10};
|
||||||
|
|
||||||
public ForceFileProperty(Guid id)
|
public ForceFileProperty(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
9
StructureHelperCommon/Models/Forces/IFileProperty.cs
Normal file
9
StructureHelperCommon/Models/Forces/IFileProperty.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces
|
||||||
|
{
|
||||||
|
public interface IFileProperty : ISaveable
|
||||||
|
{
|
||||||
|
string FilePath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supports list of files which provides import of combination of forces
|
/// Supports list of files which provides import of combination of forces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal interface IForceCombinationFromFile : IForceFactoredCombination
|
public interface IForceCombinationFromFile : IForceFactoredCombination
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of file properties for import combination
|
/// List of file properties for import combination
|
||||||
|
|||||||
@@ -11,11 +11,8 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings for extracting force combination from MSExcel file
|
/// Settings for extracting force combination from MSExcel file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IForceFileProperty : ISaveable
|
public interface IForceFileProperty : IFileProperty
|
||||||
{
|
{
|
||||||
LimitStates LimitState { get; set; }
|
|
||||||
CalcTerms CalcTerm { get; set; }
|
|
||||||
string FilePath { get; set; }
|
|
||||||
int SkipRowBeforeHeaderCount { get; set; }
|
int SkipRowBeforeHeaderCount { get; set; }
|
||||||
int SkipRowHeaderCount { get; set; }
|
int SkipRowHeaderCount { get; set; }
|
||||||
double GlobalFactor { get; set; }
|
double GlobalFactor { get; set; }
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
public class ActionUpdateStrategy : IUpdateStrategy<IAction>
|
public class ActionUpdateStrategy : IUpdateStrategy<IAction>
|
||||||
{
|
{
|
||||||
readonly IUpdateStrategy<IForceAction> forceUpdateStrategy = new ForceActionUpdateStrategy();
|
private IUpdateStrategy<IForceAction> forceUpdateStrategy;
|
||||||
public void Update(IAction targetObject, IAction sourceObject)
|
public void Update(IAction targetObject, IAction sourceObject)
|
||||||
{
|
{
|
||||||
|
forceUpdateStrategy ??= new ForceActionUpdateStrategy();
|
||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
|
{
|
||||||
|
public class CheckForceActionsLogic : ICheckEntityLogic<IEnumerable<IForceAction>>
|
||||||
|
{
|
||||||
|
private bool result;
|
||||||
|
private string checkResult;
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public IEnumerable<IForceAction> Entity { get; set; }
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
foreach (var item in Entity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
item.GetCombinations();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
string errorString = $"Error of getting of combination of forces from action {item.Name}: {ex.Message}";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces.Logics
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public class ForceActionBaseUpdateStrategy : IUpdateStrategy<IForceAction>
|
public class ForceActionBaseUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ using System.Threading.Tasks;
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Forces.Logics;
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
|
|
||||||
|
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||||
@@ -18,24 +21,28 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
|
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
|
||||||
private readonly IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
|
private readonly IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
|
||||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
||||||
|
private readonly IUpdateStrategy<IForceCombinationFromFile> fileCombinationUpdateStrategy;
|
||||||
|
|
||||||
public ForceActionUpdateStrategy(
|
public ForceActionUpdateStrategy(
|
||||||
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
||||||
IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy,
|
IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy,
|
||||||
IUpdateStrategy<IForceFactoredList> factorUpdateStrategy,
|
IUpdateStrategy<IForceFactoredList> factorUpdateStrategy,
|
||||||
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy)
|
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy,
|
||||||
|
IUpdateStrategy<IForceCombinationFromFile> fileCombinationUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
||||||
this.forcePairUpdateStrategy = forcePairUpdateStrategy;
|
this.forcePairUpdateStrategy = forcePairUpdateStrategy;
|
||||||
this.factorUpdateStrategy = factorUpdateStrategy;
|
this.factorUpdateStrategy = factorUpdateStrategy;
|
||||||
this.forceListUpdateStrategy = forceListUpdateStrategy;
|
this.forceListUpdateStrategy = forceListUpdateStrategy;
|
||||||
|
this.fileCombinationUpdateStrategy = fileCombinationUpdateStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceActionUpdateStrategy() : this(
|
public ForceActionUpdateStrategy() : this(
|
||||||
new ForceActionBaseUpdateStrategy(),
|
new ForceActionBaseUpdateStrategy(),
|
||||||
new ForcePairUpdateStrategy(),
|
new ForcePairUpdateStrategy(),
|
||||||
new ForceFactoredListUpdateStrategy(),
|
new ForceFactoredListUpdateStrategy(),
|
||||||
new ForceCombinationListUpdateStrategy()
|
new ForceCombinationListUpdateStrategy(),
|
||||||
|
new ForceCombinationFromFileUpdateStrategy()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -64,6 +71,10 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
forceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject);
|
forceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject);
|
||||||
}
|
}
|
||||||
|
else if (targetObject is IForceCombinationFromFile fileCombination)
|
||||||
|
{
|
||||||
|
fileCombinationUpdateStrategy.Update(fileCombination, (IForceCombinationFromFile)sourceObject);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(IForceAction), targetObject.GetType());
|
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(IForceAction), targetObject.GetType());
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
||||||
private IUpdateStrategy<IForceFileProperty> fileUpdateStrategy;
|
private IUpdateStrategy<IForceFileProperty> fileUpdateStrategy;
|
||||||
|
|
||||||
public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy<IForceAction> baseUpdateStrategy, IUpdateStrategy<IForceFileProperty> fileUpdateStrategy)
|
public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy<IForceAction> baseUpdateStrategy,
|
||||||
|
IUpdateStrategy<IForceFileProperty> fileUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.baseUpdateStrategy = baseUpdateStrategy;
|
this.baseUpdateStrategy = baseUpdateStrategy;
|
||||||
this.fileUpdateStrategy = fileUpdateStrategy;
|
this.fileUpdateStrategy = fileUpdateStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCombinationFromFileUpdateStrategy() : this (
|
public ForceCombinationFromFileUpdateStrategy()
|
||||||
new ForceActionUpdateStrategy(),
|
|
||||||
new ForceFilePropertyUpdateStrategy())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUpdateStrategy<IForceCombinationFromFile>.Update(IForceCombinationFromFile targetObject, IForceCombinationFromFile sourceObject)
|
void IUpdateStrategy<IForceCombinationFromFile>.Update(IForceCombinationFromFile targetObject, IForceCombinationFromFile sourceObject)
|
||||||
@@ -31,12 +29,21 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
InitializeLogics();
|
||||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
targetObject.ForceFiles.Clear();
|
targetObject.ForceFiles.Clear();
|
||||||
foreach (var file in sourceObject.ForceFiles)
|
foreach (var file in sourceObject.ForceFiles)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
ForceFileProperty newProperty = new();
|
||||||
|
fileUpdateStrategy.Update(newProperty, file);
|
||||||
|
targetObject.ForceFiles.Add(newProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeLogics()
|
||||||
|
{
|
||||||
|
baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
||||||
|
fileUpdateStrategy ??= new ForceFilePropertyUpdateStrategy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.LimitState = sourceObject.LimitState;
|
|
||||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
|
||||||
targetObject.FilePath = sourceObject.FilePath;
|
targetObject.FilePath = sourceObject.FilePath;
|
||||||
targetObject.GlobalFactor = sourceObject.GlobalFactor;
|
targetObject.GlobalFactor = sourceObject.GlobalFactor;
|
||||||
targetObject.SkipRowBeforeHeaderCount = sourceObject.SkipRowBeforeHeaderCount;
|
targetObject.SkipRowBeforeHeaderCount = sourceObject.SkipRowBeforeHeaderCount;
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
using ExcelDataReader;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
|
{
|
||||||
|
public class GetTupleFromFileLogic : IGetTupleFromFileLogic
|
||||||
|
{
|
||||||
|
public IForceFileProperty ForceFileProperty { get; set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public List<IForceTuple> GetTuples()
|
||||||
|
{
|
||||||
|
// Ensure ExcelDataReader's encoding provider is registered
|
||||||
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
||||||
|
|
||||||
|
var result = ReadDataFromFile();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<IForceTuple> ReadDataFromFile()
|
||||||
|
{
|
||||||
|
List<IForceTuple> result = new();
|
||||||
|
// Open the Excel file stream
|
||||||
|
using (var stream = File.Open(ForceFileProperty.FilePath, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
// Create an Excel reader
|
||||||
|
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
||||||
|
{
|
||||||
|
// Skip the first two header rows if necessary (adjust based on structure)
|
||||||
|
int skipRows = ForceFileProperty.SkipRowBeforeHeaderCount + ForceFileProperty.SkipRowHeaderCount;
|
||||||
|
for (int i = 0; i < skipRows; i++)
|
||||||
|
{
|
||||||
|
reader.Read(); // Skip row
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through the rows
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
var nValue = reader.GetValue(ForceFileProperty.Nz.ColumnIndex)?.ToString();
|
||||||
|
var mxValue = reader.GetValue(ForceFileProperty.Mx.ColumnIndex)?.ToString();
|
||||||
|
var myValue = reader.GetValue(ForceFileProperty.My.ColumnIndex)?.ToString();
|
||||||
|
TraceLogger?.AddMessage($"Values: Nz = {nValue}(N), Mx = {mxValue}(N*m), My = {myValue}(N*m) were gained", TraceLogStatuses.Debug);
|
||||||
|
if (nValue is not null && mxValue is not null && myValue is not null)
|
||||||
|
{
|
||||||
|
ForceTuple newTuple = GetForceTuple(nValue, mxValue, myValue);
|
||||||
|
result.Add(newTuple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceTuple GetForceTuple(string? nValue, string? mxValue, string? myValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double nDouble = Convert.ToDouble(nValue);
|
||||||
|
double mxDouble = Convert.ToDouble(mxValue);
|
||||||
|
double myDouble = Convert.ToDouble(myValue);
|
||||||
|
TraceLogger?.AddMessage($"Values: Nz = {nDouble}(N), Mx = {mxDouble}(N*m), My = {myDouble}(N*m) were converted successfully", TraceLogStatuses.Debug);
|
||||||
|
ForceTuple newTuple = new() { Nz = nDouble, Mx = mxDouble, My = myDouble };
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string errorString = ErrorStrings.DataIsInCorrect + $": incorrect data in file {ForceFileProperty.FilePath}, " + ex.Message;
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
|
{
|
||||||
|
public interface IGetTupleFromFileLogic : ILogic
|
||||||
|
{
|
||||||
|
IForceFileProperty ForceFileProperty { get; set; }
|
||||||
|
|
||||||
|
List<IForceTuple> GetTuples();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="ExcelDataReader" Version="3.7.0" />
|
||||||
<PackageReference Include="NLog" Version="5.3.4" />
|
<PackageReference Include="NLog" Version="5.3.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using StructureHelperCommon.Infrastructures.Settings;
|
|||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -66,9 +67,24 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
CheckAccuracy();
|
CheckAccuracy();
|
||||||
|
CheckActions();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckActions()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckForceActionsLogic()
|
||||||
|
{
|
||||||
|
Entity = InputData.ForceActions,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
if (checkLogic.Check() == false)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
TraceMessage(checkLogic.CheckResult);
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckAccuracy()
|
private void CheckAccuracy()
|
||||||
{
|
{
|
||||||
checkAccuracyLogic.Entity = InputData.Accuracy;
|
checkAccuracyLogic.Entity = InputData.Accuracy;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperCommon.Models.Materials;
|
using StructureHelperCommon.Models.Materials;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
@@ -74,7 +75,23 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
string message = "Calculator does not contain any actions\n";
|
string message = "Calculator does not contain any actions\n";
|
||||||
CheckResult += message;
|
CheckResult += message;
|
||||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
var checkLogic = new CheckForceActionsLogic()
|
||||||
|
{
|
||||||
|
Entity = InputData.ForceActions,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
if (checkLogic.Check() == false)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
TraceMessage(checkLogic.CheckResult);
|
||||||
|
}
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
CheckResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user