Library material was added
This commit is contained in:
@@ -198,7 +198,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||
double sizeX = PrimitiveOperations.GetSizeX(PrimitiveSet.ValuePrimitives);
|
||||
double sizeY = PrimitiveOperations.GetSizeY(PrimitiveSet.ValuePrimitives);
|
||||
dX = PrimitiveOperations.GetMinMaxX(PrimitiveSet.ValuePrimitives)[0];
|
||||
dY = PrimitiveOperations.GetMinMaxY(PrimitiveSet.ValuePrimitives)[0];
|
||||
dY = PrimitiveOperations.GetMinMaxY(PrimitiveSet.ValuePrimitives)[1];
|
||||
WorkPlaneCanvas.Width = Math.Abs(sizeX);
|
||||
WorkPlaneCanvas.Height = Math.Abs(sizeY);
|
||||
WorkPlaneBox.Width = ScrolWidth - 50;
|
||||
@@ -260,7 +260,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||
shape.Tag = valuePrimitive;
|
||||
shape.Fill = brush;
|
||||
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
||||
Canvas.SetTop(shape, -valuePrimitive.CenterY - addY - dY);
|
||||
Canvas.SetTop(shape, -valuePrimitive.CenterY - addY + dY);
|
||||
}
|
||||
private void Zoom(double coefficient)
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.Strings
|
||||
{
|
||||
internal static class ErrorStrings
|
||||
{
|
||||
public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
|
||||
public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,13 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
string materialName = MaterialName;
|
||||
ICenter center = new Center { X = CenterX, Y = CenterY };
|
||||
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = this.Area };
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||
IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial();
|
||||
//IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
|
||||
PrestrainKx = PrestrainKx,
|
||||
PrestrainKy = PrestrainKy,
|
||||
PrestrainEpsZ = PrestrainEpsZ
|
||||
};
|
||||
return ndmPrimitive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,24 @@ using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.Exceptions;
|
||||
using StructureHelper.Infrastructure.Strings;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public abstract class PrimitiveBase : ViewModelBase
|
||||
{
|
||||
#region Поля
|
||||
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
private readonly PrimitiveType type;
|
||||
private string name;
|
||||
private double centerX, centerY;
|
||||
@@ -31,7 +34,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
private Color color;
|
||||
private IHeadMaterial headMaterial;
|
||||
private MaterialDefinitionBase material;
|
||||
private double prestrain_kx, prestrain_ky, prestrain_epsz;
|
||||
private double prestrainKx, prestrainKy, prestrainEpsZ;
|
||||
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
|
||||
protected double delta = 0.5;
|
||||
private int showedZIndex = 1, zIndex;
|
||||
@@ -52,6 +55,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
}
|
||||
|
||||
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
@@ -96,6 +101,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
OnPropertyChanged(value, ref centerY);
|
||||
}
|
||||
}
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
|
||||
public IHeadMaterial HeadMaterial
|
||||
{
|
||||
@@ -103,6 +111,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, ref headMaterial);
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +122,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
public Color Color
|
||||
{
|
||||
get => setMaterialColor? headMaterial.Color :color;
|
||||
get => ((setMaterialColor == true) & (headMaterial !=null))? headMaterial.Color :color;
|
||||
set
|
||||
{
|
||||
SetMaterialColor = false;
|
||||
@@ -285,10 +294,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
this.type = type;
|
||||
X = ownerVM.YX1 + x;
|
||||
Y = ownerVM.XY1 + y;
|
||||
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);
|
||||
color = ColorProcessor.GetRandomColor();
|
||||
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
|
||||
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
|
||||
|
||||
@@ -302,6 +308,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
});
|
||||
OwnerVm = ownerVM;
|
||||
SetMaterialColor = true;
|
||||
PrestrainKx = 0;
|
||||
PrestrainKy = 0;
|
||||
PrestrainEpsZ = 0;
|
||||
}
|
||||
|
||||
protected readonly MainViewModel OwnerVm;
|
||||
@@ -342,5 +351,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
|
||||
return materialTypes;
|
||||
}
|
||||
public IPrimitiveMaterial GetPrimitiveMaterial()
|
||||
{
|
||||
return HeadMaterial.HelperMaterial.GetPrimitiveMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,16 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
var height = PrimitiveHeight;
|
||||
double centerX = CenterX;
|
||||
double centerY = CenterY;
|
||||
string materialName = MaterialName;
|
||||
ICenter center = new Center { X = centerX, Y = centerY };
|
||||
IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 };
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision };
|
||||
IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial();
|
||||
//IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive
|
||||
{ Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
|
||||
NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
|
||||
PrestrainKx = PrestrainKx,
|
||||
PrestrainKy = PrestrainKy,
|
||||
PrestrainEpsZ = PrestrainEpsZ };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@
|
||||
<HintPath>packages\System.Diagnostics.DiagnosticSource.6.0.0\lib\net461\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -132,8 +133,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Infrastructure\Enums\PrimitiveType.cs" />
|
||||
<Compile Include="Infrastructure\Exceptions\StructureHelperException.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\Length.cs" />
|
||||
@@ -142,8 +141,6 @@
|
||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Materials\HeadMaterial.cs" />
|
||||
<Compile Include="Models\Materials\IHeadMaterial.cs" />
|
||||
<Compile Include="Services\Primitives\PrimitiveRepository.cs" />
|
||||
<Compile Include="Services\Primitives\IPrimitiveRepository.cs" />
|
||||
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
||||
@@ -276,7 +273,7 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Logics\" />
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="FieldVisualizer\FieldVisualizer.csproj">
|
||||
|
||||
@@ -11,6 +11,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "Str
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{5DFEC3FD-9677-47BB-9E88-EB71828B5913} = {5DFEC3FD-9677-47BB-9E88-EB71828B5913}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{5DFEC3FD-9677-47BB-9E88-EB71828B5913}"
|
||||
EndProject
|
||||
|
||||
12
StructureHelperCommon/Infrastructures/Enums/CodeTypes.cs
Normal file
12
StructureHelperCommon/Infrastructures/Enums/CodeTypes.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
{
|
||||
public enum CodeTypes
|
||||
{
|
||||
SP63_13330_2018,
|
||||
EuroCode_2_1990
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
|
||||
{
|
||||
public enum MaterialTypes
|
||||
{
|
||||
@@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.Exceptions
|
||||
namespace StructureHelperCommon.Infrastructures.Exceptions
|
||||
{
|
||||
internal class StructureHelperException : Exception
|
||||
public class StructureHelperException : Exception
|
||||
{
|
||||
public StructureHelperException(string errorString) : base(errorString)
|
||||
{
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IHasParent
|
||||
{
|
||||
object Parent { get; }
|
||||
void RegisterParent();
|
||||
}
|
||||
}
|
||||
19
StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
Normal file
19
StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Strings
|
||||
{
|
||||
public static class ErrorStrings
|
||||
{
|
||||
public static string UnknownError => "#0000: Unknown error";
|
||||
public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
|
||||
public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
|
||||
public static string DataIsInCorrect => "#0003: Data is not correct";
|
||||
public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
|
||||
public static string LimitStatesIsNotValid => "#0005: Type of limite state is not valid";
|
||||
public static string LoadTermIsNotValid => "#0006: Load term is not valid";
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,8 @@ namespace StructureHelperCommon.Models.Entities
|
||||
IPrimitiveMaterial PrimitiveMaterial {get;set;}
|
||||
double NdmMaxSize { get; set; }
|
||||
int NdmMinDivision { get; set; }
|
||||
double PrestrainKx { get; set; }
|
||||
double PrestrainKy { get; set; }
|
||||
double PrestrainEpsZ { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,8 @@ namespace StructureHelperCommon.Models.Entities
|
||||
public IPrimitiveMaterial PrimitiveMaterial { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public interface IPrimitiveMaterial
|
||||
{
|
||||
string Id { get;}
|
||||
MaterialTypes MaterialType { get; }
|
||||
CodeTypes CodeType { get; set; }
|
||||
string ClassName { get; }
|
||||
double Strength { get; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
@@ -6,9 +7,11 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public string Id { get; }
|
||||
public MaterialTypes MaterialType { get; set; }
|
||||
public CodeTypes CodeType { get; set; }
|
||||
public string ClassName { get; set; }
|
||||
public double Strength { get; set; }
|
||||
|
||||
|
||||
public PrimitiveMaterial()
|
||||
{
|
||||
Id = Convert.ToString(Guid.NewGuid());
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace StructureHelperCommon.Services.ColorServices
|
||||
{
|
||||
public static class ColorProcessor
|
||||
{
|
||||
public static Color GetRandomColor()
|
||||
{
|
||||
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);
|
||||
return Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
||||
}
|
||||
public static void EditColor(ref Color wpfColor)
|
||||
{
|
||||
var winformsColor = System.Drawing.Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B);
|
||||
ColorDialog dialog = new ColorDialog();
|
||||
dialog.FullOpen = true;
|
||||
dialog.Color = winformsColor;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
wpfColor = Color.FromArgb(dialog.Color.A, dialog.Color.R, dialog.Color.G, dialog.Color.B);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,12 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -42,10 +46,14 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Infrastructures\Enums\CodeTypes.cs" />
|
||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
||||
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
||||
<Compile Include="Models\Entities\INdmPrimitive.cs" />
|
||||
<Compile Include="Models\Entities\NdmPrimitive.cs" />
|
||||
<Compile Include="Models\Materials\IPrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\Materials\MaterialTypes.cs" />
|
||||
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
||||
<Compile Include="Models\Materials\PrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\IPrimitive.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\PointPrimitive.cs" />
|
||||
@@ -61,6 +69,7 @@
|
||||
<Compile Include="Models\Shapes\Point.cs" />
|
||||
<Compile Include="Models\Shapes\Rectangle.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
69
StructureHelperCommon/StructureHelperCommon.csproj.bak
Normal file
69
StructureHelperCommon/StructureHelperCommon.csproj.bak
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5DFEC3FD-9677-47BB-9E88-EB71828B5913}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StructureHelperCommon</RootNamespace>
|
||||
<AssemblyName>StructureHelperCommon</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||
<Compile Include="Infrastructures\Strings\ErrorStrings.cs" />
|
||||
<Compile Include="Models\Entities\INdmPrimitive.cs" />
|
||||
<Compile Include="Models\Entities\NdmPrimitive.cs" />
|
||||
<Compile Include="Models\Materials\IPrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\Materials\MaterialTypes.cs" />
|
||||
<Compile Include="Models\Materials\PrimitiveMaterial.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\IPrimitive.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\PointPrimitive.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\PrimitiveBase.cs" />
|
||||
<Compile Include="Models\NdmPrimitives\RectanglePrimitive.cs" />
|
||||
<Compile Include="Models\Shapes\Center.cs" />
|
||||
<Compile Include="Models\Shapes\ICenter.cs" />
|
||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||
<Compile Include="Models\Shapes\ICircle.cs" />
|
||||
<Compile Include="Models\Shapes\IPoint.cs" />
|
||||
<Compile Include="Models\Shapes\IRectangle.cs" />
|
||||
<Compile Include="Models\Shapes\IShape.cs" />
|
||||
<Compile Include="Models\Shapes\Point.cs" />
|
||||
<Compile Include="Models\Shapes\Rectangle.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
24
StructureHelperLogics/Models/Materials/ElasticMaterial.cs
Normal file
24
StructureHelperLogics/Models/Materials/ElasticMaterial.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ElasticMaterial : IElasticMaterial
|
||||
{
|
||||
public double Modulus { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new ElasticMaterial() { Modulus = Modulus };
|
||||
}
|
||||
|
||||
public IPrimitiveMaterial GetPrimitiveMaterial()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials.Factories
|
||||
{
|
||||
public static class LibMaterialFactory
|
||||
{
|
||||
public static List<ILibMaterial> GetLibMaterials(CodeTypes code)
|
||||
{
|
||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
||||
libMaterials.AddRange(GetConcrete(code));
|
||||
libMaterials.AddRange(GetReinforcement(code));
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetReinforcement(CodeTypes code)
|
||||
{
|
||||
if (code == CodeTypes.EuroCode_2_1990)
|
||||
{
|
||||
return GetReinforcementEurocode();
|
||||
}
|
||||
else if (code == CodeTypes.SP63_13330_2018)
|
||||
{
|
||||
return GetReinforcementSP63();
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetConcrete(CodeTypes code)
|
||||
{
|
||||
if (code == CodeTypes.EuroCode_2_1990)
|
||||
{
|
||||
return GetConcreteEurocode();
|
||||
}
|
||||
else if (code == CodeTypes.SP63_13330_2018)
|
||||
{
|
||||
return GetConcreteSP63();
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetConcreteEurocode()
|
||||
{
|
||||
var code = CodeTypes.EuroCode_2_1990;
|
||||
var material = MaterialTypes.Concrete;
|
||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
||||
libMaterials.Add(new LibMaterial(material, code, "C12", 12e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C20", 20e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C30", 30e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C40", 40e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C50", 50e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C60", 60e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C70", 70e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "C80", 80e6));
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetReinforcementEurocode()
|
||||
{
|
||||
var code = CodeTypes.EuroCode_2_1990;
|
||||
var material = MaterialTypes.Reinforcement;
|
||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
||||
libMaterials.Add(new LibMaterial(material, code, "S240", 240e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "S400", 400e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "S500", 500e6));
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetConcreteSP63()
|
||||
{
|
||||
var code = CodeTypes.SP63_13330_2018;
|
||||
var material = MaterialTypes.Concrete;
|
||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
||||
libMaterials.Add(new LibMaterial(material, code, "B5", 5e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B7,5", 7.5e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B10", 10e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B15", 15e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B20", 20e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B25", 25e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B30", 30e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B35", 35e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B40", 40e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B50", 50e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "B60", 60e6));
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterial> GetReinforcementSP63()
|
||||
{
|
||||
var code = CodeTypes.EuroCode_2_1990;
|
||||
var material = MaterialTypes.Reinforcement;
|
||||
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
|
||||
libMaterials.Add(new LibMaterial(material, code, "A240", 240e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "A400", 400e6));
|
||||
libMaterials.Add(new LibMaterial(material, code, "A500", 500e6));
|
||||
return libMaterials;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
StructureHelperLogics/Models/Materials/HeadMaterial.cs
Normal file
38
StructureHelperLogics/Models/Materials/HeadMaterial.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public class HeadMaterial : IHeadMaterial
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
//public MaterialDefinitionBase Material { get; set; }
|
||||
|
||||
public HeadMaterial()
|
||||
{
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
IHeadMaterial material = new HeadMaterial
|
||||
{
|
||||
Name = Name,
|
||||
Color = Color,
|
||||
HelperMaterial = HelperMaterial.Clone() as IHelperMaterial
|
||||
};
|
||||
return material;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class HeadMaterialRepository : IHeadMaterialRepository
|
||||
{
|
||||
public object Parent { get; private set; }
|
||||
|
||||
public List<IHeadMaterial> HeadMaterials { get; set; }
|
||||
public List<ILibMaterial> LibMaterials { get; set; }
|
||||
|
||||
public HeadMaterialRepository()
|
||||
{
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
LibMaterials = new List<ILibMaterial>();
|
||||
}
|
||||
|
||||
public HeadMaterialRepository(object parent)
|
||||
{
|
||||
Parent = parent;
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
LibMaterials = new List<ILibMaterial>();
|
||||
}
|
||||
|
||||
public void RegisterParent(object obj)
|
||||
{
|
||||
Parent = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
StructureHelperLogics/Models/Materials/IElasticMaterial.cs
Normal file
13
StructureHelperLogics/Models/Materials/IElasticMaterial.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IElasticMaterial : IHelperMaterial
|
||||
{
|
||||
double Modulus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -7,10 +8,11 @@ using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public interface IHeadMaterial
|
||||
public interface IHeadMaterial : ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
Color Color { get; set; }
|
||||
MaterialDefinitionBase Material { get; set; }
|
||||
IHelperMaterial HelperMaterial { get; set; }
|
||||
//MaterialDefinitionBase Material { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IHeadMaterialRepository
|
||||
{
|
||||
object Parent { get; }
|
||||
List<IHeadMaterial> HeadMaterials { get; set; }
|
||||
List<ILibMaterial> LibMaterials { get; set; }
|
||||
void RegisterParent(object obj);
|
||||
|
||||
}
|
||||
}
|
||||
13
StructureHelperLogics/Models/Materials/IHelperMaterial.cs
Normal file
13
StructureHelperLogics/Models/Materials/IHelperMaterial.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IHelperMaterial : ICloneable
|
||||
{
|
||||
IPrimitiveMaterial GetPrimitiveMaterial();
|
||||
}
|
||||
}
|
||||
17
StructureHelperLogics/Models/Materials/ILibMaterial.cs
Normal file
17
StructureHelperLogics/Models/Materials/ILibMaterial.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface ILibMaterial : IHelperMaterial
|
||||
{
|
||||
MaterialTypes MaterialType { get; set; }
|
||||
CodeTypes CodeType { get; set; }
|
||||
string Name { get; set; }
|
||||
double MainStrength { get; set; }
|
||||
}
|
||||
}
|
||||
73
StructureHelperLogics/Models/Materials/LibMaterial.cs
Normal file
73
StructureHelperLogics/Models/Materials/LibMaterial.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class LibMaterial : ILibMaterial
|
||||
{
|
||||
public MaterialTypes MaterialType { get; set; }
|
||||
public CodeTypes CodeType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double MainStrength { get; set; }
|
||||
|
||||
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
||||
{
|
||||
MaterialType = materialType;
|
||||
CodeType = codeType;
|
||||
Name = name;
|
||||
MainStrength = mainStrength;
|
||||
}
|
||||
|
||||
public IPrimitiveMaterial GetPrimitiveMaterial()
|
||||
{
|
||||
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.EuroCode_2_1990)
|
||||
{ return GetConcreteEurocode();}
|
||||
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.EuroCode_2_1990)
|
||||
{ return GetReinfrocementeEurocode();}
|
||||
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.SP63_13330_2018)
|
||||
{ return GetConcreteSP63(); }
|
||||
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.SP63_13330_2018)
|
||||
{ return GetReinfrocementeSP63(); }
|
||||
else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {CodeType}");
|
||||
}
|
||||
|
||||
private IPrimitiveMaterial GetReinfrocementeSP63()
|
||||
{
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
|
||||
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
|
||||
return primitiveMaterial;
|
||||
}
|
||||
|
||||
private IPrimitiveMaterial GetConcreteSP63()
|
||||
{
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
|
||||
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Concrete {Name}", Strength = MainStrength };
|
||||
return primitiveMaterial;
|
||||
}
|
||||
|
||||
private IPrimitiveMaterial GetReinfrocementeEurocode()
|
||||
{
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
|
||||
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
|
||||
return primitiveMaterial;
|
||||
}
|
||||
|
||||
private IPrimitiveMaterial GetConcreteEurocode()
|
||||
{
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
|
||||
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Concrete {Name}", Strength = MainStrength };
|
||||
return primitiveMaterial;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new LibMaterial(this.MaterialType, this.CodeType, this.Name, this.MainStrength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,8 @@
|
||||
{
|
||||
public interface ITriangulationLogicOptions
|
||||
{
|
||||
double PrestrainKx { get;}
|
||||
double PrestrainKy { get;}
|
||||
double PrestrainEpsZ { get;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using LoaderCalculator.Data.Ndms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms.Transformations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
@@ -23,6 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
List<INdm> ndmCollection = new List<INdm>();
|
||||
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
|
||||
ndmCollection.Add(ndm);
|
||||
NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.NdmPrimitives;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
@@ -11,13 +15,31 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
///
|
||||
/// </summary>
|
||||
public ICenter Center { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public double Area { get; }
|
||||
/// <inheritdoc />
|
||||
public double PrestrainKx { get; }
|
||||
/// <inheritdoc />
|
||||
public double PrestrainKy { get; }
|
||||
/// <inheritdoc />
|
||||
public double PrestrainEpsZ { get; }
|
||||
|
||||
public PointTriangulationLogicOptions(ICenter center, double area)
|
||||
{
|
||||
Center = center;
|
||||
Area = area;
|
||||
}
|
||||
|
||||
public PointTriangulationLogicOptions(INdmPrimitive primitive)
|
||||
{
|
||||
if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
Center = primitive.Center;
|
||||
IPoint point = primitive.Shape as IPoint;
|
||||
Center = primitive.Center;
|
||||
Area = point.Area;
|
||||
PrestrainKx = primitive.PrestrainKx;
|
||||
PrestrainKy = primitive.PrestrainKy;
|
||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Ndms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Ndms.Transformations;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
@@ -25,6 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
NdmTransform.Move(ndmCollection, dX, dY);
|
||||
double angle = rectangleOptions.Rectangle.Angle;
|
||||
NdmTransform.Rotate(ndmCollection, angle);
|
||||
NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
@@ -15,6 +17,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
public double NdmMaxSize { get; }
|
||||
/// <inheritdoc />
|
||||
public int NdmMinDivision { get; }
|
||||
/// <inheritdoc />
|
||||
public double PrestrainKx { get;}
|
||||
/// <inheritdoc />
|
||||
public double PrestrainKy { get; }
|
||||
/// <inheritdoc />
|
||||
public double PrestrainEpsZ { get;}
|
||||
|
||||
public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
|
||||
{
|
||||
@@ -26,11 +34,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
||||
{
|
||||
if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); }
|
||||
if (! (primitive.Shape is IRectangle)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
Center = primitive.Center;
|
||||
Rectangle = primitive.Shape as IRectangle;
|
||||
NdmMaxSize = primitive.NdmMaxSize;
|
||||
NdmMinDivision = primitive.NdmMinDivision;
|
||||
PrestrainKx = primitive.PrestrainKx;
|
||||
PrestrainKy = primitive.PrestrainKy;
|
||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
@@ -67,12 +70,11 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
}
|
||||
else if (shape is IPoint)
|
||||
{
|
||||
IPoint point = shape as IPoint;
|
||||
options = new PointTriangulationLogicOptions(primitive.Center, point.Area);
|
||||
options = new PointTriangulationLogicOptions(primitive);
|
||||
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
ndms.AddRange(logic.GetNdmCollection(material));
|
||||
}
|
||||
else { throw new Exception("Primitive type is not valid"); }
|
||||
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
||||
return ndms;
|
||||
}
|
||||
|
||||
@@ -81,7 +83,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
IMaterial material;
|
||||
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
|
||||
else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
|
||||
else { throw new Exception("Material type is invalid"); }
|
||||
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
|
||||
return material;
|
||||
}
|
||||
|
||||
@@ -106,14 +108,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
|
||||
{
|
||||
materialOptions.Strength = primitiveMaterial.Strength;
|
||||
materialOptions.CodesType = CodesType.EC2_1990;
|
||||
if (primitiveMaterial.CodeType == CodeTypes.EuroCode_2_1990)
|
||||
{
|
||||
materialOptions.CodesType = CodesType.EC2_1990;
|
||||
}
|
||||
else if (primitiveMaterial.CodeType == CodeTypes.SP63_13330_2018)
|
||||
{
|
||||
materialOptions.CodesType = CodesType.SP63_2018;
|
||||
}
|
||||
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {primitiveMaterial.CodeType}"); }
|
||||
if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; }
|
||||
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; }
|
||||
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; }
|
||||
else { throw new Exception("LimitStateType is not valid"); }
|
||||
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
||||
if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||
else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||
else { throw new Exception("Calculation term is not valid"); }
|
||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="LoaderCalculator">
|
||||
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||
<HintPath>..\Libraries\LoaderCalculator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System.Windows" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
3
StructureHelperLogics/StructureHelperLogics.csproj.bak
Normal file
3
StructureHelperLogics/StructureHelperLogics.csproj.bak
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
42
StructureHelperLogics/StructureHelperLogics1.csproj
Normal file
42
StructureHelperLogics/StructureHelperLogics1.csproj
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="LoaderCalculator">
|
||||
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -10,6 +10,7 @@ using System.Threading;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
{
|
||||
|
||||
@@ -8,8 +8,11 @@ using StructureHelper.Services;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Materials.Factories;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services;
|
||||
using System.Collections;
|
||||
@@ -21,11 +24,17 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class MainModel
|
||||
{
|
||||
//const CodeTypes code = CodeTypes.EuroCode_2_1990;
|
||||
const CodeTypes code = CodeTypes.SP63_13330_2018;
|
||||
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
public IHeadMaterialRepository HeadMaterialRepository { get; }
|
||||
public List<IHeadMaterial> HeadMaterials { get; }
|
||||
private CalculationService calculationService;
|
||||
private UnitSystemService unitSystemService;
|
||||
|
||||
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
|
||||
|
||||
public ICalculationProperty CalculationProperty { get; private set; }
|
||||
|
||||
public MainModel(IPrimitiveRepository primitiveRepository, CalculationService calculationService, UnitSystemService unitSystemService)
|
||||
@@ -36,6 +45,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
CalculationProperty = new CalculationProperty();
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
HeadMaterialRepository = new HeadMaterialRepository(this);
|
||||
HeadMaterialRepository.LibMaterials = LibMaterialFactory.GetLibMaterials(code);
|
||||
}
|
||||
|
||||
public IStrainMatrix Calculate(double mx, double my, double nz)
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -49,6 +48,9 @@
|
||||
</MenuItem>
|
||||
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||
<MenuItem Header="Templates">
|
||||
<Button Content="Concrete beam 400x600" Command="{Binding AddTestCase}"/>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Analisys">
|
||||
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
|
||||
@@ -177,13 +179,10 @@
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<!--<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Units" Command="{Binding OpenUnitsSystemSettings}"/>
|
||||
<Label VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="{Binding UnitsSystemName}"/>-->
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0.333,0.333,39.667" Grid.RowSpan="2" Width="519">
|
||||
<Button VerticalAlignment="Center" Margin="5" Content="Add test primitives" Command="{Binding AddTestCase}"/>
|
||||
</StackPanel>
|
||||
<StatusBar Grid.Row="2">
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="Structure Helper"/>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -24,14 +24,18 @@ using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.PrimitiveProperiesWindow;
|
||||
using StructureHelper.Infrastructure.Exceptions;
|
||||
using StructureHelper.Infrastructure.Strings;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Models.Materials.Factories;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
private List<IHeadMaterial> headMaterials;
|
||||
private readonly double scaleRate = 1.1;
|
||||
|
||||
private IPrimitiveRepository PrimitiveRepository { get; }
|
||||
@@ -87,7 +91,19 @@ namespace StructureHelper.Windows.MainWindow
|
||||
get => canvasHeight;
|
||||
set => OnPropertyChanged(value, ref canvasHeight);
|
||||
}
|
||||
public List<IHeadMaterial> HeadMaterials { get => Model.HeadMaterials; }
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials
|
||||
{
|
||||
get
|
||||
{
|
||||
var collection = new ObservableCollection<IHeadMaterial>();
|
||||
foreach (var obj in headMaterials)
|
||||
{
|
||||
collection.Add(obj);
|
||||
}
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
public double XX2
|
||||
{
|
||||
@@ -139,6 +155,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
PrimitiveRepository = primitiveRepository;
|
||||
Model = model;
|
||||
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
||||
this.unitSystemService = unitSystemService;
|
||||
CanvasWidth = 1500;
|
||||
CanvasHeight = 1000;
|
||||
@@ -148,7 +165,6 @@ namespace StructureHelper.Windows.MainWindow
|
||||
YY2 = CanvasHeight;
|
||||
calculationProperty = new CalculationProperty();
|
||||
|
||||
|
||||
LeftButtonUp = new RelayCommand(o =>
|
||||
{
|
||||
if (o is Rectangle rect) rect.BorderCaptured = false;
|
||||
@@ -297,8 +313,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
|
||||
private void EditHeadMaterials()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(HeadMaterials);
|
||||
var wnd = new HeadMaterialsView(Model.HeadMaterialRepository);
|
||||
wnd.ShowDialog();
|
||||
headMaterials = Model.HeadMaterialRepository.HeadMaterials;
|
||||
OnPropertyChanged(nameof(headMaterials));
|
||||
}
|
||||
|
||||
private void DeleteSelectedPrimitive()
|
||||
@@ -319,19 +337,46 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
if (!(SelectedPrimitive is null))
|
||||
{
|
||||
var wnd = new PrimitiveProperties(SelectedPrimitive);
|
||||
var wnd = new PrimitiveProperties(SelectedPrimitive, Model.HeadMaterialRepository);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(headMaterials));
|
||||
}
|
||||
else { MessageBox.Show("Selection is changed", "Please, select primitive", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); }
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
IEnumerable<INdm> ndms = Model.GetNdms();
|
||||
CalculationService calculationService = new CalculationService();
|
||||
var loaderResults = calculationService.GetCalculationResults(calculationProperty, ndms);
|
||||
var wnd = new CalculationResultView(new CalculationResultViewModel(loaderResults, ndms));
|
||||
wnd.ShowDialog();
|
||||
bool check = CheckAnalisysOptions();
|
||||
if (check == false)
|
||||
{
|
||||
MessageBox.Show(ErrorStrings.DataIsInCorrect, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
IEnumerable<INdm> ndms = Model.GetNdms();
|
||||
CalculationService calculationService = new CalculationService();
|
||||
var loaderResults = calculationService.GetCalculationResults(calculationProperty, ndms);
|
||||
var wnd = new CalculationResultView(new CalculationResultViewModel(loaderResults, ndms));
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"{ErrorStrings.UnknownError}: {ex}", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckAnalisysOptions()
|
||||
{
|
||||
foreach (var item in PrimitiveRepository.Primitives)
|
||||
{
|
||||
if (item.HeadMaterial == null)
|
||||
{
|
||||
MessageBox.Show($"Primitive {item.Name} does not has material", "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
|
||||
@@ -345,10 +390,13 @@ namespace StructureHelper.Windows.MainWindow
|
||||
var rectMaterial = new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5);
|
||||
var pointMaterial = new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15);
|
||||
|
||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete C40", Material = rectMaterial };
|
||||
HeadMaterials.Add(concrete);
|
||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement S400", Material = pointMaterial };
|
||||
HeadMaterials.Add(reinforcement);
|
||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete 40"};
|
||||
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement 400"};
|
||||
reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
||||
headMaterials.Add(concrete);
|
||||
headMaterials.Add(reinforcement);
|
||||
OnPropertyChanged(nameof(headMaterials));
|
||||
|
||||
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 };
|
||||
|
||||
@@ -13,29 +13,46 @@
|
||||
<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>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
<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>
|
||||
<TextBox Grid.Row="1" Text="{Binding SelectedMaterial.Name}"/>
|
||||
<ComboBox Grid.Row="2" ItemsSource="{Binding LibMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
|
||||
<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}"/>
|
||||
<Button Content="New Material" Command="{Binding AddNewMaterialCommand}"/>
|
||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -23,9 +24,9 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
private HeadMaterialsViewModel viewmodel;
|
||||
|
||||
public HeadMaterialsView(IEnumerable<IHeadMaterial> materials)
|
||||
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
|
||||
{
|
||||
viewmodel = new HeadMaterialsViewModel(materials);
|
||||
viewmodel = new HeadMaterialsViewModel(headMaterialRepository);
|
||||
this.DataContext = viewmodel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -87,9 +87,26 @@
|
||||
<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}"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<ComboBox HorizontalAlignment="Left"/>
|
||||
<Button Width="50" Content="...">
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<ComboBox Width="120" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.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>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Width="50" Content="..." Command="{Binding EditMaterialCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||
@@ -102,11 +119,10 @@
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
<Button Width="50" Content="..." Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<!--<Expander Header="Prestrain" IsExpanded="True">
|
||||
<Expander Header="Prestrain" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
@@ -120,11 +136,11 @@
|
||||
<TextBlock Grid.Row="0" Text="k_x"/>
|
||||
<TextBlock Grid.Row="1" Text="k_y"/>
|
||||
<TextBlock Grid.Row="2" Text="epsilon_z"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Prestrain_kx, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding Prestrain_kx, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding Prestrain_kx, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
</Expander>-->
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Window>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -27,10 +28,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||
{
|
||||
PrimitiveBase primitive;
|
||||
private PrimitivePropertiesViewModel viewModel;
|
||||
public PrimitiveProperties(PrimitiveBase primitive)
|
||||
public PrimitiveProperties(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
viewModel = new PrimitivePropertiesViewModel(this.primitive);
|
||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, materialRepository);
|
||||
this.DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
if (primitive is Rectangle) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||
@@ -60,10 +61,5 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||
StpProperties.Children.Add(contentControl);
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.EditColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,30 +12,136 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
public class HeadMaterialsViewModel : ViewModelBase
|
||||
{
|
||||
IHeadMaterialRepository materialRepository;
|
||||
IEnumerable<IHeadMaterial> headMaterials;
|
||||
IEnumerable<ILibMaterial> libMaterials;
|
||||
IHeadMaterial selectedMaterial;
|
||||
ILibMaterial selectedLibMaterial;
|
||||
|
||||
public ICommand AddHeadMaterial;
|
||||
public ICommand CopyHeadMaterial;
|
||||
public ICommand DeleteHeadMaterial;
|
||||
public ICommand AddNewMaterialCommand { get; set; }
|
||||
public ICommand CopyHeadMaterialCommand { get; set; }
|
||||
public ICommand EditColorCommand { get; set; }
|
||||
public ICommand DeleteMaterialCommand { get; set; }
|
||||
public ICommand EditHeadMaterial;
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
public IHeadMaterial SelectedMaterial { get; set; }
|
||||
|
||||
public HeadMaterialsViewModel(IEnumerable<IHeadMaterial> materials)
|
||||
public IHeadMaterial SelectedMaterial
|
||||
{
|
||||
headMaterials = materials;
|
||||
get => selectedMaterial;
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, ref selectedMaterial);
|
||||
if (!(selectedMaterial is null))
|
||||
{
|
||||
selectedLibMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||
OnPropertyChanged(nameof(selectedLibMaterial));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedName
|
||||
{
|
||||
get => selectedMaterial.Name;
|
||||
set
|
||||
{
|
||||
selectedMaterial.Name = value;
|
||||
OnPropertyChanged(nameof(selectedMaterial));
|
||||
}
|
||||
}
|
||||
|
||||
public ILibMaterial SelectedLibMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (selectedLibMaterial is null) { return null; }
|
||||
else { return selectedLibMaterial; }
|
||||
}
|
||||
set
|
||||
{
|
||||
selectedMaterial.HelperMaterial = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<ILibMaterial> LibMaterials
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (SelectedMaterial is null)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
return libMaterials;//.Where(x => x.MaterialType == (SelectedMaterial.HelperMaterial as ILibMaterial).MaterialType);
|
||||
}
|
||||
}
|
||||
|
||||
public HeadMaterialsViewModel(IHeadMaterialRepository headMaterialRepository)
|
||||
{
|
||||
materialRepository = headMaterialRepository;
|
||||
headMaterials = materialRepository.HeadMaterials;
|
||||
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||
foreach (var material in headMaterials)
|
||||
{
|
||||
HeadMaterials.Add(material);
|
||||
}
|
||||
libMaterials = materialRepository.LibMaterials;
|
||||
AddNewMaterialCommand = new RelayCommand(o => AddNewMaterial(MaterialTypes.Reinforcement));
|
||||
CopyHeadMaterialCommand = new RelayCommand(o => CopyMaterial(), o => !(SelectedMaterial is null));
|
||||
EditColorCommand = new RelayCommand(o => EditColor(), o=> ! (SelectedMaterial is null));
|
||||
DeleteMaterialCommand = new RelayCommand(o => DeleteMaterial(), o => !(SelectedMaterial is null));
|
||||
}
|
||||
|
||||
private void CopyMaterial()
|
||||
{
|
||||
var material = SelectedMaterial.Clone() as IHeadMaterial;
|
||||
HeadMaterials.Add(material);
|
||||
materialRepository.HeadMaterials.Add(material);
|
||||
SelectedMaterial = material;
|
||||
|
||||
}
|
||||
|
||||
private void DeleteMaterial()
|
||||
{
|
||||
var mainModel = materialRepository.Parent as MainModel;
|
||||
var primitivesWithMaterial = mainModel.PrimitiveRepository.Primitives.Where(x => x.HeadMaterial == SelectedMaterial);
|
||||
int primitivesCount = primitivesWithMaterial.Count();
|
||||
if (primitivesCount > 0)
|
||||
{
|
||||
MessageBox.Show("Some primitives reference to this material", "Material can not be deleted", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
materialRepository.HeadMaterials.Remove(SelectedMaterial);
|
||||
HeadMaterials.Remove(SelectedMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
private void EditColor()
|
||||
{
|
||||
Color color = SelectedMaterial.Color;
|
||||
ColorProcessor.EditColor(ref color);
|
||||
SelectedMaterial.Color = color;
|
||||
OnPropertyChanged(nameof(selectedMaterial.Color));
|
||||
OnPropertyChanged(nameof(selectedMaterial));
|
||||
}
|
||||
|
||||
private void AddNewMaterial(MaterialTypes materialType)
|
||||
{
|
||||
IHeadMaterial material = new HeadMaterial() { Name = "New material" };
|
||||
material.HelperMaterial = LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||
HeadMaterials.Add(material);
|
||||
//headMaterials.Append(material);
|
||||
materialRepository.HeadMaterials.Add(material);
|
||||
SelectedMaterial = material;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Models.NdmPrimitives;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -19,8 +25,13 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
||||
{
|
||||
private PrimitiveBase primitive;
|
||||
private IHeadMaterialRepository headMaterialRepository;
|
||||
private List<IHeadMaterial> headMaterials;
|
||||
|
||||
public ICommand EditColorCommand;
|
||||
public ICommand EditColorCommand { get; private set; }
|
||||
public ICommand EditMaterialCommand { get; private set; }
|
||||
|
||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
@@ -40,6 +51,18 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
OnPropertyChanged(nameof(MaterialName));
|
||||
}
|
||||
}
|
||||
public IHeadMaterial PrimitiveMaterial
|
||||
{ get => primitive.HeadMaterial;
|
||||
set
|
||||
{
|
||||
primitive.HeadMaterial = value;
|
||||
OnPropertyChanged(nameof(PrimitiveMaterial));
|
||||
if (primitive.SetMaterialColor == true)
|
||||
{
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double CenterX
|
||||
{
|
||||
@@ -65,6 +88,22 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
}
|
||||
}
|
||||
|
||||
public double PrestrainKx
|
||||
{
|
||||
get => primitive.PrestrainKx;
|
||||
set => primitive.PrestrainKx = value;
|
||||
}
|
||||
public double PrestrainKy
|
||||
{
|
||||
get => primitive.PrestrainKy;
|
||||
set => primitive.PrestrainKy = value;
|
||||
}
|
||||
public double PrestrainEpsZ
|
||||
{
|
||||
get => primitive.PrestrainEpsZ;
|
||||
set => primitive.PrestrainEpsZ = value;
|
||||
}
|
||||
|
||||
public int MinElementDivision
|
||||
{
|
||||
get => primitive.MinElementDivision;
|
||||
@@ -99,6 +138,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
var shape = primitive as Rectangle;
|
||||
shape.PrimitiveWidth = value;
|
||||
}
|
||||
CenterX = CenterX;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +160,9 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
var shape = primitive as Rectangle;
|
||||
shape.PrimitiveHeight = value;
|
||||
}
|
||||
CenterY = CenterY; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double Area
|
||||
{
|
||||
@@ -160,6 +201,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
set
|
||||
{
|
||||
primitive.SetMaterialColor = value;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
OnPropertyChanged(nameof(SetMaterialColor));
|
||||
}
|
||||
}
|
||||
@@ -185,17 +227,32 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
|
||||
public string Error => throw new NotImplementedException();
|
||||
|
||||
public PrimitivePropertiesViewModel(PrimitiveBase primitive)
|
||||
public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHeadMaterialRepository materialRepository)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
headMaterialRepository = materialRepository;
|
||||
headMaterials = materialRepository.HeadMaterials;
|
||||
HeadMaterials = new ObservableCollection<IHeadMaterial>();
|
||||
foreach (var material in headMaterials)
|
||||
{
|
||||
HeadMaterials.Add(material);
|
||||
}
|
||||
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
|
||||
EditMaterialCommand = new RelayCommand(o => EditMaterial());
|
||||
|
||||
}
|
||||
|
||||
private void EditMaterial()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(headMaterialRepository);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
public void EditColor()
|
||||
{
|
||||
var wnd = new ColorPickerView(primitive);
|
||||
wnd.ShowDialog();
|
||||
OnPropertyChanged(nameof(Color));
|
||||
Color color = Color;
|
||||
ColorProcessor.EditColor(ref color);
|
||||
Color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user