Merge pull request #4 from RedikultsevEvg/IsoFields(.NET6)
Iso fields(.net6)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
*\bin
|
||||
*\packages
|
||||
*\.vs
|
||||
**\publish
|
||||
|
||||
14
App.config
14
App.config
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
12
App.xaml
12
App.xaml
@@ -1,12 +0,0 @@
|
||||
<Application x:Class="StructureHelper.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:StructureHelper">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
13
FieldVisualizer/Entities/ColorMaps/ColorMap.cs
Normal file
13
FieldVisualizer/Entities/ColorMaps/ColorMap.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.Entities.ColorMaps
|
||||
{
|
||||
public class ColorMap : IColorMap
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<Color> Colors { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using FieldVisualizer.InfraStructures.Enums;
|
||||
using FieldVisualizer.InfraStructures.Exceptions;
|
||||
using FieldVisualizer.InfraStructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FieldVisualizer.Entities.ColorMaps.Factories
|
||||
{
|
||||
/// <summary>
|
||||
/// Factory for creating of different color maps
|
||||
/// </summary>
|
||||
public static class ColorMapFactory
|
||||
{
|
||||
public static IColorMap GetColorMap(ColorMapsTypes mapsTypes)
|
||||
{
|
||||
if (mapsTypes == ColorMapsTypes.FullSpectrum) { return GetFullSpectrum(); }
|
||||
if (mapsTypes == ColorMapsTypes.RedToWhite) { return GetRedToWhite(); }
|
||||
if (mapsTypes == ColorMapsTypes.RedToBlue) { return GetRedToBlue(); }
|
||||
if (mapsTypes == ColorMapsTypes.BlueToWhite) { return GetBlueToWhite(); }
|
||||
else { throw new FieldVisulizerException(ErrorStrings.ColorMapTypeIsUnknown); }
|
||||
}
|
||||
|
||||
private static IColorMap GetFullSpectrum()
|
||||
{
|
||||
ColorMap colorMap = new ColorMap();
|
||||
colorMap.Name = "FullSpectrumColorMap";
|
||||
List<Color> colors = new List<Color>();
|
||||
byte Alpha = 0xff;
|
||||
colors.AddRange(new Color[]{
|
||||
Color.FromArgb(Alpha, 0xFF, 0x80, 0x80) ,//
|
||||
Color.FromArgb(Alpha, 0xFF, 0, 0x80) ,//
|
||||
Color.FromArgb(Alpha, 0xFF, 0, 0) ,//Red
|
||||
Color.FromArgb(Alpha, 0xFF, 0x45, 0) ,//Orange Red
|
||||
Color.FromArgb(Alpha, 0xFF, 0xD7, 0) ,//Gold
|
||||
Color.FromArgb(Alpha, 0xFF, 0xFF, 0) ,//Yellow
|
||||
Color.FromArgb(Alpha, 0x9A, 0xCD, 0x32) ,//Yellow Green
|
||||
Color.FromArgb(Alpha, 0, 0x80, 0) ,//Green
|
||||
Color.FromArgb(Alpha, 0, 0x64, 0) ,//Dark Green
|
||||
Color.FromArgb(Alpha, 0x2F, 0x4F, 0x4F) ,//Dark Slate Gray
|
||||
Color.FromArgb(Alpha, 0, 0, 0xFF) ,//Blue
|
||||
});
|
||||
colorMap.Colors = colors;
|
||||
return colorMap;
|
||||
}
|
||||
|
||||
private static IColorMap GetRedToWhite()
|
||||
{
|
||||
ColorMap colorMap = new ColorMap();
|
||||
colorMap.Name = "FullSpectrumColorMap";
|
||||
List<Color> colors = new List<Color>();
|
||||
byte Alpha = 0xff;
|
||||
colors.AddRange(new Color[]{
|
||||
Color.FromArgb(Alpha, 0xFF, 0, 0) ,//Red
|
||||
Color.FromArgb(Alpha, 0xFF, 0xFF, 0xFF) ,//White
|
||||
});
|
||||
colorMap.Colors = colors;
|
||||
return colorMap;
|
||||
}
|
||||
|
||||
private static IColorMap GetRedToBlue()
|
||||
{
|
||||
ColorMap colorMap = new ColorMap();
|
||||
colorMap.Name = "FullSpectrumColorMap";
|
||||
List<Color> colors = new List<Color>();
|
||||
byte Alpha = 0xff;
|
||||
colors.AddRange(new Color[]{
|
||||
Color.FromArgb(Alpha, 0xFF, 0, 0) ,//Red
|
||||
Color.FromArgb(Alpha, 0, 0, 0xFF) ,//Blue
|
||||
});
|
||||
colorMap.Colors = colors;
|
||||
return colorMap;
|
||||
}
|
||||
|
||||
private static IColorMap GetBlueToWhite()
|
||||
{
|
||||
ColorMap colorMap = new ColorMap();
|
||||
colorMap.Name = "FullSpectrumColorMap";
|
||||
List<Color> colors = new List<Color>();
|
||||
byte Alpha = 0xff;
|
||||
colors.AddRange(new Color[]{
|
||||
Color.FromArgb(Alpha, 0, 0, 0xFF) ,//Blue
|
||||
Color.FromArgb(Alpha, 0xFF, 0xFF, 0xFF) ,//White
|
||||
});
|
||||
colorMap.Colors = colors;
|
||||
return colorMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
FieldVisualizer/Entities/ColorMaps/IColorMap.cs
Normal file
13
FieldVisualizer/Entities/ColorMaps/IColorMap.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.Entities.ColorMaps
|
||||
{
|
||||
public interface IColorMap
|
||||
{
|
||||
string Name { get;}
|
||||
List<Color> Colors { get; }
|
||||
}
|
||||
}
|
||||
19
FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs
Normal file
19
FieldVisualizer/Entities/ColorMaps/IValueColorRange.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FieldVisualizer.Entities.ColorMaps
|
||||
{
|
||||
public interface IValueColorRange
|
||||
{
|
||||
bool IsActive { get; set; }
|
||||
double BottomValue { get; set; }
|
||||
double AverageValue { get; set; }
|
||||
double TopValue {get;set;}
|
||||
Color BottomColor { get; set; }
|
||||
Color TopColor { get; set; }
|
||||
}
|
||||
}
|
||||
19
FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs
Normal file
19
FieldVisualizer/Entities/ColorMaps/ValueColorRange.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FieldVisualizer.Entities.ColorMaps
|
||||
{
|
||||
public class ValueColorRange : IValueColorRange
|
||||
{
|
||||
public bool IsActive { get; set; }
|
||||
public double BottomValue { get; set; }
|
||||
public double AverageValue { get; set; }
|
||||
public double TopValue { get; set; }
|
||||
public Color BottomColor { get; set; }
|
||||
public Color TopColor { get; set; }
|
||||
}
|
||||
}
|
||||
12
FieldVisualizer/Entities/Values/IValueRange.cs
Normal file
12
FieldVisualizer/Entities/Values/IValueRange.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values
|
||||
{
|
||||
public interface IValueRange
|
||||
{
|
||||
double TopValue { get; set; }
|
||||
double BottomValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public class CirclePrimitive : ICirclePrimitive
|
||||
{
|
||||
public double Diameter { get; set; }
|
||||
public double Value { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public double Area => Math.PI * Math.Pow(Diameter, 2) / 4;
|
||||
}
|
||||
}
|
||||
14
FieldVisualizer/Entities/Values/Primitives/ICenter.cs
Normal file
14
FieldVisualizer/Entities/Values/Primitives/ICenter.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public interface ICenter
|
||||
{
|
||||
double CenterX { get;}
|
||||
double CenterY { get;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
/// Represent circle primitive
|
||||
/// </summary>
|
||||
public interface ICirclePrimitive : IValuePrimitive
|
||||
{
|
||||
double Diameter { get; set; }
|
||||
}
|
||||
}
|
||||
15
FieldVisualizer/Entities/Values/Primitives/IPrimitiveSet.cs
Normal file
15
FieldVisualizer/Entities/Values/Primitives/IPrimitiveSet.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public interface IPrimitiveSet
|
||||
{
|
||||
string Name { get; }
|
||||
IEnumerable<IValuePrimitive> ValuePrimitives { get; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
internal interface IRectanglePrimitive : IValuePrimitive
|
||||
{
|
||||
double Height { get; set; }
|
||||
double Width { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public interface IValuePrimitive
|
||||
{
|
||||
double Value { get; }
|
||||
double CenterX { get; }
|
||||
double CenterY { get; }
|
||||
double Area { get; }
|
||||
}
|
||||
}
|
||||
20
FieldVisualizer/Entities/Values/Primitives/PrimitiveSet.cs
Normal file
20
FieldVisualizer/Entities/Values/Primitives/PrimitiveSet.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public class PrimitiveSet : IPrimitiveSet
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public IEnumerable<IValuePrimitive> ValuePrimitives { get; set;}
|
||||
|
||||
public PrimitiveSet()
|
||||
{
|
||||
Name = "New set of primitives";
|
||||
ValuePrimitives = new List<IValuePrimitive>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
public double Height { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Value { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public double Area => Height * Width;
|
||||
}
|
||||
}
|
||||
12
FieldVisualizer/Entities/Values/ValueRange.cs
Normal file
12
FieldVisualizer/Entities/Values/ValueRange.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.Entities.Values
|
||||
{
|
||||
public class ValueRange : IValueRange
|
||||
{
|
||||
public double TopValue { get; set; }
|
||||
public double BottomValue { get; set; }
|
||||
}
|
||||
}
|
||||
11
FieldVisualizer/FieldVisualizer.csproj
Normal file
11
FieldVisualizer/FieldVisualizer.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
4
FieldVisualizer/FieldVisualizer.csproj.user
Normal file
4
FieldVisualizer/FieldVisualizer.csproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
27
FieldVisualizer/InfraStructures/Comands/RelayCommand.cs
Normal file
27
FieldVisualizer/InfraStructures/Comands/RelayCommand.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace FieldVisualizer.Infrastructure.Commands
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private Action<object> execute;
|
||||
private Func<object, bool> canExecute;
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add => CommandManager.RequerySuggested += value;
|
||||
remove => CommandManager.RequerySuggested -= value;
|
||||
}
|
||||
|
||||
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||
{
|
||||
this.execute = execute;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter) => canExecute == null || canExecute(parameter);
|
||||
|
||||
public void Execute(object parameter) => execute(parameter);
|
||||
}
|
||||
}
|
||||
14
FieldVisualizer/InfraStructures/Enums/ColorMapsTypes.cs
Normal file
14
FieldVisualizer/InfraStructures/Enums/ColorMapsTypes.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.InfraStructures.Enums
|
||||
{
|
||||
public enum ColorMapsTypes
|
||||
{
|
||||
FullSpectrum = 0,
|
||||
RedToWhite = 1,
|
||||
RedToBlue = 2,
|
||||
BlueToWhite = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.InfraStructures.Exceptions
|
||||
{
|
||||
public class FieldVisulizerException : Exception
|
||||
{
|
||||
public FieldVisulizerException(string errorString) : base(errorString)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
12
FieldVisualizer/InfraStructures/Strings/ErrorStrings.cs
Normal file
12
FieldVisualizer/InfraStructures/Strings/ErrorStrings.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FieldVisualizer.InfraStructures.Strings
|
||||
{
|
||||
public static class ErrorStrings
|
||||
{
|
||||
public static string ColorMapTypeIsUnknown => "#0001: ColorMap type is unknown";
|
||||
public static string PrimitiveTypeIsUnknown => "#0002: Type of primitive is unknown";
|
||||
}
|
||||
}
|
||||
63
FieldVisualizer/Services/ColorServices/ColorOperations.cs
Normal file
63
FieldVisualizer/Services/ColorServices/ColorOperations.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using FieldVisualizer.Entities.ColorMaps;
|
||||
using FieldVisualizer.Entities.Values;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FieldVisualizer.Services.ColorServices
|
||||
{
|
||||
public static class ColorOperations
|
||||
{
|
||||
const byte Alpha = 0xff;
|
||||
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 maxVal = range.TopValue + 1e-15d * (Math.Abs(range.TopValue));
|
||||
if (val > maxVal || val < minVal) { return Colors.Gray; }
|
||||
if (val == minVal) { return map.Colors[0]; }
|
||||
if (val == maxVal) { return map.Colors[map.Colors.Count - 1]; }
|
||||
|
||||
double valPerc = (val - minVal) / (maxVal - minVal);// value%
|
||||
if (valPerc >= 1d)
|
||||
{ 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 blockOfColor = valPerc / colorPerc;// the integer part repersents how many block to skip
|
||||
int blockIdx = (int)Math.Truncate(blockOfColor);// Idx of
|
||||
double valPercResidual = valPerc - (blockIdx * colorPerc);//remove the part represented of block
|
||||
double percOfColor = valPercResidual / colorPerc;// % of color of this block that will be filled
|
||||
|
||||
Color cTarget = map.Colors[blockIdx];
|
||||
Color cNext = map.Colors[blockIdx + 1];
|
||||
|
||||
var deltaR = cNext.R - cTarget.R;
|
||||
var deltaG = cNext.G - cTarget.G;
|
||||
var deltaB = cNext.B - cTarget.B;
|
||||
|
||||
var R = cTarget.R + (deltaR * percOfColor);
|
||||
var G = cTarget.G + (deltaG * percOfColor);
|
||||
var B = cTarget.B + (deltaB * percOfColor);
|
||||
|
||||
Color c = map.Colors[0];
|
||||
c = Color.FromArgb(Alpha, (byte)R, (byte)G, (byte)B);
|
||||
return c;
|
||||
}
|
||||
public static IEnumerable<IValueColorRange> GetValueColorRanges(IValueRange fullRange, IEnumerable<IValueRange> valueRanges, IColorMap colorMap)
|
||||
{
|
||||
var colorRanges = new List<IValueColorRange>();
|
||||
foreach (var valueRange in valueRanges)
|
||||
{
|
||||
IValueColorRange valueColorRange = new ValueColorRange();
|
||||
valueColorRange.IsActive = true;
|
||||
valueColorRange.BottomValue = valueRange.BottomValue;
|
||||
valueColorRange.AverageValue = (valueRange.BottomValue + valueRange.TopValue) / 2;
|
||||
valueColorRange.TopValue = valueRange.TopValue;
|
||||
valueColorRange.BottomColor = GetColorByValue(fullRange, colorMap, valueColorRange.BottomValue);
|
||||
valueColorRange.TopColor = GetColorByValue(fullRange, colorMap, valueColorRange.TopValue);
|
||||
colorRanges.Add(valueColorRange);
|
||||
}
|
||||
return colorRanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using FieldVisualizer.Entities.Values;
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.InfraStructures.Exceptions;
|
||||
using FieldVisualizer.InfraStructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace FieldVisualizer.Services.PrimitiveServices
|
||||
{
|
||||
public static class PrimitiveOperations
|
||||
{
|
||||
public static IValueRange GetValueRange(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
double minVal =0d, maxVal = 0d;
|
||||
foreach (var primitive in valuePrimitives)
|
||||
{
|
||||
minVal = Math.Min(minVal, primitive.Value);
|
||||
maxVal = Math.Max(maxVal, primitive.Value);
|
||||
}
|
||||
return new ValueRange() { BottomValue = minVal, TopValue = maxVal };
|
||||
}
|
||||
|
||||
public static double[] GetMinMaxX(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
List<double> coords = GetXs(valuePrimitives);
|
||||
return new double[] { coords.Min(), coords.Max() };
|
||||
}
|
||||
|
||||
public static double GetSizeX(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
double[] coords = GetMinMaxX(valuePrimitives);
|
||||
return coords[1] - coords[0];
|
||||
}
|
||||
|
||||
public static double[] GetMinMaxY(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
List<double> coords = GetYs(valuePrimitives);
|
||||
return new double[] { coords.Min(), coords.Max() };
|
||||
}
|
||||
|
||||
public static double GetSizeY(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
double[] coords = GetMinMaxY(valuePrimitives);
|
||||
return coords[1] - coords[0];
|
||||
}
|
||||
|
||||
public static List<double> GetXs(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
List<double> coords = new List<double>();
|
||||
foreach (var primitive in valuePrimitives)
|
||||
{
|
||||
if (primitive is IRectanglePrimitive)
|
||||
{
|
||||
IRectanglePrimitive rectanglePrimitive = primitive as IRectanglePrimitive;
|
||||
coords.Add(rectanglePrimitive.CenterX + rectanglePrimitive.Width / 2);
|
||||
coords.Add(rectanglePrimitive.CenterX - rectanglePrimitive.Width / 2);
|
||||
}
|
||||
else if (primitive is ICirclePrimitive)
|
||||
{
|
||||
ICirclePrimitive circlePrimitive = primitive as ICirclePrimitive;
|
||||
coords.Add(circlePrimitive.CenterX + circlePrimitive.Diameter / 2);
|
||||
coords.Add(circlePrimitive.CenterX - circlePrimitive.Diameter / 2);
|
||||
}
|
||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown);}
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
|
||||
public static List<double> GetYs(IEnumerable<IValuePrimitive> valuePrimitives)
|
||||
{
|
||||
List<double> coords = new List<double>();
|
||||
foreach (var primitive in valuePrimitives)
|
||||
{
|
||||
if (primitive is IRectanglePrimitive)
|
||||
{
|
||||
IRectanglePrimitive rectanglePrimitive = primitive as IRectanglePrimitive;
|
||||
coords.Add(rectanglePrimitive.CenterY + rectanglePrimitive.Height / 2);
|
||||
coords.Add(rectanglePrimitive.CenterY - rectanglePrimitive.Height / 2);
|
||||
}
|
||||
else if (primitive is ICirclePrimitive)
|
||||
{
|
||||
ICirclePrimitive circlePrimitive = primitive as ICirclePrimitive;
|
||||
coords.Add(circlePrimitive.CenterY + circlePrimitive.Diameter / 2);
|
||||
coords.Add(circlePrimitive.CenterY - circlePrimitive.Diameter / 2);
|
||||
}
|
||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
FieldVisualizer/Services/ValueRanges/ValueRangeOperations.cs
Normal file
35
FieldVisualizer/Services/ValueRanges/ValueRangeOperations.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using FieldVisualizer.Entities.Values;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.Services.ValueRanges
|
||||
{
|
||||
public static class ValueRangeOperations
|
||||
{
|
||||
public static IEnumerable<IValueRange> DivideValueRange (IValueRange valueRange, int divisionNumber)
|
||||
{
|
||||
List<IValueRange> valueRanges = new List<IValueRange>();
|
||||
if (valueRange.BottomValue == valueRange.TopValue)
|
||||
{
|
||||
var newRange = new ValueRange() { BottomValue = valueRange.BottomValue, TopValue = valueRange.TopValue };
|
||||
valueRanges.Add(newRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
double dVal = (valueRange.TopValue - valueRange.BottomValue) / divisionNumber;
|
||||
double startBottom = valueRange.BottomValue;
|
||||
for (int i = 0; i < divisionNumber; i++ )
|
||||
{
|
||||
|
||||
double currentBottom = startBottom + i * dVal;
|
||||
var newRange = new ValueRange() { BottomValue = currentBottom, TopValue = currentBottom + dVal };
|
||||
valueRanges.Add(newRange);
|
||||
}
|
||||
}
|
||||
return valueRanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
using FieldVisualizer.Entities.ColorMaps.Factories;
|
||||
using FieldVisualizer.Entities.ColorMaps;
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.Entities.Values;
|
||||
using FieldVisualizer.Infrastructure.Commands;
|
||||
using FieldVisualizer.InfraStructures.Enums;
|
||||
using FieldVisualizer.InfraStructures.Exceptions;
|
||||
using FieldVisualizer.InfraStructures.Strings;
|
||||
using FieldVisualizer.Services.ColorServices;
|
||||
using FieldVisualizer.Services.PrimitiveServices;
|
||||
using FieldVisualizer.Services.ValueRanges;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using FieldVisualizer.Windows.UserControls;
|
||||
using System.ComponentModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
||||
{
|
||||
public class FieldViewerViewModel : ViewModelBase, IDataErrorInfo
|
||||
{
|
||||
public ICommand RebuildCommand { get; }
|
||||
public ICommand ZoomInCommand { get; }
|
||||
public ICommand ZoomOutCommand { get; }
|
||||
public ICommand ChangeColorMapCommand { get; }
|
||||
public ICommand SetUserColorsCommand { get; }
|
||||
public ICommand SetCrossLineCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (setCrossLineCommand == null)
|
||||
{
|
||||
setCrossLineCommand = new RelayCommand(SetCrossLine);
|
||||
}
|
||||
|
||||
return setCrossLineCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public IPrimitiveSet PrimitiveSet
|
||||
{ get
|
||||
{
|
||||
return primitiveSet;
|
||||
}
|
||||
set
|
||||
{
|
||||
primitiveSet = value;
|
||||
OnPropertyChanged(nameof(PrimitiveSet));
|
||||
AreaTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaTotal));
|
||||
AreaNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaNeg));
|
||||
AreaZero = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value == 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaZero));
|
||||
AreaPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Area);
|
||||
OnPropertyChanged(nameof(AreaPos));
|
||||
SumTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumTotal));
|
||||
SumNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumNeg));
|
||||
SumPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Value);
|
||||
OnPropertyChanged(nameof(SumPos));
|
||||
|
||||
}
|
||||
}
|
||||
public IValueRange UserValueRange { get; set; }
|
||||
public bool SetMinValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return setMinValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
setMinValue = value;
|
||||
OnPropertyChanged(nameof(SetMinValue));
|
||||
//OnPropertyChanged(nameof(UserMinValue));
|
||||
}
|
||||
}
|
||||
public bool SetMaxValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return setMaxValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
setMaxValue = value;
|
||||
OnPropertyChanged(nameof(SetMaxValue));
|
||||
//OnPropertyChanged(nameof(UserMaxValue));
|
||||
}
|
||||
}
|
||||
public double UserMinValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return UserValueRange.BottomValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
UserValueRange.BottomValue = value;
|
||||
OnPropertyChanged(nameof(UserMinValue));
|
||||
}
|
||||
}
|
||||
public double UserMaxValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return UserValueRange.TopValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
double tmpVal = UserValueRange.TopValue;
|
||||
try
|
||||
{
|
||||
UserValueRange.TopValue = value;
|
||||
OnPropertyChanged(nameof(UserMaxValue));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserValueRange.TopValue = tmpVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
public double AreaTotal { get; private set; }
|
||||
public double AreaNeg { get; private set; }
|
||||
public double AreaZero { get; private set; }
|
||||
public double AreaPos { get; private set; }
|
||||
public double SumTotal { get; private set;}
|
||||
public double SumNeg { get; private set; }
|
||||
public double SumPos { get; private set; }
|
||||
public Viewbox WorkPlaneBox { get; set; }
|
||||
public VerticalLegend Legend { get; set; }
|
||||
public Canvas WorkPlaneCanvas { get; set; }
|
||||
public double ScrolWidth { get; set; }
|
||||
public double ScrolHeight { get; set; }
|
||||
public double CrossLineX { get => crossLineX; set => SetProperty(ref crossLineX, value); }
|
||||
public double CrossLineY { get => crossLineY; set => SetProperty(ref crossLineY, value); }
|
||||
|
||||
public double SumAboveLine { get => sumAboveLine; set => SetProperty(ref sumAboveLine, value); }
|
||||
public double SumUnderLine { get => sumUnderLine; set => SetProperty(ref sumUnderLine, value); }
|
||||
|
||||
public string Error { get; }
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
string error = String.Empty;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand setCrossLineCommand;
|
||||
private IPrimitiveSet primitiveSet;
|
||||
private double dX, dY;
|
||||
private ColorMapsTypes _ColorMapType;
|
||||
private IColorMap _ColorMap;
|
||||
private IValueRange valueRange;
|
||||
private IEnumerable<IValueRange> _ValueRanges;
|
||||
private IEnumerable<IValueColorRange> _ValueColorRanges;
|
||||
private bool setMinValue;
|
||||
private bool setMaxValue;
|
||||
private double crossLineX;
|
||||
private double crossLineY;
|
||||
private double sumAboveLine;
|
||||
private double sumUnderLine;
|
||||
private Line previosLine;
|
||||
const int RangeNumber = 16;
|
||||
|
||||
public FieldViewerViewModel()
|
||||
{
|
||||
_ColorMapType = ColorMapsTypes.FullSpectrum;
|
||||
RebuildCommand = new RelayCommand(o => ProcessPrimitives(), o => PrimitiveValidation());
|
||||
ZoomInCommand = new RelayCommand(o => Zoom(1.2), o => PrimitiveValidation());
|
||||
ZoomOutCommand = new RelayCommand(o => Zoom(0.8), o => PrimitiveValidation());
|
||||
ChangeColorMapCommand = new RelayCommand(o => ChangeColorMap(), o => PrimitiveValidation());
|
||||
SetUserColorsCommand = new RelayCommand(o => ColorRefresh(), o => (SetMinValue || SetMaxValue));
|
||||
UserValueRange = new ValueRange() { BottomValue = 0, TopValue = 0 };
|
||||
SetMinValue = false;
|
||||
SetMaxValue = false;
|
||||
}
|
||||
public void ColorRefresh()
|
||||
{
|
||||
if (PrimitiveValidation() == false) { return; }
|
||||
_ColorMap = ColorMapFactory.GetColorMap(_ColorMapType);
|
||||
SetColor();
|
||||
if ((PrimitiveSet is null) == false)
|
||||
{
|
||||
ProcessPrimitives();
|
||||
Legend.ValueColorRanges = _ValueColorRanges;
|
||||
Legend.Refresh();
|
||||
}
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
SetMinValue = false;
|
||||
SetMaxValue = false;
|
||||
ColorRefresh();
|
||||
}
|
||||
private void ProcessPrimitives()
|
||||
{
|
||||
WorkPlaneCanvas.Children.Clear();
|
||||
double sizeX = PrimitiveOperations.GetSizeX(PrimitiveSet.ValuePrimitives);
|
||||
double sizeY = PrimitiveOperations.GetSizeY(PrimitiveSet.ValuePrimitives);
|
||||
dX = PrimitiveOperations.GetMinMaxX(PrimitiveSet.ValuePrimitives)[0];
|
||||
dY = PrimitiveOperations.GetMinMaxY(PrimitiveSet.ValuePrimitives)[1];
|
||||
WorkPlaneCanvas.Width = Math.Abs(sizeX);
|
||||
WorkPlaneCanvas.Height = Math.Abs(sizeY);
|
||||
WorkPlaneBox.Width = ScrolWidth - 50;
|
||||
WorkPlaneBox.Height = ScrolHeight - 50;
|
||||
foreach (var primitive in PrimitiveSet.ValuePrimitives)
|
||||
{
|
||||
if (primitive is IRectanglePrimitive)
|
||||
{
|
||||
IRectanglePrimitive rectanglePrimitive = primitive as IRectanglePrimitive;
|
||||
Rectangle rectangle = ProcessRectanglePrimitive(rectanglePrimitive);
|
||||
WorkPlaneCanvas.Children.Add(rectangle);
|
||||
}
|
||||
else if (primitive is ICirclePrimitive)
|
||||
{
|
||||
ICirclePrimitive circlePrimitive = primitive as ICirclePrimitive;
|
||||
Ellipse ellipse = ProcessCirclePrimitive(circlePrimitive);
|
||||
WorkPlaneCanvas.Children.Add(ellipse);
|
||||
}
|
||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
||||
}
|
||||
}
|
||||
private Rectangle ProcessRectanglePrimitive(IRectanglePrimitive rectanglePrimitive)
|
||||
{
|
||||
Rectangle rectangle = new Rectangle
|
||||
{
|
||||
Height = rectanglePrimitive.Height,
|
||||
Width = rectanglePrimitive.Width
|
||||
};
|
||||
double addX = rectanglePrimitive.Width / 2;
|
||||
double addY = rectanglePrimitive.Height / 2;
|
||||
ProcessShape(rectangle, rectanglePrimitive, addX, addY);
|
||||
return rectangle;
|
||||
}
|
||||
private Ellipse ProcessCirclePrimitive(ICirclePrimitive circlePrimitive)
|
||||
{
|
||||
Ellipse ellipse = new Ellipse
|
||||
{
|
||||
Height = circlePrimitive.Diameter,
|
||||
Width = circlePrimitive.Diameter
|
||||
};
|
||||
double addX = circlePrimitive.Diameter / 2;
|
||||
double addY = circlePrimitive.Diameter / 2;
|
||||
|
||||
ProcessShape(ellipse, circlePrimitive, addX, addY);
|
||||
return ellipse;
|
||||
}
|
||||
private void ProcessShape(Shape shape, IValuePrimitive valuePrimitive, double addX, double addY)
|
||||
{
|
||||
SolidColorBrush brush = new SolidColorBrush();
|
||||
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
||||
foreach (var valueRange in _ValueColorRanges)
|
||||
{
|
||||
if (valuePrimitive.Value >= valueRange.BottomValue & valuePrimitive.Value <= valueRange.TopValue & (!valueRange.IsActive))
|
||||
{
|
||||
brush.Color = Colors.Gray;
|
||||
}
|
||||
}
|
||||
shape.ToolTip = valuePrimitive.Value;
|
||||
shape.Tag = valuePrimitive;
|
||||
shape.Fill = brush;
|
||||
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
||||
Canvas.SetTop(shape, -valuePrimitive.CenterY - addY + dY);
|
||||
}
|
||||
private void Zoom(double coefficient)
|
||||
{
|
||||
WorkPlaneBox.Width *= coefficient;
|
||||
WorkPlaneBox.Height *= coefficient;
|
||||
}
|
||||
private void ChangeColorMap()
|
||||
{
|
||||
//Iterate all available color maps one by one
|
||||
try
|
||||
{
|
||||
_ColorMapType++;
|
||||
IColorMap colorMap = ColorMapFactory.GetColorMap(_ColorMapType);
|
||||
}
|
||||
catch (Exception ex) { _ColorMapType = 0; }
|
||||
ColorRefresh();
|
||||
}
|
||||
private bool PrimitiveValidation()
|
||||
{
|
||||
if (PrimitiveSet == null || PrimitiveSet.ValuePrimitives.Count() == 0) { return false; }
|
||||
else return true;
|
||||
}
|
||||
private void SetColor()
|
||||
{
|
||||
valueRange = PrimitiveOperations.GetValueRange(PrimitiveSet.ValuePrimitives);
|
||||
//if bottom value is greater than top value
|
||||
if (SetMinValue
|
||||
& SetMaxValue
|
||||
& (UserValueRange.BottomValue > UserValueRange.TopValue))
|
||||
{
|
||||
UserValueRange.TopValue = UserValueRange.BottomValue;
|
||||
}
|
||||
if (SetMinValue) { valueRange.BottomValue = UserValueRange.BottomValue; } else { UserValueRange.BottomValue = valueRange.BottomValue; }
|
||||
if (SetMaxValue) { valueRange.TopValue = UserValueRange.TopValue; } else { UserValueRange.TopValue = valueRange.TopValue; }
|
||||
_ValueRanges = ValueRangeOperations.DivideValueRange(valueRange, RangeNumber);
|
||||
_ValueColorRanges = ColorOperations.GetValueColorRanges(valueRange, _ValueRanges, _ColorMap);
|
||||
}
|
||||
private void SetCrossLine(object commandParameter)
|
||||
{
|
||||
AddCrossLine();
|
||||
AddSummaryInfoCrossLine();
|
||||
}
|
||||
private void AddCrossLine()
|
||||
{
|
||||
double width = WorkPlaneCanvas.ActualWidth;
|
||||
double heigth = WorkPlaneCanvas.ActualHeight;
|
||||
Line line = new Line();
|
||||
if (crossLineX == 0d)
|
||||
{
|
||||
line.X1 = - width / 2d - dX;
|
||||
line.Y1 = - crossLineY + dY;
|
||||
line.X2 = width / 2d - dX;
|
||||
line.Y2 = - crossLineY + dY;
|
||||
}
|
||||
else if (crossLineY == 0d)
|
||||
{
|
||||
line.X1 = crossLineX - dX;
|
||||
line.Y1 = heigth / 2 + dY;
|
||||
line.X2 = crossLineX - dX;
|
||||
line.Y2 = -heigth / 2 + dY;
|
||||
}
|
||||
else
|
||||
{
|
||||
line.X1 = - width / 2d - dX;
|
||||
line.Y1 = -(crossLineY / crossLineX * width / 2 + crossLineY) - dY;
|
||||
line.X2 = width / 2d - dX;
|
||||
line.Y2 = -(-crossLineY / crossLineX * width / 2 + crossLineY) - dY ;
|
||||
}
|
||||
SolidColorBrush brush = new SolidColorBrush();
|
||||
brush.Color = Colors.Red;
|
||||
line.Fill = brush;
|
||||
line.Stroke = brush;
|
||||
line.StrokeThickness = (width + heigth) / 100;
|
||||
if (previosLine != null)
|
||||
{
|
||||
try { WorkPlaneCanvas.Children.Remove(previosLine);}
|
||||
catch (Exception) {}
|
||||
}
|
||||
previosLine = line;
|
||||
WorkPlaneCanvas.Children.Add(line);
|
||||
}
|
||||
private double GetPointOfCrossLine(double x)
|
||||
{
|
||||
double y;
|
||||
if (crossLineX == 0d)
|
||||
{
|
||||
y = crossLineY;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = -crossLineY / crossLineX - crossLineY;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
private void AddSummaryInfoCrossLine()
|
||||
{
|
||||
SumAboveLine = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x=>x.CenterY >= GetPointOfCrossLine(x.CenterX)).Sum(x => x.Value);
|
||||
SumUnderLine = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.CenterY <= GetPointOfCrossLine(x.CenterX)).Sum(x => x.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
FieldVisualizer/ViewModels/ViewModelBase.cs
Normal file
36
FieldVisualizer/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace FieldVisualizer.ViewModels
|
||||
{
|
||||
public class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged<T>(T value, T prop, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected virtual void OnPropertyChanged<T>(T value, ref T prop, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
prop = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
}
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (!Equals(field, newValue))
|
||||
{
|
||||
field = newValue;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
100
FieldVisualizer/Windows/UserControls/FieldViewer.xaml
Normal file
100
FieldVisualizer/Windows/UserControls/FieldViewer.xaml
Normal file
@@ -0,0 +1,100 @@
|
||||
<UserControl x:Class="FieldVisualizer.Windows.UserControls.FieldViewer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:FieldVisualizer.Windows.UserControls"
|
||||
xmlns:vm="clr-namespace:FieldVisualizer.ViewModels.FieldViewerViewModels"
|
||||
d:DataContext="{d:DesignInstance vm:FieldViewerViewModel}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="220"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button x:Name="RebuildButton" Content="Rebuild" Command="{Binding RebuildCommand}"/>
|
||||
<Button x:Name="ZoomInButton" Content="ZoomIn" Command="{Binding ZoomInCommand}"/>
|
||||
<Button x:Name="ZoomOutButton" Content="ZoomOut" Command="{Binding ZoomOutCommand}"/>
|
||||
<Button x:Name="ChangeColorMapButton" Content="ColorMap" Command="{Binding ChangeColorMapCommand}"/>
|
||||
</StackPanel>
|
||||
<ScrollViewer Name="WorkPlaneViewer" Grid.Row="1" HorizontalScrollBarVisibility="Visible" SizeChanged="WorkPlaneViewer_SizeChanged">
|
||||
<ScrollViewer.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="Black"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="#FF00EDFF" Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
</ScrollViewer.Background>
|
||||
<Viewbox Name="WorkPlaneBox" Margin="10">
|
||||
<Canvas Name="WorkPlaneCanvas">
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Column="2">
|
||||
<StackPanel>
|
||||
<Expander Header="Color legend" IsExpanded="True">
|
||||
<StackPanel>
|
||||
<CheckBox x:Name="cbMinValueEnabled" Margin="3" Content="Minimum Value" IsChecked="{Binding Path=SetMinValue}"/>
|
||||
<TextBox x:Name="tbMinValue" Margin="20,3,3,3" IsEnabled="{Binding IsChecked, ElementName=cbMinValueEnabled}" Text="{Binding Path=UserMinValue, ValidatesOnDataErrors=True}"/>
|
||||
<CheckBox x:Name="cbMaxValueEnabled" Margin="3" Content="Maximum Value" IsChecked="{Binding Path=SetMaxValue}"/>
|
||||
<TextBox x:Name="tbMaxValue" Margin="20,3,3,3" IsEnabled="{Binding IsChecked, ElementName=cbMaxValueEnabled}" Text="{Binding Path=UserMaxValue, ValidatesOnDataErrors=True}"/>
|
||||
<Button Margin="3" Content="Set custom colors" Command="{Binding SetUserColorsCommand}"/>
|
||||
<local:VerticalLegend x:Name="LegendViewer" Margin="3" Grid.Column="2"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Summary information" IsExpanded="False">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Total area:"/>
|
||||
<TextBlock Text="{Binding AreaTotal}"/>
|
||||
<TextBlock Text="Negative value area:"/>
|
||||
<TextBlock Text="{Binding AreaNeg}"/>
|
||||
<TextBlock Text="Zero value area:"/>
|
||||
<TextBlock Text="{Binding AreaZero}"/>
|
||||
<TextBlock Text="Positive value area:"/>
|
||||
<TextBlock Text="{Binding AreaPos}"/>
|
||||
<TextBlock Text="Total sum: "/>
|
||||
<TextBlock Text="{Binding SumTotal}"/>
|
||||
<TextBlock Text="Sum negative: "/>
|
||||
<TextBlock Text="{Binding SumNeg}"/>
|
||||
<TextBlock Text="Sum positive: "/>
|
||||
<TextBlock Text="{Binding SumPos}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Summary section" IsExpanded="False">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="X-distance"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding CrossLineX, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Y-distance"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CrossLineY, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
<Button Content="Set section line" Command="{Binding SetCrossLineCommand}"/>
|
||||
<TextBlock Text="Sum above line: "/>
|
||||
<TextBlock Text="{Binding SumAboveLine}"/>
|
||||
<TextBlock Text="Sum under line: "/>
|
||||
<TextBlock Text="{Binding SumUnderLine}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
67
FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs
Normal file
67
FieldVisualizer/Windows/UserControls/FieldViewer.xaml.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using FieldVisualizer.Entities.ColorMaps;
|
||||
using FieldVisualizer.Entities.ColorMaps.Factories;
|
||||
using FieldVisualizer.Entities.Values;
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.Infrastructure.Commands;
|
||||
using FieldVisualizer.InfraStructures.Enums;
|
||||
using FieldVisualizer.InfraStructures.Exceptions;
|
||||
using FieldVisualizer.InfraStructures.Strings;
|
||||
using FieldVisualizer.Services.ColorServices;
|
||||
using FieldVisualizer.Services.PrimitiveServices;
|
||||
using FieldVisualizer.Services.ValueRanges;
|
||||
using FieldVisualizer.ViewModels.FieldViewerViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace FieldVisualizer.Windows.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для FieldViewer.xaml
|
||||
/// </summary>
|
||||
public partial class FieldViewer : UserControl
|
||||
{
|
||||
private FieldViewerViewModel viewModel;
|
||||
|
||||
public FieldViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
viewModel = new FieldViewerViewModel();
|
||||
this.DataContext = viewModel;
|
||||
PrimitiveSet = viewModel.PrimitiveSet;
|
||||
viewModel.WorkPlaneBox = WorkPlaneBox;
|
||||
viewModel.WorkPlaneCanvas = WorkPlaneCanvas;
|
||||
viewModel.Legend = LegendViewer;
|
||||
}
|
||||
|
||||
//public FieldViewer(FieldViewerViewModel vm)
|
||||
//{
|
||||
// InitializeComponent();
|
||||
// viewModel = vm;
|
||||
// this.DataContext = viewModel;
|
||||
// PrimitiveSet = viewModel.PrimitiveSet;
|
||||
// viewModel.WorkPlaneBox = WorkPlaneBox;
|
||||
// viewModel.WorkPlaneCanvas = WorkPlaneCanvas;
|
||||
// viewModel.Legend = LegendViewer;
|
||||
//}
|
||||
|
||||
public IPrimitiveSet PrimitiveSet { get => viewModel.PrimitiveSet; set { viewModel.PrimitiveSet = value; } }
|
||||
|
||||
internal void Refresh()
|
||||
{
|
||||
viewModel.Refresh();
|
||||
}
|
||||
|
||||
private void WorkPlaneViewer_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
ScrollViewer viewer = (ScrollViewer)sender;
|
||||
viewModel.ScrolWidth = viewer.ActualWidth;
|
||||
viewModel.ScrolHeight = viewer.ActualHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
FieldVisualizer/Windows/UserControls/VerticalLegend.xaml
Normal file
49
FieldVisualizer/Windows/UserControls/VerticalLegend.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<UserControl x:Class="FieldVisualizer.Windows.UserControls.VerticalLegend"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:FieldVisualizer.Windows.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid x:Name="grid">
|
||||
<StackPanel>
|
||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FF868686"></TextBlock>
|
||||
<ListBox Name="LegendBox" ItemsSource="{Binding}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="30" Width="190" VerticalAlignment="Top" Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Name="ActiveCheckBox" Grid.Column="0" IsChecked="{Binding Path=IsActive}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Rectangle Grid.Column="1" Margin="0,2,0,2" ToolTip="{Binding Path=BottomValue}">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Path=BottomColor}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Rectangle Grid.Column="2" Margin="0,2,0,2">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="{Binding Path=BottomColor}"/>
|
||||
<GradientStop Color="{Binding Path=TopColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FF868686" Text="{Binding AverageValue}"/>
|
||||
<Rectangle Grid.Column="3" Margin="0,2,0,2" ToolTip="{Binding Path=TopValue}">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Path=TopColor}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
36
FieldVisualizer/Windows/UserControls/VerticalLegend.xaml.cs
Normal file
36
FieldVisualizer/Windows/UserControls/VerticalLegend.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using FieldVisualizer.Entities.ColorMaps;
|
||||
using FieldVisualizer.Entities.Values;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace FieldVisualizer.Windows.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для VerticalLegend.xaml
|
||||
/// </summary>
|
||||
public partial class VerticalLegend : UserControl
|
||||
{
|
||||
public IEnumerable<IValueColorRange> ValueColorRanges;
|
||||
public VerticalLegend()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
this.DataContext = ValueColorRanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
FieldVisualizer/Windows/VerticalLegendTemplates.xaml
Normal file
4
FieldVisualizer/Windows/VerticalLegendTemplates.xaml
Normal file
@@ -0,0 +1,4 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
</ResourceDictionary>
|
||||
30
FieldVisualizer/Windows/WndFieldViewer.xaml
Normal file
30
FieldVisualizer/Windows/WndFieldViewer.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<Window x:Class="FieldVisualizer.Windows.WndFieldViewer"
|
||||
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:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
|
||||
xmlns:local="clr-namespace:FieldVisualizer.Windows"
|
||||
mc:Ignorable="d"
|
||||
Title="FieldViewer" Height="800" Width="1200" WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Name="SetsList" ItemsSource="{Binding}" SelectionChanged="SetsList_SelectionChanged">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Path=Name}" Width="270"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<FieldViewerControl:FieldViewer x:Name="FieldViewerControl" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
48
FieldVisualizer/Windows/WndFieldViewer.xaml.cs
Normal file
48
FieldVisualizer/Windows/WndFieldViewer.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.Windows.UserControls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
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 FieldVisualizer.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для WndFieldViewer.xaml
|
||||
/// </summary>
|
||||
public partial class WndFieldViewer : Window
|
||||
{
|
||||
public ObservableCollection<IPrimitiveSet> PrimitiveSets { get; private set; }
|
||||
public WndFieldViewer(IEnumerable<IPrimitiveSet> primitiveSets)
|
||||
{
|
||||
InitializeComponent();
|
||||
PrimitiveSets = new ObservableCollection<IPrimitiveSet>();
|
||||
foreach (var primitiveSet in primitiveSets)
|
||||
{
|
||||
PrimitiveSets.Add(primitiveSet);
|
||||
}
|
||||
this.DataContext = PrimitiveSets;
|
||||
|
||||
}
|
||||
|
||||
private void SetsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ListBox lb = sender as ListBox;
|
||||
if (lb.SelectedItem != null)
|
||||
{
|
||||
FieldViewerControl.PrimitiveSet = lb.SelectedItem as IPrimitiveSet;
|
||||
FieldViewerControl.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
FieldVisualizer/WindowsOperation/FieldViewerOperation.cs
Normal file
19
FieldVisualizer/WindowsOperation/FieldViewerOperation.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.Windows;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FieldVisualizer.WindowsOperation
|
||||
{
|
||||
public static class FieldViewerOperation
|
||||
{
|
||||
public static void ShowViewer(IEnumerable<IPrimitiveSet> primitiveSets)
|
||||
{
|
||||
WndFieldViewer Viewer = new WndFieldViewer(primitiveSets);
|
||||
Viewer.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
6
FiledVisualzerDemo/App.config
Normal file
6
FiledVisualzerDemo/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
61
FiledVisualzerDemo/DemoForm.Designer.cs
generated
Normal file
61
FiledVisualzerDemo/DemoForm.Designer.cs
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace FiledVisualzerDemo
|
||||
{
|
||||
partial class DemoForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором форм Windows
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.RectanglesSetDemo = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// RectanglesSetDemo
|
||||
//
|
||||
this.RectanglesSetDemo.Location = new System.Drawing.Point(29, 22);
|
||||
this.RectanglesSetDemo.Name = "RectanglesSetDemo";
|
||||
this.RectanglesSetDemo.Size = new System.Drawing.Size(167, 23);
|
||||
this.RectanglesSetDemo.TabIndex = 0;
|
||||
this.RectanglesSetDemo.Text = "RectanglesSetDemo";
|
||||
this.RectanglesSetDemo.UseVisualStyleBackColor = true;
|
||||
this.RectanglesSetDemo.Click += new System.EventHandler(this.RectanglesSetDemo_Click);
|
||||
//
|
||||
// DemoForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.RectanglesSetDemo);
|
||||
this.Name = "DemoForm";
|
||||
this.Text = "FieldVisualizerDemo";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button RectanglesSetDemo;
|
||||
}
|
||||
}
|
||||
|
||||
29
FiledVisualzerDemo/DemoForm.cs
Normal file
29
FiledVisualzerDemo/DemoForm.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using FieldVisualizer.Entities.Values.Primitives;
|
||||
using FieldVisualizer.Services.PrimitiveServices;
|
||||
using FieldVisualizer.WindowsOperation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FiledVisualzerDemo
|
||||
{
|
||||
public partial class DemoForm : Form
|
||||
{
|
||||
public DemoForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RectanglesSetDemo_Click(object sender, EventArgs e)
|
||||
{
|
||||
var primitiveSets = TestPrimitivesOperation.AddTestPrimitives();
|
||||
FieldViewerOperation.ShowViewer(primitiveSets);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
FiledVisualzerDemo/DemoForm.resx
Normal file
120
FiledVisualzerDemo/DemoForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
28
FiledVisualzerDemo/FieldVisualzerDemo - Backup.csproj
Normal file
28
FiledVisualzerDemo/FieldVisualzerDemo - Backup.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="StructureHelperCommon\**" />
|
||||
<Compile Remove="StructureHelperLogics\**" />
|
||||
<EmbeddedResource Remove="StructureHelperCommon\**" />
|
||||
<EmbeddedResource Remove="StructureHelperLogics\**" />
|
||||
<None Remove="StructureHelperCommon\**" />
|
||||
<None Remove="StructureHelperLogics\**" />
|
||||
<Page Remove="StructureHelperCommon\**" />
|
||||
<Page Remove="StructureHelperLogics\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FieldVisualizer\FieldVisualizer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
28
FiledVisualzerDemo/FieldVisualzerDemo.csproj
Normal file
28
FiledVisualzerDemo/FieldVisualzerDemo.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="StructureHelperCommon\**" />
|
||||
<Compile Remove="StructureHelperLogics\**" />
|
||||
<EmbeddedResource Remove="StructureHelperCommon\**" />
|
||||
<EmbeddedResource Remove="StructureHelperLogics\**" />
|
||||
<None Remove="StructureHelperCommon\**" />
|
||||
<None Remove="StructureHelperLogics\**" />
|
||||
<Page Remove="StructureHelperCommon\**" />
|
||||
<Page Remove="StructureHelperLogics\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FieldVisualizer\FieldVisualizer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
28
FiledVisualzerDemo/FieldVisualzerDemo.csproj.bak
Normal file
28
FiledVisualzerDemo/FieldVisualzerDemo.csproj.bak
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="StructureHelperCommon\**" />
|
||||
<Compile Remove="StructureHelperLogics\**" />
|
||||
<EmbeddedResource Remove="StructureHelperCommon\**" />
|
||||
<EmbeddedResource Remove="StructureHelperLogics\**" />
|
||||
<None Remove="StructureHelperCommon\**" />
|
||||
<None Remove="StructureHelperLogics\**" />
|
||||
<Page Remove="StructureHelperCommon\**" />
|
||||
<Page Remove="StructureHelperLogics\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FieldVisualizer\FieldVisualizer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
9
FiledVisualzerDemo/FieldVisualzerDemo.csproj.user
Normal file
9
FiledVisualzerDemo/FieldVisualzerDemo.csproj.user
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Compile Update="DemoForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
118
FiledVisualzerDemo/FiledVisualzerDemo_old.csproj
Normal file
118
FiledVisualzerDemo/FiledVisualzerDemo_old.csproj
Normal file
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C92A5F2E-567B-48C9-A524-5740DB03509D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>FiledVisualzerDemo</RootNamespace>
|
||||
<AssemblyName>FiledVisualzerDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DemoForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DemoForm.Designer.cs">
|
||||
<DependentUpon>DemoForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="DemoForm.resx">
|
||||
<DependentUpon>DemoForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FieldVisualizer\FieldVisualizer.csproj">
|
||||
<Project>{87064b50-3b7c-4a91-af4a-941c6f95d997}</Project>
|
||||
<Name>FieldVisualizer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.8 %28x86 и x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
22
FiledVisualzerDemo/Program.cs
Normal file
22
FiledVisualzerDemo/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FiledVisualzerDemo
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Главная точка входа для приложения.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DemoForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
FiledVisualzerDemo/Properties/AssemblyInfo.cs
Normal file
36
FiledVisualzerDemo/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанных со сборкой.
|
||||
[assembly: AssemblyTitle("FiledVisualzerDemo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FiledVisualzerDemo")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("c92a5f2e-567b-48c9-a524-5740db03509d")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
FiledVisualzerDemo/Properties/Resources.Designer.cs
generated
Normal file
63
FiledVisualzerDemo/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FiledVisualzerDemo.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FiledVisualzerDemo.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
FiledVisualzerDemo/Properties/Resources.resx
Normal file
117
FiledVisualzerDemo/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
FiledVisualzerDemo/Properties/Settings.Designer.cs
generated
Normal file
26
FiledVisualzerDemo/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FiledVisualzerDemo.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
FiledVisualzerDemo/Properties/Settings.settings
Normal file
7
FiledVisualzerDemo/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class Point : PrimitiveBase
|
||||
{
|
||||
public Point(double d, double x, double y, MainViewModel ownerVm) : base(PrimitiveType.Point, x, y, ownerVm)
|
||||
{
|
||||
PrimitiveWidth = d;
|
||||
PrimitiveHeight = d;
|
||||
PreviewMouseMove = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is Point point)) return;
|
||||
if (point.Captured && !point.ElementLock)
|
||||
{
|
||||
var pointDelta = point.PrimitiveWidth / 2;
|
||||
|
||||
if (point.ShowedX % 10 <= pointDelta || point.ShowedX % 10 >= 10 - pointDelta)
|
||||
point.ShowedX = Math.Round((ownerVm.PanelX - OwnerVm.YX1) / 10) * 10;
|
||||
else
|
||||
point.ShowedX = ownerVm.PanelX - pointDelta - OwnerVm.YX1;
|
||||
|
||||
if (point.ShowedY % 10 <= pointDelta || point.ShowedY % 10 >= 10 - pointDelta)
|
||||
point.ShowedY = -(Math.Round((ownerVm.PanelY - OwnerVm.XY1) / 10) * 10);
|
||||
else
|
||||
point.ShowedY = -(ownerVm.PanelY - pointDelta - OwnerVm.XY1);
|
||||
}
|
||||
});
|
||||
ShowedX = x;
|
||||
ShowedY = y;
|
||||
}
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
||||
{
|
||||
var diam = unitSystem.ConvertLength(PrimitiveWidth);
|
||||
double area = diam * diam * Math.PI / 4;
|
||||
string materialName = MaterialName;
|
||||
ICenter center = new Center { X = unitSystem.ConvertLength(ShowedX), Y = unitSystem.ConvertLength(ShowedY) };
|
||||
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area };
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public abstract class PrimitiveBase : ViewModelBase
|
||||
{
|
||||
#region Поля
|
||||
|
||||
private readonly PrimitiveType type;
|
||||
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
||||
private Brush brush;
|
||||
private MaterialDefinitionBase material;
|
||||
private double opacity = 1, showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight, showedX, showedY;
|
||||
protected double delta = 0.5;
|
||||
private int showedZIndex = 1, zIndex;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Свойства
|
||||
|
||||
public PrimitiveType Type
|
||||
{
|
||||
get => type;
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(value, type);
|
||||
OnPropertyChanged(nameof(RectangleFieldVisibility));
|
||||
OnPropertyChanged(nameof(PrimitiveDimension));
|
||||
OnPropertyChanged(nameof(HeightRowHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Captured
|
||||
{
|
||||
set => OnPropertyChanged(value, ref captured);
|
||||
get => captured;
|
||||
}
|
||||
public bool ParameterCaptured
|
||||
{
|
||||
set => OnPropertyChanged(value, ref parameterCaptured);
|
||||
get => parameterCaptured;
|
||||
}
|
||||
public bool ElementLock
|
||||
{
|
||||
get => elementLock;
|
||||
set => OnPropertyChanged(value, ref elementLock);
|
||||
}
|
||||
public Brush Brush
|
||||
{
|
||||
get => brush;
|
||||
set => OnPropertyChanged(value, ref brush);
|
||||
}
|
||||
public MaterialDefinitionBase Material
|
||||
{
|
||||
get => material;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
MaterialName = value.MaterialClass;
|
||||
OnPropertyChanged(value, ref material);
|
||||
OnPropertyChanged(nameof(MaterialName));
|
||||
}
|
||||
}
|
||||
}
|
||||
private string materialName = string.Empty;
|
||||
public string MaterialName
|
||||
{
|
||||
get => materialName;
|
||||
set => OnPropertyChanged(value, ref materialName);
|
||||
}
|
||||
public bool ParamsPanelVisibilty
|
||||
{
|
||||
get => paramsPanelVisibilty;
|
||||
set => OnPropertyChanged(value, ref paramsPanelVisibilty);
|
||||
}
|
||||
public bool PopupCanBeClosed
|
||||
{
|
||||
get => popupCanBeClosed;
|
||||
set => OnPropertyChanged(value, ref popupCanBeClosed);
|
||||
}
|
||||
public double ShowedOpacity
|
||||
{
|
||||
get => showedOpacity;
|
||||
set
|
||||
{
|
||||
Opacity = (100 - value) / 100;
|
||||
OnPropertyChanged(nameof(Opacity));
|
||||
OnPropertyChanged(value, ref showedOpacity);
|
||||
}
|
||||
}
|
||||
public double Opacity
|
||||
{
|
||||
get => opacity;
|
||||
set => OnPropertyChanged(value, ref opacity);
|
||||
}
|
||||
public int ShowedZIndex
|
||||
{
|
||||
get => showedZIndex;
|
||||
set
|
||||
{
|
||||
ZIndex = value - 1;
|
||||
OnPropertyChanged(nameof(ZIndex));
|
||||
OnPropertyChanged(value, ref showedZIndex);
|
||||
}
|
||||
}
|
||||
public int ZIndex
|
||||
{
|
||||
get => zIndex;
|
||||
set => OnPropertyChanged(value, ref zIndex);
|
||||
}
|
||||
public double X
|
||||
{
|
||||
get => x;
|
||||
set => OnPropertyChanged(value, ref x);
|
||||
}
|
||||
public double Y
|
||||
{
|
||||
get => y;
|
||||
set => OnPropertyChanged(value, ref y);
|
||||
}
|
||||
public double Xy1
|
||||
{
|
||||
get => xY1;
|
||||
set => OnPropertyChanged(value, ref xY1);
|
||||
}
|
||||
public double Yx1
|
||||
{
|
||||
get => yX1;
|
||||
set => OnPropertyChanged(value, ref yX1);
|
||||
}
|
||||
public double PrimitiveWidth
|
||||
{
|
||||
get => primitiveWidth;
|
||||
set => OnPropertyChanged(value, ref primitiveWidth);
|
||||
}
|
||||
public double PrimitiveHeight
|
||||
{
|
||||
get => primitiveHeight;
|
||||
set => OnPropertyChanged(value, ref primitiveHeight);
|
||||
}
|
||||
public double ShowedX
|
||||
{
|
||||
get => showedX;
|
||||
set
|
||||
{
|
||||
UpdateCoordinatesX(value);
|
||||
OnPropertyChanged(value, ref showedX);
|
||||
OnPropertyChanged(nameof(X));
|
||||
}
|
||||
}
|
||||
public double ShowedY
|
||||
{
|
||||
get => showedY;
|
||||
set
|
||||
{
|
||||
UpdateCoordinatesY(value);
|
||||
OnPropertyChanged(value, ref showedY);
|
||||
OnPropertyChanged(nameof(Y));
|
||||
}
|
||||
}
|
||||
public bool BorderCaptured
|
||||
{
|
||||
get => borderCaptured;
|
||||
set => OnPropertyChanged(value, ref borderCaptured);
|
||||
}
|
||||
|
||||
public Visibility RectangleFieldVisibility => Type == PrimitiveType.Rectangle ? Visibility.Visible : Visibility.Hidden;
|
||||
public string PrimitiveDimension => Type == PrimitiveType.Rectangle ? "Ширина" : "Диаметр";
|
||||
public double HeightRowHeight => Type == PrimitiveType.Rectangle ? 40 : 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Команды
|
||||
public ICommand PrimitiveLeftButtonDown { get; }
|
||||
public ICommand PrimitiveLeftButtonUp { get; }
|
||||
public ICommand PreviewMouseMove { get; protected set; }
|
||||
public ICommand PrimitiveDoubleClick { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
protected PrimitiveBase(PrimitiveType type, double x, double y, MainViewModel ownerVM)
|
||||
{
|
||||
this.type = type;
|
||||
X = ownerVM.YX1 + x;
|
||||
Y = ownerVM.XY1 + y;
|
||||
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
||||
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
||||
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
||||
var color = Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
||||
Brush = new SolidColorBrush(color);
|
||||
PrimitiveLeftButtonUp = new RelayCommand(o => Captured = false);
|
||||
PrimitiveLeftButtonDown = new RelayCommand(o => Captured = true);
|
||||
|
||||
PrimitiveDoubleClick = new RelayCommand(o =>
|
||||
{
|
||||
PopupCanBeClosed = false;
|
||||
Captured = false;
|
||||
ParamsPanelVisibilty = true;
|
||||
ParameterCaptured = true;
|
||||
});
|
||||
OwnerVm = ownerVM;
|
||||
}
|
||||
|
||||
protected readonly MainViewModel OwnerVm;
|
||||
|
||||
private void UpdateCoordinatesX(double showedX)
|
||||
{
|
||||
if (Type == PrimitiveType.Rectangle) X = showedX + OwnerVm.YX1;
|
||||
if (Type == PrimitiveType.Point) X = showedX + OwnerVm.YX1 - PrimitiveWidth / 2;
|
||||
}
|
||||
private void UpdateCoordinatesY(double showedY)
|
||||
{
|
||||
if (Type == PrimitiveType.Rectangle) Y = -showedY + OwnerVm.XY1 - PrimitiveHeight;
|
||||
if (Type == PrimitiveType.Point) Y = -showedY + OwnerVm.XY1 - PrimitiveWidth / 2;
|
||||
}
|
||||
|
||||
public abstract INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem);
|
||||
public MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
MaterialTypes materialTypes;
|
||||
if (Material is ConcreteDefinition) { materialTypes = MaterialTypes.Concrete; }
|
||||
else if (Material is RebarDefinition) { materialTypes = MaterialTypes.Reinforcement; }
|
||||
else { throw new Exception("MaterialType is unknown"); }
|
||||
return materialTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class Rectangle : PrimitiveBase
|
||||
{
|
||||
public Rectangle(double primitiveWidth, double primitiveHeight, double x, double y, MainViewModel ownerVm) : base(PrimitiveType.Rectangle, x, y, ownerVm)
|
||||
{
|
||||
Type = PrimitiveType.Rectangle;
|
||||
PrimitiveWidth = primitiveWidth;
|
||||
PrimitiveHeight = primitiveHeight;
|
||||
PreviewMouseMove = new RelayCommand(o =>
|
||||
{
|
||||
if (!(o is Rectangle rect)) return;
|
||||
if (Captured && !rect.BorderCaptured && !ElementLock)
|
||||
{
|
||||
var deltaX = PrimitiveWidth / 2;
|
||||
var deltaY = PrimitiveHeight / 2;
|
||||
|
||||
if (rect.ShowedX % 10 <= delta || rect.ShowedX % 10 >= 10 - delta)
|
||||
rect.ShowedX = Math.Round((OwnerVm.PanelX - deltaX - OwnerVm.YX1) / 10) * 10;
|
||||
else
|
||||
rect.ShowedX = OwnerVm.PanelX - deltaX - OwnerVm.YX1;
|
||||
|
||||
if (rect.ShowedY % 10 <= delta || rect.ShowedY % 10 >= 10 - delta)
|
||||
rect.ShowedY = -(Math.Round((OwnerVm.PanelY - deltaY - OwnerVm.XY1 + rect.PrimitiveHeight) / 10) * 10);
|
||||
else
|
||||
rect.ShowedY = -(OwnerVm.PanelY - deltaY - OwnerVm.XY1 + rect.PrimitiveHeight);
|
||||
}
|
||||
});
|
||||
|
||||
ShowedX = x;
|
||||
ShowedY = y;
|
||||
}
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive(IUnitSystem unitSystem)
|
||||
{
|
||||
var width = unitSystem.ConvertLength(PrimitiveWidth);
|
||||
var height = unitSystem.ConvertLength(PrimitiveHeight);
|
||||
double centerX = unitSystem.ConvertLength(ShowedX) + width / 2;
|
||||
double centerY = unitSystem.ConvertLength(ShowedY) + height / 2;
|
||||
string materialName = MaterialName;
|
||||
ICenter center = new Center { X = centerX, Y = centerY };
|
||||
IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 };
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength };
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<UserControl x:Class="StructureHelper.Infrastructure.UI.DataTemplates.EllipseTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:StructureHelper"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:Point}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewMouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseUp">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseMove">
|
||||
<i:InvokeCommandAction Command="{Binding PreviewMouseMove}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<mouseEventTriggers:DoubleClickEventTrigger EventName="MouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
||||
</mouseEventTriggers:DoubleClickEventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Ellipse>
|
||||
<userControls:PrimitivePopup Type="Rectangle" IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:PrimitiveBase}"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -1,48 +0,0 @@
|
||||
<UserControl x:Class="StructureHelper.Infrastructure.UI.DataTemplates.RectangleTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:StructureHelper"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance dataContexts:Rectangle}">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Rectangle Style="{StaticResource RectangleStyle}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewMouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseUp">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseMove">
|
||||
<i:InvokeCommandAction Command="{Binding PreviewMouseMove}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<mouseEventTriggers:DoubleClickEventTrigger EventName="MouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
||||
</mouseEventTriggers:DoubleClickEventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Rectangle>
|
||||
<Rectangle Cursor="SizeNWSE" Width="20" Height="20" Fill="{Binding Brush}" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="PreviewMouseDown">
|
||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonDown}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseUp">
|
||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonUp}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseMove">
|
||||
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PreviewMouseMove}" CommandParameter="{Binding}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Rectangle>
|
||||
</Grid>
|
||||
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -1,55 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||
mc:Ignorable="d" >
|
||||
|
||||
<Style TargetType="Shape" x:Key="ShapeStyle">
|
||||
<Setter Property="Fill" Value="{Binding Brush, Mode=TwoWay}"/>
|
||||
<Setter Property="Opacity" Value="{Binding Opacity, Mode=TwoWay}"/>
|
||||
<Setter Property="ToolTip">
|
||||
<Setter.Value>
|
||||
<ToolTip Background="White" BorderBrush="Black" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата X:"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedX}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата Y:"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedY}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Ширина:"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding PrimitiveWidth}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Высота:"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding PrimitiveHeight}"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Материал:"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding MaterialName, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</ToolTip>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="EllipseStyle" TargetType="Ellipse" BasedOn="{StaticResource ShapeStyle}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Width" Value="{Binding PrimitiveWidth}"/>
|
||||
<Setter Property="Height" Value="{Binding PrimitiveWidth}"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RectangleStyle" TargetType="Rectangle" BasedOn="{StaticResource ShapeStyle}">
|
||||
<Setter Property="Width" Value="{Binding PrimitiveWidth}"/>
|
||||
<Setter Property="Height" Value="{Binding PrimitiveHeight}"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Binary file not shown.
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelperCommon.Models.NdmPrimitives;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using Point = StructureHelper.Infrastructure.UI.DataContexts.Point;
|
||||
using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle;
|
||||
|
||||
namespace StructureHelper.Services
|
||||
{
|
||||
public interface IPrimitiveRepository
|
||||
{
|
||||
void Add(PrimitiveBase primitive);
|
||||
void Delete(PrimitiveBase primitive);
|
||||
IEnumerable<Point> GetPoints();
|
||||
IEnumerable<Rectangle> GetRectangles();
|
||||
}
|
||||
class PrimitiveRepository : IPrimitiveRepository
|
||||
{
|
||||
List<Point> points = new List<Point>();
|
||||
List<Rectangle> rectangles = new List<Rectangle>();
|
||||
|
||||
public void Add(PrimitiveBase primitive)
|
||||
{
|
||||
switch (primitive)
|
||||
{
|
||||
case Point point:
|
||||
points.Add(point);
|
||||
break;
|
||||
case Rectangle rectangle:
|
||||
rectangles.Add(rectangle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void Delete(PrimitiveBase primitive)
|
||||
{
|
||||
switch (primitive)
|
||||
{
|
||||
case Point point:
|
||||
points.Remove(point);
|
||||
break;
|
||||
case Rectangle rectangle:
|
||||
rectangles.Remove(rectangle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Point> GetPoints() => points;
|
||||
|
||||
public IEnumerable<Rectangle> GetRectangles() => rectangles;
|
||||
}
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BAD27E27-4444-4300-ADF8-E21042C0781D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>StructureHelper</RootNamespace>
|
||||
<AssemblyName>StructureHelper</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=6.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Autofac.6.4.0\lib\netstandard2.0\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="LoaderCalculator, Version=1.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>Libraries\LoaderCalculator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Infrastructure\Enums\PrimitiveType.cs" />
|
||||
<Compile Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml.cs">
|
||||
<DependentUpon>PrimitivePopup.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\PrimitiveService.cs" />
|
||||
<Compile Include="UnitSystem\UnitSystemService.cs" />
|
||||
<Compile Include="UnitSystem\Enums\SystemTypes.cs" />
|
||||
<Compile Include="UnitSystem\Systems\SystemSi.cs" />
|
||||
<Compile Include="UnitSystem\Systems\IUnitSystem.cs" />
|
||||
<Compile Include="Windows\AddMaterialWindow\AddMaterialView.xaml.cs">
|
||||
<DependentUpon>AddMaterialView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\AddMaterialWindow\AddMaterialViewModel.cs" />
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ColorPickerWindow\ColorPickerView.xaml.cs">
|
||||
<DependentUpon>ColorPickerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ColorPickerWindow\ColorPickerViewModel.cs" />
|
||||
<Compile Include="Infrastructure\Extensions\ObservableCollectionExtensions.cs" />
|
||||
<Compile Include="Infrastructure\EventTriggerBase.cs" />
|
||||
<Compile Include="Infrastructure\UI\Triggers\MouseEventTriggers\MouseWheelUpEventTrigger.cs" />
|
||||
<Compile Include="Infrastructure\UI\Triggers\MouseEventTriggers\MouseWheelDownEventTrigger.cs" />
|
||||
<Compile Include="Infrastructure\ViewModelBase.cs" />
|
||||
<Compile Include="Models\Materials\ConcreteDefinition.cs" />
|
||||
<Compile Include="Infrastructure\NamedList.cs" />
|
||||
<Compile Include="Models\Materials\MaterialDefinitionBase.cs" />
|
||||
<Compile Include="Infrastructure\UI\DataContexts\Point.cs" />
|
||||
<Compile Include="Infrastructure\UI\DataContexts\PrimitiveBase.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Models\Materials\RebarDefinition.cs" />
|
||||
<Compile Include="Infrastructure\UI\DataContexts\Rectangle.cs" />
|
||||
<Compile Include="Infrastructure\UI\DataTemplates\EllipseTemplate.xaml.cs">
|
||||
<DependentUpon>EllipseTemplate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\MainWindow\MainModel.cs" />
|
||||
<Compile Include="Windows\MainWindow\MainView.xaml.cs" />
|
||||
<Compile Include="Windows\MainWindow\MainViewModel.cs" />
|
||||
<Compile Include="Infrastructure\RelayCommand.cs" />
|
||||
<Compile Include="Infrastructure\UI\DataTemplates\RectangleTemplate.xaml.cs">
|
||||
<DependentUpon>RectangleTemplate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Infrastructure\UI\Triggers\MouseEventTriggers\DoubleClickEventTrigger.cs" />
|
||||
<Compile Include="Infrastructure\EventArgs.cs" />
|
||||
<Compile Include="MaterialCatalogWindow\MaterialCatalogModel.cs" />
|
||||
<Compile Include="MaterialCatalogWindow\MaterialCatalogView.xaml.cs" />
|
||||
<Compile Include="MaterialCatalogWindow\MaterialCatalogViewModel.cs" />
|
||||
<Compile Include="Infrastructure\MouseBehaviour.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Infrastructure\UI\Styles.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Infrastructure\UI\UserControls\PrimitivePopup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\AddMaterialWindow\AddMaterialView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\ColorPickerWindow\ColorPickerView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MaterialCatalogWindow\MaterialCatalogView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Infrastructure\UI\DataTemplates\EllipseTemplate.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\MainWindow\MainView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Infrastructure\UI\DataTemplates\RectangleTemplate.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Logics\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="StructureHelperCommon\StructureHelperCommon.csproj">
|
||||
<Project>{5dfec3fd-9677-47bb-9e88-eb71828b5913}</Project>
|
||||
<Name>StructureHelperCommon</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="StructureHelperLogics\StructureHelperLogics.csproj">
|
||||
<Project>{330bef5b-15be-4d2c-a750-b1ae50fb2be3}</Project>
|
||||
<Name>StructureHelperLogics</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -3,16 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32630.192
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "StructureHelper.csproj", "{BAD27E27-4444-4300-ADF8-E21042C0781D}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperTests", "StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} = {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}
|
||||
EndProjectSection
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FieldVisualzerDemo", "FiledVisualzerDemo\FieldVisualzerDemo.csproj", "{C92A5F2E-567B-48C9-A524-5740DB03509D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelper", "StructureHelper\StructureHelper.csproj", "{271311DE-67EE-4EE8-93EA-EA8BFD366EC6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{5DFEC3FD-9677-47BB-9E88-EB71828B5913}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{C9192AE7-EE6D-409C-A05C-3549D78CBB34}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FieldVisualizer", "FieldVisualizer\FieldVisualizer.csproj", "{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -20,22 +21,30 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BAD27E27-4444-4300-ADF8-E21042C0781D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BAD27E27-4444-4300-ADF8-E21042C0781D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BAD27E27-4444-4300-ADF8-E21042C0781D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BAD27E27-4444-4300-ADF8-E21042C0781D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C92A5F2E-567B-48C9-A524-5740DB03509D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C92A5F2E-567B-48C9-A524-5740DB03509D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C92A5F2E-567B-48C9-A524-5740DB03509D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C92A5F2E-567B-48C9-A524-5740DB03509D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{271311DE-67EE-4EE8-93EA-EA8BFD366EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{271311DE-67EE-4EE8-93EA-EA8BFD366EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{271311DE-67EE-4EE8-93EA-EA8BFD366EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{271311DE-67EE-4EE8-93EA-EA8BFD366EC6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F1548BD2-7FE8-46C2-9BC4-9BA813A5C59A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C9192AE7-EE6D-409C-A05C-3549D78CBB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9192AE7-EE6D-409C-A05C-3549D78CBB34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9192AE7-EE6D-409C-A05C-3549D78CBB34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C9192AE7-EE6D-409C-A05C-3549D78CBB34}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CAC5B83-81F3-47C2-92A1-0F94A58491C2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
4
StructureHelper/.gitignore
vendored
Normal file
4
StructureHelper/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*\obj
|
||||
*\bin
|
||||
*\packages
|
||||
*\.vs
|
||||
21
StructureHelper/App.xaml
Normal file
21
StructureHelper/App.xaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<Application x:Class="StructureHelper.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:StructureHelper">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/CommonEnums.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Styles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridStyles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ButtonStyles.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/Converters.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/DataGridTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ShapeEditTemplates.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/PrimitiveToolTips.xaml"/>
|
||||
<ResourceDictionary Source="Infrastructure/UI/Resources/ITemEditPanels.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,14 +1,14 @@
|
||||
using System.Windows;
|
||||
using Autofac;
|
||||
using StructureHelper.Services;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Services;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using System.Windows;
|
||||
using Autofac;
|
||||
|
||||
namespace StructureHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для App.xaml
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
BIN
StructureHelper/Documentation/2021-06-14 10-46-38.JPG
Normal file
BIN
StructureHelper/Documentation/2021-06-14 10-46-38.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 MiB |
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Common
|
||||
{
|
||||
[ValueConversion(typeof(bool), typeof(bool))]
|
||||
public class InvertBoolConverter : IValueConverter
|
||||
{
|
||||
public InvertBoolConverter()
|
||||
{
|
||||
}
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value != null && value is bool)
|
||||
{
|
||||
return !((bool)value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return Convert(value, targetType, parameter, culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
100
StructureHelper/Infrastructure/UI/Converters/CommonOperation.cs
Normal file
100
StructureHelper/Infrastructure/UI/Converters/CommonOperation.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
{
|
||||
internal static class CommonOperation
|
||||
{
|
||||
private static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
|
||||
|
||||
public static double ConvertToDoubleChangeComma(string s)
|
||||
{
|
||||
double result;
|
||||
if (!double.TryParse(s, NumberStyles.Any, CultureInfo.CurrentCulture, out result) &&
|
||||
!double.TryParse(s, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out result) &&
|
||||
!double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
||||
{
|
||||
throw new StructureHelperException($"{ErrorStrings.IncorrectValue}: {s}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IStringDoublePair DivideIntoStringDoublePair(string s)
|
||||
{
|
||||
s = s.Replace(" ", "");
|
||||
string digitPattern = @"^[-]?[+]?\d+(\.?|\,?)\d*";
|
||||
string textPattern = @"[0-9]|\.|\,";
|
||||
string caracterPattern = "[a-z]+$";
|
||||
string target = "";
|
||||
Regex regexText = new Regex(textPattern);
|
||||
string textString = regexText.Replace(s, target);
|
||||
var textMatch = Regex.Match(textString, caracterPattern, RegexOptions.IgnoreCase);
|
||||
if (textMatch.Success) {textString = textMatch.Value.ToLower();}
|
||||
var match = Regex.Match(s, digitPattern);
|
||||
if (match.Success)
|
||||
{
|
||||
string digitString = match.Value;
|
||||
double digit = ConvertToDoubleChangeComma(digitString);
|
||||
return new StringDoublePair() { Digit = digit, Text = textString };
|
||||
}
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||
}
|
||||
|
||||
public static IUnit GetUnit(UnitTypes unitType, string unitName)
|
||||
{
|
||||
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
|
||||
}
|
||||
|
||||
public static string Convert(IUnit unit, string unitName, object value)
|
||||
{
|
||||
double val;
|
||||
if (value != null) { val = (double)value; }
|
||||
else { throw new Exception($"{unitName} value is null"); }
|
||||
val *= unit.Multiplyer;
|
||||
string strValue = $"{val} {unit.Name}";
|
||||
return strValue;
|
||||
}
|
||||
|
||||
public static double ConvertBack(UnitTypes unitType, IUnit unit, object value)
|
||||
{
|
||||
double val;
|
||||
double multy;
|
||||
double coefficient = unit.Multiplyer;
|
||||
var strVal = value as string;
|
||||
IStringDoublePair pair = DivideIntoStringDoublePair(strVal);
|
||||
try
|
||||
{
|
||||
multy = GetMultiplyer(unitType, pair.Text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
multy = coefficient;
|
||||
}
|
||||
val = pair.Digit / multy;
|
||||
return val;
|
||||
}
|
||||
|
||||
private static double GetMultiplyer(UnitTypes unitType, string unitName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single().Multiplyer;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
{
|
||||
internal interface IStringDoublePair
|
||||
{
|
||||
double Digit { get; }
|
||||
string Text { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters
|
||||
{
|
||||
internal class StringDoublePair : IStringDoublePair
|
||||
{
|
||||
public double Digit { get; set; }
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
20
StructureHelper/Infrastructure/UI/Converters/Units/Area.cs
Normal file
20
StructureHelper/Infrastructure/UI/Converters/Units/Area.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Area : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Area; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm2"); }
|
||||
public override string UnitName { get => "Area"; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Curvature : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Curvature; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "1/mm"); }
|
||||
public override string UnitName { get => "Curvature"; }
|
||||
}
|
||||
}
|
||||
19
StructureHelper/Infrastructure/UI/Converters/Units/Force.cs
Normal file
19
StructureHelper/Infrastructure/UI/Converters/Units/Force.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Force : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Force; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kN"); }
|
||||
public override string UnitName { get => "Force"; }
|
||||
}
|
||||
}
|
||||
22
StructureHelper/Infrastructure/UI/Converters/Units/Length.cs
Normal file
22
StructureHelper/Infrastructure/UI/Converters/Units/Length.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Length : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Length; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "mm"); }
|
||||
public override string UnitName { get => "Length"; }
|
||||
}
|
||||
}
|
||||
17
StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs
Normal file
17
StructureHelper/Infrastructure/UI/Converters/Units/Moment.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Moment : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Moment; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "kNm"); }
|
||||
public override string UnitName { get => "Moment"; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class PlainDouble : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (double)value;
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CommonOperation.ConvertToDoubleChangeComma((string)value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs
Normal file
19
StructureHelper/Infrastructure/UI/Converters/Units/Stress.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal class Stress : UnitBase
|
||||
{
|
||||
public override UnitTypes UnitType { get => UnitTypes.Stress; }
|
||||
public override IUnit CurrentUnit { get => CommonOperation.GetUnit(UnitType, "MPa"); }
|
||||
public override string UnitName { get => "Stress"; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal abstract class UnitBase : IValueConverter
|
||||
{
|
||||
public abstract UnitTypes UnitType { get; }
|
||||
public abstract IUnit CurrentUnit { get; }
|
||||
public abstract string UnitName { get;}
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return CommonOperation.Convert(CurrentUnit, UnitName, value);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CommonOperation.ConvertBack(UnitType, CurrentUnit, value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show($"Value of {UnitName}={(string)value} is not correct", "Error of conversion", MessageBoxButtons.OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
internal static class UnitConstatnts
|
||||
{
|
||||
public static double Length = 1e3d;
|
||||
public static double Force = 1e-3d;
|
||||
public static double Stress = 1e-6d;
|
||||
}
|
||||
}
|
||||
14
StructureHelper/Infrastructure/UI/DataContexts/IHasCenter.cs
Normal file
14
StructureHelper/Infrastructure/UI/DataContexts/IHasCenter.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal interface IHasCenter
|
||||
{
|
||||
double PrimitiveLeft { get; }
|
||||
double PrimitiveTop { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal interface IHasDivision
|
||||
{
|
||||
int NdmMinDivision { get; set; }
|
||||
double NdmMaxSize { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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 StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal class LineViewPrimitive : PrimitiveBase
|
||||
{
|
||||
public LineViewPrimitive(ILinePrimitive primitive) : base(primitive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//public LineViewPrimitive(double x, double y, MainViewModel ownerVM) : base(x, y, ownerVM)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class PointViewPrimitive : PrimitiveBase, IHasCenter
|
||||
{
|
||||
IPointPrimitive primitive;
|
||||
|
||||
public double Area
|
||||
{ get => primitive.Area;
|
||||
set
|
||||
{
|
||||
primitive.Area = value;
|
||||
RefreshPlacement();
|
||||
}
|
||||
}
|
||||
|
||||
public double PrimitiveLeft
|
||||
{
|
||||
get => DeltaX - Diameter / 2d;
|
||||
}
|
||||
public double PrimitiveTop
|
||||
{
|
||||
get => DeltaY - Diameter / 2d;
|
||||
}
|
||||
|
||||
public PointViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
|
||||
{
|
||||
primitive = _primitive;
|
||||
}
|
||||
|
||||
public double Diameter { get => Math.Sqrt(primitive.Area / Math.PI) * 2; }
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
return primitive;
|
||||
}
|
||||
|
||||
private void RefreshPlacement()
|
||||
{
|
||||
OnPropertyChanged(nameof(Area));
|
||||
OnPropertyChanged(nameof(Diameter));
|
||||
OnPropertyChanged(nameof(CenterX));
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||
OnPropertyChanged(nameof(PrimitiveTop));
|
||||
}
|
||||
}
|
||||
}
|
||||
268
StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
Normal file
268
StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System.Windows.Controls;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public abstract class PrimitiveBase : ViewModelBase
|
||||
{
|
||||
#region Поля
|
||||
private IPrimitiveRepository primitiveRepository;
|
||||
private INdmPrimitive primitive;
|
||||
private bool captured, parameterCaptured, elementLock, paramsPanelVisibilty, popupCanBeClosed = true, borderCaptured;
|
||||
private double showedOpacity = 0, x, y, xY1, yX1, primitiveWidth, primitiveHeight;
|
||||
protected double delta = 0.5;
|
||||
private int showedZIndex = 1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Свойства
|
||||
public INdmPrimitive NdmPrimitive
|
||||
{
|
||||
get => primitive;
|
||||
}
|
||||
public IPrimitiveRepository PrimitiveRepository => primitiveRepository;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => primitive.Name;
|
||||
set
|
||||
{
|
||||
primitive.Name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
public double CenterX
|
||||
{
|
||||
get => primitive.CenterX;
|
||||
set
|
||||
{
|
||||
primitive.CenterX = value;
|
||||
OnPropertyChanged(nameof(CenterX));
|
||||
}
|
||||
}
|
||||
public double CenterY
|
||||
{
|
||||
get => primitive.CenterY;
|
||||
set
|
||||
{
|
||||
primitive.CenterY = value;
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
OnPropertyChanged(nameof(InvertedCenterY));
|
||||
}
|
||||
}
|
||||
public double InvertedCenterY => - CenterY;
|
||||
public double PrestrainKx
|
||||
{ get => primitive.UsersPrestrain.Kx;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.Kx = value;
|
||||
OnPropertyChanged(nameof(PrestrainKx));
|
||||
}
|
||||
}
|
||||
public double PrestrainKy
|
||||
{ get => primitive.UsersPrestrain.Ky;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.Ky = value;
|
||||
OnPropertyChanged(nameof(PrestrainKy));
|
||||
}
|
||||
}
|
||||
public double PrestrainEpsZ
|
||||
{ get => primitive.UsersPrestrain.EpsZ;
|
||||
set
|
||||
{
|
||||
primitive.UsersPrestrain.EpsZ = value;
|
||||
OnPropertyChanged(nameof(PrestrainEpsZ));
|
||||
}
|
||||
}
|
||||
|
||||
public double AutoPrestrainKx => primitive.AutoPrestrain.Kx;
|
||||
public double AutoPrestrainKy => primitive.AutoPrestrain.Ky;
|
||||
public double AutoPrestrainEpsZ => primitive.AutoPrestrain.EpsZ;
|
||||
|
||||
public IHeadMaterial HeadMaterial
|
||||
{
|
||||
get => primitive.HeadMaterial;
|
||||
set
|
||||
{
|
||||
primitive.HeadMaterial = value;
|
||||
OnPropertyChanged(nameof(HeadMaterial));
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetMaterialColor
|
||||
{
|
||||
get => primitive.VisualProperty.SetMaterialColor;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.SetMaterialColor = value;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
|
||||
}
|
||||
public Color Color
|
||||
{
|
||||
get => ((primitive.VisualProperty.SetMaterialColor == true)
|
||||
& (primitive.HeadMaterial !=null))? primitive.HeadMaterial.Color : primitive.VisualProperty.Color;
|
||||
set
|
||||
{
|
||||
SetMaterialColor = false;
|
||||
primitive.VisualProperty.Color = value;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Captured
|
||||
{
|
||||
set => OnPropertyChanged(value, ref captured);
|
||||
get => captured;
|
||||
}
|
||||
public bool ParameterCaptured
|
||||
{
|
||||
set => OnPropertyChanged(value, ref parameterCaptured);
|
||||
get => parameterCaptured;
|
||||
}
|
||||
public bool ElementLock
|
||||
{
|
||||
get => elementLock;
|
||||
set => OnPropertyChanged(value, ref elementLock);
|
||||
}
|
||||
|
||||
public bool ParamsPanelVisibilty
|
||||
{
|
||||
get => paramsPanelVisibilty;
|
||||
set => OnPropertyChanged(value, ref paramsPanelVisibilty);
|
||||
}
|
||||
public bool PopupCanBeClosed
|
||||
{
|
||||
get => popupCanBeClosed;
|
||||
set => OnPropertyChanged(value, ref popupCanBeClosed);
|
||||
}
|
||||
public double ShowedOpacity
|
||||
{
|
||||
get => showedOpacity;
|
||||
set
|
||||
{
|
||||
Opacity = (100 - value) / 100;
|
||||
OnPropertyChanged(nameof(Opacity));
|
||||
OnPropertyChanged(value, ref showedOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get => primitive.VisualProperty.IsVisible;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.IsVisible = value;
|
||||
OnPropertyChanged(nameof(IsVisible));
|
||||
}
|
||||
}
|
||||
|
||||
public double Opacity
|
||||
{
|
||||
get => primitive.VisualProperty.Opacity;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.Opacity = value;
|
||||
OnPropertyChanged(nameof(Opacity));
|
||||
}
|
||||
}
|
||||
public int ShowedZIndex
|
||||
{
|
||||
get => showedZIndex;
|
||||
set
|
||||
{
|
||||
ZIndex = value - 1;
|
||||
OnPropertyChanged(nameof(ZIndex));
|
||||
OnPropertyChanged(value, ref showedZIndex);
|
||||
}
|
||||
}
|
||||
public int ZIndex
|
||||
{
|
||||
get => primitive.VisualProperty.ZIndex;
|
||||
set
|
||||
{
|
||||
primitive.VisualProperty.ZIndex = value;
|
||||
OnPropertyChanged(nameof(ZIndex));
|
||||
}
|
||||
}
|
||||
|
||||
public double Xy1
|
||||
{
|
||||
get => xY1;
|
||||
set => OnPropertyChanged(value, ref xY1);
|
||||
}
|
||||
public double Yx1
|
||||
{
|
||||
get => yX1;
|
||||
set => OnPropertyChanged(value, ref yX1);
|
||||
}
|
||||
public virtual double PrimitiveWidth { get; set; }
|
||||
public virtual double PrimitiveHeight { get;set; }
|
||||
public bool BorderCaptured
|
||||
{
|
||||
get => borderCaptured;
|
||||
set => OnPropertyChanged(value, ref borderCaptured);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Команды
|
||||
public ICommand PrimitiveLeftButtonDown { get; }
|
||||
public ICommand PrimitiveLeftButtonUp { get; }
|
||||
public ICommand PreviewMouseMove { get; protected set; }
|
||||
public ICommand PrimitiveDoubleClick { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
public PrimitiveBase(INdmPrimitive primitive)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
}
|
||||
|
||||
public void RegisterDeltas(double dx, double dy)
|
||||
{
|
||||
DeltaX = dx;
|
||||
DeltaY = dy;
|
||||
}
|
||||
|
||||
public MainViewModel OwnerVM { get; private set; }
|
||||
|
||||
public double DeltaX { get; private set; }
|
||||
public double DeltaY { get; private set; }
|
||||
|
||||
public virtual INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
RefreshNdmPrimitive();
|
||||
return primitive;
|
||||
}
|
||||
|
||||
public virtual void RefreshNdmPrimitive()
|
||||
{
|
||||
}
|
||||
|
||||
public void RefreshColor()
|
||||
{
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal static class PrimitiveOperations
|
||||
{
|
||||
|
||||
public static ObservableCollection<PrimitiveBase> ConvertNdmPrimitivesToPrimitiveBase(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
ObservableCollection<PrimitiveBase> viewItems = new ObservableCollection<PrimitiveBase>();
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
if (item is IPointPrimitive)
|
||||
{
|
||||
var point = item as IPointPrimitive;
|
||||
viewItems.Add(new PointViewPrimitive(point));
|
||||
}
|
||||
else if (item is IRectanglePrimitive)
|
||||
{
|
||||
var rect = item as IRectanglePrimitive;
|
||||
viewItems.Add(new RectangleViewPrimitive(rect));
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
}
|
||||
return viewItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class RectangleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
|
||||
{
|
||||
private IRectanglePrimitive primitive;
|
||||
|
||||
public override double PrimitiveWidth
|
||||
{
|
||||
get => primitive.Width;
|
||||
set
|
||||
{
|
||||
primitive.Width = value;
|
||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||
OnPropertyChanged(nameof(PrimitiveWidth));
|
||||
}
|
||||
}
|
||||
public override double PrimitiveHeight
|
||||
{
|
||||
get => primitive.Height;
|
||||
set
|
||||
{
|
||||
primitive.Height = value;
|
||||
OnPropertyChanged(nameof(PrimitiveTop));
|
||||
OnPropertyChanged(nameof(PrimitiveHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public double PrimitiveLeft
|
||||
{
|
||||
get => DeltaX - primitive.Width / 2d;
|
||||
}
|
||||
public double PrimitiveTop
|
||||
{
|
||||
get => DeltaY - primitive.Height / 2d;
|
||||
}
|
||||
public int NdmMinDivision
|
||||
{
|
||||
get => primitive.NdmMinDivision;
|
||||
set
|
||||
{
|
||||
primitive.NdmMinDivision = value;
|
||||
OnPropertyChanged(nameof(NdmMinDivision));
|
||||
}
|
||||
}
|
||||
public double NdmMaxSize
|
||||
{
|
||||
get => primitive.NdmMaxSize;
|
||||
set
|
||||
{
|
||||
primitive.NdmMaxSize = value;
|
||||
OnPropertyChanged(nameof(NdmMaxSize));
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleViewPrimitive(IRectanglePrimitive _primitive) : base(_primitive)
|
||||
{
|
||||
primitive = _primitive;
|
||||
}
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
return primitive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<UserControl x:Class="StructureHelper.Infrastructure.UI.DataTemplates.EllipseTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:StructureHelper"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel>
|
||||
<Ellipse Style="{StaticResource EllipseStyle}" d:DataContext="{d:DesignInstance dataContexts:PointViewPrimitive}">
|
||||
<Ellipse.ToolTip>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Name: " FontWeight="Bold"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="1" Text="Material Name: " FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}" FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X: "/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y: "/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="4" Text="Area: "/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Area, Converter={StaticResource AreaConverter}}"/>
|
||||
</Grid>
|
||||
</Ellipse.ToolTip>
|
||||
<Ellipse.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform X="{Binding CenterX}" Y="{Binding InvertedCenterY}"/>
|
||||
<RotateTransform/>
|
||||
</TransformGroup>
|
||||
</Ellipse.RenderTransform>
|
||||
</Ellipse>
|
||||
<userControls:PrimitivePopup Type="Rectangle" IsOpen="{Binding ParamsPanelVisibilty}" d:DataContext="{d:DesignInstance dataContexts:PrimitiveBase}"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,57 @@
|
||||
<UserControl x:Class="StructureHelper.Infrastructure.UI.DataTemplates.RectangleTemplate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:StructureHelper"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
||||
xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers"
|
||||
xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls"
|
||||
xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance dataContexts:RectangleViewPrimitive}">
|
||||
<UserControl.Resources>
|
||||
</UserControl.Resources>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Rectangle x:Name="Rect" Style="{StaticResource RectangleStyle}" Tag="{Binding}">
|
||||
<Rectangle.ToolTip>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Name: " FontWeight="Bold"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="1" Text="Material Name: " FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HeadMaterial.Name}" FontWeight="Bold"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X: "/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y: "/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="4" Text="Width: "/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding PrimitiveWidth, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="5" Text="Height: "/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding PrimitiveHeight, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
</Rectangle.ToolTip>
|
||||
<Rectangle.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform X="{Binding CenterX}" Y="{Binding InvertedCenterY}"/>
|
||||
<RotateTransform/>
|
||||
</TransformGroup>
|
||||
</Rectangle.RenderTransform>
|
||||
</Rectangle>
|
||||
</Grid>
|
||||
<userControls:PrimitivePopup IsOpen="{Binding ParamsPanelVisibilty}"/>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates
|
||||
{
|
||||
public interface IRectangleBeamProperties
|
||||
{
|
||||
IShape Shape { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Shapes = StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates
|
||||
{
|
||||
internal static class TemplateFactory
|
||||
{
|
||||
//public static IEnumerable<PrimitiveBase> RectangleBeam(IRectangleBeamTemplate properties)
|
||||
//{
|
||||
// var rect = properties.Shape as Shapes.Rectangle;
|
||||
// var width = rect.Width;
|
||||
// var height = rect.Height;
|
||||
// var area1 = Math.PI * properties.BottomDiameter * properties.BottomDiameter / 4d;
|
||||
// var area2 = Math.PI * properties.TopDiameter * properties.TopDiameter / 4d;
|
||||
// var gap = properties.CoverGap;
|
||||
|
||||
//IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete 40" };
|
||||
//concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First();
|
||||
//IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement 400" };
|
||||
//reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First();
|
||||
//headMaterials.Add(concrete);
|
||||
//headMaterials.Add(reinforcement);
|
||||
//OnPropertyChanged(nameof(headMaterials));
|
||||
|
||||
//yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete };
|
||||
//yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { HeadMaterial = reinforcement };
|
||||
//yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { HeadMaterial = reinforcement };
|
||||
//}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user