LinePrimitive and RectanglePrimitive was added
This commit is contained in:
27
Infrastructure/UI/DataContexts/LinePrimitive.cs
Normal file
27
Infrastructure/UI/DataContexts/LinePrimitive.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using StructureHelper.Infrastructure.Enums;
|
||||||
|
using StructureHelper.Services.Primitives;
|
||||||
|
using StructureHelper.UnitSystem.Systems;
|
||||||
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||||
|
{
|
||||||
|
internal class LinePrimitive : PrimitiveBase
|
||||||
|
{
|
||||||
|
private ILineShape lineShape;
|
||||||
|
public LinePrimitive(PrimitiveType type, double x, double y, MainViewModel ownerVM) : base(type, x, y, ownerVM)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
string materialName = MaterialName;
|
string materialName = MaterialName;
|
||||||
ICenter center = new Center { X = CenterX, Y = CenterY };
|
ICenter center = new Center { X = CenterX, Y = CenterY };
|
||||||
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = this.Area };
|
IShape shape = new StructureHelperCommon.Models.Shapes.PointShape { Area = this.Area };
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
||||||
{ Center = center, Shape = shape,
|
{ Center = center, Shape = shape,
|
||||||
PrestrainKx = PrestrainKx,
|
PrestrainKx = PrestrainKx,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
double centerX = CenterX;
|
double centerX = CenterX;
|
||||||
double centerY = CenterY;
|
double centerY = CenterY;
|
||||||
ICenter center = new Center { X = centerX, Y = centerY };
|
ICenter center = new Center { X = centerX, Y = centerY };
|
||||||
IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 };
|
IShape shape = new StructureHelperCommon.Models.Shapes.RectangleShape { Height = height, Width = width, Angle = 0 };
|
||||||
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
|
||||||
{ Center = center, Shape = shape,
|
{ Center = center, Shape = shape,
|
||||||
NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
|
NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
<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" />
|
||||||
<Compile Include="Infrastructure\UI\Converters\Units\UnitConstatnts.cs" />
|
<Compile Include="Infrastructure\UI\Converters\Units\UnitConstatnts.cs" />
|
||||||
|
<Compile Include="Infrastructure\UI\DataContexts\LinePrimitive.cs" />
|
||||||
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
<Compile Include="Infrastructure\UI\PrimitiveTemplates\IRectangleBeamProperties.cs" />
|
||||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
|
|||||||
@@ -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 ISaveable
|
||||||
|
{
|
||||||
|
int Id { get; set; }
|
||||||
|
void Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
/// Coordinate of center of rectangle by local axis X, m
|
/// Coordinate of center of rectangle by local axis X, m
|
||||||
/// Координата центра вдоль локальной оси X, м
|
/// Координата центра вдоль локальной оси X, м
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double X { get;}
|
double X { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Coordinate of center of rectangle by local axis Y, m
|
/// Coordinate of center of rectangle by local axis Y, m
|
||||||
/// Координата центра вдоль локальной оси Y, м
|
/// Координата центра вдоль локальной оси Y, м
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Y { get;}
|
double Y { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
StructureHelperCommon/Models/Shapes/ILineShape.cs
Normal file
15
StructureHelperCommon/Models/Shapes/ILineShape.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
public interface ILineShape : IShape
|
||||||
|
{
|
||||||
|
ICenter StartPoint { get; set; }
|
||||||
|
ICenter EndPoint { get; set; }
|
||||||
|
double Thickness { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
public interface IRectangle : IShape
|
public interface IRectangleShape : IShape
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of rectangle, m
|
/// Width of rectangle, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Width { get; }
|
double Width { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Height of rectangle, m
|
/// Height of rectangle, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Height { get; }
|
double Height { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Angle of rotating rectangle, rad
|
/// Angle of rotating rectangle, rad
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Angle { get; }
|
double Angle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
26
StructureHelperCommon/Models/Shapes/LineShape.cs
Normal file
26
StructureHelperCommon/Models/Shapes/LineShape.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public class LineShape : ILineShape
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ICenter StartPoint { get; set; }
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ICenter EndPoint { get; set; }
|
||||||
|
/// <inheritdoc />
|
||||||
|
public double Thickness { get; set; }
|
||||||
|
|
||||||
|
public LineShape()
|
||||||
|
{
|
||||||
|
StartPoint = new Center();
|
||||||
|
EndPoint = new Center();
|
||||||
|
Thickness = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
public class Point : IPoint
|
public class PointShape : IPoint
|
||||||
{
|
{
|
||||||
public double Area { get; set; }
|
public double Area { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class Rectangle : IRectangle
|
public class RectangleShape : IRectangleShape
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
27
StructureHelperCommon/Services/ShapeServices/ShapeService.cs
Normal file
27
StructureHelperCommon/Services/ShapeServices/ShapeService.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Services.ShapeServices
|
||||||
|
{
|
||||||
|
public static class ShapeService
|
||||||
|
{
|
||||||
|
public static void CopyLineProperties(ILineShape source, ILineShape target)
|
||||||
|
{
|
||||||
|
target.StartPoint.X = source.StartPoint.X;
|
||||||
|
target.StartPoint.Y = source.StartPoint.Y;
|
||||||
|
target.EndPoint.X = source.EndPoint.X;
|
||||||
|
target.EndPoint.Y = source.EndPoint.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CopyRectangleProperties(IRectangleShape source, IRectangleShape target)
|
||||||
|
{
|
||||||
|
target.Width = source.Width;
|
||||||
|
target.Height = source.Height;
|
||||||
|
target.Angle = source.Angle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,19 +51,23 @@
|
|||||||
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
|
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
|
||||||
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
|
||||||
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
|
||||||
|
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
|
||||||
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
|
||||||
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
|
||||||
<Compile Include="Models\Shapes\Center.cs" />
|
<Compile Include="Models\Shapes\Center.cs" />
|
||||||
<Compile Include="Models\Shapes\ICenter.cs" />
|
<Compile Include="Models\Shapes\ICenter.cs" />
|
||||||
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
<Compile Include="Models\Shapes\ICenterShape.cs" />
|
||||||
<Compile Include="Models\Shapes\ICircle.cs" />
|
<Compile Include="Models\Shapes\ICircle.cs" />
|
||||||
|
<Compile Include="Models\Shapes\ILineShape.cs" />
|
||||||
<Compile Include="Models\Shapes\IPoint.cs" />
|
<Compile Include="Models\Shapes\IPoint.cs" />
|
||||||
<Compile Include="Models\Shapes\IRectangle.cs" />
|
<Compile Include="Models\Shapes\IRectangleShape.cs" />
|
||||||
<Compile Include="Models\Shapes\IShape.cs" />
|
<Compile Include="Models\Shapes\IShape.cs" />
|
||||||
<Compile Include="Models\Shapes\Point.cs" />
|
<Compile Include="Models\Shapes\LineShape.cs" />
|
||||||
<Compile Include="Models\Shapes\Rectangle.cs" />
|
<Compile Include="Models\Shapes\PointShape.cs" />
|
||||||
|
<Compile Include="Models\Shapes\RectangleShape.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
|
||||||
|
<Compile Include="Services\ShapeServices\ShapeService.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -12,12 +12,14 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public class ElasticMaterial : IElasticMaterial
|
public class ElasticMaterial : IElasticMaterial
|
||||||
{
|
{
|
||||||
public double Modulus { get; set; }
|
public double Modulus { get; set; }
|
||||||
|
public double CompressiveStrength { get; set; }
|
||||||
|
public double TensileStrength { get; set; }
|
||||||
|
|
||||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
IMaterial material = new Material();
|
IMaterial material = new Material();
|
||||||
material.InitModulus = Modulus;
|
material.InitModulus = Modulus;
|
||||||
IEnumerable<double> parameters = new List<double>() { Modulus};
|
IEnumerable<double> parameters = new List<double>() { Modulus, CompressiveStrength, TensileStrength};
|
||||||
material.DiagramParameters = parameters;
|
material.DiagramParameters = parameters;
|
||||||
material.Diagram = GetStress;
|
material.Diagram = GetStress;
|
||||||
return material;
|
return material;
|
||||||
@@ -25,12 +27,17 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
|
|
||||||
private double GetStress (IEnumerable<double> parameters, double strain)
|
private double GetStress (IEnumerable<double> parameters, double strain)
|
||||||
{
|
{
|
||||||
return parameters.First() * strain;
|
double modulus = parameters.First();
|
||||||
|
double stress = modulus * strain;
|
||||||
|
double compressiveStrength = (-1d) * parameters.ElementAt(1);
|
||||||
|
double tensileStrength = parameters.ElementAt(2);
|
||||||
|
if (stress > tensileStrength || stress < compressiveStrength) { return 0d; }
|
||||||
|
else { return stress; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
return new ElasticMaterial() { Modulus = Modulus };
|
return new ElasticMaterial() { Modulus = Modulus, CompressiveStrength = CompressiveStrength, TensileStrength = TensileStrength };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public interface IElasticMaterial : IHelperMaterial
|
public interface IElasticMaterial : IHelperMaterial
|
||||||
{
|
{
|
||||||
double Modulus { get; set; }
|
double Modulus { get; set; }
|
||||||
|
double CompressiveStrength { get; set; }
|
||||||
|
double TensileStrength { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
StructureHelperLogics/Models/Primitives/IPrimitive.cs
Normal file
20
StructureHelperLogics/Models/Primitives/IPrimitive.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
|
{
|
||||||
|
public interface IPrimitive : ISaveable, ICloneable
|
||||||
|
{
|
||||||
|
string Name { get; set; }
|
||||||
|
ICenter Center { get; }
|
||||||
|
IShape Shape { get; }
|
||||||
|
|
||||||
|
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
||||||
|
}
|
||||||
|
}
|
||||||
37
StructureHelperLogics/Models/Primitives/LinePrimitive.cs
Normal file
37
StructureHelperLogics/Models/Primitives/LinePrimitive.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
|
{
|
||||||
|
public class LinePrimitive : IPrimitive
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public ICenter Center { get; set; }
|
||||||
|
public IShape Shape { get; }
|
||||||
|
|
||||||
|
public LinePrimitive()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdmPrimitive> GetNdmPrimitives()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.Models.Templates.RCs
|
|||||||
|
|
||||||
public RectangleBeamTemplate()
|
public RectangleBeamTemplate()
|
||||||
{
|
{
|
||||||
Shape = new Rectangle() { Width = 0.4d, Height = 0.6d };
|
Shape = new RectangleShape() { Width = 0.4d, Height = 0.6d };
|
||||||
CoverGap = 0.05d;
|
CoverGap = 0.05d;
|
||||||
TopDiameter = 0.016d;
|
TopDiameter = 0.016d;
|
||||||
BottomDiameter = 0.025d;
|
BottomDiameter = 0.025d;
|
||||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.Models.Templates.RCs
|
|||||||
|
|
||||||
public RectangleBeamTemplate(double width, double height)
|
public RectangleBeamTemplate(double width, double height)
|
||||||
{
|
{
|
||||||
Shape = new Rectangle() { Width = width, Height = height };
|
Shape = new RectangleShape() { Width = width, Height = height };
|
||||||
CoverGap = 0.05d;
|
CoverGap = 0.05d;
|
||||||
TopDiameter = 0.016d;
|
TopDiameter = 0.016d;
|
||||||
BottomDiameter = 0.025d;
|
BottomDiameter = 0.025d;
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
internal interface IHasDivisionSize
|
||||||
|
{
|
||||||
|
double NdmMaxSize { get; set; }
|
||||||
|
int NdmMinDivision { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,23 @@
|
|||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using System.Collections;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
{
|
{
|
||||||
public interface INdmPrimitive
|
public interface INdmPrimitive
|
||||||
{
|
{
|
||||||
|
string Name { get; set; }
|
||||||
ICenter Center { get; set; }
|
ICenter Center { get; set; }
|
||||||
IShape Shape { get; set; }
|
IShape Shape { get; set; }
|
||||||
IHeadMaterial HeadMaterial { get; }
|
IHeadMaterial HeadMaterial { get; set; }
|
||||||
double NdmMaxSize { get; set; }
|
|
||||||
int NdmMinDivision { get; set; }
|
|
||||||
double PrestrainKx { get; set; }
|
double PrestrainKx { get; set; }
|
||||||
double PrestrainKy { get; set; }
|
double PrestrainKy { get; set; }
|
||||||
double PrestrainEpsZ { get; set; }
|
double PrestrainEpsZ { get; set; }
|
||||||
|
|
||||||
|
IEnumerable<INdm> GetNdms(IMaterial material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Services.ShapeServices;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public class LinePrimitive : INdmPrimitive, ILineShape, IHasDivisionSize, ISaveable, ICloneable
|
||||||
|
{
|
||||||
|
public ICenter Center { get; set; }
|
||||||
|
public IShape Shape { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public double NdmMaxSize { get; set; }
|
||||||
|
public int NdmMinDivision { get; set; }
|
||||||
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
|
public double PrestrainKx { get; set; }
|
||||||
|
public double PrestrainKy { get; set; }
|
||||||
|
public double PrestrainEpsZ { get; set; }
|
||||||
|
|
||||||
|
public ICenter StartPoint { get; set; }
|
||||||
|
public ICenter EndPoint { get; set; }
|
||||||
|
public double Thickness { get; set; }
|
||||||
|
|
||||||
|
public LinePrimitive()
|
||||||
|
{
|
||||||
|
StartPoint = new Center();
|
||||||
|
EndPoint = new Center();
|
||||||
|
|
||||||
|
Name = "New Line";
|
||||||
|
NdmMaxSize = 0.01d;
|
||||||
|
NdmMinDivision = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
LinePrimitive primitive = new LinePrimitive();
|
||||||
|
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||||
|
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||||
|
ShapeService.CopyLineProperties(this, primitive);
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,47 @@
|
|||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Primitives
|
namespace StructureHelperLogics.Models.Primitives
|
||||||
{
|
{
|
||||||
public class NdmPrimitive : INdmPrimitive
|
public class NdmPrimitive : INdmPrimitive, ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
private IHeadMaterial headMaterial;
|
|
||||||
|
|
||||||
public ICenter Center { get; set; }
|
public ICenter Center { get; set; }
|
||||||
public IShape Shape { get; set; }
|
public IShape Shape { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get => headMaterial; }
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public IHeadMaterial HeadMaterial { get; private set; }
|
||||||
public double NdmMaxSize { get; set; }
|
public double NdmMaxSize { get; set; }
|
||||||
public int NdmMinDivision { get; set; }
|
public int NdmMinDivision { get; set; }
|
||||||
public double PrestrainKx { get; set; }
|
public double PrestrainKx { get; set; }
|
||||||
public double PrestrainKy { get; set; }
|
public double PrestrainKy { get; set; }
|
||||||
public double PrestrainEpsZ { get; set; }
|
public double PrestrainEpsZ { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public NdmPrimitive(IHeadMaterial material)
|
public NdmPrimitive(IHeadMaterial material)
|
||||||
{
|
{
|
||||||
headMaterial = material;
|
HeadMaterial = material;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Services.ShapeServices;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
{
|
||||||
|
public class RectanglePrimitive : INdmPrimitive, IRectangleShape, IHasDivisionSize, ISaveable, ICloneable
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public ICenter Center { get; set; }
|
||||||
|
public IShape Shape { get; set; }
|
||||||
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
|
public double PrestrainKx { get; set; }
|
||||||
|
public double PrestrainKy { get; set; }
|
||||||
|
public double PrestrainEpsZ { get; set; }
|
||||||
|
public double NdmMaxSize { get; set; }
|
||||||
|
public int NdmMinDivision { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public double Width { get; set; }
|
||||||
|
public double Height { get; set; }
|
||||||
|
public double Angle { get; set; }
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
RectanglePrimitive primitive = new RectanglePrimitive();
|
||||||
|
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||||
|
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||||
|
ShapeService.CopyRectangleProperties(this, primitive);
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRectangle Rectangle { get; }
|
IRectangleShape Rectangle { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum size (width or height) of ndm part after triangulation
|
/// Maximum size (width or height) of ndm part after triangulation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Exceptions;
|
|||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.Primitives;
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ICenter Center { get; }
|
public ICenter Center { get; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IRectangle Rectangle { get; }
|
public IRectangleShape Rectangle { get; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public double NdmMaxSize { get; }
|
public double NdmMaxSize { get; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -24,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public double PrestrainEpsZ { get;}
|
public double PrestrainEpsZ { get;}
|
||||||
|
|
||||||
public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
|
public RectangleTriangulationLogicOptions(ICenter center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
|
||||||
{
|
{
|
||||||
Center = center;
|
Center = center;
|
||||||
Rectangle = rectangle;
|
Rectangle = rectangle;
|
||||||
@@ -34,11 +35,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (! (primitive.Shape is IRectangle)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
if (! (primitive.Shape is IRectangleShape)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||||
Center = primitive.Center;
|
Center = primitive.Center;
|
||||||
Rectangle = primitive.Shape as IRectangle;
|
Rectangle = primitive.Shape as IRectangleShape;
|
||||||
NdmMaxSize = primitive.NdmMaxSize;
|
if (primitive is IHasDivisionSize)
|
||||||
NdmMinDivision = primitive.NdmMinDivision;
|
{
|
||||||
|
NdmMaxSize = (primitive as IHasDivisionSize).NdmMaxSize;
|
||||||
|
NdmMinDivision = (primitive as IHasDivisionSize).NdmMinDivision;
|
||||||
|
}
|
||||||
PrestrainKx = primitive.PrestrainKx;
|
PrestrainKx = primitive.PrestrainKx;
|
||||||
PrestrainKy = primitive.PrestrainKy;
|
PrestrainKy = primitive.PrestrainKy;
|
||||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
ITriangulationLogicOptions options;
|
ITriangulationLogicOptions options;
|
||||||
ICenter center = primitive.Center;
|
ICenter center = primitive.Center;
|
||||||
IShape shape = primitive.Shape;
|
IShape shape = primitive.Shape;
|
||||||
if (shape is IRectangle)
|
if (shape is IRectangleShape)
|
||||||
{
|
{
|
||||||
options = new RectangleTriangulationLogicOptions(primitive);
|
options = new RectangleTriangulationLogicOptions(primitive);
|
||||||
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||||
|
{
|
||||||
|
internal static class NdmPrimitivesService
|
||||||
|
{
|
||||||
|
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||||
|
{
|
||||||
|
target.Name = source.Name + " - copy" ;
|
||||||
|
target.HeadMaterial = source.HeadMaterial;
|
||||||
|
target.PrestrainKx = source.PrestrainKx;
|
||||||
|
target.PrestrainKy = source.PrestrainKy;
|
||||||
|
target.PrestrainEpsZ = source.PrestrainEpsZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||||
|
{
|
||||||
|
target.NdmMaxSize = source.NdmMaxSize;
|
||||||
|
target.NdmMinDivision = source.NdmMinDivision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
{
|
{
|
||||||
double strength = 40e6;
|
double strength = 40e6;
|
||||||
ICenter center = new Center { X = 0, Y = 0 };
|
ICenter center = new Center { X = 0, Y = 0 };
|
||||||
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = 0 };
|
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||||
@@ -74,8 +74,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
{
|
{
|
||||||
double gap = 0.05d;
|
double gap = 0.05d;
|
||||||
double strength = 4e8;
|
double strength = 4e8;
|
||||||
IShape topReinforcement = new Point { Area = topArea };
|
IShape topReinforcement = new PointShape { Area = topArea };
|
||||||
IShape bottomReinforcement = new Point { Area = bottomArea };
|
IShape bottomReinforcement = new PointShape { Area = bottomArea };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
||||||
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
//ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
ICenter centerRT = new Center { X = width / 2 - gap, Y = height / 2 - gap };
|
ICenter centerRT = new Center { X = width / 2 - gap, Y = height / 2 - gap };
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
|||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
ICenter center = new Center { X = 0, Y = 0 };
|
ICenter center = new Center { X = 0, Y = 0 };
|
||||||
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = 0 };
|
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = 0 };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
IPrimitiveMaterial material = new PrimitiveMaterial { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
||||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
ITriangulationOptions options = new TriangulationOptions { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
|
INdmPrimitive primitive = new NdmPrimitive { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
//Arrange
|
//Arrange
|
||||||
IMaterial material = new Material();
|
IMaterial material = new Material();
|
||||||
ICenter center = new Center { X = centerX, Y = centerY };
|
ICenter center = new Center { X = centerX, Y = centerY };
|
||||||
IRectangle rectangle = new Rectangle { Width = width, Height = height, Angle = angle };
|
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height, Angle = angle };
|
||||||
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
|
||||||
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
|
IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
|
||||||
//Act
|
//Act
|
||||||
|
|||||||
@@ -65,7 +65,12 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20" >
|
<Expander Header="Materials" ExpandDirection="Down" MinWidth="20">
|
||||||
|
<Expander.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Materials" Command="{Binding EditHeadMaterialsCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding HeadMaterials}">
|
<ListBox ItemsSource="{Binding HeadMaterials}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -86,7 +91,21 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
<Expander Header="Geometry" ExpandDirection="Down" MinWidth="20" >
|
||||||
|
<Expander.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Add">
|
||||||
|
<Button Content="Add Rectangle" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
|
<Button Content="Add Point" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
|
</MenuItem>
|
||||||
|
</ContextMenu>
|
||||||
|
</Expander.ContextMenu>
|
||||||
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
<ListBox ItemsSource="{Binding Primitives}" SelectedItem="{Binding SelectedPrimitive}">
|
||||||
|
<ListBox.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<Button Content="Edit" Command="{Binding EditPrimitive}"/>
|
||||||
|
<Button Content="Delete" Command="{Binding DeletePrimitive}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -122,7 +141,6 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
</Expander>
|
</Expander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.Column="1">
|
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.Column="1">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="PreviewMouseDown">
|
<i:EventTrigger EventName="PreviewMouseDown">
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
|
|
||||||
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
|
if (CheckMaterials() == false) { return;}
|
||||||
IEnumerable<INdm> ndms = Model.GetNdms(calculationProperty);
|
IEnumerable<INdm> ndms = Model.GetNdms(calculationProperty);
|
||||||
double[] center = GeometryOperations.GetGravityCenter(ndms);
|
double[] center = GeometryOperations.GetGravityCenter(ndms);
|
||||||
foreach (var primitive in Model.PrimitiveRepository.Primitives)
|
foreach (var primitive in Model.PrimitiveRepository.Primitives)
|
||||||
@@ -404,6 +405,12 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckAnalisysOptions()
|
private bool CheckAnalisysOptions()
|
||||||
|
{
|
||||||
|
if (CheckMaterials() == false) { return false; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckMaterials()
|
||||||
{
|
{
|
||||||
foreach (var item in PrimitiveRepository.Primitives)
|
foreach (var item in PrimitiveRepository.Primitives)
|
||||||
{
|
{
|
||||||
@@ -454,16 +461,16 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
wnd.ShowDialog();
|
wnd.ShowDialog();
|
||||||
if (wnd.DialogResult == true)
|
if (wnd.DialogResult == true)
|
||||||
{
|
{
|
||||||
var rect = template.Shape as StructureHelperCommon.Models.Shapes.Rectangle;
|
var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
|
||||||
var width = rect.Width;
|
var width = rect.Width;
|
||||||
var height = rect.Height;
|
var height = rect.Height;
|
||||||
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
||||||
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
||||||
var gap = template.CoverGap;
|
var gap = template.CoverGap;
|
||||||
|
|
||||||
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete 40" };
|
IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete" };
|
||||||
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||||
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement 400" };
|
IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement" };
|
||||||
reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
||||||
headMaterials.Add(concrete);
|
headMaterials.Add(concrete);
|
||||||
headMaterials.Add(reinforcement);
|
headMaterials.Add(reinforcement);
|
||||||
|
|||||||
@@ -7,19 +7,53 @@
|
|||||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
|
||||||
d:DataContext="{d:DesignInstance vm:HeadMaterialsViewModel}"
|
d:DataContext="{d:DesignInstance vm:HeadMaterialsViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Materials" Height="350" Width="400" WindowStartupLocation="CenterScreen">
|
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
|
||||||
|
<Window.Resources>
|
||||||
|
<DataTemplate x:Key="LibMaterial">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="Library material"/>
|
||||||
|
<ComboBox Grid.Row="2" Height="25" VerticalAlignment="Top" ItemsSource="{Binding LibMaterials}" SelectedItem="{Binding SelectedLibMaterial}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="ElasticMaterial">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="180"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
<RowDefinition Height="28"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Elastic material"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Young's modulus"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Modulus, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Compressive strength"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding CompressiveStrength, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Tensile strength"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="120"/>
|
<ColumnDefinition Width="120"/>
|
||||||
|
<ColumnDefinition Width="280"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}">
|
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}" SelectionChanged="ListBox_SelectionChanged">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -38,21 +72,19 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</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>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Content="New Material" Command="{Binding AddNewMaterialCommand}"/>
|
<Button Content="New Lib Material" Command="{Binding AddNewMaterialCommand}"/>
|
||||||
|
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||||
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="2">
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Text="{Binding SelectedMaterial.Name}"/>
|
||||||
|
<StackPanel x:Name="StpMaterialProperties"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow.Materials
|
namespace StructureHelper.Windows.MainWindow.Materials
|
||||||
{
|
{
|
||||||
@@ -22,20 +23,47 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class HeadMaterialsView : Window
|
public partial class HeadMaterialsView : Window
|
||||||
{
|
{
|
||||||
private HeadMaterialsViewModel viewmodel;
|
private HeadMaterialsViewModel viewModel;
|
||||||
|
|
||||||
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
|
public HeadMaterialsView(IHeadMaterialRepository headMaterialRepository)
|
||||||
{
|
{
|
||||||
viewmodel = new HeadMaterialsViewModel(headMaterialRepository);
|
viewModel = new HeadMaterialsViewModel(headMaterialRepository);
|
||||||
this.DataContext = viewmodel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
public HeadMaterialsView(HeadMaterialsViewModel vm)
|
||||||
{
|
{
|
||||||
viewmodel = vm;
|
viewModel = vm;
|
||||||
this.DataContext = viewmodel;
|
this.DataContext = viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
StpMaterialProperties.Children.Clear();
|
||||||
|
var selectedMaterial = viewModel.SelectedMaterial;
|
||||||
|
if (selectedMaterial == null) { return; }
|
||||||
|
var helperMaterial = selectedMaterial.HelperMaterial;
|
||||||
|
string dataTemplateName = string.Empty;
|
||||||
|
Binding binding = new Binding();
|
||||||
|
if (helperMaterial is ILibMaterial)
|
||||||
|
{
|
||||||
|
dataTemplateName = "LibMaterial";
|
||||||
|
binding.Source = viewModel;
|
||||||
|
}
|
||||||
|
if (helperMaterial is IElasticMaterial)
|
||||||
|
{
|
||||||
|
dataTemplateName = "ElasticMaterial";
|
||||||
|
binding.Source = viewModel.SelectedMaterial.HelperMaterial;
|
||||||
|
}
|
||||||
|
if (dataTemplateName != string.Empty)
|
||||||
|
{
|
||||||
|
ContentControl contentControl = new ContentControl();
|
||||||
|
contentControl.SetResourceReference(ContentTemplateProperty, dataTemplateName);
|
||||||
|
contentControl.SetBinding(ContentProperty, binding);
|
||||||
|
StpMaterialProperties.Children.Add(contentControl);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,10 +54,9 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
|||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
ContentControl contentControl = new ContentControl();
|
ContentControl contentControl = new ContentControl();
|
||||||
contentControl.SetResourceReference(ContentControl.ContentTemplateProperty, name);
|
contentControl.SetResourceReference(ContentTemplateProperty, name);
|
||||||
Binding binding = new Binding();
|
Binding binding = new Binding {Source = viewModel};
|
||||||
binding.Source = viewModel;
|
contentControl.SetBinding(ContentProperty, binding);
|
||||||
contentControl.SetBinding(ContentControl.ContentProperty, binding);
|
|
||||||
StpProperties.Children.Add(contentControl);
|
StpProperties.Children.Add(contentControl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,33 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
ILibMaterial selectedLibMaterial;
|
ILibMaterial selectedLibMaterial;
|
||||||
|
|
||||||
public ICommand AddNewMaterialCommand { get; set; }
|
public ICommand AddNewMaterialCommand { get; set; }
|
||||||
|
public ICommand AddElasticMaterialCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return addElasticMaterialCommand ??
|
||||||
|
(
|
||||||
|
addElasticMaterialCommand = new RelayCommand(o => AddElasticMaterial())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddElasticMaterial()
|
||||||
|
{
|
||||||
|
IHeadMaterial material = new HeadMaterial() { Name = "New elastic material" };
|
||||||
|
material.HelperMaterial = new ElasticMaterial() { Modulus = 2e11d, CompressiveStrength = 4e8d, TensileStrength = 4e8d };
|
||||||
|
HeadMaterials.Add(material);
|
||||||
|
materialRepository.HeadMaterials.Add(material);
|
||||||
|
SelectedMaterial = material;
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand CopyHeadMaterialCommand { get; set; }
|
public ICommand CopyHeadMaterialCommand { get; set; }
|
||||||
public ICommand EditColorCommand { get; set; }
|
public ICommand EditColorCommand { get; set; }
|
||||||
public ICommand DeleteMaterialCommand { get; set; }
|
public ICommand DeleteMaterialCommand { get; set; }
|
||||||
public ICommand EditHeadMaterial;
|
public ICommand EditHeadMaterial;
|
||||||
|
|
||||||
|
private ICommand addElasticMaterialCommand;
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
public IHeadMaterial SelectedMaterial
|
public IHeadMaterial SelectedMaterial
|
||||||
{
|
{
|
||||||
@@ -104,7 +126,6 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
HeadMaterials.Add(material);
|
HeadMaterials.Add(material);
|
||||||
materialRepository.HeadMaterials.Add(material);
|
materialRepository.HeadMaterials.Add(material);
|
||||||
SelectedMaterial = material;
|
SelectedMaterial = material;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteMaterial()
|
private void DeleteMaterial()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveTemplates.RCs
|
|||||||
{
|
{
|
||||||
public IRectangleBeamTemplate Model;
|
public IRectangleBeamTemplate Model;
|
||||||
|
|
||||||
private Rectangle rectangle => (Model.Shape as Rectangle);
|
private RectangleShape rectangle => (Model.Shape as RectangleShape);
|
||||||
|
|
||||||
public Window ParentWindow { get; set; }
|
public Window ParentWindow { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user