CrossSection view model was improved
This commit is contained in:
@@ -25,12 +25,12 @@ namespace StructureHelper
|
||||
builder.RegisterType<CrossSectionModel>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<CrossSectionViewModel>().AsSelf().SingleInstance();
|
||||
|
||||
builder.RegisterType<MainView>().AsSelf();
|
||||
builder.RegisterType<CrossSectionView>().AsSelf();
|
||||
|
||||
Container = builder.Build();
|
||||
Scope = Container.Resolve<ILifetimeScope>();
|
||||
|
||||
var window = Scope.Resolve<MainView>();
|
||||
var window = Scope.Resolve<CrossSectionView>();
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.MainView"
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.CrossSectionView"
|
||||
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"
|
||||
@@ -13,7 +13,7 @@
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
||||
d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
|
||||
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
|
||||
<Window.Resources>
|
||||
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
|
||||
@@ -363,7 +363,7 @@
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
|
||||
<Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}">
|
||||
<Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding VisualProperty.WorkPlainWidth}" Height="{Binding VisualProperty.WorkPlainHeight}">
|
||||
<Canvas.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}">
|
||||
@@ -438,8 +438,10 @@
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Canvas.Background>
|
||||
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<!--Horizontal axis line-->
|
||||
<Line X1="0" X2="{Binding RightLimitX}" Y1="{Binding MiddleLimitY}" Y2="{Binding MiddleLimitY}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<!--Vertical axis line-->
|
||||
<Line X1="{Binding MiddleLimitX}" X2="{Binding MiddleLimitX}" Y1="0" Y2="{Binding BottomLimitY}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
|
||||
<ItemsControl DataContext="{Binding PrimitiveLogic}" ItemsSource="{Binding Items}" ContextMenu="{StaticResource PrimitiveCRUD}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -6,12 +6,12 @@ using StructureHelper.Services.Primitives;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public partial class MainView : Window
|
||||
public partial class CrossSectionView : Window
|
||||
{
|
||||
private CrossSectionViewModel viewModel;
|
||||
public IPrimitiveRepository PrimitiveRepository { get; }
|
||||
|
||||
public MainView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
|
||||
public CrossSectionView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
|
||||
{
|
||||
PrimitiveRepository = primitiveRepository;
|
||||
this.viewModel = viewModel;
|
||||
@@ -27,21 +27,19 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class CrossSectionViewModel : ViewModelBase
|
||||
{
|
||||
ICrossSection section;
|
||||
ICrossSectionRepository repository => section.SectionRepository;
|
||||
|
||||
private CrossSectionViewVisualProperty visualProperty;
|
||||
|
||||
private ICrossSection section;
|
||||
private ICrossSectionRepository repository => section.SectionRepository;
|
||||
private readonly double scaleRate = 1.1d;
|
||||
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
//public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||
public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
|
||||
|
||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
|
||||
public MaterialsViewModel MaterialsLogic { get => materialsLogic; }
|
||||
public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
|
||||
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get; private set; }
|
||||
public ActionsViewModel CombinationsLogic { get; }
|
||||
public MaterialsViewModel MaterialsLogic { get; }
|
||||
public PrimitiveViewModelLogic PrimitiveLogic { get; }
|
||||
public HelpLogic HelpLogic => new HelpLogic();
|
||||
|
||||
private CrossSectionModel Model { get; }
|
||||
@@ -84,37 +82,26 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => visualProperty.AxisLineThickness / scaleValue;
|
||||
get => VisualProperty.AxisLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => visualProperty.GridLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
private double xX2, xY1, yX1, yY2;
|
||||
public double CanvasWidth
|
||||
{
|
||||
get => visualProperty.WorkPlainWidth;
|
||||
}
|
||||
|
||||
public double CanvasHeight
|
||||
{
|
||||
get => visualProperty.WorkPlainHeight;
|
||||
}
|
||||
get => VisualProperty.GridLineThickness / scaleValue;
|
||||
}
|
||||
|
||||
public string CanvasViewportSize
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = visualProperty.GridSize.ToString();
|
||||
string s = VisualProperty.GridSize.ToString();
|
||||
s = s.Replace(',', '.');
|
||||
return $"0,0,{s},{s}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double GridSize { get => visualProperty.GridSize; }
|
||||
public double GridSize => VisualProperty.GridSize;
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||
{
|
||||
@@ -129,26 +116,22 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
public double XX2
|
||||
{
|
||||
get => xX2;
|
||||
set => OnPropertyChanged(value, ref xX2);
|
||||
}
|
||||
public double XY1
|
||||
{
|
||||
get => xY1;
|
||||
set => OnPropertyChanged(value, ref xY1);
|
||||
}
|
||||
public double YX1
|
||||
{
|
||||
get => yX1;
|
||||
set => OnPropertyChanged(value, ref yX1);
|
||||
}
|
||||
public double YY2
|
||||
{
|
||||
get => yY2;
|
||||
set => OnPropertyChanged(value, ref yY2);
|
||||
}
|
||||
/// <summary>
|
||||
/// Right edge of work plane, coordinate X
|
||||
/// </summary>
|
||||
public double RightLimitX => VisualProperty.WorkPlainWidth;
|
||||
/// <summary>
|
||||
/// Bottom edge of work plane Y
|
||||
/// </summary>
|
||||
public double BottomLimitY => VisualProperty.WorkPlainHeight;
|
||||
/// <summary>
|
||||
/// Middle of coordinate X
|
||||
/// </summary>
|
||||
public double MiddleLimitX => VisualProperty.WorkPlainWidth / 2d;
|
||||
/// <summary>
|
||||
/// Middle of coordinate Y
|
||||
/// </summary>
|
||||
public double MiddleLimitY => VisualProperty.WorkPlainHeight / 2d;
|
||||
|
||||
public ICommand Calculate { get; }
|
||||
public ICommand EditCalculationPropertyCommand { get; }
|
||||
@@ -160,7 +143,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
return new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetRCCirclePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -189,11 +172,18 @@ namespace StructureHelper.Windows.MainWindow
|
||||
return showVisualProperty ??
|
||||
(showVisualProperty = new RelayCommand(o=>
|
||||
{
|
||||
var wnd = new VisualPropertyView(visualProperty);
|
||||
var wnd = new VisualPropertyView(VisualProperty);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
OnPropertyChanged(nameof(CanvasViewportSize));
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
OnPropertyChanged(nameof(RightLimitX));
|
||||
OnPropertyChanged(nameof(BottomLimitY));
|
||||
OnPropertyChanged(nameof(MiddleLimitX));
|
||||
OnPropertyChanged(nameof(MiddleLimitY));
|
||||
PrimitiveLogic.WorkPlaneWidth = VisualProperty.WorkPlainWidth;
|
||||
PrimitiveLogic.WorkPlaneHeight = VisualProperty.WorkPlainHeight;
|
||||
PrimitiveLogic.Refresh();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -214,27 +204,24 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
|
||||
private double delta = 0.0005;
|
||||
private ActionsViewModel combinationsLogic;
|
||||
private PrimitiveViewModelLogic primitiveLogic;
|
||||
private RelayCommand showVisualProperty;
|
||||
private RelayCommand selectPrimitive;
|
||||
private MaterialsViewModel materialsLogic;
|
||||
|
||||
public CrossSectionViewModel(CrossSectionModel model)
|
||||
{
|
||||
visualProperty = new CrossSectionViewVisualProperty();
|
||||
VisualProperty = new CrossSectionVisualPropertyVM();
|
||||
Model = model;
|
||||
section = model.Section;
|
||||
combinationsLogic = new ActionsViewModel(repository);
|
||||
materialsLogic = new MaterialsViewModel(repository);
|
||||
materialsLogic.AfterItemsEdit += afterMaterialEdit;
|
||||
calculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
|
||||
XX2 = CanvasWidth;
|
||||
XY1 = CanvasHeight / 2d;
|
||||
YX1 = CanvasWidth / 2d;
|
||||
YY2 = CanvasHeight;
|
||||
scaleValue = 300d;
|
||||
CombinationsLogic = new ActionsViewModel(repository);
|
||||
MaterialsLogic = new MaterialsViewModel(repository);
|
||||
MaterialsLogic.AfterItemsEdit += afterMaterialEdit;
|
||||
CalculatorsLogic = new AnalysisVewModelLogic(repository);
|
||||
PrimitiveLogic = new PrimitiveViewModelLogic(section)
|
||||
{
|
||||
WorkPlaneWidth = VisualProperty.WorkPlainWidth,
|
||||
WorkPlaneHeight = VisualProperty.WorkPlainHeight
|
||||
};
|
||||
scaleValue = 500d;
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
@@ -260,13 +247,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
});
|
||||
|
||||
//SetColor = new RelayCommand(o =>
|
||||
//{
|
||||
// var primitive = o as PrimitiveBase;
|
||||
// var colorPickerView = new ColorPickerView(primitive);
|
||||
// colorPickerView.ShowDialog();
|
||||
//});
|
||||
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
ScrollPanelX = PanelX;
|
||||
@@ -284,19 +264,19 @@ namespace StructureHelper.Windows.MainWindow
|
||||
AddBeamCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetBeamCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddColumnCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetColumnCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
AddSlabCase = new RelayCommand(o =>
|
||||
{
|
||||
PrimitiveLogic.AddItems(GetSlabCasePrimitives());
|
||||
materialsLogic.Refresh();
|
||||
MaterialsLogic.Refresh();
|
||||
});
|
||||
|
||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||
@@ -328,7 +308,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
|
||||
{
|
||||
foreach (var primitive in primitiveLogic.Items)
|
||||
foreach (var primitive in PrimitiveLogic.Items)
|
||||
{
|
||||
primitive.RefreshColor();
|
||||
}
|
||||
@@ -336,7 +316,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
private bool CheckMaterials()
|
||||
{
|
||||
foreach (var item in primitiveLogic.Items)
|
||||
foreach (var item in PrimitiveLogic.Items)
|
||||
{
|
||||
if (item.HeadMaterial == null)
|
||||
{
|
||||
@@ -400,7 +380,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
item.RegisterDeltas(VisualProperty.WorkPlainWidth / 2, VisualProperty.WorkPlainHeight / 2);
|
||||
}
|
||||
PrimitiveLogic.Refresh();
|
||||
foreach (var item in newRepository.HeadMaterials)
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class CrossSectionVisualPropertyVM : ViewModelBase
|
||||
{
|
||||
private double axisLineThickness;
|
||||
private double gridLineThickness;
|
||||
private double gridSize;
|
||||
private double workPlainWidth;
|
||||
private double workPlainHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Thickness of x-, and y- axis line
|
||||
/// </summary>
|
||||
public double AxisLineThickness
|
||||
{
|
||||
get => axisLineThickness; set
|
||||
{
|
||||
axisLineThickness = value;
|
||||
OnPropertyChanged(nameof(AxisLineThickness));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Thickness of lines of coordinate mesh
|
||||
/// </summary>
|
||||
public double GridLineThickness
|
||||
{
|
||||
get => gridLineThickness; set
|
||||
{
|
||||
gridLineThickness = value;
|
||||
OnPropertyChanged(nameof(GridLineThickness));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Size of coordinate mesh
|
||||
/// </summary>
|
||||
public double GridSize
|
||||
{
|
||||
get => gridSize; set
|
||||
{
|
||||
gridSize = value;
|
||||
OnPropertyChanged(nameof(GridSize));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Width of work plane
|
||||
/// </summary>
|
||||
public double WorkPlainWidth
|
||||
{
|
||||
get => workPlainWidth; set
|
||||
{
|
||||
workPlainWidth = value;
|
||||
OnPropertyChanged(nameof(WorkPlainWidth));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Height of work plane
|
||||
/// </summary>
|
||||
public double WorkPlainHeight
|
||||
{
|
||||
get => workPlainHeight; set
|
||||
{
|
||||
workPlainHeight = value;
|
||||
OnPropertyChanged(nameof(WorkPlainHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public CrossSectionVisualPropertyVM()
|
||||
{
|
||||
AxisLineThickness = 2d;
|
||||
GridLineThickness = 0.25d;
|
||||
GridSize = 0.05d;
|
||||
WorkPlainWidth = 1.2d;
|
||||
WorkPlainHeight = 1.2d;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
|
||||
d:DataContext="{d:DesignInstance local:CrossSectionVisualPropertyVM}"
|
||||
mc:Ignorable="d"
|
||||
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
@@ -18,7 +22,13 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Axis grid thickness"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Mesh size"/>
|
||||
<TextBlock Grid.Row="1" Text="Grid size"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Grid line thickness"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding GridLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Work plane width"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding WorkPlainWidth, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="4" Text="Work plane height"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding WorkPlainHeight, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -20,7 +19,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
/// </summary>
|
||||
public partial class VisualPropertyView : Window
|
||||
{
|
||||
public VisualPropertyView(CrossSectionViewVisualProperty vm)
|
||||
public VisualPropertyView(CrossSectionVisualPropertyVM vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace StructureHelper.Windows.Services
|
||||
}
|
||||
private void RefreshAngle()
|
||||
{
|
||||
Angle = Math.Atan2(deltaX, deltaY) * 180d / Math.PI - 90d;
|
||||
Angle = Math.Atan2(deltaX, deltaY * (-1)) * 180d / Math.PI - 90d;
|
||||
Angle = Math.Round(Angle, 1);
|
||||
Distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
Distance = Math.Round(Distance, 3);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class CrossSectionViewVisualProperty
|
||||
{
|
||||
public double AxisLineThickness { get; set; }
|
||||
public double GridLineThickness { get; set; }
|
||||
public double GridSize { get; set; }
|
||||
public double WorkPlainWidth { get; set; }
|
||||
public double WorkPlainHeight { get; set; }
|
||||
|
||||
public CrossSectionViewVisualProperty()
|
||||
{
|
||||
AxisLineThickness = 2d;
|
||||
GridLineThickness = 0.25d;
|
||||
GridSize = 0.05d;
|
||||
WorkPlainWidth = 2.4d;
|
||||
WorkPlainHeight = 2.0d;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,21 @@
|
||||
using FieldVisualizer.ViewModels;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
using StructureHelper.Windows.Services;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using ViewModelBase = StructureHelper.Infrastructure.ViewModelBase;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Documents;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System.Windows.Input;
|
||||
using StructureHelper.Windows.Services;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
@@ -36,8 +31,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
private ICommand setToBack;
|
||||
private ICommand copyToCommand;
|
||||
|
||||
public double CanvasWidth { get; set; }
|
||||
public double CanvasHeight { get; set; }
|
||||
public double WorkPlaneWidth { get; set; }
|
||||
public double WorkPlaneHeight { get; set; }
|
||||
|
||||
public PrimitiveBase SelectedItem { get; set; }
|
||||
|
||||
@@ -101,7 +96,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
viewPrimitive = new CircleViewPrimitive(primitive);
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
|
||||
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
viewPrimitive.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
|
||||
repository.Primitives.Add(ndmPrimitive);
|
||||
ndmPrimitive.CrossSection = section;
|
||||
Items.Add(viewPrimitive);
|
||||
@@ -244,7 +239,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
primitiveBase.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
primitiveBase.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
|
||||
Items.Add(primitiveBase);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
@@ -306,6 +301,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
item.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
|
||||
item.Refresh();
|
||||
}
|
||||
OnPropertyChanged(nameof(PrimitivesCount));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user