IReport is added
This commit is contained in:
@@ -12,16 +12,16 @@ namespace FieldVisualizer.Services.ColorServices
|
|||||||
const byte Alpha = 0xff;
|
const byte Alpha = 0xff;
|
||||||
public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
|
public static Color GetColorByValue(IValueRange range, IColorMap map, double val)
|
||||||
{
|
{
|
||||||
|
if (range.TopValue == range.BottomValue || map.Colors.Count == 0) { return map.Colors[0]; }
|
||||||
double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
|
double minVal = range.BottomValue - 1e-15d*(Math.Abs(range.BottomValue));
|
||||||
double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
double maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
||||||
if (range.TopValue == minVal || map.Colors.Count == 0) { return map.Colors[0]; }
|
|
||||||
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
||||||
if (val == minVal) { return map.Colors[0]; }
|
if (val == minVal) { return map.Colors[0]; }
|
||||||
if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
|
if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
|
||||||
|
|
||||||
double valPerc = (val - minVal) / (maxVal - minVal);// value%
|
double valPerc = (val - minVal) / (maxVal - minVal);// value%
|
||||||
//if (valPerc == 1d)
|
if (valPerc >= 1d)
|
||||||
//{ return map.Colors[map.Colors.Count - 1]; }
|
{ return map.Colors[map.Colors.Count - 1]; }
|
||||||
double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
|
double colorPerc = 1d / (map.Colors.Count - 1d); // % of each block of color. the last is the "100% Color"
|
||||||
double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
|
double blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
|
||||||
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FieldVisualizer.Services.PrimitiveServices
|
||||||
|
{
|
||||||
|
public static class TestPrimitivesOperation
|
||||||
|
{
|
||||||
|
public static List<IPrimitiveSet> AddTestPrimitives()
|
||||||
|
{
|
||||||
|
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||||
|
int imax = 100;
|
||||||
|
int jmax = 100;
|
||||||
|
PrimitiveSet primitiveSet = new PrimitiveSet();
|
||||||
|
primitiveSets.Add(primitiveSet);
|
||||||
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
|
IValuePrimitive primitive;
|
||||||
|
for (int i = 0; i < imax; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < jmax; j++)
|
||||||
|
{
|
||||||
|
primitive = new RectanglePrimitive() { Height = 10, Width = 20, CenterX = 20 * i, CenterY = 10 * j, Value = -(i + j) };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
primitive = new CirclePrimitive() { Diameter = 150, CenterX = -200 * i, CenterY = -100 * j, Value = i * 100 + j * 200 };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
primitiveSet = new PrimitiveSet();
|
||||||
|
primitives = new List<IValuePrimitive>();
|
||||||
|
primitive = new RectanglePrimitive() { Height = 100, Width = 200, CenterX = 0, CenterY = 0, Value = 100 };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
primitive = new CirclePrimitive() { Diameter = 50, CenterX = 0, CenterY = 0, Value = -100 };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
|
primitiveSets.Add(primitiveSet);
|
||||||
|
return primitiveSets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition Width="200"/>
|
<ColumnDefinition Width="220"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -35,7 +35,12 @@
|
|||||||
</Viewbox>
|
</Viewbox>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<StackPanel Grid.Column="2">
|
||||||
<local:VerticalLegend x:Name="LegendViewer" Grid.Column="2"/>
|
<CheckBox x:Name="cbMinValueEnabled" Margin="3" Content="Minimum Value"/>
|
||||||
|
<TextBox x:Name="tbMinValue" Margin="20,3,3,3" IsEnabled="{Binding IsChecked, ElementName=cbMinValueEnabled}" Text="{Binding Path=UserValueRange.BottomValue}"/>
|
||||||
|
<CheckBox x:Name="cbMaxValueEnabled" Margin="3" Content="Maximum Value"/>
|
||||||
|
<TextBox x:Name="tbMaxValue" Margin="20,3,3,3" IsEnabled="{Binding IsChecked, ElementName=cbMaxValueEnabled}" Text="{Binding Path=UserValueRange.TopValue}"/>
|
||||||
|
<local:VerticalLegend x:Name="LegendViewer" Margin="3" Grid.Column="2"/>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -31,10 +31,12 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
public ICommand ChangeColorMapCommand { get; }
|
public ICommand ChangeColorMapCommand { get; }
|
||||||
|
|
||||||
public IPrimitiveSet PrimitiveSet { get; set; }
|
public IPrimitiveSet PrimitiveSet { get; set; }
|
||||||
|
public IValueRange UserValueRange { get; set; }
|
||||||
|
|
||||||
private double dX, dY;
|
private double dX, dY;
|
||||||
private ColorMapsTypes _ColorMapType;
|
private ColorMapsTypes _ColorMapType;
|
||||||
private IColorMap _ColorMap;
|
private IColorMap _ColorMap;
|
||||||
private IValueRange _ValueRange;
|
private IValueRange valueRange;
|
||||||
private IEnumerable<IValueRange> _ValueRanges;
|
private IEnumerable<IValueRange> _ValueRanges;
|
||||||
private IEnumerable<IValueColorRange> _ValueColorRanges;
|
private IEnumerable<IValueColorRange> _ValueColorRanges;
|
||||||
const int RangeNumber = 16;
|
const int RangeNumber = 16;
|
||||||
@@ -48,14 +50,13 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
|
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
|
||||||
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
|
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
|
||||||
ChangeColorMapCommand = new RelayCommand(o => ChangeColorMap(), o => PrimitiveValidation());
|
ChangeColorMapCommand = new RelayCommand(o => ChangeColorMap(), o => PrimitiveValidation());
|
||||||
|
UserValueRange = new ValueRange() { BottomValue = 0, TopValue = 0 };
|
||||||
}
|
}
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
if (PrimitiveValidation() == false) { return; }
|
if (PrimitiveValidation() == false) { return; }
|
||||||
_ValueRange = PrimitiveOperations.GetValueRange(PrimitiveSet.ValuePrimitives);
|
|
||||||
_ValueRanges = ValueRangeOperations.DivideValueRange(_ValueRange, RangeNumber);
|
|
||||||
_ColorMap = ColorMapFactory.GetColorMap(_ColorMapType);
|
_ColorMap = ColorMapFactory.GetColorMap(_ColorMapType);
|
||||||
_ValueColorRanges = ColorOperations.GetValueColorRanges(_ValueRange, _ValueRanges, _ColorMap);
|
SetColor();
|
||||||
if ((PrimitiveSet is null) == false)
|
if ((PrimitiveSet is null) == false)
|
||||||
{
|
{
|
||||||
ProcessPrimitives();
|
ProcessPrimitives();
|
||||||
@@ -65,6 +66,7 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
}
|
}
|
||||||
private void ProcessPrimitives()
|
private void ProcessPrimitives()
|
||||||
{
|
{
|
||||||
|
|
||||||
WorkPlaneCanvas.Children.Clear();
|
WorkPlaneCanvas.Children.Clear();
|
||||||
double sizeX = PrimitiveOperations.GetSizeX(PrimitiveSet.ValuePrimitives);
|
double sizeX = PrimitiveOperations.GetSizeX(PrimitiveSet.ValuePrimitives);
|
||||||
double sizeY = PrimitiveOperations.GetSizeY(PrimitiveSet.ValuePrimitives);
|
double sizeY = PrimitiveOperations.GetSizeY(PrimitiveSet.ValuePrimitives);
|
||||||
@@ -119,7 +121,7 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
private void ProcessShape(Shape shape, IValuePrimitive valuePrimitive, double addX, double addY)
|
private void ProcessShape(Shape shape, IValuePrimitive valuePrimitive, double addX, double addY)
|
||||||
{
|
{
|
||||||
SolidColorBrush brush = new SolidColorBrush();
|
SolidColorBrush brush = new SolidColorBrush();
|
||||||
brush.Color = ColorOperations.GetColorByValue(_ValueRange, _ColorMap, valuePrimitive.Value);
|
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
||||||
foreach (var valueRange in _ValueColorRanges)
|
foreach (var valueRange in _ValueColorRanges)
|
||||||
{
|
{
|
||||||
if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
|
if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
|
||||||
@@ -131,7 +133,7 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
shape.Tag = valuePrimitive;
|
shape.Tag = valuePrimitive;
|
||||||
shape.Fill = brush;
|
shape.Fill = brush;
|
||||||
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
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)
|
private void Zoom(double coefficient)
|
||||||
{
|
{
|
||||||
@@ -154,5 +156,13 @@ namespace FieldVisualizer.Windows.UserControls
|
|||||||
if (PrimitiveSet == null || PrimitiveSet.ValuePrimitives.Count() == 0) { return false; }
|
if (PrimitiveSet == null || PrimitiveSet.ValuePrimitives.Count() == 0) { return false; }
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
private void SetColor()
|
||||||
|
{
|
||||||
|
valueRange = PrimitiveOperations.GetValueRange(PrimitiveSet.ValuePrimitives);
|
||||||
|
if (cbMinValueEnabled.IsChecked == true) { valueRange.BottomValue = UserValueRange.BottomValue; } else { UserValueRange.BottomValue = valueRange.BottomValue; }
|
||||||
|
if (cbMaxValueEnabled.IsChecked == true) { valueRange.TopValue = UserValueRange.TopValue; } else { UserValueRange.TopValue = valueRange.TopValue; }
|
||||||
|
_ValueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
||||||
|
_ValueColorRanges = ColorOperations.GetValueColorRanges(valueRange, _ValueRanges, _ColorMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<ListBox Name="LegendBox" ItemsSource="{Binding}">
|
<ListBox Name="LegendBox" ItemsSource="{Binding}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid Height="30" Width="194" VerticalAlignment="Top" Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}">
|
<Grid Height="30" Width="190" VerticalAlignment="Top" Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="30"/>
|
<ColumnDefinition Width="30"/>
|
||||||
<ColumnDefinition Width="10"/>
|
<ColumnDefinition Width="10"/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
|
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
|
||||||
xmlns:local="clr-namespace:FieldVisualizer.Windows"
|
xmlns:local="clr-namespace:FieldVisualizer.Windows"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="FieldViewer" Height="700" Width="1200" WindowStartupLocation="CenterOwner">
|
Title="FieldViewer" Height="800" Width="1200" WindowStartupLocation="CenterOwner">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="300"/>
|
<ColumnDefinition Width="300"/>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using FieldVisualizer.Entities.Values.Primitives;
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using FieldVisualizer.Services.PrimitiveServices;
|
||||||
using FieldVisualizer.WindowsOperation;
|
using FieldVisualizer.WindowsOperation;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -21,38 +22,7 @@ namespace FiledVisualzerDemo
|
|||||||
|
|
||||||
private void RectanglesSetDemo_Click(object sender, EventArgs e)
|
private void RectanglesSetDemo_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
var primitiveSets = TestPrimitivesOperation.AddTestPrimitives();
|
||||||
int imax = 100;
|
|
||||||
int jmax = 100;
|
|
||||||
PrimitiveSet primitiveSet = new PrimitiveSet();
|
|
||||||
primitiveSets.Add(primitiveSet);
|
|
||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
|
||||||
primitiveSet.ValuePrimitives = primitives;
|
|
||||||
IValuePrimitive primitive;
|
|
||||||
for (int i = 0; i < imax; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < jmax; j++)
|
|
||||||
{
|
|
||||||
primitive = new RectanglePrimitive() { Height = 10, Width = 20, CenterX = 20 * i, CenterY = 10 * j, Value = -(i + j) };
|
|
||||||
primitives.Add(primitive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < 2; j++)
|
|
||||||
{
|
|
||||||
primitive = new CirclePrimitive() { Diameter = 150, CenterX = -200 * i, CenterY = -100 * j, Value = i * 100 + j * 200 };
|
|
||||||
primitives.Add(primitive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
primitiveSet = new PrimitiveSet();
|
|
||||||
primitives = new List<IValuePrimitive>();
|
|
||||||
primitive = new RectanglePrimitive() { Height = 100, Width = 200, CenterX = 0, CenterY = 0, Value = 100 };
|
|
||||||
primitives.Add(primitive);
|
|
||||||
primitive = new CirclePrimitive() { Diameter = 50, CenterX = 0, CenterY = 0, Value = -100 };
|
|
||||||
primitives.Add(primitive);
|
|
||||||
primitiveSet.ValuePrimitives = primitives;
|
|
||||||
primitiveSets.Add(primitiveSet);
|
|
||||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
Services/Reports/CalculationReports/IIsoFieldReport.cs
Normal file
12
Services/Reports/CalculationReports/IIsoFieldReport.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.Reports.CalculationReports
|
||||||
|
{
|
||||||
|
interface IIsoFieldReport : IReport
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
37
Services/Reports/CalculationReports/IsoFieldReport.cs
Normal file
37
Services/Reports/CalculationReports/IsoFieldReport.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using FieldVisualizer.Services.PrimitiveServices;
|
||||||
|
using FieldVisualizer.WindowsOperation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.Reports.CalculationReports
|
||||||
|
{
|
||||||
|
public class IsoFieldReport : IIsoFieldReport
|
||||||
|
{
|
||||||
|
private IEnumerable<IPrimitiveSet> primitiveSets;
|
||||||
|
|
||||||
|
public void Prepare()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowPrepared()
|
||||||
|
{
|
||||||
|
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
Prepare();
|
||||||
|
ShowPrepared();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsoFieldReport(IEnumerable<IPrimitiveSet> primitiveSets)
|
||||||
|
{
|
||||||
|
this.primitiveSets = primitiveSets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Services/Reports/IReport.cs
Normal file
15
Services/Reports/IReport.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Services.Reports
|
||||||
|
{
|
||||||
|
public interface IReport
|
||||||
|
{
|
||||||
|
void Prepare();
|
||||||
|
void ShowPrepared();
|
||||||
|
void Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
List<IResultFunc> resultFuncs = new List<IResultFunc>();
|
||||||
IStressLogic stressLogic = new StressLogic();
|
IStressLogic stressLogic = new StressLogic();
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Total Strain", ResultFunction = stressLogic.GetTotalStrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Elastic Srtain", ResultFunction = stressLogic.GetElasticStrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Elastic Strain", ResultFunction = stressLogic.GetElasticStrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
resultFuncs.Add(new ResultFunc() { Name = "Plastic Strain", ResultFunction = stressLogic.GetPlasticStrain });
|
||||||
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress });
|
resultFuncs.Add(new ResultFunc() { Name = "Stress", ResultFunction = stressLogic.GetStress });
|
||||||
return resultFuncs;
|
return resultFuncs;
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
public static class ShowIsoFieldResult
|
public static class ShowIsoFieldResult
|
||||||
{
|
{
|
||||||
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
public static void ShowResult(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
||||||
|
{
|
||||||
|
var primitiveSets = GetPrimitiveSets(strainMatrix, ndms, resultFuncs);
|
||||||
|
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, IEnumerable<INdm> ndms, IEnumerable<IResultFunc> resultFuncs)
|
||||||
{
|
{
|
||||||
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
List<IPrimitiveSet> primitiveSets = new List<IPrimitiveSet>();
|
||||||
foreach (var valDelegate in resultFuncs)
|
foreach (var valDelegate in resultFuncs)
|
||||||
@@ -39,8 +45,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
primitiveSet.ValuePrimitives = primitives;
|
primitiveSet.ValuePrimitives = primitives;
|
||||||
primitiveSets.Add(primitiveSet);
|
primitiveSets.Add(primitiveSet);
|
||||||
}
|
}
|
||||||
|
return primitiveSets;
|
||||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,9 @@
|
|||||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Services\PrimitiveService.cs" />
|
<Compile Include="Services\PrimitiveService.cs" />
|
||||||
|
<Compile Include="Services\Reports\CalculationReports\IIsoFieldReport.cs" />
|
||||||
|
<Compile Include="Services\Reports\CalculationReports\IsoFieldReport.cs" />
|
||||||
|
<Compile Include="Services\Reports\IReport.cs" />
|
||||||
<Compile Include="Services\ResultViewers\IResultFunc.cs" />
|
<Compile Include="Services\ResultViewers\IResultFunc.cs" />
|
||||||
<Compile Include="Services\ResultViewers\ResultFunc.cs" />
|
<Compile Include="Services\ResultViewers\ResultFunc.cs" />
|
||||||
<Compile Include="Services\ResultViewers\ResultFuncFactory.cs" />
|
<Compile Include="Services\ResultViewers\ResultFuncFactory.cs" />
|
||||||
@@ -119,6 +122,9 @@
|
|||||||
<Compile Include="Windows\CalculationWindows\CalculationPropertyWindow\CalculationPropertyView.xaml.cs">
|
<Compile Include="Windows\CalculationWindows\CalculationPropertyWindow\CalculationPropertyView.xaml.cs">
|
||||||
<DependentUpon>CalculationPropertyView.xaml</DependentUpon>
|
<DependentUpon>CalculationPropertyView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\CalculationWindows\CalculationResultWindow\CalculationResultView.xaml.cs">
|
||||||
|
<DependentUpon>CalculationResultView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\ColorPickerWindow\ColorPickerView.xaml.cs">
|
<Compile Include="Windows\ColorPickerWindow\ColorPickerView.xaml.cs">
|
||||||
<DependentUpon>ColorPickerView.xaml</DependentUpon>
|
<DependentUpon>ColorPickerView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -147,6 +153,7 @@
|
|||||||
<DependentUpon>RectangleTemplate.xaml</DependentUpon>
|
<DependentUpon>RectangleTemplate.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
<Compile Include="Windows\ViewModels\Calculations\CalculationProperies\CalculationPropertyViewModel.cs" />
|
||||||
|
<Compile Include="Windows\ViewModels\Calculations\CalculationResult\CalculationResultViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Infrastructure\UI\Triggers\MouseEventTriggers\DoubleClickEventTrigger.cs" />
|
<Compile Include="Infrastructure\UI\Triggers\MouseEventTriggers\DoubleClickEventTrigger.cs" />
|
||||||
@@ -180,6 +187,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\CalculationWindows\CalculationResultWindow\CalculationResultView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\ColorPickerWindow\ColorPickerView.xaml">
|
<Page Include="Windows\ColorPickerWindow\ColorPickerView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ namespace StructureHelperTests.FieldsVisualizerTests.ColorOperationTests
|
|||||||
|
|
||||||
[TestCase(0, 100, -10, 255, 128, 128, 128)] //Gray as less than minimum
|
[TestCase(0, 100, -10, 255, 128, 128, 128)] //Gray as less than minimum
|
||||||
[TestCase(0, 100, 0, 255, 255, 128, 128)]
|
[TestCase(0, 100, 0, 255, 255, 128, 128)]
|
||||||
[TestCase(0, 100, 50, 255, 255, 255, 0)]
|
[TestCase(0, 100, 50, 255, 255, 254, 0)] //!!!!!!254 cause broading range in method!
|
||||||
[TestCase(0, 100, 100, 255, 0, 0, 255)]//Blue
|
[TestCase(0, 100, 100, 255, 0, 0, 254)]//Blue
|
||||||
[TestCase(0, 100, 110, 255,128, 128, 128)] //Gray as greater than maximum
|
[TestCase(0, 100, 110, 255,128, 128, 128)] //Gray as greater than maximum
|
||||||
[TestCase(-100, 100, 110, 255, 128, 128, 128)] //Gray as greater than maximum
|
[TestCase(-100, 100, 110, 255, 128, 128, 128)] //Gray as greater than maximum
|
||||||
[TestCase(-100, 100, 100, 255, 0, 0, 255)]//Blue
|
[TestCase(-100, 100, 100, 255, 0, 0, 254)]//Blue
|
||||||
[TestCase(100, 100, -100, 255, 255, 128, 128)]
|
[TestCase(100, 100, -100, 255, 255, 128, 128)]
|
||||||
public void Run_ShouldPass(double bottomVal, double topVal, double val, int expectedA, int expectedR, int expectedG, int expectedB)
|
public void Run_ShouldPass(double bottomVal, double topVal, double val, int expectedA, int expectedR, int expectedG, int expectedB)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using FieldVisualizer.Entities.ColorMaps;
|
||||||
|
using FieldVisualizer.Entities.ColorMaps.Factories;
|
||||||
|
using FieldVisualizer.Entities.Values;
|
||||||
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
|
using FieldVisualizer.InfraStructures.Enums;
|
||||||
|
using FieldVisualizer.Services.ColorServices;
|
||||||
|
using FieldVisualizer.Services.PrimitiveServices;
|
||||||
|
using FieldVisualizer.Windows;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.FieldsVisualizerTests.WindowTests
|
||||||
|
{
|
||||||
|
public class ViewerTest
|
||||||
|
{
|
||||||
|
private IEnumerable<IPrimitiveSet> primitiveSets;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
primitiveSets = TestPrimitivesOperation.AddTestPrimitives();
|
||||||
|
}
|
||||||
|
public void Run_ShouldPass()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
//Act
|
||||||
|
WndFieldViewer viewer = new WndFieldViewer(primitiveSets);
|
||||||
|
//Assert
|
||||||
|
Assert.NotNull(viewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FieldsVisualizerTests\ColorOperationTests\GetColorByValueTest.cs" />
|
<Compile Include="FieldsVisualizerTests\ColorOperationTests\GetColorByValueTest.cs" />
|
||||||
|
<Compile Include="FieldsVisualizerTests\WindowTests\ViewerTest.cs" />
|
||||||
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionFromNdmPrimitiveTest.cs" />
|
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionFromNdmPrimitiveTest.cs" />
|
||||||
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionTest.cs" />
|
<Compile Include="FunctionalTests\Ndms\RCSections\RCSectionTest.cs" />
|
||||||
<Compile Include="FunctionalTests\Ndms\SteelSections\ReinforcementTest.cs" />
|
<Compile Include="FunctionalTests\Ndms\SteelSections\ReinforcementTest.cs" />
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
<Compile Include="LibrariesTests\Ndms\RCSections\RCSectionTest.cs" />
|
<Compile Include="LibrariesTests\Ndms\RCSections\RCSectionTest.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UnitTests\Ndms\Triangulations\RectangleTriangulationTest.cs" />
|
<Compile Include="UnitTests\Ndms\Triangulations\RectangleTriangulationTest.cs" />
|
||||||
|
<Compile Include="UnitTests\WindowTests\Calculations\CalculationProperties\CalculationPropertyWindowTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
@@ -67,6 +69,7 @@
|
|||||||
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
@@ -85,6 +88,10 @@
|
|||||||
<Project>{87064b50-3b7c-4a91-af4a-941c6f95d997}</Project>
|
<Project>{87064b50-3b7c-4a91-af4a-941c6f95d997}</Project>
|
||||||
<Name>FieldVisualizer</Name>
|
<Name>FieldVisualizer</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\StructureHelper.csproj">
|
||||||
|
<Project>{BAD27E27-4444-4300-ADF8-E21042C0781D}</Project>
|
||||||
|
<Name>StructureHelper</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj">
|
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj">
|
||||||
<Project>{5DFEC3FD-9677-47BB-9E88-EB71828B5913}</Project>
|
<Project>{5DFEC3FD-9677-47BB-9E88-EB71828B5913}</Project>
|
||||||
<Name>StructureHelperCommon</Name>
|
<Name>StructureHelperCommon</Name>
|
||||||
@@ -94,9 +101,7 @@
|
|||||||
<Name>StructureHelperLogics</Name>
|
<Name>StructureHelperLogics</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="FieldsVisualizerTests\WindowTests\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||||
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
||||||
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||||
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.UnitTests.WindowTests.Calculations.CalculationProperties
|
||||||
|
{
|
||||||
|
public class CalculationPropertyWindowTest
|
||||||
|
{
|
||||||
|
private CalculationPropertyViewModel viewModel;
|
||||||
|
private ICalculationProperty calculationProperty;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
calculationProperty = new CalculationProperty();
|
||||||
|
viewModel = new CalculationPropertyViewModel(calculationProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run_Shoulpass()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var wnd = new CalculationPropertyView(viewModel);
|
||||||
|
//Assert
|
||||||
|
Assert.NotNull(wnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<Button Content="Add" Command="{Binding Path=AddForceCombinationCommand}"/>
|
<Button Margin="3" Content="Add" Command="{Binding Path=AddForceCombinationCommand}"/>
|
||||||
<Button Content="Remove" Command="{Binding Path=RemoveForceCombinationCommand}"/>
|
<Button Margin="3" Content="Remove" Command="{Binding Path=RemoveForceCombinationCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculationResultWindow.CalculationResultView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculationResultWindow"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.CalculationResult"
|
||||||
|
d:DataContext="{d:DesignInstance vm:CalculationResultViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Results of calculations" Height="400" Width="800" MinHeight="400" MinWidth="600">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding CalculationResults}" SelectedItem="{Binding SelectedResult}" >
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||||
|
<Setter Property="Background" Value="Pink"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||||
|
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Mx}"/>
|
||||||
|
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.My}"/>
|
||||||
|
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding Path=LoaderResults.ForceStrainPair.ForceMatrix.Nz}"/>
|
||||||
|
<DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding Path=LoaderResults.AccuracyRate}"/>
|
||||||
|
<DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding Path=LoaderResults.IterationCounter}"/>
|
||||||
|
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Path=Desctription}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<Button Margin="3" Content="Graphic" Command="{Binding ShowIsoFieldCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.CalculationWindows.CalculationResultWindow
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для CalculationResultView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class CalculationResultView : Window
|
||||||
|
{
|
||||||
|
private CalculationResultViewModel viewModel;
|
||||||
|
public CalculationResultView(CalculationResultViewModel resultViewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
viewModel = resultViewModel;
|
||||||
|
this.DataContext = viewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="20"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
@@ -33,11 +33,17 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Menu x:Name="menu">
|
<Menu x:Name="menu">
|
||||||
<MenuItem Header="File">
|
<MenuItem Header="File">
|
||||||
|
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Edit">
|
<MenuItem Header="Edit">
|
||||||
|
<MenuItem Header="Primitives">
|
||||||
|
<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>
|
||||||
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
<Button Content="Calculation properties" Command="{Binding Path=EditCalculationPropertyCommand}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem Header="Analisys">
|
||||||
|
<Button Content="Solve problem" Command="{Binding Path=Calculate}"/>
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5" Grid.Row="1">
|
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5" Grid.ColumnSpan="5" Grid.Row="1">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
@@ -97,16 +103,15 @@
|
|||||||
</Canvas>
|
</Canvas>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
<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="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
||||||
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Система едениц" Command="{Binding OpenUnitsSystemSettings}"/>
|
<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="Система едениц" Command="{Binding OpenUnitsSystemSettings}"/>
|
||||||
<Label VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="{Binding UnitsSystemName}"/>
|
<Label VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Content="{Binding UnitsSystemName}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
<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="Добавить тестовые примитивы" Command="{Binding AddTestCase}"/>
|
<Button VerticalAlignment="Center" Margin="5" Content="Добавить тестовые примитивы" Command="{Binding AddTestCase}"/>
|
||||||
<Button VerticalAlignment="Center" Margin="5" Content="Добавить прямоугольник" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
<Button VerticalAlignment="Center" Margin="5" Content="Добавить прямоугольник" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||||
<Button VerticalAlignment="Center" Margin="5" Content="Добавить точку" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
<Button VerticalAlignment="Center" Margin="5" Content="Добавить точку" Command="{Binding AddPrimitive}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Content="Рассчитать" Command="{Binding Calculate}"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
|||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
||||||
using StructureHelperLogics.Services;
|
using StructureHelperLogics.Services;
|
||||||
|
using StructureHelper.Windows.CalculationWindows.CalculationResultWindow;
|
||||||
|
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
||||||
|
|
||||||
namespace StructureHelper.Windows.MainWindow
|
namespace StructureHelper.Windows.MainWindow
|
||||||
{
|
{
|
||||||
@@ -274,11 +276,8 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
IEnumerable<INdm> ndms = Model.GetNdms();
|
IEnumerable<INdm> ndms = Model.GetNdms();
|
||||||
CalculationService calculationService = new CalculationService();
|
CalculationService calculationService = new CalculationService();
|
||||||
var loaderResults = calculationService.GetCalculationResults(calculationProperty, ndms);
|
var loaderResults = calculationService.GetCalculationResults(calculationProperty, ndms);
|
||||||
if (loaderResults[0].IsValid)
|
var wnd = new CalculationResultView(new CalculationResultViewModel(loaderResults, ndms));
|
||||||
{
|
wnd.ShowDialog();
|
||||||
IStrainMatrix strainMatrix = loaderResults[0].LoaderResults.ForceStrainPair.StrainMatrix;
|
|
||||||
ShowIsoFieldResult.ShowResult(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
|
private IEnumerable<PrimitiveBase> GetTestCasePrimitives()
|
||||||
@@ -308,6 +307,14 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
calculationProperty.ForceCombinations[0].ForceMatrix.Mx = 40e3d;
|
calculationProperty.ForceCombinations[0].ForceMatrix.Mx = 40e3d;
|
||||||
calculationProperty.ForceCombinations[0].ForceMatrix.My = 20e3d;
|
calculationProperty.ForceCombinations[0].ForceMatrix.My = 20e3d;
|
||||||
calculationProperty.ForceCombinations[0].ForceMatrix.Nz = 0d;
|
calculationProperty.ForceCombinations[0].ForceMatrix.Nz = 0d;
|
||||||
|
calculationProperty.ForceCombinations.Add(new ForceCombination());
|
||||||
|
calculationProperty.ForceCombinations[1].ForceMatrix.Mx = 200e3d;
|
||||||
|
calculationProperty.ForceCombinations[1].ForceMatrix.My = 0d;
|
||||||
|
calculationProperty.ForceCombinations[1].ForceMatrix.Nz = 0d;
|
||||||
|
calculationProperty.ForceCombinations.Add(new ForceCombination());
|
||||||
|
calculationProperty.ForceCombinations[2].ForceMatrix.Mx = 50e3d;
|
||||||
|
calculationProperty.ForceCombinations[2].ForceMatrix.My = 50e3d;
|
||||||
|
calculationProperty.ForceCombinations[2].ForceMatrix.Nz = 0d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,10 +86,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationProperies
|
|||||||
public ICommand AddForceCombinationCommand { get; private set; }
|
public ICommand AddForceCombinationCommand { get; private set; }
|
||||||
public ICommand RemoveForceCombinationCommand { get; private set; }
|
public ICommand RemoveForceCombinationCommand { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private readonly ICalculationProperty calculationProperty;
|
private readonly ICalculationProperty calculationProperty;
|
||||||
|
|
||||||
public CalculationPropertyViewModel(ICalculationProperty calculationProperty)
|
public CalculationPropertyViewModel(ICalculationProperty calculationProperty)
|
||||||
{
|
{
|
||||||
this.calculationProperty = calculationProperty;
|
this.calculationProperty = calculationProperty;
|
||||||
@@ -102,8 +99,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.CalculationProperies
|
|||||||
RemoveForceCombinationCommand = new RelayCommand(o => RemoveForceCombination(), o => SelectedCombination != null);
|
RemoveForceCombinationCommand = new RelayCommand(o => RemoveForceCombination(), o => SelectedCombination != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SaveProperties()
|
public void SaveProperties()
|
||||||
{
|
{
|
||||||
calculationProperty.ForceCombinations.Clear();
|
calculationProperty.ForceCombinations.Clear();
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelper.Infrastructure;
|
||||||
|
using StructureHelper.Services.Reports;
|
||||||
|
using StructureHelper.Services.Reports.CalculationReports;
|
||||||
|
using StructureHelper.Services.ResultViewers;
|
||||||
|
using StructureHelperLogics.Models.Calculations.CalculationsResults;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Calculations.CalculationResult
|
||||||
|
{
|
||||||
|
public class CalculationResultViewModel
|
||||||
|
{
|
||||||
|
public ICalculationResult SelectedResult { get; set; }
|
||||||
|
public ICommand ShowIsoFieldCommand { get; set; }
|
||||||
|
private ObservableCollection<ICalculationResult> calculationResults;
|
||||||
|
private IEnumerable<INdm> ndms;
|
||||||
|
private IReport isoFieldReport;
|
||||||
|
|
||||||
|
|
||||||
|
public CalculationResultViewModel(IEnumerable<ICalculationResult> results, IEnumerable<INdm> ndmCollection)
|
||||||
|
{
|
||||||
|
ShowIsoFieldCommand = new RelayCommand(o=>ShowIsoField(), o=> !(SelectedResult is null) && SelectedResult.IsValid);
|
||||||
|
//
|
||||||
|
calculationResults = new ObservableCollection<ICalculationResult>();
|
||||||
|
ndms = ndmCollection;
|
||||||
|
foreach (var result in results)
|
||||||
|
{
|
||||||
|
calculationResults.Add(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<ICalculationResult> CalculationResults
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return calculationResults;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowIsoField()
|
||||||
|
{
|
||||||
|
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
|
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
|
||||||
|
isoFieldReport = new IsoFieldReport(primitiveSets);
|
||||||
|
isoFieldReport.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user