Head material was added
This commit is contained in:
33
Infrastructure/UI/Converters/Common/InvertBoolConverter.cs
Normal file
33
Infrastructure/UI/Converters/Common/InvertBoolConverter.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.Converters.Common
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(bool), typeof(bool))]
|
||||||
|
public class InvertBoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public InvertBoolConverter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value != null && value is bool)
|
||||||
|
{
|
||||||
|
return !((bool)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return Convert(value, targetType, parameter, culture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using StructureHelper.Infrastructure.Enums;
|
using StructureHelper.Infrastructure.Enums;
|
||||||
@@ -25,6 +27,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
private double maxElementSize;
|
private double maxElementSize;
|
||||||
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
||||||
private Brush brush;
|
private Brush brush;
|
||||||
|
private bool setMaterialColor;
|
||||||
|
private Color color;
|
||||||
|
private IHeadMaterial headMaterial;
|
||||||
private MaterialDefinitionBase material;
|
private MaterialDefinitionBase material;
|
||||||
private double prestrain_kx, prestrain_ky, prestrain_epsz;
|
private double prestrain_kx, prestrain_ky, prestrain_epsz;
|
||||||
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
|
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
|
||||||
@@ -91,6 +96,30 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
OnPropertyChanged(value, ref centerY);
|
OnPropertyChanged(value, ref centerY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IHeadMaterial HeadMaterial
|
||||||
|
{
|
||||||
|
get => headMaterial;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
OnPropertyChanged(value, ref headMaterial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SetMaterialColor
|
||||||
|
{
|
||||||
|
get => setMaterialColor;
|
||||||
|
set { OnPropertyChanged(value, ref setMaterialColor);}
|
||||||
|
}
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get => setMaterialColor? headMaterial.Color :color;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetMaterialColor = false;
|
||||||
|
OnPropertyChanged(value, ref color);
|
||||||
|
}
|
||||||
|
}
|
||||||
public int MinElementDivision
|
public int MinElementDivision
|
||||||
{
|
{
|
||||||
get => minElementDivision;
|
get => minElementDivision;
|
||||||
@@ -119,8 +148,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
}
|
}
|
||||||
public Brush Brush
|
public Brush Brush
|
||||||
{
|
{
|
||||||
get => brush;
|
get => new SolidColorBrush(Color);
|
||||||
set => OnPropertyChanged(value, ref brush);
|
set { }
|
||||||
}
|
}
|
||||||
public MaterialDefinitionBase Material
|
public MaterialDefinitionBase Material
|
||||||
{
|
{
|
||||||
@@ -259,8 +288,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
||||||
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
||||||
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
||||||
var color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
||||||
Brush = new SolidColorBrush(color);
|
|
||||||
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
|
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
|
||||||
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
|
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
|
||||||
|
|
||||||
@@ -273,6 +301,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
|
|
||||||
});
|
});
|
||||||
OwnerVm = ownerVM;
|
OwnerVm = ownerVM;
|
||||||
|
SetMaterialColor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly MainViewModel OwnerVm;
|
protected readonly MainViewModel OwnerVm;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</mouseEventTriggers:DoubleClickEventTrigger>-->
|
</mouseEventTriggers:DoubleClickEventTrigger>-->
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<Rectangle Cursor="SizeNWSE" Fill="{Binding Brush}" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
<Rectangle Cursor="SizeNWSE" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="PreviewMouseDown">
|
<i:EventTrigger EventName="PreviewMouseDown">
|
||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonDown}" CommandParameter="{Binding}"/>
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonDown}" CommandParameter="{Binding}"/>
|
||||||
@@ -41,6 +41,9 @@
|
|||||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PreviewMouseMove}" CommandParameter="{Binding}"/>
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PreviewMouseMove}" CommandParameter="{Binding}"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
|
<!--<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>-->
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Grid>
|
</Grid>
|
||||||
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
||||||
|
|||||||
@@ -12,7 +12,11 @@
|
|||||||
<converters:Area x:Key="AreaConverter"/>
|
<converters:Area x:Key="AreaConverter"/>
|
||||||
|
|
||||||
<Style TargetType="Shape" x:Key="ShapeStyle">
|
<Style TargetType="Shape" x:Key="ShapeStyle">
|
||||||
<Setter Property="Fill" Value="{Binding Brush, Mode=TwoWay}"/>
|
<Setter Property="Fill">
|
||||||
|
<Setter.Value>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
|
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
|
||||||
<!--<Setter Property="ToolTip">
|
<!--<Setter Property="ToolTip">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
|||||||
27
Models/Materials/HeadMaterial.cs
Normal file
27
Models/Materials/HeadMaterial.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Models.Materials
|
||||||
|
{
|
||||||
|
public class HeadMaterial : IHeadMaterial
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public Color Color { get; set; }
|
||||||
|
public MaterialDefinitionBase Material { get; set; }
|
||||||
|
|
||||||
|
public HeadMaterial()
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
||||||
|
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
||||||
|
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
||||||
|
Color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Models/Materials/IHeadMaterial.cs
Normal file
16
Models/Materials/IHeadMaterial.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IHeadMaterial
|
||||||
|
{
|
||||||
|
string Name { get; set; }
|
||||||
|
Color Color { get; set; }
|
||||||
|
MaterialDefinitionBase Material { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -134,6 +134,7 @@
|
|||||||
<Compile Include="Infrastructure\Enums\PrimitiveType.cs" />
|
<Compile Include="Infrastructure\Enums\PrimitiveType.cs" />
|
||||||
<Compile Include="Infrastructure\Exceptions\StructureHelperException.cs" />
|
<Compile Include="Infrastructure\Exceptions\StructureHelperException.cs" />
|
||||||
<Compile Include="Infrastructure\Strings\ErrorStrings.cs" />
|
<Compile Include="Infrastructure\Strings\ErrorStrings.cs" />
|
||||||
|
<Compile Include="Infrastructure\UI\Converters\Common\InvertBoolConverter.cs" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\Area.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\Area.cs" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\Length.cs" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\UnitBase.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\UnitBase.cs" />
|
||||||
@@ -141,6 +142,8 @@
|
|||||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Models\Materials\HeadMaterial.cs" />
|
||||||
|
<Compile Include="Models\Materials\IHeadMaterial.cs" />
|
||||||
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
||||||
<Compile Include="Services\Primitives\IPrimitiveRepository.cs" />
|
<Compile Include="Services\Primitives\IPrimitiveRepository.cs" />
|
||||||
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
||||||
@@ -195,11 +198,15 @@
|
|||||||
<Compile Include="Infrastructure\UI\DataTemplates\RectangleTemplate.xaml.cs">
|
<Compile Include="Infrastructure\UI\DataTemplates\RectangleTemplate.xaml.cs">
|
||||||
<DependentUpon>RectangleTemplate.xaml</DependentUpon>
|
<DependentUpon>RectangleTemplate.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\MainWindow\Materials\HeadMaterialsView.xaml.cs">
|
||||||
|
<DependentUpon>HeadMaterialsView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml.cs">
|
<Compile Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml.cs">
|
||||||
<DependentUpon>PrimitivePropertiesView.xaml</DependentUpon>
|
<DependentUpon>PrimitivePropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||||
|
<Compile Include="Windows\ViewModels\Materials\HeadMaterialsViewModel.cs" />
|
||||||
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
<Compile Include="Windows\ViewModels\PrimitiveProperties\PrimitivePropertiesViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -259,6 +266,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\MainWindow\Materials\HeadMaterialsView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml">
|
<Page Include="Windows\PrimitiveProperiesWindow\PrimitivePropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -26,7 +26,11 @@
|
|||||||
<TextBox Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Red}"/>
|
<TextBox Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Red}"/>
|
||||||
|
|
||||||
<Border Grid.Column="3" Grid.RowSpan="3" Margin="10" BorderBrush="Black" BorderThickness="1">
|
<Border Grid.Column="3" Grid.RowSpan="3" Margin="10" BorderBrush="Black" BorderThickness="1">
|
||||||
<Rectangle Fill="{Binding SelectedColor}"/>
|
<Rectangle>
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding SelectedColor}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ namespace StructureHelper.Windows.ColorPickerWindow
|
|||||||
set => OnColorItemChanged(value, ref blue);
|
set => OnColorItemChanged(value, ref blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Brush selectedColor;
|
private Color selectedColor;
|
||||||
public Brush SelectedColor
|
public Color SelectedColor
|
||||||
{
|
{
|
||||||
get => selectedColor;
|
get => selectedColor;
|
||||||
set => OnPropertyChanged(value, ref selectedColor);
|
set => OnPropertyChanged(value, ref selectedColor);
|
||||||
@@ -38,12 +38,12 @@ namespace StructureHelper.Windows.ColorPickerWindow
|
|||||||
{
|
{
|
||||||
if (primitive != null)
|
if (primitive != null)
|
||||||
{
|
{
|
||||||
var solidBrush = (SolidColorBrush)primitive.Brush;
|
var color = primitive.Color;
|
||||||
Red = solidBrush.Color.R;
|
Red = color.R;
|
||||||
Green = solidBrush.Color.G;
|
Green = color.G;
|
||||||
Blue = solidBrush.Color.B;
|
Blue = color.B;
|
||||||
|
|
||||||
SetColor = new RelayCommand(o => primitive.Brush = SelectedColor);
|
SetColor = new RelayCommand(o => primitive.Color = SelectedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnColorItemChanged(int value, ref int colorItem, [CallerMemberName] string propertyName = null)
|
private void OnColorItemChanged(int value, ref int colorItem, [CallerMemberName] string propertyName = null)
|
||||||
@@ -58,7 +58,7 @@ namespace StructureHelper.Windows.ColorPickerWindow
|
|||||||
private void UpdateSelectedColor()
|
private void UpdateSelectedColor()
|
||||||
{
|
{
|
||||||
var color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue);
|
var color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue);
|
||||||
SelectedColor = new SolidColorBrush(color);
|
SelectedColor = color;
|
||||||
OnPropertyChanged(nameof(SelectedColor));
|
OnPropertyChanged(nameof(SelectedColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Matrix;
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
using LoaderCalculator.Data.SourceData;
|
using LoaderCalculator.Data.SourceData;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelper.Services;
|
using StructureHelper.Services;
|
||||||
using StructureHelper.Services.Primitives;
|
using StructureHelper.Services.Primitives;
|
||||||
using StructureHelper.UnitSystem;
|
using StructureHelper.UnitSystem;
|
||||||
@@ -21,6 +22,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public class MainModel
|
public class MainModel
|
||||||
{
|
{
|
||||||
private IPrimitiveRepository primitiveRepository;
|
private IPrimitiveRepository primitiveRepository;
|
||||||
|
public List<IHeadMaterial> HeadMaterials { get; }
|
||||||
private CalculationService calculationService;
|
private CalculationService calculationService;
|
||||||
private UnitSystemService unitSystemService;
|
private UnitSystemService unitSystemService;
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
this.unitSystemService = unitSystemService;
|
this.unitSystemService = unitSystemService;
|
||||||
|
|
||||||
CalculationProperty = new CalculationProperty();
|
CalculationProperty = new CalculationProperty();
|
||||||
|
HeadMaterials = new List<IHeadMaterial>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IStrainMatrix Calculate(double mx, double my, double nz)
|
public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
<Button Content="Edit primitive" Command="{Binding EditPrimitive}"/>
|
<Button Content="Edit primitive" Command="{Binding EditPrimitive}"/>
|
||||||
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
<Button Content="Delete primitive" Command="{Binding DeletePrimitive}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Analisys">
|
<MenuItem Header="Analisys">
|
||||||
@@ -60,7 +61,24 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20" >
|
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20" >
|
||||||
|
<ListBox ItemsSource="{Binding HeadMaterials}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="20"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle Grid.Column="0" Margin="3">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
||||||
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
||||||
@@ -71,7 +89,11 @@
|
|||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Rectangle Grid.Column="0" Margin="3" Fill="{Binding Brush}" />
|
<Rectangle Grid.Column="0" Margin="3">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using StructureHelper.Services.Primitives;
|
|||||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||||
using StructureHelper.Infrastructure.Exceptions;
|
using StructureHelper.Infrastructure.Exceptions;
|
||||||
using StructureHelper.Infrastructure.Strings;
|
using StructureHelper.Infrastructure.Strings;
|
||||||
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
@@ -86,6 +87,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
get => canvasHeight;
|
get => canvasHeight;
|
||||||
set => OnPropertyChanged(value, ref canvasHeight);
|
set => OnPropertyChanged(value, ref canvasHeight);
|
||||||
}
|
}
|
||||||
|
public List<IHeadMaterial> HeadMaterials { get => Model.HeadMaterials; }
|
||||||
|
|
||||||
public double XX2
|
public double XX2
|
||||||
{
|
{
|
||||||
@@ -111,6 +113,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
public ICommand Calculate { get; }
|
public ICommand Calculate { get; }
|
||||||
public ICommand DeletePrimitive { get; }
|
public ICommand DeletePrimitive { get; }
|
||||||
public ICommand EditCalculationPropertyCommand { get; }
|
public ICommand EditCalculationPropertyCommand { get; }
|
||||||
|
public ICommand EditHeadMaterialsCommand { get; }
|
||||||
public ICommand EditPrimitive { get; }
|
public ICommand EditPrimitive { get; }
|
||||||
public ICommand AddTestCase { get; }
|
public ICommand AddTestCase { get; }
|
||||||
public ICommand LeftButtonDown { get; }
|
public ICommand LeftButtonDown { get; }
|
||||||
@@ -178,6 +181,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
primitive.ParameterCaptured = false;
|
primitive.ParameterCaptured = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
||||||
OpenMaterialCatalog = new RelayCommand(o =>
|
OpenMaterialCatalog = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
var materialCatalogView = new MaterialCatalogView();
|
var materialCatalogView = new MaterialCatalogView();
|
||||||
@@ -291,6 +295,12 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditHeadMaterials()
|
||||||
|
{
|
||||||
|
var wnd = new HeadMaterialsView(HeadMaterials);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void DeleteSelectedPrimitive()
|
private void DeleteSelectedPrimitive()
|
||||||
{
|
{
|
||||||
if (! (SelectedPrimitive is null))
|
if (! (SelectedPrimitive is null))
|
||||||
@@ -331,13 +341,20 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
var area1 = Math.PI * 0.012d * 0.012d / 4d;
|
var area1 = Math.PI * 0.012d * 0.012d / 4d;
|
||||||
var area2 = Math.PI * 0.025d * 0.025d / 4d;
|
var area2 = Math.PI * 0.025d * 0.025d / 4d;
|
||||||
var gap = 0.05d;
|
var gap = 0.05d;
|
||||||
|
|
||||||
var rectMaterial = new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5);
|
var rectMaterial = new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5);
|
||||||
var pointMaterial = new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15);
|
var pointMaterial = new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15);
|
||||||
yield return new Rectangle(width, height, 0, 0, this) { Material = rectMaterial, MaterialName = rectMaterial.MaterialClass };
|
|
||||||
yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete C40", Material = rectMaterial };
|
||||||
yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
HeadMaterials.Add(concrete);
|
||||||
yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement S400", Material = pointMaterial };
|
||||||
yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass };
|
HeadMaterials.Add(reinforcement);
|
||||||
|
|
||||||
|
yield return new Rectangle(width, height, 0, 0, this) { Material = rectMaterial, MaterialName = rectMaterial.MaterialClass, HeadMaterial = concrete };
|
||||||
|
yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||||
|
yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||||
|
yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||||
|
yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { Material = pointMaterial, MaterialName = pointMaterial.MaterialClass, HeadMaterial = reinforcement };
|
||||||
}
|
}
|
||||||
private void EditCalculationProperty()
|
private void EditCalculationProperty()
|
||||||
{
|
{
|
||||||
|
|||||||
41
Windows/MainWindow/Materials/HeadMaterialsView.xaml
Normal file
41
Windows/MainWindow/Materials/HeadMaterialsView.xaml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.HeadMaterialsView"
|
||||||
|
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.MainWindow.Materials"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
|
||||||
|
d:DataContext="{d:DesignInstance vm:HeadMaterialsViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Materials" Height="350" Width="400" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="120"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ListBox ItemsSource="{Binding HeadMaterials}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="20"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle Grid.Column="0" Margin="3">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<Button Content="New Concrete" Command="{Binding AddHeadMaterial}"/>
|
||||||
|
<Button Content="New Reinforcement" Command="{Binding AddHeadMaterial}"/>
|
||||||
|
<Button Content="Edit" Command="{Binding EditHeadMaterial}"/>
|
||||||
|
<Button Content="Edit" Command="{Binding DeleteHeadMaterial}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
40
Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
Normal file
40
Windows/MainWindow/Materials/HeadMaterialsView.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
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.MainWindow.Materials
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для HeadMaterials.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HeadMaterialsView : Window
|
||||||
|
{
|
||||||
|
private HeadMaterialsViewModel viewmodel;
|
||||||
|
|
||||||
|
public HeadMaterialsView(IEnumerable<IHeadMaterial> materials)
|
||||||
|
{
|
||||||
|
viewmodel = new HeadMaterialsViewModel(materials);
|
||||||
|
this.DataContext = viewmodel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
||||||
|
{
|
||||||
|
viewmodel = vm;
|
||||||
|
this.DataContext = viewmodel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,13 +5,15 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.PrimitiveProperiesWindow"
|
xmlns:local="clr-namespace:StructureHelper.Windows.PrimitiveProperiesWindow"
|
||||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
|
||||||
xmlns:converters ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Units"
|
xmlns:convertersCommon ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Common"
|
||||||
|
xmlns:convertersUnits ="clr-namespace:StructureHelper.Infrastructure.UI.Converters.Units"
|
||||||
d:DataContext="{d:DesignInstance vm:PrimitivePropertiesViewModel}"
|
d:DataContext="{d:DesignInstance vm:PrimitivePropertiesViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="PrimitiveProperties" Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
Title="PrimitiveProperties" Height="450" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<converters:Length x:Key="LengthConverter"/>
|
<convertersCommon:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:Area x:Key="AreaConverter"/>
|
<convertersUnits:Length x:Key="LengthConverter"/>
|
||||||
|
<convertersUnits:Area x:Key="AreaConverter"/>
|
||||||
<DataTemplate x:Key="RectangleProperties">
|
<DataTemplate x:Key="RectangleProperties">
|
||||||
<Expander Header="Rectangle" IsExpanded="True">
|
<Expander Header="Rectangle" IsExpanded="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -73,6 +75,7 @@
|
|||||||
<RowDefinition Height="22"/>
|
<RowDefinition Height="22"/>
|
||||||
<RowDefinition Height="22"/>
|
<RowDefinition Height="22"/>
|
||||||
<RowDefinition Height="22"/>
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="100"/>
|
||||||
@@ -82,6 +85,7 @@
|
|||||||
<TextBlock Grid.Row="1" Text="Name of material"/>
|
<TextBlock Grid.Row="1" Text="Name of material"/>
|
||||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Material color"/>
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<ComboBox HorizontalAlignment="Left"/>
|
<ComboBox HorizontalAlignment="Left"/>
|
||||||
@@ -90,6 +94,16 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
||||||
|
<Rectangle Width="50" Margin="5,0,10,0">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<SolidColorBrush Color="{Binding Color}"/>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||||
|
<Button Width="50" Content="..." Click="Button_Click"/>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Expander>
|
</Expander>
|
||||||
<!--<Expander Header="Prestrain" IsExpanded="True">
|
<!--<Expander Header="Prestrain" IsExpanded="True">
|
||||||
|
|||||||
@@ -60,5 +60,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
StpProperties.Children.Add(contentControl);
|
StpProperties.Children.Add(contentControl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
viewModel.EditColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
Normal file
36
Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
public class HeadMaterialsViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
IEnumerable<IHeadMaterial> headMaterials;
|
||||||
|
|
||||||
|
public ICommand AddHeadMaterial;
|
||||||
|
public ICommand CopyHeadMaterial;
|
||||||
|
public ICommand DeleteHeadMaterial;
|
||||||
|
public ICommand EditHeadMaterial;
|
||||||
|
|
||||||
|
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
|
public IHeadMaterial SelectedMaterial { get; set; }
|
||||||
|
|
||||||
|
public HeadMaterialsViewModel(IEnumerable<IHeadMaterial> materials)
|
||||||
|
{
|
||||||
|
headMaterials = materials;
|
||||||
|
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||||
|
foreach (var material in headMaterials)
|
||||||
|
{
|
||||||
|
HeadMaterials.Add(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,6 +8,8 @@ using System.ComponentModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
||||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
||||||
@@ -17,6 +20,8 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
{
|
{
|
||||||
private PrimitiveBase primitive;
|
private PrimitiveBase primitive;
|
||||||
|
|
||||||
|
public ICommand EditColorCommand;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get => primitive.Name;
|
get => primitive.Name;
|
||||||
@@ -48,7 +53,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double CenterY
|
public double CenterY
|
||||||
{
|
{
|
||||||
get => primitive.CenterY;
|
get => primitive.CenterY;
|
||||||
@@ -61,11 +65,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Prestrain_Kx
|
|
||||||
{
|
|
||||||
get => primitive.Pre
|
|
||||||
}
|
|
||||||
|
|
||||||
public int MinElementDivision
|
public int MinElementDivision
|
||||||
{
|
{
|
||||||
get => primitive.MinElementDivision;
|
get => primitive.MinElementDivision;
|
||||||
@@ -145,6 +144,26 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get => primitive.Color;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.Color = value;
|
||||||
|
OnPropertyChanged(nameof(Color));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SetMaterialColor
|
||||||
|
{
|
||||||
|
get => primitive.SetMaterialColor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
primitive.SetMaterialColor = value;
|
||||||
|
OnPropertyChanged(nameof(SetMaterialColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string this[string columnName]
|
public string this[string columnName]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -169,6 +188,14 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
public PrimitivePropertiesViewModel(PrimitiveBase primitive)
|
public PrimitivePropertiesViewModel(PrimitiveBase primitive)
|
||||||
{
|
{
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
|
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EditColor()
|
||||||
|
{
|
||||||
|
var wnd = new ColorPickerView(primitive);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
OnPropertyChanged(nameof(Color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user