Добавьте файлы проекта.
26
App.config
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<!--
|
||||
name = Имя, которое используется для ссылки на данный раздел в файле настройки.
|
||||
type = Обработчик раздела настроек. Включает две секции: полный путь - пространство имен обработчика наших данных + имя самого обработчика, наименование сборки, где данный класс располагается.
|
||||
-->
|
||||
<section name="StartupFolders" type="ConfigSectionTester.StartupFoldersConfigSection, ConfigSectionTester"/>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="GroundOrganizer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
|
||||
<userSettings>
|
||||
<GroundOrganizer.Properties.Settings>
|
||||
<setting name="BasePath" serializeAs="String">
|
||||
<value/>
|
||||
</setting>
|
||||
</GroundOrganizer.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
13
App.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<Application x:Class="GroundOrganizer.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:GroundOrganizer"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Dictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
24
App.xaml.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
//public static ViewModel vm;
|
||||
//public App()
|
||||
//{
|
||||
// InitializeComponent();
|
||||
// vm = new ViewModel();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
119
BL/Bore.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class Bore
|
||||
{
|
||||
/// <summary>
|
||||
/// Порядковый номер скважины
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
/// <summary>
|
||||
/// Имя скважины
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Х-координата распложения скважины
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
/// <summary>
|
||||
/// Y-координата распложения скважины
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
/// <summary>
|
||||
/// Абсолютная отметка устья скважины
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
/// <summary>
|
||||
/// Относительная отметка уровня грунтовых вод
|
||||
/// </summary>
|
||||
public double? WL { get; set; }
|
||||
/// <summary>
|
||||
/// Превышение глубины сважины в расчетах осадки
|
||||
/// </summary>
|
||||
public double DZ { get; set; }
|
||||
/// <summary>
|
||||
/// Массив грунтовых слоев
|
||||
/// </summary>
|
||||
public ObservableCollection<Layer> Layers { get; set; }
|
||||
|
||||
public Bore()
|
||||
{
|
||||
Layers = new ObservableCollection<Layer>();
|
||||
}
|
||||
|
||||
public void AddLayer(Layer layer)
|
||||
{
|
||||
if (Layers == null) Layers = new ObservableCollection<Layer>();
|
||||
Layers.Add(layer);
|
||||
}
|
||||
public void AddLayers(ObservableCollection<Layer> layers)
|
||||
{
|
||||
Layers = layers;
|
||||
}
|
||||
public void AddLayers(List<Layer> layers)
|
||||
{
|
||||
if (Layers == null) Layers = new ObservableCollection<Layer>();
|
||||
foreach (var item in layers) Layers.Add(item);
|
||||
}
|
||||
|
||||
public void DeleteLayers()
|
||||
{
|
||||
Layers = new ObservableCollection<Layer>();
|
||||
}
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number + s + Name + s + X + s + Y + s + Z + s + WL + s + DZ;
|
||||
}
|
||||
|
||||
internal List<object> PropsToList()
|
||||
{
|
||||
return new List<object> { Number, Name, X, Y, Z, WL, DZ };
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
Name = src[1];
|
||||
X = double.Parse(src[2]);
|
||||
Y = double.Parse(src[3]);
|
||||
Z = double.Parse(src[4]);
|
||||
WL = double.Parse(src[5]);
|
||||
DZ = double.Parse(src[6]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal void ListToProps(List<object> src)
|
||||
{
|
||||
try
|
||||
{
|
||||
Number = (int)(double)src[0];
|
||||
Name = (string)src[1];
|
||||
X = (double)src[2];
|
||||
Y = (double)src[3];
|
||||
Z = (double)src[4];
|
||||
WL = (double)src[5];
|
||||
DZ = (double)src[6];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
BL/DataPair.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{ [Serializable]
|
||||
public struct DataPair
|
||||
{
|
||||
public string Описание { get; set; }
|
||||
public object Параметр { get; set; }
|
||||
public UnitsForce ForcesUnits { get; set; }
|
||||
public UnitsStress StressUnits { get; set; }
|
||||
public UnitsArea AreasUnits { get; set; }
|
||||
public UnitsLin LenghtsUnits { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct DataPairProps
|
||||
{
|
||||
public string Описание { get; set; }
|
||||
public object Параметр { get; set; }
|
||||
public UnitsList Ед_изм { get; set; }
|
||||
}
|
||||
}
|
||||
404
BL/DataR.cs
Normal file
@@ -0,0 +1,404 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public struct DataR
|
||||
{
|
||||
public string Bore { get; set; }
|
||||
public string Base { get; set; }
|
||||
public double R { get; set; }
|
||||
public double P { get; set; }
|
||||
public double PmaxX { get; set; }
|
||||
public double PmaxY { get; set; }
|
||||
public double GapX { get; set; }
|
||||
public double GapY { get; set; }
|
||||
public double CheckP { get; set; }
|
||||
public double CheckGap { get; set; }
|
||||
public double YIIu { get; set; }
|
||||
public double YII { get; set; }
|
||||
public double FiII { get; set; }
|
||||
public double CII { get; set; }
|
||||
public double Yc1 { get; set; }
|
||||
public double Yc2 { get; set; }
|
||||
public double My { get; set; }
|
||||
public double Mq { get; set; }
|
||||
public double Mc { get; set; }
|
||||
public double IL { get; set; }
|
||||
public double Ys { get; set; }
|
||||
public double Ke { get; set; }
|
||||
public double Kz { get; set; }
|
||||
public double K { get; set; }
|
||||
public double d1 { get; set; }
|
||||
public double db { get; set; }
|
||||
public string Ground { get; set; }
|
||||
public string GroundType { get; set; }
|
||||
public List<DataPair> FullData { get; private set; }
|
||||
public List<DataPair> MediumData { get; private set; }
|
||||
public List<DataPair> SmallData { get; private set; }
|
||||
|
||||
internal void CreateFullData()
|
||||
{
|
||||
FullData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Скважина", Параметр = Bore };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина заложения", Параметр = d1, LenghtsUnits = UnitsLin.м };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина подвала", Параметр = db, LenghtsUnits = UnitsLin.м };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Грунт под подошвой", Параметр = Ground };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Объемный вес (осредненный) грунта выше подошвы", Параметр = YIIu,
|
||||
AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Объемный вес (осредненный) грунта ниже подошвы", Параметр = YII,
|
||||
AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Угол внутреннего трения грунта основания (осредненный)", Параметр = FiII };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Удельное сцепление грунта основания (осредненное)", Параметр = CII,
|
||||
AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Показатель текучести грунта основания ", Параметр = IL };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент пористости грунта основания ", Параметр = Ke };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Тип грунта основания согласно таблице 5.4", Параметр = GroundType };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Yc1 согласно таблице 5.4", Параметр = Yc1 };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Yc2 согласно таблице 5.4", Параметр = Yc2 };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт My согласно таблице 5.5", Параметр = My };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Mq согласно таблице 5.5", Параметр = Mq };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Mc согласно таблице 5.5", Параметр = Mc };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Kz", Параметр = Kz };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт K", Параметр = K };
|
||||
FullData.Add(dataPair);
|
||||
|
||||
}
|
||||
internal void CreateMediumData()
|
||||
{
|
||||
MediumData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина заложения", Параметр = d1, LenghtsUnits = UnitsLin.м };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина подвала", Параметр = db, LenghtsUnits = UnitsLin.м };
|
||||
MediumData.Add(dataPair);
|
||||
//dataPair = new DataPair() { Descriptions = "Грунт под подошвой", DataEntity = Ground };
|
||||
//MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта выше подошвы",
|
||||
Параметр = YIIu,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта ниже подошвы",
|
||||
Параметр = YII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Угол внутреннего трения грунта основания (осредненный)", Параметр = FiII };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Удельное сцепление грунта основания (осредненное)",
|
||||
Параметр = CII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
}
|
||||
internal void CreateSmallData()
|
||||
{
|
||||
SmallData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
SmallData.Add(dataPair);
|
||||
}
|
||||
|
||||
internal List<DataPair> FullResults()
|
||||
{
|
||||
FullData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Скважина", Параметр = Bore };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина заложения", Параметр = d1, LenghtsUnits = UnitsLin.м };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина подвала", Параметр = db, LenghtsUnits = UnitsLin.м };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Грунт под подошвой", Параметр = Ground };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта выше подошвы",
|
||||
Параметр = YIIu,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта ниже подошвы",
|
||||
Параметр = YII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Угол внутреннего трения грунта основания (осредненный)", Параметр = FiII };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Удельное сцепление грунта основания (осредненное)",
|
||||
Параметр = CII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Показатель текучести грунта основания ", Параметр = IL };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент пористости грунта основания ", Параметр = Ke };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Тип грунта основания согласно таблице 5.4", Параметр = GroundType };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Yc1 согласно таблице 5.4", Параметр = Yc1 };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Yc2 согласно таблице 5.4", Параметр = Yc2 };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт My согласно таблице 5.5", Параметр = My };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Mq согласно таблице 5.5", Параметр = Mq };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Mc согласно таблице 5.5", Параметр = Mc };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт Kz", Параметр = Kz };
|
||||
FullData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффицинт K", Параметр = K };
|
||||
FullData.Add(dataPair);
|
||||
|
||||
return FullData;
|
||||
}
|
||||
internal List<DataPair> MediumResults()
|
||||
{
|
||||
MediumData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина заложения", Параметр = d1, LenghtsUnits = UnitsLin.м };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Глубина подвала", Параметр = db, LenghtsUnits = UnitsLin.м };
|
||||
MediumData.Add(dataPair);
|
||||
//dataPair = new DataPair() { Descriptions = "Грунт под подошвой", DataEntity = Ground };
|
||||
//MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта выше подошвы",
|
||||
Параметр = YIIu,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Объемный вес (осредненный) грунта ниже подошвы",
|
||||
Параметр = YII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Угол внутреннего трения грунта основания (осредненный)", Параметр = FiII };
|
||||
MediumData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Удельное сцепление грунта основания (осредненное)",
|
||||
Параметр = CII,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
MediumData.Add(dataPair);
|
||||
|
||||
return MediumData;
|
||||
}
|
||||
internal List<DataPair> SmallResults()
|
||||
{
|
||||
SmallData = new List<DataPair>();
|
||||
DataPair dataPair = new DataPair() { Описание = "Фундамент", Параметр = Base };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Расчетное сопротивление", Параметр = R, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Среднее давление под подошвой", Параметр = P, AreasUnits = UnitsArea.м, ForcesUnits = UnitsForce.т };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении длины фундамента",
|
||||
Параметр = PmaxX,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair()
|
||||
{
|
||||
Описание = "Максимальное давление под подошвой в направлении ширины фундамента",
|
||||
Параметр = PmaxY,
|
||||
AreasUnits = UnitsArea.м,
|
||||
ForcesUnits = UnitsForce.т
|
||||
};
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении длины фундамента", Параметр = GapX };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Отрыв в направлении ширины фундамента", Параметр = GapY };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Максимальный отрыв подошвы", Параметр = CheckGap };
|
||||
SmallData.Add(dataPair);
|
||||
dataPair = new DataPair() { Описание = "Коэффициент использования расчетного сопротивления", Параметр = CheckP };
|
||||
SmallData.Add(dataPair);
|
||||
|
||||
return SmallData;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
BL/DataS.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public struct DataS
|
||||
{
|
||||
public string Bore { get; set; }
|
||||
public string Base { get; set; }
|
||||
public double Sp { get; set; }
|
||||
public double Sr { get; set; }
|
||||
public double p { get; set; }
|
||||
public double Hc { get; set; }
|
||||
public double Hmin { get; set; }
|
||||
public double YIIu { get; set; }
|
||||
public List<double> Z { get; set; }
|
||||
public List<double?> Alfa { get; set; }
|
||||
public List<double> sig_zp { get; set; }
|
||||
public List<double> sig_zy { get; set; }
|
||||
public List<double> sig_zg { get; set; }
|
||||
public List<double> E { get; set; }
|
||||
public List<double> N { get; set; }
|
||||
}
|
||||
}
|
||||
18
BL/Enums.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public enum TypeFound { Прямоугольный, Ленточный, Круглый }
|
||||
public enum PointFound { Центр, Угол}
|
||||
public enum TypeFlexStructure { Гибкая, Жесткая }
|
||||
public enum ResKey { eps_b_max, eps_b_min, sig_b_max, sig_b_min, eps_bult, eps_s_max, eps_s_min, sig_s_max, sig_s_min, asel, kf, Mxult, Myult, Nult, Mxcrc, Mycrc, num_itr, rep, info }
|
||||
public enum SecShape { прямоугольник, круг, кольцо, тавр_с_полками_вверху, тавр_с_полками_внизу, двутавр, короб, пользовательское }
|
||||
public enum ElementType { стержень, пластина }
|
||||
public enum CharMat { C, CL, N, NL }
|
||||
public enum LongForces { кратковременное, длительное }
|
||||
public enum Vlajnost { Ниже_40, От_40_до_75, Выше_75 }
|
||||
public enum Orientation { вертикальная, горизонтальная }
|
||||
public enum ClassBet { B10, B15, B20, B25, B30, B35, B40, B45, B50, B55, B60 }
|
||||
public enum ClassArm { A240, A400, A500, B500, A600, A800, A1000, Bp500, Bp1200 }
|
||||
public enum TypeDiagramm { трехлинейная, двухлинейная }
|
||||
public enum TypeLayer { Au, As1, As2, As3, As4, одиночный, радиальный, линейный, AuAs }
|
||||
public enum ParamsLayer { AsDs, AsNd, DsNd }
|
||||
}
|
||||
82
BL/FoundLoad.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class FoundLoad
|
||||
{
|
||||
public double NC { get; set; }
|
||||
public double MxC { get; set; }
|
||||
public double MyC { get; set; }
|
||||
public double QyC { get; set; }
|
||||
public double QxC { get; set; }
|
||||
|
||||
|
||||
public double N { get; set; }
|
||||
public double Mx { get; set; }
|
||||
public double My { get; set; }
|
||||
public double Qy { get; set; }
|
||||
public double Qx { get; set; }
|
||||
public double q { get; set; }
|
||||
|
||||
public int Number { get; set; }
|
||||
|
||||
public bool InFoot { get; set; }
|
||||
|
||||
public UnitsForce UnitsF { get; set; }
|
||||
public UnitsLin UnitsL { get; set; }
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number + s + N + s + Mx + s + My + s + Qx + s + Qy + s + q;
|
||||
}
|
||||
|
||||
internal List<object> PropsToList()
|
||||
{
|
||||
return new List<object> { Number, N, Mx, My, Qx, Qy, q, InFoot };
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
N = double.Parse(src[1]);
|
||||
Mx = double.Parse(src[2]);
|
||||
My = double.Parse(src[3]);
|
||||
Qx = double.Parse(src[4]);
|
||||
Qy = double.Parse(src[5]);
|
||||
q = double.Parse(src[6]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal void ListToProps(List<object> src)
|
||||
{
|
||||
try
|
||||
{
|
||||
Number = (int)(double)src[0];
|
||||
N = (double)src[1];
|
||||
Mx = (double)src[2];
|
||||
My = (double)src[3];
|
||||
Qx = (double)src[4];
|
||||
Qy = (double)src[5];
|
||||
q = (double)src[6];
|
||||
InFoot = (bool)src[7];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
920
BL/Foundation.cs
Normal file
@@ -0,0 +1,920 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Geo;
|
||||
using TriangleNet;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Meshing;
|
||||
using TriangleNet.Tools;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class Foundation
|
||||
{
|
||||
public int Number { get; set; }
|
||||
public string Name { get; set; }
|
||||
public TypeFound Type { get; set; }
|
||||
public bool Basement { get; set; }
|
||||
public double B { get; set; }
|
||||
public double L { get; set; }
|
||||
public double Db { get; set; }
|
||||
public double D1 { get; set; }
|
||||
public double H { get; set; }
|
||||
public double AlfaDeg { get; set; }
|
||||
public double Hs { get; set; }
|
||||
public double Hcf { get; set; }
|
||||
public double Ycf { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
/// <summary>
|
||||
/// Относительная отметка подошвы фундамента
|
||||
/// </summary>
|
||||
public double FL { get; set; }
|
||||
/// <summary>
|
||||
/// Абсолютная отметка планировки в центральной точке фундамента
|
||||
/// </summary>
|
||||
public double DL { get; set; }
|
||||
/// <summary>
|
||||
/// Абсолютная отметка естественного рельефа в центральной точке фундамента
|
||||
/// </summary>
|
||||
public double NL { get; set; }
|
||||
public ObservableCollection<FoundLoad> Loads { get; set; }
|
||||
public UnitsForce UnitsF { get; set; }
|
||||
public UnitsLin UnitsL { get; set; }
|
||||
public Quadrangle Contour { get; set; }
|
||||
|
||||
public List<DataPair> FullResults { get; private set; }
|
||||
public List<DataPairProps> FullProps { get; private set; }
|
||||
public List<DataPair> MediumResults { get; private set; }
|
||||
public List<DataPairProps> MediumProps { get; private set; }
|
||||
public List<DataPair> SmallResults{ get; private set; }
|
||||
public List<DataPairProps> SmallProps{ get; private set; }
|
||||
|
||||
public Foundation()
|
||||
{
|
||||
Loads = new ObservableCollection<FoundLoad>();
|
||||
Type = TypeFound.Прямоугольный;
|
||||
UnitsF = UnitsForce.т;
|
||||
UnitsL = UnitsLin.м;
|
||||
Ycf = 2.2;
|
||||
FullResults = new List<DataPair>();
|
||||
MediumResults = new List<DataPair>();
|
||||
SmallResults = new List<DataPair>();
|
||||
}
|
||||
|
||||
public Foundation(Quadrangle cntr)
|
||||
{
|
||||
if (cntr.Units == UnitsLin.см)
|
||||
{
|
||||
Contour.Vertex1 = cntr.Vertex1 * 0.01;
|
||||
Contour.Vertex2 = cntr.Vertex2 * 0.01;
|
||||
Contour.Vertex3 = cntr.Vertex3 * 0.01;
|
||||
Contour.Vertex4 = cntr.Vertex4 * 0.01;
|
||||
}
|
||||
if (cntr.Units == UnitsLin.мм)
|
||||
{
|
||||
Contour.Vertex1 = cntr.Vertex1 * 0.001;
|
||||
Contour.Vertex2 = cntr.Vertex2 * 0.001;
|
||||
Contour.Vertex3 = cntr.Vertex3 * 0.001;
|
||||
Contour.Vertex4 = cntr.Vertex4 * 0.001;
|
||||
}
|
||||
if(cntr.Units == UnitsLin.м) Contour = cntr;
|
||||
|
||||
X = Math.Round(Contour.Centroid.X, 3);
|
||||
Y = Math.Round(Contour.Centroid.Y, 3);
|
||||
|
||||
IOrderedEnumerable<Line2d> selected = from l in Contour.Segments // определяем каждый объект как
|
||||
orderby l.Length // упорядочиваем по возрастанию
|
||||
select l; // выбираем объект
|
||||
|
||||
AlfaDeg = Math.Round(RadToDeg(Math.Acos(selected.First().Directive.Vx / selected.First().Length)), 3);
|
||||
B = Math.Round(selected.First().Length, 3);
|
||||
L = Math.Round(selected.Last().Length, 3);
|
||||
|
||||
Loads = new ObservableCollection<FoundLoad>();
|
||||
Type = TypeFound.Прямоугольный;
|
||||
UnitsF = UnitsForce.т;
|
||||
UnitsL = UnitsLin.м;
|
||||
Ycf = 2.2;
|
||||
FullResults = new List<DataPair>();
|
||||
MediumResults = new List<DataPair>();
|
||||
SmallResults = new List<DataPair>();
|
||||
}
|
||||
|
||||
internal void CreateFullPropsList()
|
||||
{
|
||||
FullProps = new List<DataPairProps>();
|
||||
DataPairProps dataPair = new DataPairProps() { Описание = "Номер", Параметр = Number };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Марка", Параметр = Name };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Ширина", Параметр = B, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Длина", Параметр = L, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Высота", Параметр = H, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка подошвы", Параметр = FL, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Глубина заложения", Параметр = D1, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка планировки", Параметр = DL };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка рельефа", Параметр = NL };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Наличие подвала", Параметр = Basement };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Глубина подвала", Параметр = Db, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "h_s", Параметр = Hs, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "h_cf", Параметр = Hcf, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Ycf, т/м3", Параметр = Ycf };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Х", Параметр = X, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Y", Параметр = Y, Ед_изм = UnitsList.м };
|
||||
FullProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Поворот", Параметр = AlfaDeg, Ед_изм= UnitsList.градус };
|
||||
FullProps.Add(dataPair);
|
||||
|
||||
}
|
||||
|
||||
internal void CreateMediumPropsList()
|
||||
{
|
||||
MediumProps = new List<DataPairProps>();
|
||||
DataPairProps dataPair = new DataPairProps() { Описание = "Номер", Параметр = Number };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Марка", Параметр = Name };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Ширина", Параметр = B, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Длина", Параметр = L, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Высота", Параметр = H, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка подошвы", Параметр = FL, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Глубина заложения", Параметр = D1, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка планировки", Параметр = DL };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка рельефа", Параметр = NL };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Наличие подвала", Параметр = Basement };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Глубина подвала", Параметр = Db, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "h_s", Параметр = Hs, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "h_cf", Параметр = Hcf, Ед_изм = UnitsList.м };
|
||||
MediumProps.Add(dataPair);
|
||||
}
|
||||
|
||||
internal void CreateSmallPropsList()
|
||||
{
|
||||
SmallProps = new List<DataPairProps>();
|
||||
DataPairProps dataPair = new DataPairProps() { Описание = "Номер", Параметр = Number };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Марка", Параметр = Name };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Ширина b", Параметр = B, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Длина l", Параметр = L, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Высота h", Параметр = H, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка подошвы FL", Параметр = FL, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Глубина заложения d_1", Параметр = D1, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка планировки DL", Параметр = DL, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
dataPair = new DataPairProps() { Описание = "Отметка рельефа NL", Параметр = NL, Ед_изм = UnitsList.м };
|
||||
SmallProps.Add(dataPair);
|
||||
}
|
||||
|
||||
public DataS Sp(Bore bore, FoundLoad load, double kHc = 0.5, PointFound ptFond = PointFound.Центр)
|
||||
{
|
||||
DataS res = new DataS();
|
||||
List<Layer> downFS = DownFS(bore);
|
||||
List<double> n = res.N;
|
||||
n = new List<double>();
|
||||
|
||||
foreach (Layer item in downFS)
|
||||
{
|
||||
n.Add(Math.Ceiling(item.H / (0.4 * B)));
|
||||
}
|
||||
|
||||
List<Layer> layers = new List<Layer>();
|
||||
for (int i = 0; i < n.Count; i++)
|
||||
{
|
||||
double z = downFS[i].Up;
|
||||
double dlt = downFS[i].H / n[i];
|
||||
while (downFS[i].Down > z)
|
||||
{
|
||||
z += dlt;
|
||||
Layer lay = downFS[i].Clone();
|
||||
lay.Down = z;
|
||||
lay.H = dlt;
|
||||
lay.Up = z - dlt;
|
||||
layers.Add(lay);
|
||||
}
|
||||
}
|
||||
|
||||
double FL;
|
||||
if (Basement) FL = Hs + Hcf + Db;
|
||||
else FL = D1;
|
||||
|
||||
res.Z = new List<double>() { 0 };
|
||||
foreach (Layer item in layers)
|
||||
{
|
||||
res.Z.Add(item.Up + 0.5 * item.H - FL);
|
||||
}
|
||||
|
||||
res.Alfa = TablesInterolator.Table_5_8(res.Z, B, L, Type);
|
||||
|
||||
List<Layer> upF = UpF(bore);
|
||||
double roh = 0;
|
||||
double h = 0;
|
||||
if (upF.Count > 0)
|
||||
{
|
||||
foreach (Layer item in upF)
|
||||
{
|
||||
roh += item.H * item.IGE.RoII;
|
||||
h += item.H;
|
||||
}
|
||||
}
|
||||
res.YIIu = Math.Round(roh / h, 3);
|
||||
|
||||
double sig_zg0 = res.YIIu * FL;
|
||||
double p = load.N / (B * L) + load.q + 2 * FL;
|
||||
|
||||
res.sig_zy = new List<double>();
|
||||
res.sig_zp = new List<double>();
|
||||
for (int i = 0; i < res.Z.Count; i++)
|
||||
{
|
||||
res.sig_zp.Add((double)res.Alfa[i] * p);
|
||||
res.sig_zy.Add((double)res.Alfa[i] * sig_zg0);
|
||||
}
|
||||
|
||||
res.sig_zg = new List<double> { sig_zg0 };
|
||||
res.E = new List<double>();
|
||||
for (int i = 0; i < layers.Count; i++)
|
||||
{
|
||||
res.sig_zg.Add(sig_zg0 + layers[i].IGE.RoII * (res.Z[i + 1] - (layers[i].Up - FL)));
|
||||
sig_zg0 += layers[i].H * layers[i].IGE.RoII;
|
||||
res.E.Add(layers[i].IGE.E * 101.972);
|
||||
}
|
||||
|
||||
sig_zg0 = res.YIIu * FL;
|
||||
|
||||
if (B <= 10) res.Hmin = B / 2;
|
||||
else if (B > 10 && B <= 60) res.Hmin = 4 + 0.1 * B;
|
||||
else res.Hmin = 10;
|
||||
|
||||
int j = 0;
|
||||
for (int i = 0; i < layers.Count; i++)
|
||||
{
|
||||
if (res.sig_zp[i] >= kHc * res.sig_zg[i])
|
||||
{
|
||||
res.Hc = res.Z[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int t = 0; double pt = layers[t].H;
|
||||
while (pt <= res.Hmin)
|
||||
{
|
||||
t++;
|
||||
pt += layers[t].H;
|
||||
}
|
||||
|
||||
if (res.Hmin > res.Hc)
|
||||
{
|
||||
res.Hc = res.Hmin;
|
||||
j = t;
|
||||
}
|
||||
|
||||
if (sig_zg0 >= p)
|
||||
{
|
||||
for (int i = 0; i <= j; i++)
|
||||
{
|
||||
res.Sp += res.sig_zp[i + 1] * layers[i].H / (5 * res.E[i]);
|
||||
}
|
||||
res.Sp *= 0.8;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= j; i++)
|
||||
{
|
||||
res.Sp += (res.sig_zp[i + 1] - res.sig_zy[i + 1]) * layers[i].H / res.E[i] + res.sig_zy[i + 1] * layers[i].H / (5 * res.E[i]);
|
||||
}
|
||||
res.Sp *= 0.8;
|
||||
}
|
||||
|
||||
res.Sp = Math.Round(res.Sp * 100, 1);
|
||||
res.p = Math.Round(p, 2);
|
||||
|
||||
return res;
|
||||
}
|
||||
public DataR P(Bore bore, TypeFlexStructure ts, double ls, double hs, double k = 1)
|
||||
{
|
||||
DataR dataR = R(bore, ts, ls, hs, k);
|
||||
dataR.Base = Name;
|
||||
dataR.Bore = "Скв." + bore.Name;
|
||||
|
||||
if (Loads == null || Loads.Count == 0)
|
||||
{
|
||||
FullResults = dataR.FullResults();
|
||||
MediumResults = dataR.MediumResults();
|
||||
SmallResults = dataR.SmallResults();
|
||||
return dataR;
|
||||
}
|
||||
List<double> P = new List<double>(Loads.Count);
|
||||
List<double> PmaxX = new List<double>(Loads.Count);
|
||||
List<double> PmaxY = new List<double>(Loads.Count);
|
||||
List<double> chP = new List<double>(Loads.Count);
|
||||
List<double> GapX = new List<double>(Loads.Count);
|
||||
List<double> GapY = new List<double>(Loads.Count);
|
||||
List<double> chGap = new List<double>(Loads.Count);
|
||||
foreach (FoundLoad item in Loads)
|
||||
{
|
||||
P.Add(item.N / (B * L) + item.q + 2 * D1);
|
||||
double ex = (Math.Abs(item.Mx) / (item.N + 2 * D1 * L * B)) / L;
|
||||
double wx = (B * L * L * L) / 6;
|
||||
double pmaxx;
|
||||
if (ex <= (1.0 / 6)) {pmaxx= item.N / (B * L) + 2 * D1 + Math.Abs(item.Mx) / wx; PmaxX.Add(pmaxx); GapX.Add(0); ex = 0; }
|
||||
else
|
||||
{
|
||||
double C0x = 0.5 * L - item.Mx / (item.N + 2 * D1 * L * B);
|
||||
pmaxx = 2 * (item.N + 2 * D1 * L * B) / (3 * B * C0x);
|
||||
PmaxX.Add(pmaxx);
|
||||
GapX.Add(ex);
|
||||
}
|
||||
double ey = (Math.Abs(item.My) / (item.N + 2 * D1 * L * B)) / B;
|
||||
double wy = (L * B * B * B) / 6;
|
||||
double pmaxy;
|
||||
if (ey <= (1.0 / 6)) {pmaxy= item.N / (B * L) + 2 * D1 + Math.Abs(item.My) / wy; PmaxY.Add(pmaxy); GapY.Add(0); ey = 0; }
|
||||
else
|
||||
{
|
||||
double C0y = 0.5 * B - item.My / (item.N + 2 * D1 * L * B);
|
||||
pmaxy = 2 * (item.N + 2 * D1 * L * B) / (3 * L * C0y);
|
||||
PmaxY.Add(pmaxy);
|
||||
GapY.Add(ey);
|
||||
}
|
||||
chGap.Add(Math.Max(ex, ey));
|
||||
List<double> chp = new List<double> { (item.N / (B * L) + item.q + 2 * D1) / dataR.R, pmaxx / (1.2 * dataR.R), pmaxy / (1.2 * dataR.R) };
|
||||
chP.Add(chp.Max());
|
||||
}
|
||||
dataR.P = Math.Round(P.Max(), 3);
|
||||
dataR.PmaxX = Math.Round(PmaxX.Max(), 3);
|
||||
dataR.PmaxY = Math.Round(PmaxY.Max(), 3);
|
||||
dataR.CheckP = Math.Round(chP.Max(), 3);
|
||||
dataR.CheckGap = Math.Round(chGap.Max(), 3);
|
||||
dataR.GapX = Math.Round(GapX.Max(), 3);
|
||||
dataR.GapY = Math.Round(GapY.Max(), 3);
|
||||
|
||||
FullResults = dataR.FullResults();
|
||||
MediumResults = dataR.MediumResults();
|
||||
SmallResults = dataR.SmallResults();
|
||||
|
||||
return dataR;
|
||||
}
|
||||
public ObservableCollection<DataR> P(ObservableCollection<Bore> bores, TypeFlexStructure ts, double ls, double hs, double k = 1)
|
||||
{
|
||||
ObservableCollection<DataR> res = new ObservableCollection<DataR>();
|
||||
foreach (Bore bore in bores)
|
||||
{
|
||||
DataR dataR = R(bore, ts, ls, hs, k);
|
||||
dataR.Base = Name;
|
||||
dataR.Bore = "Скв." + bore.Name;
|
||||
|
||||
if (Loads == null || Loads.Count == 0)
|
||||
{
|
||||
dataR.CreateFullData();
|
||||
dataR.CreateMediumData();
|
||||
dataR.CreateSmallData();
|
||||
res.Add(dataR);
|
||||
continue;
|
||||
}
|
||||
List<double> P = new List<double>(Loads.Count);
|
||||
List<double> PmaxX = new List<double>(Loads.Count);
|
||||
List<double> PmaxY = new List<double>(Loads.Count);
|
||||
List<double> chP = new List<double>(Loads.Count);
|
||||
List<double> GapX = new List<double>(Loads.Count);
|
||||
List<double> GapY = new List<double>(Loads.Count);
|
||||
List<double> chGap = new List<double>(Loads.Count);
|
||||
foreach (FoundLoad item in Loads)
|
||||
{
|
||||
P.Add(item.N / (B * L) + item.q + 2 * D1);
|
||||
double ex = (item.Mx / (item.N + 2 * D1 * L * B)) / L;
|
||||
double wx = (B * L * L * L) / 6;
|
||||
double pmaxx;
|
||||
if (ex <= 1 / 6) { pmaxx = item.N / (B * L) + 2 * D1 + Math.Abs(item.Mx) / wx; PmaxX.Add(pmaxx); GapX.Add(0); ex = 0; }
|
||||
else
|
||||
{
|
||||
double C0x = 0.5 * L - item.Mx / (item.N + 2 * D1 * L * B);
|
||||
pmaxx = 2 * (item.N + 2 * D1 * L * B) / (3 * B * C0x);
|
||||
PmaxX.Add(pmaxx);
|
||||
GapX.Add(ex);
|
||||
}
|
||||
double ey = (item.My / (item.N + 2 * D1 * L * B)) / B;
|
||||
double wy = (L * B * B * B) / 6;
|
||||
double pmaxy;
|
||||
if (ey <= 1 / 6) { pmaxy = item.N / (B * L) + 2 * D1 + Math.Abs(item.My) / wy; PmaxY.Add(pmaxy); GapY.Add(0); ey = 0; }
|
||||
else
|
||||
{
|
||||
double C0y = 0.5 * B - item.My / (item.N + 2 * D1 * L * B);
|
||||
pmaxy = 2 * (item.N + 2 * D1 * L * B) / (3 * L * C0y);
|
||||
PmaxY.Add(pmaxy);
|
||||
GapY.Add(ey);
|
||||
}
|
||||
chGap.Add(Math.Max(ex, ey));
|
||||
List<double> chp = new List<double> { (item.N / (B * L) + item.q + 2 * D1) / dataR.R, pmaxx / (1.2 * dataR.R), pmaxy / (1.2 * dataR.R) };
|
||||
chP.Add(chp.Max());
|
||||
}
|
||||
dataR.P = Math.Round(P.Max(), 3);
|
||||
dataR.PmaxX = Math.Round(PmaxX.Max(), 3);
|
||||
dataR.PmaxY = Math.Round(PmaxY.Max(), 3);
|
||||
dataR.CheckP = Math.Round(chP.Max(), 3);
|
||||
dataR.CheckGap = Math.Round(chGap.Max(), 3);
|
||||
dataR.GapX = Math.Round(GapX.Max(), 3);
|
||||
dataR.GapY = Math.Round(GapY.Max(), 3);
|
||||
|
||||
dataR.CreateFullData();
|
||||
dataR.CreateMediumData();
|
||||
dataR.CreateSmallData();
|
||||
|
||||
res.Add(dataR);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
private DataR R(Bore bore, TypeFlexStructure ts, double ls, double hs, double k = 1)
|
||||
{
|
||||
DataR res = new DataR();
|
||||
List<Layer> upF = UpF(bore);
|
||||
List<Layer> downF = DownF(bore);
|
||||
double roh = 0;
|
||||
double h = 0;
|
||||
if (upF.Count > 0)
|
||||
{
|
||||
foreach (Layer item in upF)
|
||||
{
|
||||
roh += item.H * item.IGE.RoII;
|
||||
h += item.H;
|
||||
}
|
||||
}
|
||||
res.YIIu = Math.Round(roh / h, 3);
|
||||
|
||||
double fih = 0;
|
||||
double ch = 0;
|
||||
roh = 0;
|
||||
h = 0;
|
||||
if (downF.Count > 0)
|
||||
{
|
||||
foreach (Layer item in downF)
|
||||
{
|
||||
fih += item.H * item.IGE.FiII;
|
||||
ch += item.H * item.IGE.CII * 100;
|
||||
roh += item.H * item.IGE.RoII;
|
||||
h += item.H;
|
||||
}
|
||||
}
|
||||
res.YII = Math.Round(roh / h, 3);
|
||||
res.FiII = Math.Round(fih / h);
|
||||
res.CII = Math.Round(ch / h, 3);
|
||||
res.IL = downF[0].IGE.IL;
|
||||
res.Ke = downF[0].IGE.Ke;
|
||||
res.Ys = downF[0].IGE.Ys;
|
||||
res.Ground = "ИГЭ " + downF[0].IGE.NumIGE + " " + downF[0].IGE.Description;
|
||||
res.GroundType = downF[0].IGE.GroundType;
|
||||
res.Yc1 = TablesInterolator.Yc1(res.GroundType);
|
||||
res.Yc2 = TablesInterolator.Yc2(res.GroundType, ts, ls, hs);
|
||||
double[] MyMqMc = TablesInterolator.My_Mq_Mc(res.FiII);
|
||||
res.My = MyMqMc[0];
|
||||
res.Mq = MyMqMc[1];
|
||||
res.Mc = MyMqMc[2];
|
||||
res.K = k;
|
||||
|
||||
if (B < 10) res.Kz = 1;
|
||||
else res.Kz = 8 / B + 0.2;
|
||||
|
||||
if (Basement) res.d1 = Math.Round(Hs + Hcf * (Ycf / res.YIIu), 3);
|
||||
else res.d1 = D1;
|
||||
|
||||
if (Basement && Db > 2) res.db = 2;
|
||||
else if (Basement && Db <= 2) res.db = Db;
|
||||
else res.db = 0;
|
||||
|
||||
res.R = res.Yc1 * res.Yc2 * (res.My * res.Kz * B * res.YII + res.Mq * res.d1 * res.YIIu + (res.Mq - 1) * res.db * res.YIIu + res.Mc * res.CII) / k;
|
||||
res.R = Math.Round(res.R, 2);
|
||||
//res.GroundType = "";
|
||||
|
||||
return res;
|
||||
}
|
||||
private List<Layer> UpF(Bore bore)
|
||||
{
|
||||
List<Layer> res = new List<Layer>();
|
||||
double d;
|
||||
if (Basement) d = Hs + Hcf + Db;
|
||||
else d = D1;
|
||||
|
||||
double FL;
|
||||
FL = d;
|
||||
|
||||
Bore boreW = BoreW(bore);
|
||||
if (boreW.Layers.Count == 0) return res;
|
||||
foreach (Layer item in boreW.Layers)
|
||||
{
|
||||
if (item.Up > FL) break;
|
||||
res.Add(item.Clone());
|
||||
}
|
||||
res[res.Count - 1].Down = FL;
|
||||
res[res.Count - 1].H = res[res.Count - 1].Down - res[res.Count - 1].Up;
|
||||
|
||||
return res;
|
||||
}
|
||||
private List<Layer> DownF(Bore bore)
|
||||
{
|
||||
List<Layer> res = new List<Layer>();
|
||||
double d, z;
|
||||
if (Basement) d = Hs + Hcf + Db;
|
||||
else d = D1;
|
||||
|
||||
if (B < 10) z = 0.5 * B;
|
||||
else z = 4 + 0.1 * B;
|
||||
|
||||
double FL, ZL;
|
||||
FL = d;
|
||||
ZL = d + z;
|
||||
|
||||
Bore boreW = BoreW(bore);
|
||||
if (boreW.Layers.Count == 0) return res;
|
||||
foreach (Layer item in boreW.Layers)
|
||||
{
|
||||
if (item.Down > FL) res.Add(item.Clone());
|
||||
if (item.Down >= ZL) break;
|
||||
}
|
||||
res[0].Up = FL;
|
||||
res[0].H = res[0].Down - res[0].Up;
|
||||
res[res.Count - 1].Down = ZL;
|
||||
res[res.Count - 1].H = res[res.Count - 1].Down - res[res.Count - 1].Up;
|
||||
return res;
|
||||
}
|
||||
private List<Layer> UpW(Bore bore)
|
||||
{
|
||||
List<Layer> res = new List<Layer>();
|
||||
foreach (Layer item in bore.Layers)
|
||||
{
|
||||
if (item.Up > bore.WL) break;
|
||||
res.Add(item.Clone());
|
||||
}
|
||||
if (res.Count > 0)
|
||||
{
|
||||
res[res.Count - 1].Down = (double)bore.WL;
|
||||
res[res.Count - 1].H = res[res.Count - 1].Down - res[res.Count - 1].Up;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private List<Layer> DownW(Bore bore)
|
||||
{
|
||||
List<Layer> layers = new List<Layer>(bore.Layers.Reverse());
|
||||
List<Layer> res = new List<Layer>();
|
||||
foreach (Layer item in layers)
|
||||
{
|
||||
if (item.Down <= bore.WL) break;
|
||||
if (item.IGE.W) item.IGE.RoII = (item.IGE.Ys - 1) / (1 + item.IGE.Ke);
|
||||
res.Add(item.Clone());
|
||||
}
|
||||
if (res.Count > 0)
|
||||
{
|
||||
res.Reverse();
|
||||
res[0].Up = (double)bore.WL;
|
||||
res[0].H = res[0].Down - res[0].Up;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private List<Layer> DownFS(Bore bore)
|
||||
{
|
||||
List<Layer> res = new List<Layer>();
|
||||
double FL;
|
||||
|
||||
if (Basement) FL = Hs + Hcf + Db;
|
||||
else FL = D1;
|
||||
|
||||
Bore boreW = BoreW(bore);
|
||||
if (boreW.Layers.Count == 0) return res;
|
||||
|
||||
foreach (Layer item in boreW.Layers.Reverse())
|
||||
{
|
||||
if (item.Down < FL) break;
|
||||
res.Add(item.Clone());
|
||||
}
|
||||
|
||||
if (res.Count > 0) res.Reverse();
|
||||
res[0].Up = FL;
|
||||
res[0].H = res[0].Down - res[0].Up;
|
||||
|
||||
return res;
|
||||
}
|
||||
private Bore BoreW(Bore bore)
|
||||
{
|
||||
Bore res = new Bore
|
||||
{
|
||||
Name = bore.Name,
|
||||
Number = bore.Number,
|
||||
WL = bore.WL,
|
||||
X = bore.X,
|
||||
Y = bore.Y,
|
||||
Z = bore.Z
|
||||
};
|
||||
List<Layer> downW = DownW(bore);
|
||||
List<Layer> layers = new List<Layer>(UpW(bore));
|
||||
if (downW.Count > 0) layers.AddRange(downW);
|
||||
if (layers.Count > 0)
|
||||
{
|
||||
res.Layers = new ObservableCollection<Layer>(layers);
|
||||
res.Layers[res.Layers.Count - 1].Down = res.Layers[res.Layers.Count - 1].Down + bore.DZ;
|
||||
res.Layers[res.Layers.Count - 1].H = res.Layers[res.Layers.Count - 1].H + bore.DZ;
|
||||
res.Layers[res.Layers.Count - 1].Z = res.Layers[res.Layers.Count - 1].Z - bore.DZ;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
bore.Layers[bore.Layers.Count - 1].Down = bore.Layers[bore.Layers.Count - 1].Down + bore.DZ;
|
||||
bore.Layers[bore.Layers.Count - 1].H = bore.Layers[bore.Layers.Count - 1].H + bore.DZ;
|
||||
bore.Layers[bore.Layers.Count - 1].Z = bore.Layers[bore.Layers.Count - 1].Z - bore.DZ;
|
||||
return bore;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CalcDL(Structure str)
|
||||
{
|
||||
if (str == null || str.RedPlanning == null || str.RedPlanning.Count == 0) return;
|
||||
|
||||
List<Vertex> vrtxs = new List<Vertex>();
|
||||
Vertex vrtx;
|
||||
int i = 1;
|
||||
foreach (PlanningVertex item in str.RedPlanning)
|
||||
{
|
||||
vrtx = new Vertex(item.X, item.Y, item.Number, 2);
|
||||
vrtx.Attributes[0] = item.Red;
|
||||
vrtx.Attributes[1] = item.Black;
|
||||
vrtxs.Add(vrtx);
|
||||
i++;
|
||||
}
|
||||
|
||||
Contour cnt = new Contour(vrtxs);
|
||||
TriangleNet.Geometry.Polygon polygon = new TriangleNet.Geometry.Polygon();
|
||||
polygon.Add(cnt);
|
||||
GenericMesher mesher = new GenericMesher();
|
||||
ConstraintOptions constraint = new ConstraintOptions();
|
||||
constraint.Convex = true;
|
||||
Mesh meshPlanning = (Mesh)mesher.Triangulate(polygon, constraint);
|
||||
TriangleQuadTree meshTree = new TriangleQuadTree(meshPlanning);
|
||||
TriangleNet.Topology.Triangle trgl = (TriangleNet.Topology.Triangle)meshTree.Query(X, Y);
|
||||
if (trgl == null)
|
||||
{
|
||||
Dictionary<Vertex, double> valuePairs = new Dictionary<Vertex, double>();
|
||||
Line2d ln;
|
||||
foreach (Vertex item in meshPlanning.Vertices)
|
||||
{
|
||||
ln = new Line2d(new Point2d(X, Y), new Point2d(item.X, item.Y));
|
||||
valuePairs.Add(item, ln.Length);
|
||||
}
|
||||
IOrderedEnumerable<KeyValuePair<Vertex, double>> selected = from v in valuePairs // определяем каждый объект как
|
||||
orderby v.Value // упорядочиваем по возрастанию
|
||||
select v; // выбираем объект
|
||||
List<KeyValuePair<Vertex, double>> lst = selected.ToList();
|
||||
foreach (TriangleNet.Topology.Triangle item in meshPlanning.Triangles)
|
||||
{
|
||||
if (item.Contains(lst[0].Key) && item.Contains(lst[1].Key)) { trgl = item; break; }
|
||||
}
|
||||
}
|
||||
vrtx = new Vertex(X, Y, Number, 2);
|
||||
Interpolation.InterpolateAttributes(vrtx, trgl, 1);
|
||||
DL = Math.Round(vrtx.Attributes[0], 3);
|
||||
}
|
||||
|
||||
internal void CalcDL(Mesh planningMesh)
|
||||
{
|
||||
if (planningMesh == null) return;
|
||||
|
||||
Vertex vrtx;
|
||||
TriangleQuadTree meshTree = new TriangleQuadTree(planningMesh);
|
||||
TriangleNet.Topology.Triangle trgl = (TriangleNet.Topology.Triangle)meshTree.Query(X, Y);
|
||||
if (trgl == null)
|
||||
{
|
||||
Dictionary<Vertex, double> valuePairs = new Dictionary<Vertex, double>();
|
||||
Line2d ln;
|
||||
foreach (Vertex item in planningMesh.Vertices)
|
||||
{
|
||||
ln = new Line2d(new Point2d(X, Y), new Point2d(item.X, item.Y));
|
||||
valuePairs.Add(item, ln.Length);
|
||||
}
|
||||
IOrderedEnumerable<KeyValuePair<Vertex, double>> selected = from v in valuePairs // определяем каждый объект как
|
||||
orderby v.Value // упорядочиваем по возрастанию
|
||||
select v; // выбираем объект
|
||||
List<KeyValuePair<Vertex, double>> lst = selected.ToList();
|
||||
foreach (TriangleNet.Topology.Triangle item in planningMesh.Triangles)
|
||||
{
|
||||
if (item.Contains(lst[0].Key) && item.Contains(lst[1].Key)) { trgl = item; break; }
|
||||
}
|
||||
}
|
||||
vrtx = new Vertex(X, Y, Number, 2);
|
||||
Interpolation.InterpolateAttributes(vrtx, trgl, 1);
|
||||
DL = Math.Round(vrtx.Attributes[0], 3);
|
||||
}
|
||||
|
||||
internal void CalcNL(Mesh blackMesh)
|
||||
{
|
||||
if (blackMesh == null) return;
|
||||
|
||||
Vertex vrtx;
|
||||
TriangleQuadTree meshTree = new TriangleQuadTree(blackMesh);
|
||||
TriangleNet.Topology.Triangle trgl = (TriangleNet.Topology.Triangle)meshTree.Query(X, Y);
|
||||
if (trgl == null)
|
||||
{
|
||||
Dictionary<Vertex, double> valuePairs = new Dictionary<Vertex, double>();
|
||||
Line2d ln;
|
||||
foreach (Vertex item in blackMesh.Vertices)
|
||||
{
|
||||
ln = new Line2d(new Point2d(X, Y), new Point2d(item.X, item.Y));
|
||||
valuePairs.Add(item, ln.Length);
|
||||
}
|
||||
IOrderedEnumerable<KeyValuePair<Vertex, double>> selected = from v in valuePairs // определяем каждый объект как
|
||||
orderby v.Value // упорядочиваем по возрастанию
|
||||
select v; // выбираем объект
|
||||
List<KeyValuePair<Vertex, double>> lst = selected.ToList();
|
||||
foreach (TriangleNet.Topology.Triangle item in blackMesh.Triangles)
|
||||
{
|
||||
if (item.Contains(lst[0].Key) && item.Contains(lst[1].Key)) { trgl = item; break; }
|
||||
}
|
||||
}
|
||||
vrtx = new Vertex(X, Y, Number, 2);
|
||||
Interpolation.InterpolateAttributes(vrtx, trgl, 1);
|
||||
NL = Math.Round(vrtx.Attributes[0], 3);
|
||||
}
|
||||
|
||||
internal void DLtoD1(double nullLevel)
|
||||
{
|
||||
double dlt = nullLevel - DL;
|
||||
D1 = Math.Round(-FL - dlt, 3);
|
||||
}
|
||||
|
||||
internal void D1toDL(double nullLevel)
|
||||
{
|
||||
DL = Math.Round(nullLevel + FL + D1, 3);
|
||||
}
|
||||
|
||||
internal void D1toFL(double nullLevel)
|
||||
{
|
||||
double dlt = nullLevel - DL;
|
||||
FL = Math.Round(-dlt - D1, 3);
|
||||
}
|
||||
|
||||
internal void FLtoD1(double nullLevel)
|
||||
{
|
||||
double dlt = nullLevel + FL;
|
||||
D1 = Math.Round(DL - dlt, 3);
|
||||
}
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number + s + Name + s + (int)Type + s + Basement + s + B + s + L + s + H + s + Db + s + D1 + s + Hs + s + Hcf + s + Ycf + s + X + s + Y + s + FL
|
||||
+ s + DL + s + NL + s + AlfaDeg;
|
||||
}
|
||||
|
||||
internal List<object> PropsToList()
|
||||
{
|
||||
return new List<object> { Number, Name, (int)Type, Basement, B, L, H, Db, D1, Hs, Hcf, Ycf, X, Y, FL, DL, NL, AlfaDeg };
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
Name = src[1];
|
||||
Type = (TypeFound)Int32.Parse(src[2]);
|
||||
Basement = bool.Parse(src[3]);
|
||||
B = double.Parse(src[4]);
|
||||
L = double.Parse(src[5]);
|
||||
H = double.Parse(src[6]);
|
||||
Db = double.Parse(src[7]);
|
||||
D1 = double.Parse(src[8]);
|
||||
Hs = double.Parse(src[9]);
|
||||
Hcf = double.Parse(src[10]);
|
||||
Ycf = double.Parse(src[11]);
|
||||
X = double.Parse(src[12]);
|
||||
Y = double.Parse(src[13]);
|
||||
FL = double.Parse(src[14]);
|
||||
DL = double.Parse(src[15]);
|
||||
NL = double.Parse(src[16]);
|
||||
AlfaDeg = double.Parse(src[17]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal void ListToProps(List<object> src)
|
||||
{
|
||||
try
|
||||
{
|
||||
Number = (int)(double)src[0];
|
||||
Name = (string)src[1];
|
||||
Type = (TypeFound)(int)(double)src[2];
|
||||
Basement = (bool)src[3];
|
||||
B = (double)src[4];
|
||||
L = (double)src[5];
|
||||
H = (double)src[6];
|
||||
Db = (double)src[7];
|
||||
D1 = (double)src[8];
|
||||
Hs = (double)src[9];
|
||||
Hcf = (double)src[10];
|
||||
Ycf = (double)src[11];
|
||||
X = (double)src[12];
|
||||
Y = (double)src[13];
|
||||
FL = (double)src[14];
|
||||
DL = (double)src[15];
|
||||
NL = (double)src[16];
|
||||
AlfaDeg = (double)src[17];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CalcLevels(Mesh planningMesh, Mesh blackMesh)
|
||||
{
|
||||
CalcDL(planningMesh);
|
||||
CalcNL(blackMesh);
|
||||
}
|
||||
|
||||
public void CopyProps(IEnumerable<Foundation> founds)
|
||||
{
|
||||
foreach (Foundation item in founds)
|
||||
{
|
||||
if (this.Equals(item)) continue;
|
||||
item.Name = Name;
|
||||
item.B = B;
|
||||
item.L = L;
|
||||
item.H = H;
|
||||
item.FL = FL;
|
||||
item.DL = DL;
|
||||
item.D1 = D1;
|
||||
item.Loads = Loads;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CalcContour()
|
||||
{
|
||||
if (Type == TypeFound.Круглый) return;
|
||||
Point2d v1 = new Point2d(-0.5 * B, -0.5 * L);
|
||||
Point2d v2 = new Point2d(-0.5 * B, 0.5 * L);
|
||||
Point2d v3 = new Point2d(0.5 * B, 0.5 * L);
|
||||
Point2d v4 = new Point2d(0.5 * B, -0.5 * L);
|
||||
double alfa = DegToRad(AlfaDeg);
|
||||
double x = v1.X; double y = v1.Y;
|
||||
v1.X = x * Math.Cos(alfa) - y * Math.Sin(alfa) + X;
|
||||
v1.Y = x * Math.Sin(alfa) + y * Math.Cos(alfa) + Y;
|
||||
x = v2.X; y = v2.Y;
|
||||
v2.X = x * Math.Cos(alfa) - y * Math.Sin(alfa) + X;
|
||||
v2.Y = x * Math.Sin(alfa) + y * Math.Cos(alfa) + Y;
|
||||
x = v3.X; y = v3.Y;
|
||||
v3.X = x * Math.Cos(alfa) - y * Math.Sin(alfa) + X;
|
||||
v3.Y = x * Math.Sin(alfa) + y * Math.Cos(alfa) + Y;
|
||||
x = v4.X; y = v4.Y;
|
||||
v4.X = x * Math.Cos(alfa) - y * Math.Sin(alfa) + X;
|
||||
v4.Y = x * Math.Sin(alfa) + y * Math.Cos(alfa) + Y;
|
||||
|
||||
Contour = new Quadrangle(v1, v2, v3, v4);
|
||||
}
|
||||
|
||||
private double RadToDeg(double radians)
|
||||
{
|
||||
return radians * 180 / Math.PI;
|
||||
}
|
||||
|
||||
private double DegToRad(double degries)
|
||||
{
|
||||
return degries * Math.PI / 180;
|
||||
}
|
||||
}
|
||||
}
|
||||
168
BL/IGE.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class IGE
|
||||
{
|
||||
private string groundType;
|
||||
public int Number { get; set; }
|
||||
/// <summary>
|
||||
/// Номер иженерно-геологического элемента
|
||||
/// </summary>
|
||||
public string NumIGE { get; set; }
|
||||
/// <summary>
|
||||
/// Тип грунта согласно таблицы 5.4 СП 22.13330.2011
|
||||
/// </summary>
|
||||
public string GroundType { get => groundType; set { groundType = value; ChangeTypeGroundIdx(); } }
|
||||
/// <summary>
|
||||
/// Плотность грунта для расчетов по 2-й группе предельных сосотояний
|
||||
/// </summary>
|
||||
public double RoII { get; set; }
|
||||
/// <summary>
|
||||
/// Угол внутреннего трения грунта в градусах для расчетов по 2-й группе предельных сосотояний
|
||||
/// </summary>
|
||||
public double FiII { get; set; }
|
||||
/// <summary>
|
||||
/// Удельное сцепление для расчетов по 2-й группе предельных сосотояний
|
||||
/// </summary>
|
||||
public double CII { get; set; }
|
||||
/// <summary>
|
||||
/// Модуль деформации грунта
|
||||
/// </summary>
|
||||
public double E { get; set; }
|
||||
/// <summary>
|
||||
/// Удельный вес частиц (минеральной части) грунта
|
||||
/// </summary>
|
||||
public double Ys { get; set; }
|
||||
/// <summary>
|
||||
/// Коэффициент пористости
|
||||
/// </summary>
|
||||
public double Ke { get; set; }
|
||||
/// <summary>
|
||||
///Показатель текучести
|
||||
/// </summary>
|
||||
public double IL { get; set; }
|
||||
/// <summary>
|
||||
/// Наличие водонасыщения
|
||||
/// </summary>
|
||||
public bool W { get; set; }
|
||||
/// <summary>
|
||||
/// Описание слоя грунта
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
public int GroundTypeIdx { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Типы грунтов согласно таблицы 5.4 СП 22.13330.2011
|
||||
/// </summary>
|
||||
private readonly string[] groundTypes = new string[]
|
||||
{
|
||||
"Крупнообломочные с песчаным заполнителем и пески кроме мелких и пылеватых",
|
||||
"Пески мелкие",
|
||||
"Пески пылеватые маловлажные",
|
||||
"Пески пылеватые влажные насыщенные водой",
|
||||
"Пески рыхлые",
|
||||
"Глинистые, а также крупнообломочные с глинистым заполнителем при IL<=0.25",
|
||||
"Глинистые, а также крупнообломочные с глинистым заполнителем при 0.25<IL<=0.5",
|
||||
"Глинистые, а также крупнообломочные с глинистым заполнителем при 0.5<IL"
|
||||
};
|
||||
|
||||
public IGE Clone()
|
||||
{
|
||||
return new IGE()
|
||||
{
|
||||
Number=Number,
|
||||
NumIGE=NumIGE,
|
||||
GroundType = GroundType,
|
||||
RoII = RoII,
|
||||
FiII = FiII,
|
||||
CII = CII,
|
||||
E = E,
|
||||
Ys = Ys,
|
||||
Ke = Ke,
|
||||
IL = IL,
|
||||
W = W,
|
||||
Description = Description
|
||||
};
|
||||
}
|
||||
|
||||
void ChangeTypeGroundIdx()
|
||||
{
|
||||
int i = 1;
|
||||
foreach (string item in groundTypes)
|
||||
{
|
||||
if (item == groundType)
|
||||
{
|
||||
GroundTypeIdx = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number.ToString() + s + NumIGE + s + Description + s + RoII.ToString() + s + FiII.ToString() + s + CII.ToString() + s + E.ToString() +
|
||||
s + Ys.ToString() + s + Ke.ToString() + s + IL.ToString() + s + W.ToString() + s + GroundType + s + GroundTypeIdx.ToString();
|
||||
}
|
||||
|
||||
internal List<object> PropsToList()
|
||||
{
|
||||
return new List<object> { Number, NumIGE, Description, RoII, FiII, CII, E, Ys, Ke, IL, W, GroundType, GroundTypeIdx };
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
NumIGE = src[1];
|
||||
Description = src[2];
|
||||
RoII = double.Parse(src[3]);
|
||||
FiII = double.Parse(src[4]);
|
||||
CII = double.Parse(src[5]);
|
||||
E = double.Parse(src[6]);
|
||||
Ys = double.Parse(src[7]);
|
||||
Ke = double.Parse(src[8]);
|
||||
IL = double.Parse(src[9]);
|
||||
W = bool.Parse(src[10]);
|
||||
GroundType = src[11];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
internal void ListToProps(List<object> src)
|
||||
{
|
||||
try
|
||||
{
|
||||
Number = (int)(double)src[0];
|
||||
NumIGE = (string)src[1];
|
||||
Description = (string)src[2];
|
||||
RoII = (double)src[3];
|
||||
FiII = (double)src[4];
|
||||
CII = (double)src[5];
|
||||
E = (double)src[6];
|
||||
Ys = (double)src[7];
|
||||
Ke = (double)src[8];
|
||||
IL = (double)src[9];
|
||||
W = (bool)src[10];
|
||||
GroundType = (string)src[11];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
96
BL/Layer.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class Layer
|
||||
{
|
||||
public int Number { get; set; }
|
||||
|
||||
public string NumIGE { get; set; }
|
||||
public IGE IGE { get; set; }
|
||||
/// <summary>
|
||||
///Относительная отметка верхней границы слоя относительно устья скважины
|
||||
/// </summary>
|
||||
public double Up { get; set; }
|
||||
/// <summary>
|
||||
///Относительная отметка нижней границы слоя относительно устья скважины
|
||||
/// </summary>
|
||||
public double Down { get; set; }
|
||||
/// <summary>
|
||||
///Мощность слоя
|
||||
/// </summary>
|
||||
public double H { get; set; }
|
||||
/// <summary>
|
||||
///Абсолютная отметка подошвы слоя
|
||||
/// </summary>
|
||||
public double Z { get; set; }
|
||||
/// <summary>
|
||||
/// Описание слоя грунта
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
public Layer Clone()
|
||||
{
|
||||
return new Layer()
|
||||
{
|
||||
Number = this.Number,
|
||||
NumIGE = this.NumIGE,
|
||||
IGE = this.IGE,
|
||||
Up = this.Up,
|
||||
Down = this.Down,
|
||||
H = this.H,
|
||||
Z = this.Z,
|
||||
Description = this.Description
|
||||
};
|
||||
}
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number + s + NumIGE + s + Down + s + H + s + Z;
|
||||
}
|
||||
|
||||
internal List<object> PropsToList()
|
||||
{
|
||||
return new List<object> { Number, NumIGE, Down, H, Z };
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
NumIGE = src[1];
|
||||
Down = double.Parse(src[2]);
|
||||
H = double.Parse(src[3]);
|
||||
Z = double.Parse(src[4]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal void ListToProps(List<object> src)
|
||||
{
|
||||
try
|
||||
{
|
||||
Number = (int)(double)src[0];
|
||||
NumIGE = (string)src[1];
|
||||
Down = (double)src[2];
|
||||
H = (double)src[3];
|
||||
Z = (double)src[4];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
BL/PlanningVertex.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class PlanningVertex : Geo.Point3d
|
||||
{
|
||||
public int Number { get; set; }
|
||||
public double Red { get; set; }
|
||||
public double Black { get; set; }
|
||||
|
||||
internal string PropsToString()
|
||||
{
|
||||
string s = ";";
|
||||
return Number + s + X + s + Y + s + Red + s + Black;
|
||||
}
|
||||
|
||||
internal void StringToProps(string line, char separator = ';')
|
||||
{
|
||||
string[] src = line.Split(separator);
|
||||
try
|
||||
{
|
||||
Number = Int32.Parse(src[0]);
|
||||
X = double.Parse(src[1]);
|
||||
Y = double.Parse(src[2]);
|
||||
Red = double.Parse(src[3]);
|
||||
Black = double.Parse(src[4]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
69
BL/PlayGround.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayGround
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public int Number { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ObservableCollection<IGE> IGEs { get; private set; }
|
||||
public ObservableCollection<Bore> Bores { get; private set; }
|
||||
public ObservableCollection<Structure> Structures { get; private set; }
|
||||
|
||||
public PlayGround()
|
||||
{
|
||||
IGEs = new ObservableCollection<IGE>();
|
||||
Bores = new ObservableCollection<Bore>();
|
||||
Structures = new ObservableCollection<Structure>();
|
||||
}
|
||||
|
||||
public void AddIGE(IGE ige)
|
||||
{
|
||||
if (IGEs == null) IGEs = new ObservableCollection<IGE>();
|
||||
IGEs.Add(ige);
|
||||
}
|
||||
public void AddIGEs(ObservableCollection<IGE> iges)
|
||||
{
|
||||
IGEs = iges;
|
||||
}
|
||||
public void AddIGEs(List<IGE> iges)
|
||||
{
|
||||
if (IGEs == null) IGEs = new ObservableCollection<IGE>();
|
||||
foreach (var item in iges) IGEs.Add(item);
|
||||
}
|
||||
|
||||
public void AddBore(Bore bore)
|
||||
{
|
||||
if (Bores == null) Bores = new ObservableCollection<Bore>();
|
||||
Bores.Add(bore);
|
||||
}
|
||||
public void AddBores(ObservableCollection<Bore> bores)
|
||||
{
|
||||
Bores = bores;
|
||||
}
|
||||
public void AddBores(List<Bore> bores)
|
||||
{
|
||||
if (Bores == null) Bores = new ObservableCollection<Bore>();
|
||||
foreach (var item in bores) Bores.Add(item);
|
||||
}
|
||||
|
||||
public void DeleteBores()
|
||||
{
|
||||
Bores = new ObservableCollection<Bore>();
|
||||
}
|
||||
|
||||
public void DeleteIGEs()
|
||||
{
|
||||
IGEs = new ObservableCollection<IGE>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
30
BL/Structure.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
public class Structure
|
||||
{
|
||||
public TypeFlexStructure flexStructure { get; set; }
|
||||
public double L { get; set; }
|
||||
public double H { get; set; }
|
||||
public double Null { get; set; }
|
||||
public int Number { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public ObservableCollection<Foundation> Foundations { get; set; }
|
||||
public ObservableCollection<PlanningVertex> RedPlanning { get; set; }
|
||||
public ObservableCollection<PlanningVertex> BlackPlanning { get; set; }
|
||||
public Structure()
|
||||
{
|
||||
Foundations = new ObservableCollection<Foundation>();
|
||||
RedPlanning = new ObservableCollection<PlanningVertex>();
|
||||
BlackPlanning = new ObservableCollection<PlanningVertex>();
|
||||
}
|
||||
}
|
||||
}
|
||||
415
BL/TablesInterolator.cs
Normal file
@@ -0,0 +1,415 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Geo;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public struct My_Mq_Mc
|
||||
{
|
||||
public double My;
|
||||
public double Mq;
|
||||
public double Mc;
|
||||
Dictionary<double, double[]> table_5_5;
|
||||
|
||||
public My_Mq_Mc(double fi)
|
||||
{
|
||||
table_5_5 = new Dictionary<double, double[]>
|
||||
{
|
||||
{0,new double[]{0,1,3.14}},
|
||||
{1,new double[]{0.01,1.06,3.23}},
|
||||
{2,new double[]{0.03,1.12,3.32}},
|
||||
{3,new double[]{0.04,1.18,3.41}},
|
||||
{4,new double[]{0.06,1.25,3.51}},
|
||||
{5,new double[]{0.08,1.32,3.61}},
|
||||
{6,new double[]{0.1,1.39,3.71}},
|
||||
{7,new double[]{0.12,1.47,3.82}},
|
||||
{8,new double[]{0.14,1.55,3.93}},
|
||||
{9,new double[]{0.16,1.64,4.05}},
|
||||
{10,new double[]{0.18,1.73,4.17}},
|
||||
{11,new double[]{0.21,1.83,4.29}},
|
||||
{12,new double[]{0.23,1.94,4.42}},
|
||||
{13,new double[]{0.26,2.05,4.55}},
|
||||
{14,new double[]{0.29,2.17,4.69}},
|
||||
{15,new double[]{0.32,2.3,4.84}},
|
||||
{16,new double[]{0.36,2.43,4.99}},
|
||||
{17,new double[]{0.39,2.57,5.15}},
|
||||
{18,new double[]{0.43,2.73,5.31}},
|
||||
{19,new double[]{0.47,2.89,5.48}},
|
||||
{20,new double[]{0.51,3.06,5.66}},
|
||||
{21,new double[]{0.56,3.24,5.84}},
|
||||
{22,new double[]{0.61,3.44,6.04}},
|
||||
{23,new double[]{0.66,3.65,6.24}},
|
||||
{24,new double[]{0.72,3.87,6.45}},
|
||||
{25,new double[]{0.78,4.11,6.67}},
|
||||
{26,new double[]{0.84,4.37,6.9}},
|
||||
{27,new double[]{0.91,4.64,7.14}},
|
||||
{28,new double[]{0.98,4.93,7.4}},
|
||||
{29,new double[]{1.06,5.25,7.67}},
|
||||
{30,new double[]{1.15,5.59,7.95}},
|
||||
{31,new double[]{1.24,5.95,8.24}},
|
||||
{32,new double[]{1.34,6.34,8.55}},
|
||||
{33,new double[]{1.44,6.76,8.88}},
|
||||
{34,new double[]{1.55,7.22,9.22}},
|
||||
{35,new double[]{1.68,7.71,9.58}},
|
||||
{36,new double[]{1.81,8.24,9.97}},
|
||||
{37,new double[]{1.95,8.81,10.37}},
|
||||
{38,new double[]{2.11,9.44,10.8}},
|
||||
{39,new double[]{2.28,10.11,11.25}},
|
||||
{40,new double[]{2.46,10.85,11.73}},
|
||||
{41,new double[]{2.66,11.64,12.24}},
|
||||
{42,new double[]{2.88,12.51,12.79}},
|
||||
{43,new double[]{3.12,13.46,13.37}},
|
||||
{44,new double[]{3.38,14.5,13.98}},
|
||||
{45,new double[]{3.66,15.64,14.64}}
|
||||
};
|
||||
My= table_5_5[fi][0];
|
||||
Mq = table_5_5[fi][1];
|
||||
Mc = table_5_5[fi][2];
|
||||
}
|
||||
}
|
||||
public class TablesInterolator
|
||||
{
|
||||
static readonly Dictionary<double, double[]> table_5_5 = new Dictionary<double, double[]>
|
||||
{
|
||||
{0,new double[]{0,1,3.14}},
|
||||
{1,new double[]{0.01,1.06,3.23}},
|
||||
{2,new double[]{0.03,1.12,3.32}},
|
||||
{3,new double[]{0.04,1.18,3.41}},
|
||||
{4,new double[]{0.06,1.25,3.51}},
|
||||
{5,new double[]{0.08,1.32,3.61}},
|
||||
{6,new double[]{0.1,1.39,3.71}},
|
||||
{7,new double[]{0.12,1.47,3.82}},
|
||||
{8,new double[]{0.14,1.55,3.93}},
|
||||
{9,new double[]{0.16,1.64,4.05}},
|
||||
{10,new double[]{0.18,1.73,4.17}},
|
||||
{11,new double[]{0.21,1.83,4.29}},
|
||||
{12,new double[]{0.23,1.94,4.42}},
|
||||
{13,new double[]{0.26,2.05,4.55}},
|
||||
{14,new double[]{0.29,2.17,4.69}},
|
||||
{15,new double[]{0.32,2.3,4.84}},
|
||||
{16,new double[]{0.36,2.43,4.99}},
|
||||
{17,new double[]{0.39,2.57,5.15}},
|
||||
{18,new double[]{0.43,2.73,5.31}},
|
||||
{19,new double[]{0.47,2.89,5.48}},
|
||||
{20,new double[]{0.51,3.06,5.66}},
|
||||
{21,new double[]{0.56,3.24,5.84}},
|
||||
{22,new double[]{0.61,3.44,6.04}},
|
||||
{23,new double[]{0.66,3.65,6.24}},
|
||||
{24,new double[]{0.72,3.87,6.45}},
|
||||
{25,new double[]{0.78,4.11,6.67}},
|
||||
{26,new double[]{0.84,4.37,6.9}},
|
||||
{27,new double[]{0.91,4.64,7.14}},
|
||||
{28,new double[]{0.98,4.93,7.4}},
|
||||
{29,new double[]{1.06,5.25,7.67}},
|
||||
{30,new double[]{1.15,5.59,7.95}},
|
||||
{31,new double[]{1.24,5.95,8.24}},
|
||||
{32,new double[]{1.34,6.34,8.55}},
|
||||
{33,new double[]{1.44,6.76,8.88}},
|
||||
{34,new double[]{1.55,7.22,9.22}},
|
||||
{35,new double[]{1.68,7.71,9.58}},
|
||||
{36,new double[]{1.81,8.24,9.97}},
|
||||
{37,new double[]{1.95,8.81,10.37}},
|
||||
{38,new double[]{2.11,9.44,10.8}},
|
||||
{39,new double[]{2.28,10.11,11.25}},
|
||||
{40,new double[]{2.46,10.85,11.73}},
|
||||
{41,new double[]{2.66,11.64,12.24}},
|
||||
{42,new double[]{2.88,12.51,12.79}},
|
||||
{43,new double[]{3.12,13.46,13.37}},
|
||||
{44,new double[]{3.38,14.5,13.98}},
|
||||
{45,new double[]{3.66,15.64,14.64}}
|
||||
};
|
||||
static readonly Dictionary<string, double[]> table_5_4 = new Dictionary<string, double[]>
|
||||
{
|
||||
{"Крупнообломочные с песчаным заполнителем и пески кроме мелких и пылеватых", new double[]{1.4, 1.2, 1.4} },
|
||||
{"Пески мелкие", new double[]{1.3, 1.1, 1.3} },
|
||||
{"Пески пылеватые маловлажные", new double[]{1.25, 1.0, 1.2} },
|
||||
{"Пески пылеватые влажные насыщенные водой", new double[]{1.1, 1.0, 1.2} },
|
||||
{"Пески рыхлые", new double[]{1.0, 1.0, 1.0} },
|
||||
{"Глинистые, а также крупнообломочные с глинистым заполнителем при IL<=0.25", new double[]{1.25, 1.0, 1.1} },
|
||||
{"Глинистые, а также крупнообломочные с глинистым заполнителем при 0.25<IL<=0.5", new double[]{1.2, 1.0, 1.1} },
|
||||
{"Глинистые, а также крупнообломочные с глинистым заполнителем при 0.5<IL", new double[]{1.1, 1.0, 1.0} },
|
||||
};
|
||||
static readonly double[,] table_5_8_R =
|
||||
{
|
||||
{ 1, 1, 1, 1, 1, 1, 1 },
|
||||
{ 0.96, 0.972, 0.975, 0.976, 0.977, 0.977, 0.977 },
|
||||
{ 0.8, 0.848, 0.866, 0.876, 0.879, 0.881, 0.881 },
|
||||
{ 0.606, 0.682, 0.717, 0.739, 0.749, 0.754, 0.755 },
|
||||
{ 0.449, 0.532, 0.578, 0.612, 0.629, 0.639, 0.642 },
|
||||
{ 0.336, 0.414, 0.463, 0.505, 0.53, 0.545, 0.55 },
|
||||
{ 0.257, 0.325, 0.374, 0.419, 0.449, 0.47, 0.477 },
|
||||
{ 0.201, 0.26, 0.304, 0.349, 0.383, 0.41, 0.42 },
|
||||
{ 0.16, 0.21, 0.251, 0.294, 0.329, 0.36, 0.374 },
|
||||
{ 0.131, 0.173, 0.209, 0.25, 0.285, 0.319, 0.337 },
|
||||
{ 0.108, 0.145, 0.176, 0.214, 0.248, 0.285, 0.306 },
|
||||
{ 0.091, 0.123, 0.15, 0.185, 0.218, 0.255, 0.28 },
|
||||
{ 0.077, 0.105, 0.13, 0.161, 0.192, 0.23, 0.258 },
|
||||
{ 0.067, 0.091, 0.113, 0.141, 0.17, 0.208, 0.239 },
|
||||
{ 0.058, 0.079, 0.099, 0.124, 0.152, 0.189, 0.223 },
|
||||
{ 0.051, 0.07, 0.087, 0.11, 0.136, 0.173, 0.208 },
|
||||
{ 0.045, 0.062, 0.077, 0.099, 0.122, 0.158, 0.196 },
|
||||
{ 0.04, 0.055, 0.069, 0.088, 0.11, 0.145, 0.185 },
|
||||
{ 0.036, 0.049, 0.062, 0.08, 0.1, 0.133, 0.175 },
|
||||
{ 0.032, 0.044, 0.056, 0.072, 0.091, 0.123, 0.166 },
|
||||
{ 0.029, 0.04, 0.051, 0.066, 0.084, 0.113, 0.158 },
|
||||
{ 0.026, 0.037, 0.046, 0.06, 0.077, 0.105, 0.15 },
|
||||
{ 0.024, 0.033, 0.042, 0.055, 0.071, 0.098, 0.143 },
|
||||
{ 0.022, 0.031, 0.039, 0.051, 0.065, 0.091, 0.137 },
|
||||
{ 0.02, 0.028, 0.036, 0.047, 0.06, 0.085, 0.132 },
|
||||
{ 0.019, 0.026, 0.033, 0.043, 0.056, 0.079, 0.126 },
|
||||
{ 0.017, 0.024, 0.031, 0.04, 0.052, 0.074, 0.122 },
|
||||
{ 0.016, 0.022, 0.029, 0.037, 0.049, 0.069, 0.117 },
|
||||
{ 0.015, 0.021, 0.027, 0.035, 0.045, 0.065, 0.113 },
|
||||
{ 0.014, 0.02, 0.025, 0.033, 0.042, 0.061, 0.109 },
|
||||
{ 0.013, 0.018, 0.023, 0.031, 0.04, 0.058, 0.106 },
|
||||
};
|
||||
static readonly double[] table_5_8_C =
|
||||
{
|
||||
1, 0.949, 0.756, 0.547, 0.39, 0.285, 0.214, 0.165, 0.13,
|
||||
0.106, 0.087, 0.073, 0.062, 0.053, 0.046, 0.04, 0.036,
|
||||
0.031, 0.028, 0.024, 0.022, 0.021, 0.019, 0.017,
|
||||
0.016, 0.015, 0.014, 0.013, 0.012, 0.011, 0.01
|
||||
};
|
||||
static readonly double[] table_5_8_L =
|
||||
{
|
||||
1,0.977,0.881,0.755,0.642,0.55,0.477,0.42,0.374,0.337,
|
||||
0.306,0.28,0.258,0.239,0.223,0.208,0.196,0.185,0.175,
|
||||
0.166,0.158,0.15,0.143,0.137,0.132,0.126,0.122,0.117,0.113,0.109,0.106
|
||||
};
|
||||
static readonly double[] table_5_8_ksi =
|
||||
{
|
||||
0,0.4,0.8,1.2,1.6,2,2.4,2.8,3.2,3.6,4,
|
||||
4.4,4.8,5.2,5.6,6,6.4,6.8,7.2,7.6,8,8.4,
|
||||
8.8,9.2,9.6,10,10.4,10.8,11.2,11.6,12
|
||||
};
|
||||
static readonly double[] table_5_8_nu = { 1, 1.4, 1.8, 2.4, 3.2, 5, 10 };
|
||||
public static double[] My_Mq_Mc(double fi)
|
||||
{
|
||||
return table_5_5[fi];
|
||||
}
|
||||
|
||||
public static double Yc1(string ground)
|
||||
{
|
||||
return table_5_4[ground][0];
|
||||
}
|
||||
|
||||
public static double Yc2(string ground, TypeFlexStructure flex = TypeFlexStructure.Гибкая, double L = 0, double H = 1)
|
||||
{
|
||||
if (flex == TypeFlexStructure.Гибкая) return 1;
|
||||
|
||||
double Yc21 = table_5_4[ground][1];
|
||||
double Yc22 = table_5_4[ground][2];
|
||||
Geo.Line2d interpolant = new Geo.Line2d(new Geo.Point2d(4, Yc21), new Geo.Point2d(1.5, Yc22));
|
||||
if (L / H < 4 && L / H > 1.5) return interpolant.Interpolation(L / H);
|
||||
else if (L / H >= 4) return Yc21;
|
||||
else return Yc22;
|
||||
}
|
||||
|
||||
public static double? table_5_8(double z, double b, double l, TypeFound typeFound = TypeFound.Прямоугольный, PointFound ptFound = PointFound.Центр)
|
||||
{
|
||||
double nu, ksi;
|
||||
if (ptFound == PointFound.Центр) ksi = 2 * z / b;
|
||||
else ksi = z / b;
|
||||
|
||||
if (typeFound == TypeFound.Прямоугольный && l / b < 10)
|
||||
{
|
||||
nu = l / b;
|
||||
return BilinearInterpolation(table_5_8_ksi, table_5_8_nu, table_5_8_R, ksi, nu);
|
||||
}
|
||||
if (typeFound == TypeFound.Ленточный || l / b >= 10)
|
||||
{
|
||||
return LinearInterpolation(table_5_8_ksi, table_5_8_L, ksi);
|
||||
}
|
||||
if (typeFound == TypeFound.Круглый)
|
||||
{
|
||||
return LinearInterpolation(table_5_8_ksi, table_5_8_C, ksi);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<double?> Table_5_8(List<double> z, double b, double l, TypeFound typeFound = TypeFound.Прямоугольный, PointFound ptFound = PointFound.Центр)
|
||||
{
|
||||
List<double?> res = new List<double?>();
|
||||
double nu, ksi;
|
||||
|
||||
foreach (double item in z)
|
||||
{
|
||||
if (ptFound == PointFound.Центр) ksi = 2 * item / b;
|
||||
else ksi = item / b;
|
||||
|
||||
if (typeFound == TypeFound.Прямоугольный && l / b < 10)
|
||||
{
|
||||
nu = l / b;
|
||||
res.Add(BilinearInterpolation(table_5_8_ksi, table_5_8_nu, table_5_8_R, ksi, nu));
|
||||
}
|
||||
if (typeFound == TypeFound.Ленточный || l / b >= 10)
|
||||
{
|
||||
res.Add(LinearInterpolation(table_5_8_ksi, table_5_8_L, ksi));
|
||||
}
|
||||
if (typeFound == TypeFound.Круглый)
|
||||
{
|
||||
res.Add(LinearInterpolation(table_5_8_ksi, table_5_8_C, ksi));
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static double? LinearInterpolation(double[] x, double[] y, double xval)
|
||||
{
|
||||
double? zval = null;
|
||||
Line2d interpolant;
|
||||
int lx = x.Length;
|
||||
int ly = y.Length;
|
||||
|
||||
if (lx < 2 || ly < 2) return zval;
|
||||
if (lx != ly) return zval;
|
||||
|
||||
for (int i = 0; i < lx - 1; i++)
|
||||
{
|
||||
if (xval >= x[i] && xval < x[i + 1])
|
||||
{
|
||||
interpolant = new Line2d(new Point2d(x[i], y[i]), new Point2d(x[i + 1], y[i + 1]));
|
||||
return interpolant.Interpolation(xval);
|
||||
}
|
||||
|
||||
if (xval < x[0])
|
||||
{
|
||||
interpolant = new Line2d(new Point2d(x[0], y[0]), new Point2d(x[1], y[1]));
|
||||
return interpolant.Interpolation(xval);
|
||||
}
|
||||
|
||||
if (xval >= x[lx - 1])
|
||||
{
|
||||
interpolant = new Line2d(new Point2d(x[lx - 2], y[lx - 2]), new Point2d(x[lx - 1], y[lx - 1]));
|
||||
return interpolant.Interpolation(xval);
|
||||
}
|
||||
}
|
||||
|
||||
return zval;
|
||||
}
|
||||
|
||||
static double? BilinearInterpolation(double[] x, double[] y, double[,] z, double xval, double yval)
|
||||
{
|
||||
//calculates single point bilinear interpolation
|
||||
double? zval = null;
|
||||
Plane interpolant;
|
||||
int lx = x.Length;
|
||||
int ly = y.Length;
|
||||
|
||||
if (lx < 2 || ly < 2 || z.Length < 4) return zval;
|
||||
if (lx !=z.GetLength(0)) return zval;
|
||||
if (ly !=z.GetLength(1)) return zval;
|
||||
|
||||
for (int i = 0; i < lx - 1; i++)
|
||||
{
|
||||
for (int j = 0; j < ly - 1; j++)
|
||||
{
|
||||
if (xval >= x[i] && xval < x[i + 1] && yval >= y[j] && yval < y[j + 1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[i], y[j], z[i, j]),
|
||||
new Point3d(x[i + 1], y[j], z[i + 1, j]),
|
||||
new Point3d(x[i], y[j + 1], z[i, j + 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval >= x[lx-1] && yval >= y[j] && yval < y[j + 1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[lx - 2], y[j], z[lx - 2, j]),
|
||||
new Point3d(x[lx - 1], y[j], z[lx - 1, j]),
|
||||
new Point3d(x[lx - 2], y[j + 1], z[lx - 2, j + 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval < x[0] && yval >= y[j] && yval < y[j + 1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[0], y[j], z[0, j]),
|
||||
new Point3d(x[1], y[j], z[1, j]),
|
||||
new Point3d(x[0], y[j + 1], z[0, j + 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval >= x[i] && xval < x[i + 1] && yval >= y[ly-1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[i], y[ly - 2], z[i, ly - 2]),
|
||||
new Point3d(x[i + 1], y[ly - 2], z[i + 1, ly - 2]),
|
||||
new Point3d(x[i], y[ly - 1], z[i, ly - 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval >= x[i] && xval < x[i + 1] && yval < y[0])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[i], y[0], z[i, 0]),
|
||||
new Point3d(x[i + 1], y[0], z[i + 1, 0]),
|
||||
new Point3d(x[i], y[1], z[i, 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval < x[0] && yval < y[0])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[0], y[0], z[0, 0]),
|
||||
new Point3d(x[1], y[0], z[1, 0]),
|
||||
new Point3d(x[0], y[1], z[0, 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval >= x[lx-1] && yval < y[0])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[lx - 2], y[0], z[lx - 2, 0]),
|
||||
new Point3d(x[lx - 1], y[0], z[lx - 1, 0]),
|
||||
new Point3d(x[lx - 2], y[1], z[lx - 2, 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval < x[0] && yval >= y[ly-1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[0], y[ly - 2], z[0, ly - 2]),
|
||||
new Point3d(x[0], y[ly - 1], z[0, ly - 1]),
|
||||
new Point3d(x[1], y[ly - 1], z[1, ly - 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
|
||||
if (xval >= x[lx-1] && yval >= y[ly - 1])
|
||||
{
|
||||
interpolant = new Plane(
|
||||
new Point3d(x[lx - 2], y[ly - 2], z[lx - 2, ly - 2]),
|
||||
new Point3d(x[lx - 1], y[ly - 2], z[lx - 1, ly - 2]),
|
||||
new Point3d(x[lx - 2], y[ly - 1], z[lx - 2, ly - 1])
|
||||
);
|
||||
return interpolant.Interpolation(xval, yval);
|
||||
}
|
||||
}
|
||||
}
|
||||
return zval;
|
||||
}
|
||||
|
||||
//double[] BilinearInterpolation(double[] x, double[] y, double[,] z, double[] xvals, double[] yvals)
|
||||
//{
|
||||
// //calculates multiple point bilinear interpolation
|
||||
// double[] zvals = new double[xvals.Length];
|
||||
// for (int i = 0; i < xvals.Length; i++)
|
||||
// zvals[i] = BilinearInterpolation(x, y, z, xvals[i], yvals[i]);
|
||||
// return zvals;
|
||||
//}
|
||||
}
|
||||
}
|
||||
15
BL/ToSerializ.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
[Serializable]
|
||||
internal class ToSerializ
|
||||
{
|
||||
public ObservableCollection<PlayGround> PlayGroundList { get; set; }
|
||||
}
|
||||
}
|
||||
107
Dictionary.xaml
Normal file
@@ -0,0 +1,107 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:GroundOrganizer"
|
||||
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
|
||||
<col:ArrayList x:Key="GroundTypeArr" >
|
||||
<sys:String>Крупнообломочные с песчаным заполнителем и пески кроме мелких и пылеватых</sys:String>
|
||||
<sys:String>Пески мелкие</sys:String>
|
||||
<sys:String>Пески пылеватые маловлажные</sys:String>
|
||||
<sys:String>Пески пылеватые влажные насыщенные водой</sys:String>
|
||||
<sys:String>Пески рыхлые</sys:String>
|
||||
<sys:String>Глинистые, а также крупнообломочные с глинистым заполнителем при IL<=0.25</sys:String>
|
||||
<sys:String>Глинистые, а также крупнообломочные с глинистым заполнителем при 0.25<IL<=0.5</sys:String>
|
||||
<sys:String>Глинистые, а также крупнообломочные с глинистым заполнителем при 0.5<IL</sys:String>
|
||||
</col:ArrayList>
|
||||
|
||||
|
||||
<Style x:Key="PlayGroundDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="LavenderBlush" />
|
||||
<Setter Property="AlternatingRowBackground" Value="LavenderBlush" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="IGEsDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="PaleGoldenrod" />
|
||||
<Setter Property="AlternatingRowBackground" Value="PaleGoldenrod" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BoresDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="LightBlue" />
|
||||
<Setter Property="AlternatingRowBackground" Value="LightBlue" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LayersDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="Moccasin" />
|
||||
<Setter Property="AlternatingRowBackground" Value="Moccasin" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StructuresDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="Azure" />
|
||||
<Setter Property="AlternatingRowBackground" Value="Azure" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RedPlanningDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="LightPink" />
|
||||
<Setter Property="AlternatingRowBackground" Value="LightPink" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BlackPlanningDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="LightGray" />
|
||||
<Setter Property="AlternatingRowBackground" Value="LightGray" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FoundationsDataGridStyle" TargetType="DataGrid" >
|
||||
<Setter Property="RowBackground" Value="Bisque" />
|
||||
<Setter Property="AlternatingRowBackground" Value="Bisque" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="HeaderGridStyle" TargetType="DataGridColumnHeader" >
|
||||
<!--<Setter Property="HorizontalAlignment" Value="Center" />-->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<!--<Setter Property="BorderBrush" Value="Black"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,0"/>-->
|
||||
<!--<Setter Property="Width" Value="520"/>-->
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CellGridStyle" TargetType="DataGridCell">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Width" Value=" 80"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RowGridStyle" TargetType="DataGridRow">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DataGridHeaderStyle" TargetType="DataGridColumnHeader">
|
||||
<Setter Property="MinHeight" Value="25"/>
|
||||
<Setter Property="BorderBrush" Value="Black"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,2"/>
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="buttonStyle" TargetType="Button">
|
||||
<Setter Property="Margin" Value="3"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="MintCream"/>
|
||||
</Style>
|
||||
|
||||
<TextBlock x:Key="ПараметрыЗаголовок" Margin="3">Параметры проекта</TextBlock>
|
||||
<TextBlock x:Key="ПлощадкиЗаголовок" Margin="3">Площадки</TextBlock>
|
||||
<TextBlock x:Key="СеченияЗаголовок" Margin="3">Сечения</TextBlock>
|
||||
<TextBlock x:Key="УсилияЗаголовок" Margin="3">Усилия</TextBlock>
|
||||
<TextBlock x:Key="АрматураЗаголовок" Margin="3">Арматура</TextBlock>
|
||||
<TextBlock x:Key="БетонЗаголовок" Margin="3">Бетон</TextBlock>
|
||||
<TextBlock x:Key="ЭлементыЗаголовок" Margin="3">Элементы</TextBlock>
|
||||
<TextBlock x:Key="ТрещиностойкостьЗаголовок" Margin="3">Трещиностойкость</TextBlock>
|
||||
<TextBlock x:Key="РасчетЗаголовок" Margin="3">Расчет</TextBlock>
|
||||
<TextBlock x:Key="ВыводЗаголовок" Margin="3">Вывод результатов</TextBlock>
|
||||
<TextBlock x:Key="ЗакреплениеЗаголовок" Text="Условия закрепления концов элемента" FontSize="12" Foreground="Blue"/>
|
||||
<TextBlock x:Key="ElemTypeGroupBox" FontSize="12" Foreground="Blue">Тип элементов</TextBlock>
|
||||
|
||||
<Image x:Key="Иконка1" Source="/Images/Icon1.png"/>
|
||||
<sys:Double x:Key="rowsHeight">25</sys:Double>
|
||||
</ResourceDictionary>
|
||||
31
Geometry/BoundingBox2d.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class BoundingBox2d
|
||||
{
|
||||
Point2d min;
|
||||
Point2d max;
|
||||
|
||||
public Point2d Min { get => min; private set => min = value; }
|
||||
public Point2d Max { get => max; private set => max = value; }
|
||||
|
||||
public BoundingBox2d()
|
||||
{
|
||||
min = new Point2d();
|
||||
max = new Point2d();
|
||||
}
|
||||
|
||||
public BoundingBox2d(Point2d minPt, Point2d maxPt)
|
||||
{
|
||||
min = minPt;
|
||||
max = maxPt;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
9
Geometry/IVector.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Geo
|
||||
{
|
||||
public interface IVector
|
||||
{
|
||||
int N { get; }
|
||||
|
||||
double[] ToArray();
|
||||
}
|
||||
}
|
||||
96
Geometry/Line2d.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Line2d
|
||||
{
|
||||
protected Point3d startPoint;
|
||||
protected Point3d endPoint;
|
||||
protected Vector2d directive;
|
||||
protected Vector2d normal;
|
||||
|
||||
public Point3d StartPoint { get => startPoint; set { startPoint = value; if (EndPoint != null) { directive = endPoint.ToPoint2d() - startPoint.ToPoint2d(); CalcLine(); }; } }
|
||||
public Point3d EndPoint { get => endPoint; set { endPoint = value; directive = endPoint.ToPoint2d() - startPoint.ToPoint2d(); CalcLine(); } }
|
||||
public Point3d CenterPoint { get; private set; }
|
||||
public Vector2d Directive { get => directive; private set => directive = value; }
|
||||
public Vector2d Normal { get => normal; private set => normal = value; }
|
||||
public double A { get; private set; }
|
||||
public double B { get; private set; }
|
||||
public double C { get; private set; }
|
||||
public double k { get; private set; }
|
||||
public double b { get; private set; }
|
||||
public double Length { get => Directive.Norma; }
|
||||
public double cosAlfa { get; private set; }
|
||||
public double cosBeta { get; private set; }
|
||||
public double p { get; private set; }
|
||||
|
||||
public Line2d()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Line2d(Point2d startPt, Point2d endPt)
|
||||
{
|
||||
startPoint = startPt.ToPoint3d(); endPoint = endPt.ToPoint3d();
|
||||
directive = endPoint.ToPoint2d() - startPoint.ToPoint2d();
|
||||
CalcLine();
|
||||
}
|
||||
|
||||
public Line2d(Point3d startPt, Point3d endPt)
|
||||
{
|
||||
startPoint = startPt;
|
||||
endPoint = endPt;
|
||||
directive = endPoint.ToPoint2d() - startPoint.ToPoint2d();
|
||||
CalcLine();
|
||||
}
|
||||
|
||||
protected void CalcLine()
|
||||
{
|
||||
A = Directive.Vy;
|
||||
B = -Directive.Vx;
|
||||
normal = new Vector2d(A, B);
|
||||
C = Directive.Vx * StartPoint.Y - Directive.Vy * StartPoint.X;
|
||||
if (Directive.Vx != 0) { k = Directive.Vy / Directive.Vx; }
|
||||
else { k = Double.PositiveInfinity; }
|
||||
if (Directive.Vx != 0) { b = -Directive.Vy / Directive.Vx * StartPoint.X + StartPoint.Y; }
|
||||
else { b= Double.PositiveInfinity; }
|
||||
double normC = 1 / Math.Sqrt(A * A + B * B);
|
||||
if (C < 0) normC *= -1;
|
||||
cosAlfa = A * normC;
|
||||
cosBeta = B * normC;
|
||||
p = C * normC;
|
||||
double dx = 0.5 * (EndPoint.X - StartPoint.X);
|
||||
double dy = 0.5 * (EndPoint.Y - StartPoint.Y);
|
||||
CenterPoint = new Point3d(StartPoint.X + dx, StartPoint.Y + dy, 0);
|
||||
}
|
||||
|
||||
public double LengthTo(Point2d point)
|
||||
{
|
||||
double normC = 1 / Math.Sqrt(A * A + B * B);
|
||||
if (C < 0) normC *= -1;
|
||||
cosAlfa = A * normC;
|
||||
cosBeta = B * normC;
|
||||
p = C * normC;
|
||||
return normC * (A * point.X + B * point.Y + C);
|
||||
}
|
||||
public double LengthTo(Point3d point)
|
||||
{
|
||||
double normC = 1 / Math.Sqrt(A * A + B * B);
|
||||
if (C < 0) normC *= -1;
|
||||
cosAlfa = A * normC;
|
||||
cosBeta = B * normC;
|
||||
p = C * normC;
|
||||
return normC * (A * point.X + B * point.Y + C);
|
||||
}
|
||||
public double Interpolation(double x)
|
||||
{
|
||||
if (B == 0) return double.PositiveInfinity;
|
||||
else return (-A * x - C) / B;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Geometry/Line3d.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Line3d
|
||||
{
|
||||
Point3d startPoint;
|
||||
Point3d endPoint;
|
||||
|
||||
public Point3d StartPoint { get => startPoint; set { startPoint = value; Directive = endPoint - startPoint; } }
|
||||
public Point3d EndPoint { get => endPoint; set { endPoint = value; Directive = endPoint - startPoint; } }
|
||||
public Vector3d Directive { get; private set; }
|
||||
public double Length { get => Directive.Norma; }
|
||||
|
||||
public Line3d()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Line3d(Point2d startPt, Point2d endPt)
|
||||
{
|
||||
startPoint = startPt.ToPoint3d(); endPoint = endPt.ToPoint3d();
|
||||
Directive = endPoint - startPoint; ;
|
||||
}
|
||||
|
||||
public Line3d(Point3d startPt, Point3d endPt)
|
||||
{
|
||||
startPoint = startPt; endPoint = endPt;
|
||||
Directive = endPoint - startPoint; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
200
Geometry/Matrix.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Matrix
|
||||
{
|
||||
double[,] arr;
|
||||
int m, n;
|
||||
public int N
|
||||
{
|
||||
get
|
||||
{
|
||||
if (n > 0)
|
||||
return n;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public int M
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m > 0)
|
||||
return m;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public double this[int i, int j]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (n > 0 && m > 0)
|
||||
if (i > -1 && j > -1)
|
||||
return arr[i, j];
|
||||
else
|
||||
Console.WriteLine("Неверный индексы");
|
||||
else
|
||||
Console.WriteLine("Не задана матрица");
|
||||
return -1;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (n > 0 && m > 0)
|
||||
if (i > -1 && j > -1)
|
||||
arr[i, j] = value;
|
||||
else
|
||||
Console.WriteLine("Неверный индексы");
|
||||
else
|
||||
Console.WriteLine("Не задана матрица");
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix(int N, int M)
|
||||
{
|
||||
m = M;
|
||||
n = N;
|
||||
arr = new double[N, M];
|
||||
}
|
||||
|
||||
public Matrix(Matrix source)
|
||||
{
|
||||
m = source.M;
|
||||
n = source.N;
|
||||
arr = new double[source.N, source.M];
|
||||
arr = (double[,])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Matrix(double[,] source)
|
||||
{
|
||||
m = source.GetLength(1);
|
||||
n = source.GetLength(0);
|
||||
arr = new double[source.GetLength(0), source.GetLength(1)];
|
||||
arr = (double[,])source.Clone();
|
||||
}
|
||||
|
||||
public double[,] ToArray()
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
public Matrix Copy()
|
||||
{
|
||||
return new Matrix(this);
|
||||
}
|
||||
|
||||
public static Matrix operator ^(Matrix A, Matrix B)
|
||||
{
|
||||
if (A.M != B.N) { throw new System.ArgumentException("Не совпадают размерности матриц"); } //Нужно только одно соответствие
|
||||
Matrix C = new Matrix(A.N, B.M); //Столько же строк, сколько в А; столько столбцов, сколько в B
|
||||
for (int i = 0; i < A.N; ++i)
|
||||
{
|
||||
for (int j = 0; j < B.M; ++j)
|
||||
{
|
||||
C[i, j] = 0;
|
||||
for (int k = 0; k < A.M; ++k)
|
||||
{ //ТРЕТИЙ цикл, до A.m=B.n
|
||||
C[i, j] += A[i, k] * B[k, j]; //Собираем сумму произведений
|
||||
}
|
||||
}
|
||||
}
|
||||
return C;
|
||||
}
|
||||
|
||||
public static Matrix operator *(Matrix A, Matrix B)
|
||||
{
|
||||
if (((A.n != B.n) || (A.m != B.m)) == true) { throw new System.ArgumentException("Не совпадают размерности матриц"); }
|
||||
double[,] res = new double[A.n, B.m];
|
||||
|
||||
for (int i = 0; i < A.n; i++)
|
||||
{
|
||||
for (int j = 0; j < B.m; j++)
|
||||
{
|
||||
res[i, j] = A[i, j] * B[i, j];
|
||||
}
|
||||
}
|
||||
return new Matrix(res);
|
||||
}
|
||||
|
||||
public static Vector operator *(Matrix A, Vector B)
|
||||
{
|
||||
if (A.M != B.N) { throw new System.ArgumentException("Не совпадают размерности матриц"); }
|
||||
double[] res = new double[A.N];
|
||||
|
||||
for (int i = 0; i < A.N; i++)
|
||||
{
|
||||
for (int j = 0; j < B.N; j++)
|
||||
{
|
||||
res[i] += A[i, j] * B[j];
|
||||
}
|
||||
}
|
||||
return new Vector(res);
|
||||
}
|
||||
|
||||
public static Vector3d operator *(Matrix A, Vector3d B)
|
||||
{
|
||||
if (A.n != 3 && A.m != 3) { throw new System.ArgumentException("Не верна размерность матрицы"); }
|
||||
double[] res = new double[3];
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
res[i] += A[i, j] * B[j];
|
||||
}
|
||||
}
|
||||
return new Vector3d (res);
|
||||
}
|
||||
|
||||
public static Point3d operator *(Matrix A, Point3d B)
|
||||
{
|
||||
if (A.n != 3 && A.m != 3) { throw new System.ArgumentException("Не верна размерность матрицы"); }
|
||||
double[] res = new double[3];
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
res[i] += A[i, j] * B[j];
|
||||
}
|
||||
}
|
||||
return new Point3d(res);
|
||||
}
|
||||
|
||||
public static Matrix operator *(Matrix A, double B)
|
||||
{
|
||||
double[,] res = new double[A.n, A.m];
|
||||
|
||||
for (int i = 0; i < A.n; i++)
|
||||
{
|
||||
for (int j = 0; j < A.m; j++)
|
||||
{
|
||||
res[i, j] = A[i, j] * B;
|
||||
}
|
||||
}
|
||||
|
||||
return new Matrix(res);
|
||||
}
|
||||
|
||||
public static Matrix operator +(Matrix A, Matrix B)
|
||||
{
|
||||
if (((A.n != B.n) || (A.m != B.m)) == true) { throw new System.ArgumentException("Не совпадают размерности матриц"); }
|
||||
double[,] res = new double[A.n, B.m];
|
||||
|
||||
for (int i = 0; i < A.n; i++)
|
||||
{
|
||||
for (int j = 0; j < B.m; j++)
|
||||
{
|
||||
res[i, j] = A[i, j] + B[i, j];
|
||||
}
|
||||
}
|
||||
return new Matrix(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
242
Geometry/Plane.cs
Normal file
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Math;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Plane
|
||||
{
|
||||
double a;
|
||||
double b;
|
||||
double c;
|
||||
double d;
|
||||
double gammaRad;
|
||||
double gammaDeg;
|
||||
|
||||
public double A { get => a; set { a = value; CalcPlane(); } }
|
||||
public double B { get => b; set { b = value; CalcPlane(); } }
|
||||
public double C { get => c; set { c = value; CalcPlane(); } }
|
||||
public double D { get => d; set { d = value; CalcPlane(); } }
|
||||
public double AlfaRad { get; private set; }
|
||||
public double BetaRad { get; private set; }
|
||||
public double GammaRad { get => gammaRad; set { gammaRad = value; RadToDeg(); } }
|
||||
public double AlfaDeg { get; private set; }
|
||||
public double BetaDeg { get; private set; }
|
||||
public double GammaDeg { get => gammaDeg; set { gammaDeg = value; DegToRad(); } }
|
||||
public Matrix MrAlfa { get; private set; }
|
||||
public Matrix MrBeta { get; private set; }
|
||||
public Matrix MrGamma { get; private set; }
|
||||
public Vector3d X1 { get; private set; }
|
||||
public Vector3d Y1 { get; private set; }
|
||||
public Vector3d Z1 { get; private set; }
|
||||
public Vector3d Normal { get; private set; }
|
||||
public Matrix Mr { get; private set; }
|
||||
public Point3d Basis { get; set; }
|
||||
|
||||
public Plane()
|
||||
{
|
||||
Basis = new Point3d() { X = 0, Y = 0, Z = 0 };
|
||||
|
||||
a = 0;
|
||||
b = 0;
|
||||
c = 1;
|
||||
d = 0;
|
||||
|
||||
CalcPlane();
|
||||
}
|
||||
|
||||
public Plane(Point3d pt1, Point3d pt2, Point3d pt3)
|
||||
{
|
||||
Basis = pt1;
|
||||
|
||||
Vector3d v1 = new Vector3d()
|
||||
{
|
||||
Vx = pt2.X - pt1.X,
|
||||
Vy = pt2.Y - pt1.Y,
|
||||
Vz = pt2.Z - pt1.Z
|
||||
};
|
||||
|
||||
Vector3d v2 = new Vector3d()
|
||||
{
|
||||
Vx = pt3.X - pt1.X,
|
||||
Vy = pt3.Y - pt1.Y,
|
||||
Vz = pt3.Z - pt1.Z
|
||||
};
|
||||
|
||||
a = v1.Vy * v2.Vz - v1.Vz * v2.Vy;
|
||||
b = v1.Vz * v2.Vx - v1.Vx * v2.Vz;
|
||||
c = v1.Vx * v2.Vy - v1.Vy * v2.Vx;
|
||||
d = -a * pt1.X - b * pt1.Y - c * pt1.Z;
|
||||
|
||||
CalcPlane();
|
||||
RadToDeg();
|
||||
|
||||
}
|
||||
|
||||
public Plane(Point3d pt1, Point3d pt2, Point3d pt3, Point3d bpt)
|
||||
{
|
||||
Basis = bpt;
|
||||
|
||||
Vector3d v1 = new Vector3d()
|
||||
{
|
||||
Vx = pt2.X - pt1.X,
|
||||
Vy = pt2.Y - pt1.Y,
|
||||
Vz = pt2.Z - pt1.Z
|
||||
};
|
||||
|
||||
Vector3d v2 = new Vector3d()
|
||||
{
|
||||
Vx = pt3.X - pt1.X,
|
||||
Vy = pt3.Y - pt1.Y,
|
||||
Vz = pt3.Z - pt1.Z
|
||||
};
|
||||
|
||||
a = v1.Vy * v2.Vz - v1.Vz * v2.Vy;
|
||||
b = v1.Vz * v2.Vx - v1.Vx * v2.Vz;
|
||||
c = v1.Vx * v2.Vy - v1.Vy * v2.Vx;
|
||||
d = -a * pt1.X - b * pt1.Y - c * pt1.Z;
|
||||
|
||||
CalcPlane();
|
||||
RadToDeg();
|
||||
|
||||
}
|
||||
|
||||
public double Interpolation(double x, double y)
|
||||
{
|
||||
if (C == 0) return double.PositiveInfinity;
|
||||
else return (-A * x - B * y - D) / C;
|
||||
}
|
||||
|
||||
protected void CreatePlane(Point3d pt1, Point3d pt2, Point3d pt3)
|
||||
{
|
||||
Basis = pt1;
|
||||
|
||||
Vector3d v1 = new Vector3d()
|
||||
{
|
||||
Vx = pt2.X - pt1.X,
|
||||
Vy = pt2.Y - pt1.Y,
|
||||
Vz = pt2.Z - pt1.Z
|
||||
};
|
||||
|
||||
Vector3d v2 = new Vector3d()
|
||||
{
|
||||
Vx = pt3.X - pt1.X,
|
||||
Vy = pt3.Y - pt1.Y,
|
||||
Vz = pt3.Z - pt1.Z
|
||||
};
|
||||
|
||||
a = v1.Vy * v2.Vz - v1.Vz * v2.Vy;
|
||||
b = v1.Vz * v2.Vx - v1.Vx * v2.Vz;
|
||||
c = v1.Vx * v2.Vy - v1.Vy * v2.Vx;
|
||||
d = -a * pt1.X - b * pt1.Y - c * pt1.Z;
|
||||
|
||||
CalcPlane();
|
||||
RadToDeg();
|
||||
}
|
||||
|
||||
protected void CalcPlane()
|
||||
{
|
||||
Normal = new Vector3d
|
||||
{
|
||||
Vx = a,
|
||||
Vy = b,
|
||||
Vz = c
|
||||
};
|
||||
|
||||
Intersect();
|
||||
CreateMatrix();
|
||||
|
||||
}
|
||||
|
||||
protected void Intersect()
|
||||
{
|
||||
if ((a == 0 & b == 0) == false)
|
||||
{
|
||||
Vector3d v3 = new Vector3d { Vx = 0, Vy = 0, Vz = 1 };
|
||||
Z1 = new Vector3d(Normal.Unit);
|
||||
X1 = new Vector3d((v3 ^ Z1).Unit);
|
||||
Y1 = new Vector3d((Z1 ^ X1).Unit);
|
||||
|
||||
AlfaRad = -Acos(X1.Vx);
|
||||
BetaRad = -Acos(Z1.Vz);
|
||||
|
||||
//alfaRad = Math.Acos(unitP.Vx);
|
||||
//betaRad = Math.Acos(unitNormal.Vz);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CreateMatrix()
|
||||
{
|
||||
Vector3d o = new Vector3d();
|
||||
o[0] = -X1.Vx * Basis.X - X1.Vy * Basis.Y - X1.Vz * Basis.Z;
|
||||
o[1] = -Y1.Vx * Basis.X - Y1.Vy * Basis.Y - Y1.Vz * Basis.Z;
|
||||
o[2] = -Z1.Vx * Basis.X - Z1.Vy * Basis.Y - Z1.Vz * Basis.Z;
|
||||
|
||||
Mr = new Matrix(4, 4);
|
||||
|
||||
Mr[0, 0] = X1.Vx; Mr[0, 1] = X1.Vy; Mr[0, 2] = X1.Vz; Mr[0, 3] = o.Vx;
|
||||
Mr[1, 0] = Y1.Vx; Mr[1, 1] = Y1.Vy; Mr[1, 2] = Y1.Vz; Mr[1, 3] = o.Vy;
|
||||
Mr[2, 0] = Z1.Vx; Mr[2, 1] = Z1.Vy; Mr[2, 2] = Z1.Vz; Mr[2, 3] = o.Vz;
|
||||
Mr[3, 0] = 0; Mr[3, 1] = 0; Mr[3, 2] = 0; Mr[3, 3] = 1;
|
||||
|
||||
MrAlfa = new Matrix(3, 3);
|
||||
|
||||
MrAlfa[0, 0] = Cos(AlfaRad); MrAlfa[0, 1] = -Sin(AlfaRad); MrAlfa[0, 2] = 0;
|
||||
MrAlfa[1, 0] = Sin(AlfaRad); MrAlfa[1, 1] = Cos(AlfaRad); MrAlfa[1, 2] = 0;
|
||||
MrAlfa[2, 0] = 0; MrAlfa[2, 1] = 0; MrAlfa[2, 2] = 0;
|
||||
|
||||
MrBeta = new Matrix(3, 3);
|
||||
|
||||
MrBeta[0, 0] = 1; MrBeta[0, 1] = 0; MrBeta[0, 2] = 0;
|
||||
MrBeta[1, 0] = 0; MrBeta[1, 1] = Cos(BetaRad); MrBeta[1, 2] = -Sin(BetaRad);
|
||||
MrBeta[2, 0] = 0; MrBeta[2, 1] = Sin(BetaRad); MrBeta[2, 2] = Cos(BetaRad);
|
||||
|
||||
MrGamma = new Matrix(3, 3);
|
||||
|
||||
MrGamma[0, 0] = Cos(gammaRad); MrGamma[0, 1] = -Sin(gammaRad); MrGamma[0, 2] = 0;
|
||||
MrGamma[1, 0] = Sin(gammaRad); MrGamma[1, 1] = Cos(gammaRad); MrGamma[1, 2] = 0;
|
||||
MrGamma[2, 0] = 0; MrGamma[2, 1] = 0; MrGamma[2, 2] = 1;
|
||||
}
|
||||
|
||||
public Point3d PointInLCS(Point3d pt)
|
||||
{
|
||||
double[] d1 = new double[] { 0, 0, 0, 1 }; ;
|
||||
Vector v1 = new Vector(d1);
|
||||
v1[0] = pt.X; v1[1] = pt.Y; v1[2] = pt.Z;
|
||||
|
||||
return new Point3d().FromArray((Mr * v1).ToArray());
|
||||
}
|
||||
|
||||
protected double[] MultiplyMtxVec(double[,] _Matrix, double[] _Vector)
|
||||
{
|
||||
int n = _Vector.Length;
|
||||
double[] _Result = new double[n];
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = 0; j < n; j++)
|
||||
{
|
||||
_Result[i] += _Matrix[i, j] * _Vector[j];
|
||||
}
|
||||
}
|
||||
|
||||
return _Result;
|
||||
}
|
||||
|
||||
protected void RadToDeg()
|
||||
{
|
||||
AlfaDeg = AlfaRad * 180 / PI;
|
||||
BetaDeg = BetaRad * 180 / PI;
|
||||
gammaDeg = gammaRad * 180 / PI;
|
||||
}
|
||||
|
||||
protected void DegToRad()
|
||||
{
|
||||
gammaRad = gammaDeg * 180 / PI;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Geometry/Point2d.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Point2d
|
||||
{
|
||||
double[] arr = new double[2];
|
||||
|
||||
public double this[int i] { get => arr[i]; set => arr[i] = value; }
|
||||
public double X { get => arr[0]; set => arr[0] = value; }
|
||||
public double Y { get => arr[1]; set => arr[1] = value; }
|
||||
|
||||
public Point2d()
|
||||
{
|
||||
arr = new double[2];
|
||||
}
|
||||
|
||||
public Point2d(double x, double y)
|
||||
{
|
||||
arr = new double[2];
|
||||
arr[0] = x; arr[1] = y;
|
||||
}
|
||||
|
||||
public Point2d(Point2d source)
|
||||
{
|
||||
arr = new double[2];
|
||||
arr = (double[])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Point2d(Point3d source)
|
||||
{
|
||||
arr = new double[2];
|
||||
arr[0]=source.X; arr[1] = source.Y;
|
||||
}
|
||||
|
||||
public Point2d(double[] source)
|
||||
{
|
||||
arr = new double[2];
|
||||
if (source.Length >= 2)
|
||||
{
|
||||
arr[0] = source[0]; arr[1] = source[1];
|
||||
}
|
||||
}
|
||||
|
||||
public double[] ToArray()
|
||||
{
|
||||
return new double[] { X, Y };
|
||||
}
|
||||
|
||||
public Vector2d ToVector2d()
|
||||
{
|
||||
return new Vector2d { Vx = X, Vy = Y};
|
||||
}
|
||||
|
||||
public Vector3d ToVector3d()
|
||||
{
|
||||
return new Vector3d { Vx = X, Vy = Y, Vz = 0 };
|
||||
}
|
||||
|
||||
public Point3d ToPoint3d()
|
||||
{
|
||||
return new Point3d { X = X, Y = Y, Z = 0 };
|
||||
}
|
||||
|
||||
public Point2d FromArray(double[] arr)
|
||||
{
|
||||
X = arr[0]; Y = arr[1];
|
||||
return this;
|
||||
}
|
||||
|
||||
public double LengthTo(Point2d node)
|
||||
{
|
||||
Line2d line = new Line2d(this, node);
|
||||
return line.Length;
|
||||
}
|
||||
|
||||
public static Vector2d operator -(Point2d pt1, Point2d pt2)
|
||||
{
|
||||
Vector2d res = new Vector2d();
|
||||
res[0] = pt1.X - pt2.X;
|
||||
res[1] = pt1.Y - pt2.Y;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static bool operator ==(Point2d p1, Point2d p2)
|
||||
{
|
||||
bool check = false;
|
||||
if (p1.X == p2.X && p1.Y == p2.Y)
|
||||
{
|
||||
check = true;
|
||||
}
|
||||
return (check);
|
||||
}
|
||||
|
||||
public static bool operator !=(Point2d p1, Point2d p2)
|
||||
{
|
||||
bool check = true;
|
||||
if (p1.X == p2.X && p1.Y == p2.Y)
|
||||
{
|
||||
check = false;
|
||||
}
|
||||
return (check);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
156
Geometry/Point3d.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Point3d : IVector
|
||||
{
|
||||
double[] arr;
|
||||
//int n = 3;
|
||||
|
||||
public double this[int i] { get => arr[i]; set => arr[i] = value; }
|
||||
public double X { get => arr[0]; set => arr[0] = value; }
|
||||
public double Y { get => arr[1]; set => arr[1] = value; }
|
||||
public double Z { get => arr[2]; set => arr[2] = value; }
|
||||
|
||||
public int N => 3;
|
||||
|
||||
//int N { get => n; }
|
||||
|
||||
public Point3d()
|
||||
{
|
||||
arr = new double[3];
|
||||
}
|
||||
|
||||
public Point3d(double x, double y, double z)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr[0] = x; arr[1] = y; arr[2] = z;
|
||||
}
|
||||
|
||||
public Point3d(double x, double y)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr[0] = x; arr[1] = y; arr[2] = 0;
|
||||
}
|
||||
|
||||
public Point3d(Point3d source)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr = (double[])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Point3d(double[] source)
|
||||
{
|
||||
arr = new double[3];
|
||||
if (source.Length >= 3) { arr[0] = source[0]; arr[1] = source[1]; arr[2] = source[2]; }
|
||||
else if (source.Length == 2) { arr[0] = source[0]; arr[1] = source[1]; }
|
||||
else { arr[0] = source[0]; }
|
||||
}
|
||||
|
||||
public double[] ToArray()
|
||||
{
|
||||
return new double[] { X, Y, Z };
|
||||
}
|
||||
|
||||
public Vector3d ToVector3d()
|
||||
{
|
||||
return new Vector3d { Vx = X, Vy = Y, Vz = Z };
|
||||
}
|
||||
|
||||
public Point2d ToPoint2d()
|
||||
{
|
||||
return new Point2d { X = X, Y = Y };
|
||||
}
|
||||
|
||||
public Point3d FromArray(double[] arr)
|
||||
{
|
||||
X = arr[0]; Y = arr[1]; Z = arr[2];
|
||||
return this;
|
||||
}
|
||||
|
||||
public double LengthTo(Point3d node)
|
||||
{
|
||||
Line3d line = new Line3d(this, node);
|
||||
return line.Length;
|
||||
}
|
||||
|
||||
public double AngleTo(Point3d startPoint, Point3d endPoint)
|
||||
{
|
||||
Point3d tempNode = new Point3d();
|
||||
|
||||
Line3d tempLine1 = new Line3d(this, startPoint);
|
||||
Line3d tempLine2 = new Line3d(this, endPoint);
|
||||
double cosTo = Vector3d.CosAngleBetVectors(tempLine1.Directive, tempLine2.Directive);
|
||||
return RadToDeg(Math.Acos(cosTo));
|
||||
}
|
||||
|
||||
public bool NormalDirection(Point3d startNode, Point3d endNode)
|
||||
{
|
||||
Line3d tempLine1 = new Line3d(this, startNode);
|
||||
Line3d tempLine2 = new Line3d(this, endNode);
|
||||
double norm = (tempLine1.Directive ^ tempLine2.Directive).Vz;
|
||||
bool res = false;
|
||||
if (norm > 0) res = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
private double RadToDeg(double radians)
|
||||
{
|
||||
return radians * 180 / Math.PI;
|
||||
}
|
||||
|
||||
public static Point3d operator *(Point3d pt, double prime)
|
||||
{
|
||||
return new Point3d
|
||||
{
|
||||
X = pt.X * prime,
|
||||
Y = pt.Y * prime,
|
||||
Z = pt.Z * prime
|
||||
};
|
||||
}
|
||||
|
||||
public static Vector3d operator -(Point3d pt1, Point3d pt2)
|
||||
{
|
||||
Vector3d res = new Vector3d();
|
||||
res[0] = pt1.X - pt2.X;
|
||||
res[1] = pt1.Y - pt2.Y;
|
||||
res[2] = pt1.Z - pt2.Z;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static bool operator ==(Point3d p1, Point3d p2)
|
||||
{
|
||||
bool check = false;
|
||||
if (p1.X == p2.X && p1.Y == p2.Y && p1.Z == p2.Z)
|
||||
{
|
||||
check = true;
|
||||
}
|
||||
return (check);
|
||||
}
|
||||
|
||||
public static bool operator !=(Point3d p1, Point3d p2)
|
||||
{
|
||||
bool check = true;
|
||||
if (p1.X == p2.X && p1.Y == p2.Y && p1.Z == p2.Z)
|
||||
{
|
||||
check = false;
|
||||
}
|
||||
return (check);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
663
Geometry/Polygon.cs
Normal file
@@ -0,0 +1,663 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Polygon
|
||||
{
|
||||
private double area;
|
||||
private double ix;
|
||||
private double iy;
|
||||
private List<Point3d> vertices = new List<Point3d>();
|
||||
|
||||
public bool Ckw { get; internal set; }
|
||||
//public bool? IsSelfItersected { get; private set; }
|
||||
public double Area { get => Math.Abs(area); }
|
||||
public double Perimeter { get; internal set; }
|
||||
public Point3d Centroid { get; internal set; }
|
||||
public double Ix { get => Math.Abs(ix); }
|
||||
public double Iy { get => Math.Abs(iy); }
|
||||
public List<Point3d> Vertices { get => vertices; set { vertices = value; CalcPolygon(); } }
|
||||
public BoundingBox2d BoundingBox { get; internal set; }
|
||||
public List<Line2d> Segments { get; internal set; }
|
||||
|
||||
public Polygon()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Polygon(List<Point3d> vrts)
|
||||
{
|
||||
vertices = vrts;
|
||||
if (vertices[0].X != vertices[vrts.Count - 1].X && vertices[0].Y != vertices[vrts.Count - 1].Y) vertices.Add(vertices[0]);
|
||||
CalcPolygon();
|
||||
}
|
||||
|
||||
public Polygon(List<Point2d> vrts)
|
||||
{
|
||||
foreach (Point2d item in vrts) vertices.Add(item.ToPoint3d());
|
||||
if (vertices[0].X != vertices[vrts.Count - 1].X && vertices[0].Y != vertices[vrts.Count - 1].Y) vertices.Add(vertices[0]);
|
||||
CalcPolygon();
|
||||
}
|
||||
|
||||
public virtual void AddVertice(Point2d pt)
|
||||
{
|
||||
if (vertices.Count == 0)
|
||||
{
|
||||
vertices.Add(pt.ToPoint3d());
|
||||
return;
|
||||
}
|
||||
if (vertices.Count == 1)
|
||||
{
|
||||
vertices.Add(pt.ToPoint3d());
|
||||
vertices.Add(vertices[0]);
|
||||
return;
|
||||
}
|
||||
if (vertices.Count >= 3)
|
||||
{
|
||||
vertices.RemoveAt(vertices.Count - 1);
|
||||
vertices.Add(pt.ToPoint3d());
|
||||
vertices.Add(vertices[0]);
|
||||
CalcPolygon();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void AddVertice(Point3d pt)
|
||||
{
|
||||
if (vertices.Count == 0)
|
||||
{
|
||||
vertices.Add(pt);
|
||||
return;
|
||||
}
|
||||
if (vertices.Count == 1)
|
||||
{
|
||||
vertices.Add(pt);
|
||||
vertices.Add(vertices[0]);
|
||||
return;
|
||||
}
|
||||
if (vertices.Count >= 3)
|
||||
{
|
||||
vertices.RemoveAt(vertices.Count - 1);
|
||||
vertices.Add(pt);
|
||||
vertices.Add(vertices[0]);
|
||||
CalcPolygon();
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcBB()
|
||||
{
|
||||
double minX = 1000000000;
|
||||
double minY = 1000000000;
|
||||
double maxX = -1000000000;
|
||||
double maxY = -1000000000;
|
||||
|
||||
if (vertices.Count > 0)
|
||||
{
|
||||
foreach (Point3d item in vertices)
|
||||
{
|
||||
if (item.X < minX) { minX = item.X; }
|
||||
if (item.Y < minY) { minY = item.Y; }
|
||||
if (item.X > maxX) { maxX = item.X; }
|
||||
if (item.Y > maxY) { maxY = item.Y; }
|
||||
}
|
||||
|
||||
BoundingBox = new BoundingBox2d(new Point2d(minX, minY), new Point2d(maxX, maxY));
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcSegs()
|
||||
{
|
||||
if (vertices.Count > 3)
|
||||
{
|
||||
Segments = new List<Line2d>();
|
||||
for (int i = 0; i < vertices.Count - 1; i++)
|
||||
{
|
||||
Segments.Add(new Line2d(vertices[i], vertices[i + 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void CalcI()
|
||||
{
|
||||
if (Segments.Count > 2)
|
||||
{
|
||||
double tempX = 0;
|
||||
double tempY = 0;
|
||||
for (int i = 0; i < Segments.Count; i++)
|
||||
{
|
||||
Point3d arrTemp = Segments[i].StartPoint; Point3d arrTemp1 = Segments[i].EndPoint;
|
||||
tempX += (Math.Pow(arrTemp.X, 2) + arrTemp.X * arrTemp1.X + Math.Pow(arrTemp1.X, 2)) * (arrTemp.X * arrTemp1.Y - arrTemp.Y * arrTemp1.X);
|
||||
tempY += (Math.Pow(arrTemp.Y, 2) + arrTemp.Y * arrTemp1.Y + Math.Pow(arrTemp1.Y, 2)) * (arrTemp.X * arrTemp1.Y - arrTemp.Y * arrTemp1.X);
|
||||
}
|
||||
ix = tempX / 12;
|
||||
iy = tempY / 12;
|
||||
}
|
||||
}
|
||||
|
||||
protected void CalcCentroid()
|
||||
{
|
||||
if (Segments.Count > 2)
|
||||
{
|
||||
Point3d temp = new Point3d();
|
||||
for (int i = 0; i < Segments.Count; i++)
|
||||
{
|
||||
Point3d arrTemp = Segments[i].StartPoint; Point3d arrTemp1 = Segments[i].EndPoint;
|
||||
temp.X += 1 / (6 * area) * (arrTemp.X + arrTemp1.X) * (arrTemp.X * arrTemp1.Y - arrTemp.Y * arrTemp1.X);
|
||||
temp.Y += 1 / (6 * area) * (arrTemp.Y + arrTemp1.Y) * (arrTemp.X * arrTemp1.Y - arrTemp.Y * arrTemp1.X);
|
||||
}
|
||||
Centroid = temp;
|
||||
}
|
||||
}
|
||||
|
||||
protected void CalcArea()
|
||||
{
|
||||
double temp = 0;
|
||||
if (Segments.Count > 2)
|
||||
{
|
||||
for (int i = 0; i < Segments.Count; i++)
|
||||
{
|
||||
Point3d arrTemp = Segments[i].StartPoint; Point3d arrTemp1 = Segments[i].EndPoint;
|
||||
temp += 0.5 * (arrTemp.X * arrTemp1.Y - arrTemp1.X * arrTemp.Y);
|
||||
}
|
||||
area = temp;
|
||||
}
|
||||
}
|
||||
|
||||
protected void CalcPerimeter()
|
||||
{
|
||||
if (Segments.Count > 2)
|
||||
{
|
||||
Perimeter = 0;
|
||||
foreach (Line2d item in Segments)
|
||||
{
|
||||
Perimeter += item.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void CalcCkw()
|
||||
{
|
||||
if (area < 0) Ckw = true;
|
||||
else Ckw = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вычисление свойств полигона
|
||||
/// </summary>
|
||||
public void CalcPolygon()
|
||||
{
|
||||
if (Vertices.Count > 3)
|
||||
{
|
||||
if ((Vertices[0].X != Vertices[vertices.Count - 1].X && Vertices[0].Y != Vertices[Vertices.Count - 1].Y)||
|
||||
(Vertices[0].X == Vertices[vertices.Count - 1].X && Vertices[0].Y != Vertices[Vertices.Count - 1].Y)||
|
||||
(Vertices[0].X != Vertices[vertices.Count - 1].X && Vertices[0].Y == Vertices[Vertices.Count - 1].Y))
|
||||
Vertices.Add(Vertices[0]);
|
||||
}
|
||||
CalcBB();
|
||||
CalcSegs();
|
||||
CalcPerimeter();
|
||||
CalcArea();
|
||||
CalcCkw();
|
||||
CalcCentroid();
|
||||
CalcI();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Замена вершины полигона
|
||||
/// </summary>
|
||||
/// <param name="oldVertIdx">индекс заменяемой вершины</param>
|
||||
/// <param name="newVert">объект заменяющей вершины</param>
|
||||
public bool ReplaceVertice( int oldVertIdx, Point3d newVert)
|
||||
{
|
||||
try
|
||||
{
|
||||
Vertices[oldVertIdx] = newVert;
|
||||
if (oldVertIdx == 0 || oldVertIdx == Vertices.Count - 1) { Vertices[0] = newVert; Vertices[Vertices.Count - 1] = newVert; }
|
||||
CalcPolygon();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Triangulation(double shag, out List<Point3d> innerNodes, out List<Triangle> triangles)
|
||||
{
|
||||
innerNodes = new List<Point3d>();
|
||||
triangles = new List<Triangle>();
|
||||
List<Polygon> polygons = new List<Polygon>();
|
||||
int n = Tesselation(shag);
|
||||
Polygon front = new Polygon(Vertices);
|
||||
//int p = 1;
|
||||
do
|
||||
{
|
||||
if (polygons.Count != 0) { front = polygons[0]; polygons.RemoveAt(0); }
|
||||
for (int j = 0; j < 1000; j++)
|
||||
{
|
||||
AngleIn3Point minAngle;
|
||||
front.MinAngleDeg(out minAngle);
|
||||
while (minAngle.AngleDeg == 0 && front.Vertices.Count > 3)
|
||||
{
|
||||
if(minAngle.VerticeIdx == 0)
|
||||
{
|
||||
front.Vertices.RemoveRange(Vertices.Count - 2, 2);
|
||||
front.Vertices.RemoveAt(0);
|
||||
}
|
||||
else front.Vertices.RemoveRange(minAngle.PreviousIdx, 2);
|
||||
front.CalcPolygon();
|
||||
front.MinAngleDeg(out minAngle);
|
||||
}
|
||||
|
||||
if (Math.Round(minAngle.AngleDeg) < 90)
|
||||
{
|
||||
triangles.Add(new Triangle(front.Vertices[minAngle.PreviousIdx], front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.NextIdx]));
|
||||
front.Vertices.RemoveAt(minAngle.VerticeIdx);
|
||||
if (minAngle.VerticeIdx == 0 && front.Vertices.Count > 3) front.Vertices.RemoveAt(front.Vertices.Count - 1);
|
||||
front.CalcPolygon();
|
||||
}
|
||||
|
||||
else if (Math.Round(minAngle.AngleDeg) == 90 /*&& Math.Round(minAngle.AngleDeg) <= 140*/)
|
||||
{
|
||||
Line2d lin = new Line2d(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.PreviousIdx]);
|
||||
Point3d temp = front.Vertices[minAngle.VerticeIdx];
|
||||
Point3d g = new Point3d(front.Vertices[minAngle.NextIdx].X + lin.Directive.Vx, front.Vertices[minAngle.NextIdx].Y + lin.Directive.Vy, 0);
|
||||
Point3d gNode = new Point3d { X = g.X, Y = g.Y, Z = g.Z/*, Number = n*/ };
|
||||
bool ch = false;
|
||||
int k = -1;
|
||||
for (int i = 0; i < front.Vertices.Count - 1; i++)
|
||||
{
|
||||
//if (i == minAngle.VerticeIdx) continue;
|
||||
double d = g.LengthTo(front.Vertices[i]);
|
||||
if (Math.Round(g.X, 2) == Math.Round(front.Vertices[i].X, 2) && Math.Round(g.Y, 2) == Math.Round(front.Vertices[i].Y, 2))
|
||||
{ ch = true; k = i; break; }
|
||||
}
|
||||
|
||||
Triangle t1, t2;
|
||||
|
||||
if (ch)
|
||||
{
|
||||
t1 = new Triangle(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.NextIdx], front.Vertices[k]);
|
||||
t2 = new Triangle(front.Vertices[minAngle.PreviousIdx], front.Vertices[minAngle.VerticeIdx], front.Vertices[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
t1 = new Triangle(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.NextIdx], gNode);
|
||||
t2 = new Triangle(front.Vertices[minAngle.PreviousIdx], front.Vertices[minAngle.VerticeIdx], gNode);
|
||||
}
|
||||
|
||||
front.ReplaceVertice(minAngle.VerticeIdx, gNode);
|
||||
|
||||
if (front.SelfItersectCheck())
|
||||
{
|
||||
front.ReplaceVertice(minAngle.VerticeIdx, temp);
|
||||
double dist = 100000000;
|
||||
k = -1;
|
||||
for (int i = 0; i < front.Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == minAngle.NextIdx || i == minAngle.PreviousIdx || i == minAngle.VerticeIdx) continue;
|
||||
double d = front.Vertices[minAngle.VerticeIdx].LengthTo(front.Vertices[i]);
|
||||
if (d < dist) { dist = d; k = i; }
|
||||
}
|
||||
Polygon sub;
|
||||
front.Bisection(k, minAngle.VerticeIdx, out sub);
|
||||
polygons.Add(sub);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ch) { innerNodes.Add(gNode); n++; }
|
||||
triangles.Add(t1); triangles.Add(t2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Line2d linPrev = new Line2d(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.PreviousIdx]);
|
||||
Line2d linNext = new Line2d(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.NextIdx]);
|
||||
double vx = (linPrev.Directive.Unit[0] + linNext.Directive.Unit[0]) * 0.5;
|
||||
double vy = (linPrev.Directive.Unit[1] + linNext.Directive.Unit[1]) * 0.5;
|
||||
//double lengthBis = (linPrev.Length + linNext.Length) * 0.5;
|
||||
double x = front.Vertices[minAngle.VerticeIdx].X + vx * shag;
|
||||
double y = front.Vertices[minAngle.VerticeIdx].Y + vy * shag;
|
||||
Point3d temp = front.Vertices[minAngle.VerticeIdx];
|
||||
Point3d g = new Point3d(x, y, 0);
|
||||
Line2d linBis = new Line2d(front.Vertices[minAngle.VerticeIdx], g);
|
||||
x = front.Vertices[minAngle.VerticeIdx].X + linBis.Directive.Unit[0] * shag;
|
||||
y = front.Vertices[minAngle.VerticeIdx].Y + linBis.Directive.Unit[1] * shag;
|
||||
g = new Point3d(x, y, 0);
|
||||
Point3d gNode = new Point3d() { X = g.X, Y = g.Y, Z = g.Z/*, Number = n*/ };
|
||||
Triangle t1, t2;
|
||||
t1 = new Triangle(front.Vertices[minAngle.VerticeIdx], front.Vertices[minAngle.NextIdx], gNode);
|
||||
t2 = new Triangle(front.Vertices[minAngle.PreviousIdx], front.Vertices[minAngle.VerticeIdx], gNode);
|
||||
front.ReplaceVertice(minAngle.VerticeIdx, gNode);
|
||||
//if (p == 1) { Shpunt.AcCreator.CreateContour(front); p++; }
|
||||
|
||||
if (front.SelfItersectCheck())
|
||||
{
|
||||
front.ReplaceVertice(minAngle.VerticeIdx, temp);
|
||||
double dist = 100000000;
|
||||
int k = -1;
|
||||
for (int i = 0; i < front.Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == minAngle.NextIdx || i == minAngle.PreviousIdx || i == minAngle.VerticeIdx) continue;
|
||||
double d = front.Vertices[minAngle.VerticeIdx].LengthTo(front.Vertices[i]);
|
||||
if (d < dist) { dist = d; k = i; }
|
||||
}
|
||||
Polygon sub;
|
||||
front.Bisection(k, minAngle.VerticeIdx, out sub);
|
||||
polygons.Add(sub);
|
||||
}
|
||||
else
|
||||
{
|
||||
triangles.Add(t1);
|
||||
triangles.Add(t2);
|
||||
innerNodes.Add(gNode);
|
||||
}
|
||||
n++;
|
||||
}
|
||||
if (front.Vertices.Count < 4) break;
|
||||
}
|
||||
} while (polygons.Count != 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Тесселяция полигона с заданным шагом
|
||||
/// </summary>
|
||||
/// <param name="shag"> Величина шага тесселяции</param>
|
||||
public int Tesselation(double shag)
|
||||
{
|
||||
List<Point3d> nodes = new List<Point3d>();
|
||||
int n = 1;
|
||||
int nD = 0;
|
||||
foreach (Line2d seg in Segments)
|
||||
{
|
||||
Point3d start = seg.StartPoint;
|
||||
Point3d end = seg.EndPoint;
|
||||
nD = (int)Math.Round(seg.Length / shag);
|
||||
if (nD > 1)
|
||||
{
|
||||
double delta = seg.Length / nD;
|
||||
double deltaX = (end.X - start.X) / nD;
|
||||
double deltaY = (end.Y - start.Y) / nD;
|
||||
double deltaZ = (end.Z - start.Z) / nD;
|
||||
for (int j = 0; j < nD; j++)
|
||||
{
|
||||
Point3d pt = new Point3d(start.X + j * deltaX, start.Y + j * deltaY, start.Z + j * deltaZ);
|
||||
//FEA.Node nd = new FEA.Node(pt) { Number = n };
|
||||
nodes.Add(pt);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Point3d pt = new Point3d(start.X, start.Y, start.Z);
|
||||
//FEA.Node nd = new FEA.Node(pt) { Number = n };
|
||||
nodes.Add(pt);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
Vertices = nodes;
|
||||
if (!Ckw) { Vertices.Reverse(); CalcPolygon(); }
|
||||
return n;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Деление полигона через указание 2-х точек деления
|
||||
/// </summary>
|
||||
/// <param name="sectPointIdx">Индекс первой точки деления(секущей)</param>
|
||||
/// <param name="basePointIdx">Индекс второй точки деления(базовой)</param>
|
||||
/// <param name="newPolygon">Возвращаемый отсеченный полигон</param>
|
||||
public void Bisection(int sectPointIdx,int basePointIdx, out Polygon newPolygon)
|
||||
{
|
||||
newPolygon = new Polygon();
|
||||
List<Point3d> tmp = new List<Point3d>();
|
||||
if (basePointIdx > sectPointIdx)
|
||||
{
|
||||
for (int i = sectPointIdx; i <= basePointIdx; i++)
|
||||
{
|
||||
newPolygon.AddVertice(Vertices[i]);
|
||||
}
|
||||
newPolygon.CalcPolygon();
|
||||
Vertices.RemoveRange(sectPointIdx + 1, basePointIdx - sectPointIdx - 1);
|
||||
CalcPolygon();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = basePointIdx; i <= sectPointIdx; i++)
|
||||
{
|
||||
newPolygon.AddVertice(Vertices[i]);
|
||||
}
|
||||
newPolygon.CalcPolygon();
|
||||
Vertices.RemoveRange(basePointIdx + 1, sectPointIdx - basePointIdx - 1);
|
||||
CalcPolygon();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка полигона на самопересечение (возвращает булево значение, если true - полигон самопересекающийся)
|
||||
/// </summary>
|
||||
public bool SelfItersectCheck()
|
||||
{
|
||||
bool IsSelfItersected = false;
|
||||
if (Segments.Count < 4) return IsSelfItersected;
|
||||
for (int i = 0; i < Segments.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < Segments.Count; j++)
|
||||
{
|
||||
if (i == j) continue;
|
||||
double a1 = Segments[i].A;
|
||||
double a2 = Segments[j].A;
|
||||
double b1 = Segments[i].B;
|
||||
double b2 = Segments[j].B;
|
||||
double c1 = Segments[i].C;
|
||||
double c2 = Segments[j].C;
|
||||
double p1 = (b2 - b1 * a2 / a1);
|
||||
if (p1 == 0) continue;
|
||||
double y = (a2 * c1 / a1 - c2) / p1;
|
||||
double x = (-b1 * y - c1) / a1;
|
||||
Point3d ptItersect = new Point3d(x, y, 0);
|
||||
Line2d linTmp1 = new Line2d(Segments[i].CenterPoint, ptItersect);
|
||||
Line2d linTmp2 = new Line2d(Segments[j].CenterPoint, ptItersect);
|
||||
double l1 = Math.Round(linTmp1.Length, 2);
|
||||
double l11 = Math.Round(Segments[i].Length / 2, 2);
|
||||
double l2 = Math.Round(linTmp2.Length, 2);
|
||||
double l22 = Math.Round(Segments[j].Length / 2, 2);
|
||||
if (Math.Round(linTmp1.Length, 2) < Math.Round(Segments[i].Length / 2, 2) &&
|
||||
Math.Round(linTmp2.Length, 2) < Math.Round(Segments[j].Length / 2, 2))
|
||||
{
|
||||
IsSelfItersected = true;
|
||||
return IsSelfItersected;
|
||||
}
|
||||
}
|
||||
}
|
||||
return IsSelfItersected;
|
||||
}
|
||||
/// <summary>
|
||||
/// Вычисление минимального угла полигона в градусах
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double MinAngleDeg()
|
||||
{
|
||||
double minAngle = 360;
|
||||
double angleTmp;
|
||||
bool type;
|
||||
for (int i = 0; i < Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
angleTmp = Vertices[0].AngleTo(Vertices[Vertices.Count - 2], Vertices[1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[0].NormalDirection(Vertices[Vertices.Count - 2], Vertices[1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < minAngle) minAngle = angleTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
angleTmp = Vertices[i].AngleTo(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < minAngle) minAngle = angleTmp;
|
||||
}
|
||||
}
|
||||
return minAngle;
|
||||
}
|
||||
/// <summary>
|
||||
/// Вычисление минимального угла полигона в градусах (возвращает массив индексов 3-х точек на которых был найден угол)
|
||||
/// </summary>
|
||||
/// <param name="minAngle"> Возвращаемое значение минимального угла в градусах </param>
|
||||
public int[] MinAngleDeg(out double minAngle)
|
||||
{
|
||||
minAngle = 0;
|
||||
if (Vertices.Count < 3) return null;
|
||||
int[] res = new int[3];
|
||||
minAngle = 360;
|
||||
double angleTmp;
|
||||
bool type;
|
||||
for (int i = 0; i < Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
angleTmp = Vertices[0].AngleTo(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < minAngle)
|
||||
{
|
||||
res[0] = Vertices.Count - 2;
|
||||
res[1] = 0;
|
||||
res[2] = 1;
|
||||
minAngle = angleTmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
angleTmp = Vertices[i].AngleTo(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < minAngle)
|
||||
{
|
||||
res[0] = i - 1;
|
||||
res[1] = i;
|
||||
res[2] = i + 1;
|
||||
minAngle = angleTmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вычисление минимального угла полигона в градусах
|
||||
/// </summary>
|
||||
/// <param name="result">Возвращаемое значение в виде объекта со свойствами индексов трех точек образуюших угол и значения угла в градусах</param>
|
||||
public void MinAngleDeg(out AngleIn3Point result)
|
||||
{
|
||||
result = new AngleIn3Point();
|
||||
result.AngleDeg = 0;
|
||||
if (Vertices.Count < 3) return;
|
||||
result.AngleDeg = 360;
|
||||
double angleTmp;
|
||||
bool type;
|
||||
for (int i = 0; i < Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
angleTmp = Vertices[0].AngleTo(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < result.AngleDeg)
|
||||
{
|
||||
result.PreviousIdx = Vertices.Count - 2;
|
||||
result.VerticeIdx = 0;
|
||||
result.NextIdx = 1;
|
||||
result.AngleDeg = angleTmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
angleTmp = Vertices[i].AngleTo(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp < result.AngleDeg)
|
||||
{
|
||||
result.PreviousIdx = i - 1;
|
||||
result.VerticeIdx = i;
|
||||
result.NextIdx = i + 1;
|
||||
result.AngleDeg = angleTmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Вычисление максимального угла полигона в градусах
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double MaxAngleDeg()
|
||||
{
|
||||
double minAngle = 0;
|
||||
double angleTmp;
|
||||
bool type;
|
||||
for (int i = 0; i < Vertices.Count - 1; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
angleTmp = Vertices[0].AngleTo(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[Vertices.Count - 2], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp > minAngle) minAngle = angleTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
angleTmp = Vertices[i].AngleTo(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (angleTmp is double.NaN) angleTmp = 180;
|
||||
type = Vertices[i].NormalDirection(Vertices[i - 1], Vertices[i + 1]);
|
||||
if (!type && angleTmp != 0) angleTmp = 360 - angleTmp;
|
||||
if (!type && angleTmp == 0) angleTmp = 0;
|
||||
if (angleTmp > minAngle) minAngle = angleTmp;
|
||||
}
|
||||
}
|
||||
|
||||
return minAngle;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Объект-структура со свойствами индексов трех точек образуюших угол и значения угла в градусах
|
||||
/// </summary>
|
||||
public struct AngleIn3Point
|
||||
{
|
||||
/// <summary>
|
||||
/// Индекс предыдущей вершины
|
||||
/// </summary>
|
||||
public int PreviousIdx { get; set; }
|
||||
/// <summary>
|
||||
/// Индех следующей вершины
|
||||
/// </summary>
|
||||
public int NextIdx { get; set; }
|
||||
/// <summary>
|
||||
/// Индекс вершины, на которой найден угол
|
||||
/// </summary>
|
||||
public int VerticeIdx { get; set; }
|
||||
/// <summary>
|
||||
/// Значение найденного угла в градусах
|
||||
/// </summary>
|
||||
public double AngleDeg { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
147
Geometry/Quadrangle.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Quadrangle : Polygon
|
||||
{
|
||||
private Point3d vertex1 = new Point3d();
|
||||
private Point3d vertex2 = new Point3d();
|
||||
private Point3d vertex3 = new Point3d();
|
||||
private Point3d vertex4 = new Point3d();
|
||||
|
||||
public Point3d Vertex1 { get => vertex1; set { vertex1 = value; Vertices[0] = vertex1; CalcQuadrangle(); } }
|
||||
public Point3d Vertex2 { get => vertex2; set { vertex2 = value; Vertices[1] = vertex2; CalcQuadrangle(); } }
|
||||
public Point3d Vertex3 { get => vertex3; set { vertex3 = value; Vertices[2] = vertex3; CalcQuadrangle(); } }
|
||||
public Point3d Vertex4 { get => vertex4; set { vertex4 = value; Vertices[3] = vertex4; CalcQuadrangle(); } }
|
||||
public double MaxAngleDeg { get; private set; }
|
||||
public bool IsValid { get; private set; }
|
||||
public UnitsLin Units { get; set; }
|
||||
|
||||
public Quadrangle(Triangle trg1, Triangle trg2)
|
||||
{
|
||||
List<Point3d> vrt = new List<Point3d>();
|
||||
List<Point3d> dgn = new List<Point3d>();
|
||||
vrt.Add(trg1.Vertex1);
|
||||
vrt.Add(trg1.Vertex2);
|
||||
vrt.Add(trg1.Vertex3);
|
||||
vrt.Add(trg2.Vertex1);
|
||||
vrt.Add(trg2.Vertex2);
|
||||
vrt.Add(trg2.Vertex3);
|
||||
for (int i = 0; i < vrt.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < vrt.Count; j++)
|
||||
{
|
||||
if (i == j) continue;
|
||||
if (Math.Round(vrt[i].X, 2) == Math.Round(vrt[j].X,2) && Math.Round(vrt[i].Y,2) == Math.Round(vrt[j].Y,2))
|
||||
{
|
||||
dgn.Add(vrt[i]);
|
||||
vrt.RemoveAt(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vrt.Count == 4)
|
||||
{
|
||||
if (vrt[0].Equals(dgn[0]) && vrt[1].Equals(dgn[1]))
|
||||
{
|
||||
vertex1 = vrt[0];
|
||||
AddVertice(Vertex1);
|
||||
vertex2 = vrt[2];
|
||||
AddVertice(Vertex2);
|
||||
vertex3 = vrt[1];
|
||||
AddVertice(Vertex3);
|
||||
vertex4 = vrt[3];
|
||||
AddVertice(Vertex4);
|
||||
}
|
||||
if (vrt[1].Equals(dgn[0]) && vrt[2].Equals(dgn[1]))
|
||||
{
|
||||
vertex1 = vrt[0];
|
||||
AddVertice(Vertex1);
|
||||
vertex2 = vrt[2];
|
||||
AddVertice(Vertex2);
|
||||
vertex3 = vrt[3];
|
||||
AddVertice(Vertex3);
|
||||
vertex4 = vrt[1];
|
||||
AddVertice(Vertex4);
|
||||
}
|
||||
if (vrt[0].Equals(dgn[0]) && vrt[2].Equals(dgn[1]))
|
||||
{
|
||||
vertex1 = vrt[0];
|
||||
AddVertice(Vertex1);
|
||||
vertex2 = vrt[1];
|
||||
AddVertice(Vertex2);
|
||||
vertex3 = vrt[2];
|
||||
AddVertice(Vertex3);
|
||||
vertex4 = vrt[3];
|
||||
AddVertice(Vertex4);
|
||||
}
|
||||
if (vrt[1].Equals(dgn[0]) && vrt[3].Equals(dgn[1]))
|
||||
{
|
||||
vertex1 = vrt[0];
|
||||
AddVertice(Vertex1);
|
||||
vertex2 = vrt[1];
|
||||
AddVertice(Vertex2);
|
||||
vertex3 = vrt[2];
|
||||
AddVertice(Vertex3);
|
||||
vertex4 = vrt[3];
|
||||
AddVertice(Vertex4);
|
||||
}
|
||||
IsValid = true;
|
||||
CalcQuadrangle();
|
||||
}
|
||||
else
|
||||
{
|
||||
IsValid = false;
|
||||
Vertices.Add(new Point3d());
|
||||
Vertices.Add(new Point3d());
|
||||
Vertices.Add(new Point3d());
|
||||
Vertices.Add(new Point3d());
|
||||
}
|
||||
}
|
||||
|
||||
public Quadrangle(Point3d node1, Point3d node2, Point3d node3, Point3d node4)
|
||||
{
|
||||
vertex1 = node1;
|
||||
AddVertice(node1);
|
||||
vertex2 = node2;
|
||||
AddVertice(node2);
|
||||
vertex3 = node3;
|
||||
AddVertice(node3);
|
||||
vertex4 = node4;
|
||||
AddVertice(node4);
|
||||
CalcQuadrangle();
|
||||
IsValid = true;
|
||||
}
|
||||
|
||||
public Quadrangle(Point2d node1, Point2d node2, Point2d node3, Point2d node4)
|
||||
{
|
||||
vertex1 = node1.ToPoint3d();
|
||||
AddVertice(node1);
|
||||
vertex2 = node2.ToPoint3d();
|
||||
AddVertice(node2);
|
||||
vertex3 = node3.ToPoint3d();
|
||||
AddVertice(node3);
|
||||
vertex4 = node4.ToPoint3d();
|
||||
AddVertice(node4);
|
||||
CalcQuadrangle();
|
||||
IsValid = true;
|
||||
}
|
||||
|
||||
public void CalcQuadrangle()
|
||||
{
|
||||
double ang1, ang2, ang3, ang4;
|
||||
ang1 = vertex1.AngleTo(vertex4, vertex2);
|
||||
ang2 = vertex2.AngleTo(vertex1, vertex3);
|
||||
ang3 = vertex3.AngleTo(vertex2, vertex4);
|
||||
ang4 = vertex4.AngleTo(vertex3, vertex1);
|
||||
MaxAngleDeg = Math.Max(Math.Max(Math.Max(ang1, ang2), ang3), ang4);
|
||||
CalcPolygon();
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Geometry/Triangle.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Triangle : Polygon
|
||||
{
|
||||
private Point3d vertex1;
|
||||
private Point3d vertex2;
|
||||
private Point3d vertex3;
|
||||
|
||||
public Point3d Vertex1 { get => vertex1; set { vertex1 = value; Vertices[0] = vertex1; CalcTriangle(); } }
|
||||
public Point3d Vertex2 { get => vertex2; set { vertex2 = value; Vertices[1] = vertex2; CalcTriangle(); } }
|
||||
public Point3d Vertex3 { get => vertex3; set { vertex3 = value; Vertices[2] = vertex3; CalcTriangle(); } }
|
||||
public double MaxAngleDeg { get; private set; }
|
||||
|
||||
public Triangle(Point3d node1, Point3d node2, Point3d node3)
|
||||
{
|
||||
vertex1 = node1;
|
||||
AddVertice(vertex1);
|
||||
vertex2 = node2;
|
||||
AddVertice(vertex2);
|
||||
vertex3 = node3;
|
||||
AddVertice(vertex3);
|
||||
CalcTriangle();
|
||||
}
|
||||
|
||||
public Triangle(Point2d node1, Point2d node2, Point2d node3)
|
||||
{
|
||||
vertex1 = node1.ToPoint3d();
|
||||
AddVertice(vertex1);
|
||||
vertex2 = node2.ToPoint3d();
|
||||
AddVertice(vertex2);
|
||||
vertex3 = node3.ToPoint3d();
|
||||
AddVertice(vertex3);
|
||||
CalcTriangle();
|
||||
}
|
||||
|
||||
public void CalcTriangle()
|
||||
{
|
||||
//Edge1 = new Line3d(vertex1, vertex2);
|
||||
//Edge2 = new Line3d(vertex2, vertex3);
|
||||
//Edge3 = new Line3d(vertex3, vertex1);
|
||||
//Centroid = new Point3d((vertex1.X + vertex2.X + vertex3.X) / 3, (vertex1.Y + vertex2.Y + vertex3.Y) / 3, (vertex1.Z + vertex2.Z + vertex3.Z) / 3);
|
||||
//Point3d minPt, maxPt;
|
||||
//minPt = new Point3d(
|
||||
// Math.Min(Math.Min(vertex1.X, vertex2.X), vertex3.X),
|
||||
// Math.Min(Math.Min(vertex1.Y, vertex2.Y), vertex3.Y),
|
||||
// Math.Min(Math.Min(vertex1.Z, vertex2.Z), vertex3.Z));
|
||||
//maxPt = new Point3d(
|
||||
// Math.Max(Math.Max(vertex1.X, vertex2.X), vertex3.X),
|
||||
// Math.Max(Math.Max(vertex1.Y, vertex2.Y), vertex3.Y),
|
||||
// Math.Max(Math.Max(vertex1.Z, vertex2.Z), vertex3.Z));
|
||||
//BoundingBox = new BoundingBox2d(minPt.ToPoint2d(), maxPt.ToPoint2d());
|
||||
double ang1, ang2, ang3;
|
||||
ang1 = vertex1.AngleTo(vertex3, vertex2);
|
||||
ang2 = vertex2.AngleTo(vertex1, vertex3);
|
||||
ang3 = vertex3.AngleTo(vertex2, vertex1);
|
||||
MaxAngleDeg = Math.Max(Math.Max(ang1, ang2), ang3);
|
||||
CalcPolygon();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Geometry/UnitsEnums.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public enum UnitsLin { м = 1, см = 2, мм = 3, _ = 0 }
|
||||
public enum UnitsArea { м = 1, см = 2, мм = 3, _ = 0 }
|
||||
public enum UnitsForce { т = 1, кН = 3, Н = 4, кг = 2, _ = 0 }
|
||||
public enum UnitsStress { т = 1, кН = 2, Н = 3, МПа = 4, кПа = 5, _ = 0 }
|
||||
public enum UnitsList { _, м, см, мм, т, кг, Н, кН, кПа, МПа, градус, rad }
|
||||
57
Geometry/Vector.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Vector : IVector
|
||||
{
|
||||
double[] arr;
|
||||
int n;
|
||||
|
||||
public int N { get => n; }
|
||||
public double this[int i] { get => arr[i]; set => arr[i] = value; }
|
||||
|
||||
public Vector(int N)
|
||||
{
|
||||
n = N;
|
||||
arr = new double[N];
|
||||
}
|
||||
|
||||
public Vector(Vector source)
|
||||
{
|
||||
n = source.N;
|
||||
arr = new double[source.N];
|
||||
arr = (double[])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Vector(Vector3d source)
|
||||
{
|
||||
n = 3;
|
||||
arr = new double[n];
|
||||
arr[0] = source.Vx;
|
||||
arr[1] = source.Vy;
|
||||
arr[2] = source.Vz;
|
||||
}
|
||||
|
||||
public Vector(double[] source)
|
||||
{
|
||||
n = source.Length;
|
||||
arr = new double[source.Length];
|
||||
arr = (double[])source.Clone();
|
||||
}
|
||||
|
||||
public double[] ToArray()
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
public Vector3d ToVector3d()
|
||||
{
|
||||
return new Vector3d { Vx = arr[0], Vy = arr[1], Vz = arr[2] };
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Geometry/Vector2d.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Math;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Vector2d
|
||||
{
|
||||
double[] arr = new double[2];
|
||||
|
||||
public double this[int i] { get => arr[i]; set => arr[i] = value; }
|
||||
public double Vx { get => arr[0]; set => arr[0] = value; }
|
||||
public double Vy { get => arr[1]; set => arr[1] = value; }
|
||||
public double Norma { get => Sqrt(Pow(Vx, 2) + Pow(Vy, 2)); }
|
||||
public double[] Unit { get => new double[] { Vx / Norma, Vy / Norma }; }
|
||||
|
||||
public Vector2d()
|
||||
{
|
||||
arr = new double[3];
|
||||
}
|
||||
|
||||
public Vector2d(double v1, double v2)
|
||||
{
|
||||
arr = new double[2];
|
||||
arr[0] = v1; arr[1] = v2;
|
||||
}
|
||||
|
||||
public Vector2d(Vector2d source)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr = (double[])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Vector2d(Point2d source)
|
||||
{
|
||||
arr = new double[2];
|
||||
arr[0] = source.X; arr[1] = source.Y;
|
||||
}
|
||||
|
||||
public Vector2d(Vector source)
|
||||
{
|
||||
arr = new double[2];
|
||||
if (source.N >= 2)
|
||||
{
|
||||
arr[0] = source[0]; arr[1] = source[1];
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2d(double[] source)
|
||||
{
|
||||
arr = new double[2];
|
||||
if (source.Length >= 2)
|
||||
{
|
||||
arr[0] = source[0]; arr[1] = source[1];
|
||||
}
|
||||
}
|
||||
|
||||
public static double CosAngleBetVectors(Vector2d v1, Vector2d v2)
|
||||
{
|
||||
return (v1.Vx * v2.Vx + v1.Vy * v2.Vy) / (Sqrt(v1.Vx * v1.Vx + v1.Vy * v1.Vy) * Sqrt(v2.Vx * v2.Vx + v2.Vy * v2.Vy));
|
||||
}
|
||||
|
||||
public double[] ToArray()
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
public Vector ToVector()
|
||||
{
|
||||
return new Vector(arr);
|
||||
}
|
||||
|
||||
public static Vector3d operator ^(Vector2d v1, Vector2d v2)
|
||||
{
|
||||
Vector3d tempV1 = new Vector3d(v1); Vector3d tempV2 = new Vector3d(v2);
|
||||
return new Vector3d
|
||||
{
|
||||
Vx = tempV1.Vy * tempV2.Vz - tempV1.Vz * tempV2.Vy,
|
||||
Vy = tempV1.Vz * tempV2.Vx - tempV1.Vx * tempV2.Vz,
|
||||
Vz = tempV1.Vx * tempV2.Vy - tempV1.Vy * tempV2.Vx
|
||||
};
|
||||
}
|
||||
|
||||
public static Vector2d operator *(Vector2d v1, Vector2d v2)
|
||||
{
|
||||
return new Vector2d
|
||||
{
|
||||
Vx = v1.Vx * v2.Vx,
|
||||
Vy = v1.Vy * v2.Vy
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
107
Geometry/Vector3d.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Math;
|
||||
|
||||
namespace Geo
|
||||
{
|
||||
[Serializable]
|
||||
public class Vector3d : IVector
|
||||
{
|
||||
double[] arr;
|
||||
int n = 3;
|
||||
|
||||
public double this[int i] { get => arr[i]; set => arr[i] = value; }
|
||||
public double Vx { get => arr[0]; set => arr[0] = value; }
|
||||
public double Vy { get => arr[1]; set => arr[1] = value; }
|
||||
public double Vz { get => arr[2]; set => arr[2] = value; }
|
||||
public double Norma { get => Sqrt(Pow(Vx, 2) + Pow(Vy, 2) + Pow(Vz, 2)); }
|
||||
public double[] Unit { get => new double[] { Vx / Norma, Vy / Norma, Vz / Norma }; }
|
||||
public int N { get => n; }
|
||||
|
||||
public Vector3d()
|
||||
{
|
||||
arr = new double[3];
|
||||
}
|
||||
|
||||
public Vector3d(Vector3d source)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr = (double[])source.arr.Clone();
|
||||
}
|
||||
|
||||
public Vector3d(Point3d source)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr[0] = source.X; arr[1] = source.Y; arr[2] = source.Z;
|
||||
}
|
||||
|
||||
public Vector3d(Vector source)
|
||||
{
|
||||
arr = new double[3];
|
||||
if (source.N >= 3)
|
||||
{
|
||||
arr[0] = source[0]; arr[1] = source[1]; arr[2] = source[2];
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3d(Vector2d source)
|
||||
{
|
||||
arr = new double[3];
|
||||
arr[0] = source.Vx;
|
||||
arr[1] = source.Vy;
|
||||
arr[2] = 0;
|
||||
}
|
||||
|
||||
public Vector3d(double[] source)
|
||||
{
|
||||
arr = new double[3];
|
||||
if (source.Length >= 3)
|
||||
{
|
||||
arr[0] = source[0]; arr[1] = source[1]; arr[2] = source[2];
|
||||
}
|
||||
}
|
||||
|
||||
public static double CosAngleBetVectors(Vector3d v1, Vector3d v2)
|
||||
{
|
||||
return (v1.Vx * v2.Vx + v1.Vy * v2.Vy + v1.Vz * v2.Vz) / (Sqrt(v1.Vx* v1.Vx + v1.Vy* v1.Vy+ v1.Vz * v1.Vz) * Sqrt(v2.Vx * v2.Vx + v2.Vy * v2.Vy + v2.Vz * v2.Vz));
|
||||
}
|
||||
|
||||
public double[] ToArray()
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
public Vector2d ToVector2d()
|
||||
{
|
||||
return new Vector2d() { Vx = Vx, Vy = Vy };
|
||||
}
|
||||
|
||||
public Vector ToVector()
|
||||
{
|
||||
return new Vector(arr);
|
||||
}
|
||||
|
||||
public static Vector3d operator ^(Vector3d v1, Vector3d v2)
|
||||
{
|
||||
return new Vector3d
|
||||
{
|
||||
Vx = v1.Vy * v2.Vz - v1.Vz * v2.Vy,
|
||||
Vy = v1.Vz * v2.Vx - v1.Vx * v2.Vz,
|
||||
Vz = v1.Vx * v2.Vy - v1.Vy * v2.Vx
|
||||
};
|
||||
}
|
||||
|
||||
public static Vector3d operator *(Vector3d v1, Vector3d v2)
|
||||
{
|
||||
return new Vector3d
|
||||
{
|
||||
Vx = v1.Vx * v2.Vx,
|
||||
Vy = v1.Vy * v2.Vy,
|
||||
Vz = v1.Vz * v2.Vz
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
231
Grapfics/CanvasDrafter.cs
Normal file
@@ -0,0 +1,231 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using AForge.Math.Geometry;
|
||||
using AForge;
|
||||
using netDxf.Entities;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class CanvasDrafter
|
||||
{
|
||||
//const double WXMIN = -300;
|
||||
//const double WXMAX = 300;
|
||||
//const double WYMIN = -300;
|
||||
//const double WYMAX = 300;
|
||||
const double DMARGIN = 0;
|
||||
|
||||
static Matrix WtoDMatrix;
|
||||
static Matrix DtoWMatrix;
|
||||
|
||||
static public void DrawPolygonsFromDxfLwPolyline(IEnumerable<LwPolyline> dxfEntitys,Canvas canvas, double h)
|
||||
{
|
||||
double dxmin = DMARGIN;
|
||||
double dymin = DMARGIN;
|
||||
double dymax = h - DMARGIN;
|
||||
|
||||
double wxmin;
|
||||
double wxmax;
|
||||
double wymin;
|
||||
double wymax;
|
||||
|
||||
List<LwPolylineVertex> dxfVertices = new List<LwPolylineVertex>();
|
||||
foreach (LwPolyline item in dxfEntitys)
|
||||
{
|
||||
dxfVertices.AddRange(item.Vertexes);
|
||||
}
|
||||
|
||||
IOrderedEnumerable<LwPolylineVertex> selected = from x in dxfVertices // определяем каждый объект как x
|
||||
orderby x.Position.X // упорядочиваем по возрастанию
|
||||
select x; // выбираем объект
|
||||
wxmin = selected.First().Position.X;
|
||||
wxmax = selected.Last().Position.X;
|
||||
|
||||
selected = from y in dxfVertices orderby y.Position.Y select y;
|
||||
|
||||
wymin = selected.First().Position.Y;
|
||||
wymax = selected.Last().Position.Y;
|
||||
|
||||
double w = (wxmax - wxmin) / (wymax - wymin)*h;
|
||||
double dxmax = w - DMARGIN;
|
||||
|
||||
PrepareTransformations(wxmin, wxmax, wymin, wymax, dxmin, dxmax, dymax, dymin);
|
||||
|
||||
Canvas da = canvas;
|
||||
da.Width = w;
|
||||
da.Height = h;
|
||||
|
||||
Polygon contour;
|
||||
foreach (LwPolyline item in dxfEntitys)
|
||||
{
|
||||
dxfVertices = item.Vertexes;
|
||||
Point pt;
|
||||
contour = new Polygon
|
||||
{
|
||||
Points = new PointCollection(),
|
||||
Stroke = Brushes.Black,
|
||||
StrokeThickness = 2,
|
||||
Fill = Brushes.White
|
||||
};
|
||||
foreach (LwPolylineVertex v in dxfVertices)
|
||||
{
|
||||
pt = WtoDMatrix.Transform(new Point(v.Position.X, v.Position.Y));
|
||||
contour.Points.Add(pt);
|
||||
}
|
||||
da.Children.Add(contour);
|
||||
//da.Children.Add(new Rectangle() { Width = 80, Height = 80,Stroke=Brushes.Black,StrokeThickness=1,Fill=Brushes.White });
|
||||
}
|
||||
}
|
||||
|
||||
static public void DrawFoundations(ObservableCollection<Foundation> founds, Canvas canvas, double h)
|
||||
{
|
||||
double dxmin = DMARGIN;
|
||||
double dymin = DMARGIN;
|
||||
double dymax = h - DMARGIN;
|
||||
|
||||
double wxmin;
|
||||
double wxmax;
|
||||
double wymin;
|
||||
double wymax;
|
||||
|
||||
List<Geo.Point3d> Vertices = new List<Geo.Point3d>();
|
||||
foreach (Foundation item in founds)
|
||||
{
|
||||
if (item.Contour != null) Vertices.AddRange(item.Contour.Vertices);
|
||||
}
|
||||
|
||||
if (Vertices.Count < 4) return;
|
||||
IOrderedEnumerable<Geo.Point3d> selected = from x in Vertices // определяем каждый объект как x
|
||||
orderby x.X // упорядочиваем по возрастанию
|
||||
select x; // выбираем объект
|
||||
|
||||
wxmin = selected.First().X;
|
||||
wxmax = selected.Last().X;
|
||||
|
||||
selected = from y in Vertices orderby y.Y select y;
|
||||
|
||||
wymin = selected.First().Y;
|
||||
wymax = selected.Last().Y;
|
||||
|
||||
double w = (wxmax - wxmin) / (wymax - wymin) * h;
|
||||
double dxmax = w - DMARGIN;
|
||||
|
||||
PrepareTransformations(wxmin, wxmax, wymin, wymax, dxmin, dxmax, dymax, dymin);
|
||||
|
||||
Canvas da = canvas;
|
||||
da.Width = w;
|
||||
da.Height = h;
|
||||
|
||||
Polygon contour;
|
||||
foreach (Foundation item in founds)
|
||||
{
|
||||
if (item.Contour == null) continue;
|
||||
ToolTip toolTip = new ToolTip();
|
||||
StackPanel toolTipPanel = new StackPanel();
|
||||
DataGrid props = new DataGrid() { ItemsSource = item.SmallProps, FontSize = 11 };
|
||||
//DataGrid results = new DataGrid() { ItemsSource = item.SmallResults};
|
||||
toolTipPanel.Children.Add(props);
|
||||
//toolTipPanel.Children.Add(results);
|
||||
toolTip.Content = toolTipPanel;
|
||||
Vertices = item.Contour.Vertices;
|
||||
Point pt;
|
||||
contour = new Polygon
|
||||
{
|
||||
Points = new PointCollection(),
|
||||
Stroke = Brushes.Black,
|
||||
StrokeThickness = 2,
|
||||
Fill = Brushes.White
|
||||
};
|
||||
ToolTipService.SetToolTip(contour, toolTip);
|
||||
ToolTipService.SetShowDuration(contour, int.MaxValue);
|
||||
|
||||
foreach (Geo.Point3d v in Vertices)
|
||||
{
|
||||
pt = WtoDMatrix.Transform(new Point(v.X, v.Y));
|
||||
contour.Points.Add(pt);
|
||||
}
|
||||
da.Children.Add(contour);
|
||||
|
||||
//da.Children.Add(new Rectangle() { Width = 80, Height = 80,Stroke=Brushes.Black,StrokeThickness=1,Fill=Brushes.White });
|
||||
}
|
||||
}
|
||||
static public void DrawFoundationsNumbers(ObservableCollection<Foundation> founds, Canvas canvas)
|
||||
{
|
||||
double dxmin = DMARGIN;
|
||||
double dymin = DMARGIN;
|
||||
double dymax = canvas.ActualHeight - DMARGIN;
|
||||
double dxmax = canvas.ActualWidth - DMARGIN;
|
||||
|
||||
double wxmin;
|
||||
double wxmax;
|
||||
double wymin;
|
||||
double wymax;
|
||||
|
||||
List<Geo.Point3d> Vertices = new List<Geo.Point3d>();
|
||||
foreach (Foundation item in founds)
|
||||
{
|
||||
if (item.Contour != null) Vertices.AddRange(item.Contour.Vertices);
|
||||
}
|
||||
|
||||
if (Vertices.Count < 4) return;
|
||||
IOrderedEnumerable<Geo.Point3d> selected = from x in Vertices // определяем каждый объект как x
|
||||
orderby x.X // упорядочиваем по возрастанию
|
||||
select x; // выбираем объект
|
||||
|
||||
wxmin = selected.First().X;
|
||||
wxmax = selected.Last().X;
|
||||
|
||||
selected = from y in Vertices orderby y.Y select y;
|
||||
|
||||
wymin = selected.First().Y;
|
||||
wymax = selected.Last().Y;
|
||||
|
||||
PrepareTransformations(wxmin, wxmax, wymin, wymax, dxmin, dxmax, dymax, dymin);
|
||||
|
||||
Canvas da = canvas;
|
||||
|
||||
Label label;
|
||||
foreach (Foundation item in founds)
|
||||
{
|
||||
Point pt = WtoDMatrix.Transform(new Point(item.X, item.Y));
|
||||
label = new Label
|
||||
{
|
||||
Content = item.Number.ToString(),
|
||||
VerticalContentAlignment = VerticalAlignment.Center,
|
||||
HorizontalContentAlignment = HorizontalAlignment.Center
|
||||
};
|
||||
Canvas.SetTop(label, pt.Y);
|
||||
Canvas.SetLeft(label, pt.X);
|
||||
da.Children.Add(label);
|
||||
|
||||
//da.Children.Add(new Rectangle() { Width = 80, Height = 80,Stroke=Brushes.Black,StrokeThickness=1,Fill=Brushes.White });
|
||||
}
|
||||
}
|
||||
|
||||
static void PrepareTransformations(double wxmin, double wxmax, double wymin, double wymax, double dxmin, double dxmax, double dymin, double dymax)
|
||||
{
|
||||
// Make WtoD.
|
||||
WtoDMatrix = Matrix.Identity;
|
||||
WtoDMatrix.Translate(-wxmin, -wymin);
|
||||
|
||||
double xscale = (dxmax - dxmin) / (wxmax - wxmin);
|
||||
double yscale = (dymax - dymin) / (wymax - wymin);
|
||||
WtoDMatrix.Scale(xscale, yscale);
|
||||
|
||||
WtoDMatrix.Translate(dxmin, dymin);
|
||||
|
||||
// Make DtoW.
|
||||
DtoWMatrix = WtoDMatrix;
|
||||
DtoWMatrix.Invert();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
85
Grapfics/RenderVisualService.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public static class RenderVisualService
|
||||
{
|
||||
private const double defaultDpi = 96.0;
|
||||
|
||||
public static ImageSource RenderToPNGImageSource(Visual targetControl)
|
||||
{
|
||||
var renderTargetBitmap = GetRenderTargetBitmapFromControl(targetControl);
|
||||
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));
|
||||
|
||||
var result = new BitmapImage();
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
encoder.Save(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
result.BeginInit();
|
||||
result.CacheOption = BitmapCacheOption.OnLoad;
|
||||
result.StreamSource = memoryStream;
|
||||
result.EndInit();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void RenderToPNGFile(Visual targetControl, string filename)
|
||||
{
|
||||
var renderTargetBitmap = GetRenderTargetBitmapFromControl(targetControl);
|
||||
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap));
|
||||
|
||||
var result = new BitmapImage();
|
||||
|
||||
try
|
||||
{
|
||||
using (var fileStream = new FileStream(filename, FileMode.Create))
|
||||
{
|
||||
encoder.Save(fileStream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"There was an error saving the file: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static BitmapSource GetRenderTargetBitmapFromControl(Visual targetControl, double dpi = defaultDpi)
|
||||
{
|
||||
if (targetControl == null) return null;
|
||||
|
||||
var bounds = VisualTreeHelper.GetDescendantBounds(targetControl);
|
||||
var renderTargetBitmap = new RenderTargetBitmap((int)(bounds.Width * dpi / 96.0),
|
||||
(int)(bounds.Height * dpi / 96.0),
|
||||
dpi,
|
||||
dpi,
|
||||
PixelFormats.Pbgra32);
|
||||
|
||||
var drawingVisual = new DrawingVisual();
|
||||
|
||||
using (var drawingContext = drawingVisual.RenderOpen())
|
||||
{
|
||||
var visualBrush = new VisualBrush(targetControl);
|
||||
drawingContext.DrawRectangle(visualBrush, null, new Rect(new Point(), bounds.Size));
|
||||
}
|
||||
|
||||
renderTargetBitmap.Render(drawingVisual);
|
||||
return renderTargetBitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
312
GroundOrganizer.csproj
Normal file
@@ -0,0 +1,312 @@
|
||||
<?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>{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>GroundOrganizer</RootNamespace>
|
||||
<AssemblyName>GroundOrganizer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\business-color_books_icon-icons.com_53474.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AForge.2.2.5\lib\AForge.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AForge.Math, Version=2.2.5.0, Culture=neutral, PublicKeyToken=abba2e25397ee8c9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AForge.Math.2.2.5\lib\AForge.Math.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EPPlus, Version=4.5.3.2, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EPPlus.4.5.3.2\lib\net40\EPPlus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="netDxf, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\netDXF.2.2.0.1\lib\net45\netDxf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Controls.Ribbon" />
|
||||
<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="Triangle">
|
||||
<HintPath>..\..\..\..\OneDrive\Documents\C#\triangle\sourceCode\sourceCode\Triangle.NET\Triangle\bin\Debug\Triangle.dll</HintPath>
|
||||
</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="BL\DataPair.cs" />
|
||||
<Compile Include="BL\PlanningVertex.cs" />
|
||||
<Compile Include="Windows\FoundPropWindow.xaml.cs">
|
||||
<DependentUpon>FoundPropWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Geometry\BoundingBox2d.cs" />
|
||||
<Compile Include="Geometry\UnitsEnums.cs" />
|
||||
<Compile Include="Geometry\Polygon.cs" />
|
||||
<Compile Include="Geometry\Quadrangle.cs" />
|
||||
<Compile Include="Geometry\Triangle.cs" />
|
||||
<Compile Include="Grapfics\CanvasDrafter.cs" />
|
||||
<Compile Include="Pages\MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TestWindow.xaml.cs">
|
||||
<DependentUpon>TestWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VM\CalculationsVM.cs" />
|
||||
<Compile Include="VM\DrawingVM.cs" />
|
||||
<Compile Include="VM\PlanningVM.cs" />
|
||||
<Compile Include="Windows\CanwasWindow.xaml.cs">
|
||||
<DependentUpon>CanwasWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Grapfics\RenderVisualService.cs" />
|
||||
<Compile Include="Windows\ImageWindow.xaml.cs">
|
||||
<DependentUpon>ImageWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VM\HelpsVM.cs" />
|
||||
<Compile Include="Windows\AlertWindow.xaml.cs">
|
||||
<DependentUpon>AlertWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BL\Enums.cs" />
|
||||
<Compile Include="BL\Foundation.cs" />
|
||||
<Compile Include="BL\FoundLoad.cs" />
|
||||
<Compile Include="BL\Structure.cs" />
|
||||
<Compile Include="BL\TablesInterolator.cs" />
|
||||
<Compile Include="BL\ToSerializ.cs" />
|
||||
<Compile Include="BL\DataR.cs" />
|
||||
<Compile Include="BL\DataS.cs" />
|
||||
<Compile Include="Geometry\IVector.cs" />
|
||||
<Compile Include="Geometry\Line2d.cs" />
|
||||
<Compile Include="Geometry\Line3d.cs" />
|
||||
<Compile Include="Geometry\Matrix.cs" />
|
||||
<Compile Include="Geometry\Plane.cs" />
|
||||
<Compile Include="Geometry\Point2d.cs" />
|
||||
<Compile Include="Geometry\Point3d.cs" />
|
||||
<Compile Include="Geometry\Vector.cs" />
|
||||
<Compile Include="Geometry\Vector2d.cs" />
|
||||
<Compile Include="Geometry\Vector3d.cs" />
|
||||
<Compile Include="Pages\FoundationsPage.xaml.cs">
|
||||
<DependentUpon>FoundationsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\StructuresPage.xaml.cs">
|
||||
<DependentUpon>StructuresPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="VM\FoundLoadsVM.cs" />
|
||||
<Compile Include="VM\FoundationsVM.cs" />
|
||||
<Compile Include="VM\StructuresVM.cs" />
|
||||
<Compile Include="VM\BoresVM.cs" />
|
||||
<Compile Include="VM\LayersVM.cs" />
|
||||
<Compile Include="VM\IGEsVM.cs" />
|
||||
<Compile Include="Pages\BoresPage.xaml.cs">
|
||||
<DependentUpon>BoresPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\ResultsPage.cs">
|
||||
<DependentUpon>ResultsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\IGEsPage.xaml.cs">
|
||||
<DependentUpon>IGEsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\PlayGroundsPage.xaml.cs">
|
||||
<DependentUpon>PlayGroundsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VM\RelayCommand.cs" />
|
||||
<Compile Include="VM\PlayGroundVM.cs" />
|
||||
<Compile Include="VM\UnitsViewModel .cs" />
|
||||
<Compile Include="VM\ViewModel.cs" />
|
||||
<Page Include="Windows\FoundPropWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="TestWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\CanwasWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\ImageWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\AlertWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\FoundationsPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\StructuresPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\BoresPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\ResultsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dictionary.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\IGEsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BL\Bore.cs" />
|
||||
<Compile Include="BL\IGE.cs" />
|
||||
<Compile Include="BL\Layer.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Pages\PlayGroundsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BL\PlayGround.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Resources\tabl_5_5.csv" />
|
||||
<None Include="Resources\ИГЭ.xlsx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\business-color_books_icon-icons.com_53474.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Аннотация 2019-06-14 145047.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ShemaFound.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ShemaLoads.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\ShemaLoads.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\text-list-numbers-icon32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Bookmark-add-icon32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Save-icon32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\database-accept-icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Help-and-Support-icon32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\Save_as-80_icon-icons.com32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\icons8-export-csv-32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\icons8-import-csv-32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\interfaceDXF.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\drawing1_32.png" />
|
||||
<Resource Include="Images\XLSX_export-32.png" />
|
||||
<Resource Include="Images\XLSX_import-32.png" />
|
||||
<Resource Include="Images\icons8-mesh-32 %281%29.png" />
|
||||
<Resource Include="Images\icons8-mesh-32.png" />
|
||||
<Resource Include="Images\icons8-mesh-80_ed1.png" />
|
||||
<Resource Include="Images\icons8-spiderweb-32.png" />
|
||||
<Resource Include="Images\drawing32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\table_1061_32.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
25
GroundOrganizer.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35303.130
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GroundOrganizer", "GroundOrganizer.csproj", "{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{82435CCA-41F6-4074-8C93-A3DCDF9BA0E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {94A84522-F2BC-4F49-9D2C-711A3AAAD4BA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Images/Bookmark-add-icon32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Images/Help-and-Support-icon32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Images/Save-icon32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Images/Save_as-80_icon-icons.com32.png
Normal file
|
After Width: | Height: | Size: 961 B |
BIN
Images/ShemaLoads.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Images/XLSX_export-32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Images/XLSX_import-32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Images/database-accept-icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Images/drawing1_32.png
Normal file
|
After Width: | Height: | Size: 582 B |
BIN
Images/drawing32.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Images/icons8-export-csv-32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Images/icons8-import-csv-32.png
Normal file
|
After Width: | Height: | Size: 1021 B |
BIN
Images/icons8-mesh-32 (1).png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Images/icons8-mesh-32.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Images/icons8-mesh-80_ed1.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Images/icons8-spiderweb-32.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Images/interfaceDXF.png
Normal file
|
After Width: | Height: | Size: 855 B |
BIN
Images/table_1061_32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Images/text-list-numbers-icon32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
125
MainWindow.xaml
Normal file
@@ -0,0 +1,125 @@
|
||||
<Window x:Class="GroundOrganizer.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
FontSize="14"
|
||||
Margin="5" SizeToContent="WidthAndHeight"
|
||||
Title="MainWindow" >
|
||||
|
||||
<Window.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Window.DataContext>
|
||||
|
||||
<!--<Window.CommandBindings>
|
||||
<CommandBinding Command="Open" Executed="CommandBinding_Executed" />
|
||||
</Window.CommandBindings>-->
|
||||
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Command="{Binding OpenGroundBase}" Key="F2" Modifiers="Ctrl"/>
|
||||
</Window.InputBindings>
|
||||
|
||||
<Grid x:Name="mainGrid">
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<Menu Background="White" Margin="4">
|
||||
<MenuItem Header="Файл">
|
||||
<MenuItem Header="Создать новую базу данных" />
|
||||
<MenuItem Header="Открыть базу данных" Command="{Binding OpenGroundBase}" />
|
||||
<MenuItem Header="Сохранить базу данных" />
|
||||
<MenuItem Header="Сохранить базу данных как"/>
|
||||
<Separator />
|
||||
<MenuItem Header="Выход"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Редактировать" ></MenuItem>
|
||||
<MenuItem Header="Вид" >
|
||||
<MenuItem Header="Табличный режим"/>
|
||||
<MenuItem Header="Графический режим"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Расчеты" >
|
||||
<MenuItem Header="Табличный режим"/>
|
||||
<MenuItem Header="Графический режим"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<TabControl x:Name="MainTabControl" >
|
||||
|
||||
<!--Площадки-->
|
||||
<TabItem x:Name="PlayGroundTab"
|
||||
Background="LavenderBlush"
|
||||
Header="{StaticResource ПлощадкиЗаголовок}" >
|
||||
<Frame x:Name="PlayGroundFrame"
|
||||
Source="Pages\PlayGroundsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Сооружения-->
|
||||
<TabItem x:Name="StructuresTab"
|
||||
Background="Azure"
|
||||
Header="Сооружения">
|
||||
<Frame x:Name="StructuresFrame" Source="Pages\StructuresPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--ИГЭ-->
|
||||
<TabItem x:Name="IGEsTab"
|
||||
Background="PaleGoldenrod"
|
||||
Header="ИГЭ">
|
||||
<Frame x:Name="IGEsFrame"
|
||||
Source="Pages\IGEsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Скважины-->
|
||||
<TabItem x:Name="BoresTab"
|
||||
Background="LightBlue"
|
||||
Header="Скважины">
|
||||
<Frame x:Name="BoresFrame"
|
||||
Source="Pages\BoresPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Фундаменты-->
|
||||
<TabItem x:Name="FoundationsTab"
|
||||
Background="Bisque"
|
||||
Header="Фундаменты">
|
||||
<Frame x:Name="FoundationsFrame" Source="Pages\FoundationsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Resultats-->
|
||||
<TabItem x:Name="ResultsTab"
|
||||
Header="Результаты" Background="#FFE0C8F7">
|
||||
<Frame x:Name="ResulsFrame" NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
<StatusBar>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding BasePath}" FontSize="10" Foreground="Gray"/>
|
||||
<TextBlock Text=" | " FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Площадка:" FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" " FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding NamePlayGround}" FontSize="10" Foreground="Blue" FontWeight="Bold"/>
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Скважина:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameBore}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Сооружение:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameStructure}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Фундамент:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameFoundation}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Нагрузка:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameFoundLoad}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</StatusBar>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Window>
|
||||
70
MainWindow.xaml.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
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;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.IO;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Controls.Ribbon;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
ViewModel vm;
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
vm = DataContext as ViewModel;
|
||||
Top = 75;
|
||||
Left = 75;
|
||||
double ws = SystemParameters.PrimaryScreenWidth;
|
||||
double hs = SystemParameters.PrimaryScreenHeight;
|
||||
MaxWidth = ws - Left - 5;
|
||||
MaxHeight = hs - Top - 40;
|
||||
//this.SizeToContent = SizeToContent.Height;
|
||||
Loaded += MainWindow_Loaded;
|
||||
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (File.Exists(Properties.Settings.Default.BasePath) == true)
|
||||
{
|
||||
// создаем объект BinaryFormatter
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
using (FileStream fs = new FileStream(Properties.Settings.Default.BasePath, FileMode.OpenOrCreate))
|
||||
{
|
||||
ViewModel vm = (ViewModel)DataContext;
|
||||
//ToSerializ ser = (ToSerializ)formatter.Deserialize(fs);
|
||||
vm.ListPlayGround = formatter.Deserialize(fs) as ObservableCollection<PlayGround>;
|
||||
DataContext = vm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
vm.ReadDB();
|
||||
}
|
||||
|
||||
//private void MainRibbon_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
//{
|
||||
// if(contentFrame!=null) contentFrame.Content = null;
|
||||
// if (HomeTab.IsSelected && contentFrame != null) contentFrame.Content = new MainPage();
|
||||
//}
|
||||
}
|
||||
}
|
||||
300
Pages/BoresPage.xaml
Normal file
@@ -0,0 +1,300 @@
|
||||
<Page x:Class="GroundOrganizer.BoresPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
Background="White" FontSize="14"
|
||||
Title="BoresPage">
|
||||
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid x:Name="BoresStackPanel">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" >
|
||||
<TextBlock Text="Скважины площадки: " HorizontalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NamePlayGround}" HorizontalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3" HorizontalAlignment="Left">
|
||||
<Button Command="{Binding AddBore}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumBores}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateBores}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportBoresToXLSX}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_export-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportBoresFromXLSX}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_import-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<Button Command="{Binding CreateBoresMesh}" Margin="3" Background="White" BorderThickness="0" ToolTip="Создать триангуляционную сеть">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-spiderweb-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="BoresDataGrid" HorizontalAlignment="Left"
|
||||
MaxHeight="300" MinColumnWidth="30"
|
||||
Margin="3" Grid.Row="1" Grid.Column="0"
|
||||
ItemsSource="{Binding ListBore}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource BoresDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
SelectedItem="{Binding SelectedBore}" ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
<DataGridTextColumn Header="Номер" Binding="{Binding Path=Name}" CellStyle="{StaticResource CellGridStyle}"/>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=X}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="X"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Y}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Y"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Z}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Абс." HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="отметка" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="устья" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=WL}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Отметка" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="уровня" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="грунтовых" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="вод*" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=DZ}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="d"/>
|
||||
<TextBlock Text="z" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<TextBlock Text="{Binding BoresNote}" FontSize="10" Foreground="Gray" Margin="3,0,0,3" Grid.Row="2" HorizontalAlignment="Left"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="1">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="0">
|
||||
<TextBlock Text="Набор слоев скважины: " HorizontalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NameBore}" HorizontalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3">
|
||||
<Button Command="{Binding AddLayer}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumLayers}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateLayers}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportLayersToXLSX}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_export-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportLayersFromXLSX}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_import-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="LayersDataGrid"
|
||||
MaxHeight="300" MinColumnWidth="40"
|
||||
Margin="3" Grid.Row="1"
|
||||
ItemsSource="{Binding ListLayer}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource LayersDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
|
||||
<DataGridComboBoxColumn x:Name="IGEsListCbxCol"
|
||||
SelectedItemBinding="{Binding Path=NumIGE}">
|
||||
<DataGridComboBoxColumn.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="ИГЭ" />
|
||||
</StackPanel>
|
||||
</DataGridComboBoxColumn.Header>
|
||||
</DataGridComboBoxColumn>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Down}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Глубина"/>
|
||||
<TextBlock Text="подошвы"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="слоя"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=H}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Мощность"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="слоя"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Z}"
|
||||
IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Абс." HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="отметка" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="подошвы" HorizontalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="слоя" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Description}"
|
||||
MinWidth="128"
|
||||
IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Грунт"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2">
|
||||
<Button Content="Отметки по мощности слоя" Command="{Binding RecalcLayerH}" Margin="3"/>
|
||||
<Button Content="Отметки по глубине подошвы" Command="{Binding RecalcLayerDown}" Margin="3"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Page>
|
||||
31
Pages/BoresPage.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для BoresPage.xaml
|
||||
/// </summary>
|
||||
public partial class BoresPage : Page
|
||||
{
|
||||
private ViewModel vm;
|
||||
public BoresPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
vm = DataContext as ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
377
Pages/FoundationsPage.xaml
Normal file
@@ -0,0 +1,377 @@
|
||||
<Page x:Class="GroundOrganizer.FoundationsPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
Background="White" FontSize="14"
|
||||
Title="FoundationsPage">
|
||||
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||
<TextBlock Text="Формирование списка фундаментов сооружения: " Margin="3" />
|
||||
<TextBlock Text="{Binding NameStructure}" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3" HorizontalAlignment="Left">
|
||||
<Button Command="{Binding AddFoundation}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumFoundations}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateFoundations}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportFoundationsFromCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_import-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportFoundationsToCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_export-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportFoundationsFromDXF}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.dxf">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/interfaceDXF.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="0" HorizontalAlignment="Right" Orientation="Horizontal" Margin="3">
|
||||
<Button ToolTip="Открыть графический вид"
|
||||
Command="{Binding DrowFoundations}" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/drawing32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button ToolTip="Справка"
|
||||
Command="{Binding HelpFoundation}" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid x:Name="FoundationsDataGrid" Grid.Row="1"
|
||||
MaxHeight="250" MinColumnWidth="30"
|
||||
Margin="3"
|
||||
ItemsSource="{Binding ListFoundation}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource FoundationsDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
SelectedItem="{Binding SelectedFoundation}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Opacity="0.9">
|
||||
<MenuItem Header="Изменить свойства фундамента" Command="{Binding ShowFoundProps}"></MenuItem>
|
||||
<MenuItem Header="Пересчитать отметки всех фундаментов" Command="{Binding CalculateLevelsFounds}"></MenuItem>
|
||||
<!--<MenuItem Header="Перенумеровать" Command="{Binding RenumIGEs}"></MenuItem>
|
||||
<MenuItem Header="Сохранить в БД" Command="{Binding UpdateIGEs}"></MenuItem>
|
||||
<MenuItem Header="Сохранить таблицу в *.csv" ></MenuItem>
|
||||
<MenuItem Header="Заполнить таблицу из *.csv" ></MenuItem>-->
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
<DataGridTextColumn Header="Марка" Binding="{Binding Path=Name}" CellStyle="{StaticResource CellGridStyle}"/>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=B}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="B"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=L}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="L"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=D1}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="d"/>
|
||||
<TextBlock Text="1" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Db}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="d"/>
|
||||
<TextBlock Text="b" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Hs}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="h"/>
|
||||
<TextBlock Text="s" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Hcf}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="h"/>
|
||||
<TextBlock Text="cf" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Ycf}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Text="γ" FontSize="16"/>
|
||||
<TextBlock Text="cf" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text=" [т" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="/м" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="3" FontSize="10" VerticalAlignment="Top" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="]" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=X}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="X"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Y}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Y"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridCheckBoxColumn Header="Подвал" Binding="{Binding Path=Basement}" CellStyle="{StaticResource CellGridStyle}"/>
|
||||
|
||||
<DataGridComboBoxColumn x:Name="typeFondsListCbxCol" SelectedItemBinding="{Binding Path=Type}">
|
||||
<DataGridComboBoxColumn.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Тип" />
|
||||
</StackPanel>
|
||||
</DataGridComboBoxColumn.Header>
|
||||
</DataGridComboBoxColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="1">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Формирование списка нагрузок на фундамент: " HorizontalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NameFoundation}" HorizontalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3">
|
||||
<Button Command="{Binding AddFoundLoad}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumFoundLoads}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateFoundLoads}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportFoundLoadsFromCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_import-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportFoundLoadsToCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_export-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="{Binding HelpLoads}" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="ForcesDataGrid" Grid.Row="1"
|
||||
MaxHeight="250" MinColumnWidth="40"
|
||||
Margin="3"
|
||||
ItemsSource="{Binding ListFoundLoad}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource LayersDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
SelectedItem="{Binding SelectedFoundLoad}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=N}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="N"/>
|
||||
<TextBlock Text=" [тс]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Mx}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="M"/>
|
||||
<TextBlock Text="x" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [тсм]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=My}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="M"/>
|
||||
<TextBlock Text="y" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [тсм]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Qx}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Q"/>
|
||||
<TextBlock Text="x" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [тс]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Qy}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Q"/>
|
||||
<TextBlock Text="y" FontSize="10" VerticalAlignment="Bottom" Margin="0,6,0,0"/>
|
||||
<TextBlock Text=" [тс]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=q}"
|
||||
CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="q"/>
|
||||
<TextBlock Text=" [т" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="/м" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="2" FontSize="10" VerticalAlignment="Top" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="]" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<UniformGrid Columns="2" Rows="3" Grid.Row="2">
|
||||
<Button Content="R по скважине" Command="{Binding CalcRinBore}" Margin="3"/>
|
||||
<Button Content="Осадка по скважине" Command="{Binding CalcSpInBore}" Margin="3"/>
|
||||
<Button Content="R по скважинам" Command="{Binding CalcRinBores}" Margin="3"/>
|
||||
<Button Content="Осадка по скважинам" Command="{Binding CalcSpInBores}" Margin="3"/>
|
||||
<Button Content="R по координатам" Command="{Binding CalcRinCoords}" Margin="3"/>
|
||||
<Button Content="Осадка по координатам" Command="{Binding RenumFoundLoads}" Margin="3"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Page>
|
||||
31
Pages/FoundationsPage.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для FoundationsPage.xaml
|
||||
/// </summary>
|
||||
public partial class FoundationsPage : Page
|
||||
{
|
||||
private ViewModel vm;
|
||||
public FoundationsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
vm = DataContext as ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
230
Pages/IGEsPage.xaml
Normal file
@@ -0,0 +1,230 @@
|
||||
<Page x:Class="GroundOrganizer.IGEsPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
Background="White" FontSize="14"
|
||||
Title="IGEsPage">
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid x:Name="IGEsGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" >
|
||||
<TextBlock Text="ИГЭ площадки: " VerticalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NamePlayGround}" VerticalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="3">
|
||||
<Button Command="{Binding AddIGE}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumIGEs}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateIGEs}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding SaveIGEsTable}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить как">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Save_as-80_icon-icons.com32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportIGEfromCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_import-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportIGEtoCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.xlsx">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/XLSX_export-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="IGEsDataGrid" Grid.Row="1"
|
||||
MaxHeight="780" MinColumnWidth="30"
|
||||
Margin="3"
|
||||
ItemsSource="{Binding ListIGE}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource IGEsDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}" ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}" SelectionUnit="CellOrRowHeader" >
|
||||
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Opacity="1">
|
||||
<MenuItem Header="Добавить ИГЭ" Command="{Binding AddIGE}"></MenuItem>
|
||||
<MenuItem Header="Перенумеровать" Command="{Binding RenumIGEs}"></MenuItem>
|
||||
<MenuItem Header="Сохранить в БД" Command="{Binding UpdateIGEs}"></MenuItem>
|
||||
<MenuItem Header="Сохранить таблицу в *.csv" Click="ToCSV_Click"></MenuItem>
|
||||
<MenuItem Header="Заполнить таблицу из *.csv" Click="FromCSV_Click"></MenuItem>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
<DataGridTextColumn Header="ИГЭ" Binding="{Binding Path=NumIGE}" CellStyle="{StaticResource CellGridStyle}"/>
|
||||
|
||||
<!--<DataGridTextColumn Binding="{Binding Path=Description}" MaxWidth="350">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Наименование грунта" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>-->
|
||||
|
||||
<DataGridTemplateColumn Header="Наименование грунта" MinWidth="200" MaxWidth="350">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path= Description}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Path= Description}" TextWrapping="Wrap" Background="LightGoldenrodYellow"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=RoII}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="ρ" FontSize="16"/>
|
||||
<TextBlock Text="II" FontSize="10" VerticalAlignment="Bottom" Margin="0,10,0,0"/>
|
||||
<TextBlock Text=" [т/м" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="3" FontSize="8" VerticalAlignment="Top" Margin="0,2,0,0" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=FiII}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="φ" FontSize="16"/>
|
||||
<TextBlock Text="II" FontSize="10" VerticalAlignment="Bottom" Margin="0,10,0,0"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=CII}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="c" FontSize="16"/>
|
||||
<TextBlock Text="II" FontSize="10" Margin="0,10,0,0"/>
|
||||
<TextBlock Text=" [МПа]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=E}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="E" FontSize="16"/>
|
||||
<TextBlock Text=" [МПа]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Ys}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="γ" FontSize="16"/>
|
||||
<TextBlock Text="s" FontSize="10" VerticalAlignment="Bottom" Margin="0,10,0,0"/>
|
||||
<TextBlock Text=" [т/м" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="3" FontSize="8" VerticalAlignment="Top" Margin="0,2,0,0" Foreground="DarkGoldenrod"/>
|
||||
<TextBlock Text="]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Ke}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="e"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=IL}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="I"/>
|
||||
<TextBlock Text="L" FontSize="10" Margin="0,6,0,0"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridCheckBoxColumn Header="W" Binding="{Binding Path=W}"/>
|
||||
|
||||
<DataGridComboBoxColumn ItemsSource="{StaticResource GroundTypeArr}"
|
||||
SelectedItemBinding="{Binding Path=GroundType}">
|
||||
<DataGridComboBoxColumn.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Тип" />
|
||||
</StackPanel>
|
||||
</DataGridComboBoxColumn.Header>
|
||||
</DataGridComboBoxColumn>
|
||||
|
||||
<!--<DataGridTemplateColumn HeaderStyle="{StaticResource HeaderGridStyle}" Header="Описание" MaxWidth="500">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path= Description}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Path= Description}" TextWrapping="Wrap" Background="LightGoldenrodYellow"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<StackPanel x:Name="IGEsStackPanel">
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Page>
|
||||
41
Pages/IGEsPage.xaml.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для IGEsPage.xaml
|
||||
/// </summary>
|
||||
public partial class IGEsPage : Page
|
||||
{
|
||||
private ViewModel vm;
|
||||
public IGEsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
vm = App.Current.MainWindow.DataContext as ViewModel;
|
||||
DataContext = vm;
|
||||
}
|
||||
|
||||
private void ToCSV_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
vm.SaveIGEsInCsv();
|
||||
}
|
||||
|
||||
private void FromCSV_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
vm.ReadIGEsFromCsv();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Pages/MainPage.xaml
Normal file
@@ -0,0 +1,60 @@
|
||||
<Page x:Class="GroundOrganizer.MainPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Bottom"
|
||||
Title="MainPage">
|
||||
<!--d:DesignHeight="450" d:DesignWidth="800"-->
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid>
|
||||
<TabControl TabStripPlacement="Bottom" >
|
||||
|
||||
<!--Площадки-->
|
||||
<TabItem x:Name="PlayGroundTab"
|
||||
Background="LavenderBlush"
|
||||
Header="{StaticResource ПлощадкиЗаголовок}" >
|
||||
<Frame x:Name="PlayGroundFrame"
|
||||
Source="PlayGroundsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--ИГЭ-->
|
||||
<TabItem x:Name="IGEsTab"
|
||||
Background="PaleGoldenrod"
|
||||
Header="ИГЭ">
|
||||
<Frame x:Name="IGEsFrame"
|
||||
Source="IGEsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Скважины-->
|
||||
<TabItem x:Name="BoresTab"
|
||||
Background="LightBlue"
|
||||
Header="Скважины">
|
||||
<Frame x:Name="BoresFrame"
|
||||
Source="BoresPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Сооружения-->
|
||||
<TabItem x:Name="StructuresTab"
|
||||
Background="Azure"
|
||||
Header="Сооружения">
|
||||
<Frame x:Name="StructuresFrame" Source="StructuresPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
<!--Фундаменты-->
|
||||
<TabItem x:Name="FoundationsTab"
|
||||
Background="Bisque"
|
||||
Header="Фундаменты">
|
||||
<Frame x:Name="FoundationsFrame" Source="FoundationsPage.xaml"
|
||||
NavigationUIVisibility="Hidden"/>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Page>
|
||||
29
Pages/MainPage.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для MainPage.xaml
|
||||
/// </summary>
|
||||
public partial class MainPage : Page
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
90
Pages/PlayGroundsPage.xaml
Normal file
@@ -0,0 +1,90 @@
|
||||
<Page x:Class="GroundOrganizer.PlayGroundsPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
FontSize="14"
|
||||
Title="PlayGroundsPage">
|
||||
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<GroupBox Header="Инженерно-геологические площадки">
|
||||
|
||||
<Grid x:Name="PlayGroundGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<UniformGrid Columns="3" Rows="1">
|
||||
<Button Content="Добавить" Command="{Binding AddPlayGround}" Margin="3"/>
|
||||
<Button Content="Перенумеровать" Command="{Binding RenumPlayGrounds}" Margin="3"/>
|
||||
<Button Content="Сохранить" Command="{Binding UpdatePlayGrounds}" Margin="3"/>
|
||||
</UniformGrid>-->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="3" HorizontalAlignment="Left">
|
||||
<Button Command="{Binding AddPlayGround}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumPlayGrounds}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdatePlayGrounds}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="PlayGroundDataGrid"
|
||||
MaxHeight="780"
|
||||
Margin="3" Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{Binding ListPlayGround}"
|
||||
SelectedItem="{Binding SelectedPlayGround}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource PlayGroundDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}"/>
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
<DataGridTextColumn Header="Наименование" Binding="{Binding Path=Name}" Width="400"/>
|
||||
|
||||
<DataGridTemplateColumn Header="Описание" Width="800">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path= Description}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Path= Description}" TextWrapping="Wrap" Background="LightGoldenrodYellow"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--<DataGridTextColumn Header="Описание" Binding="{Binding Path=Description}" MinWidth="155" HeaderStyle="{StaticResource HeaderGridStyle}"/>-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--<Button Content="Выбор файла базы данных" Command="{Binding GetGroundBasePath}"/>-->
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
</Page>
|
||||
31
Pages/PlayGroundsPage.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для PlayGroundsPage.xaml
|
||||
/// </summary>
|
||||
public partial class PlayGroundsPage : Page
|
||||
{
|
||||
private ViewModel vm;
|
||||
public PlayGroundsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
vm = DataContext as ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Pages/ResultsPage.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для CalculationsPage.xaml
|
||||
/// </summary>
|
||||
public partial class ResultsPage : Page
|
||||
{
|
||||
ViewModel vm;
|
||||
public ResultsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
vm = DataContext as ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Pages/ResultsPage.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<Page x:Class="GroundOrganizer.ResultsPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="ResultsPage">
|
||||
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid x:Name="ResultsDataGrid" Grid.Row="0"
|
||||
MinColumnWidth="40" MaxHeight="300"
|
||||
Margin="3" Background="White"
|
||||
ItemsSource="{Binding ResR}" SelectedItem="{Binding ResRselected}"
|
||||
AutoGenerateColumns="True" HorizontalAlignment="Left"
|
||||
Style="{StaticResource LayersDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}"
|
||||
MaxColumnWidth="150"/>
|
||||
|
||||
<DataGrid x:Name="DetailedResultsDataGrid" Grid.Row="1"
|
||||
Margin="3" Background="White"
|
||||
MaxHeight="500"
|
||||
ItemsSource="{Binding ResRdata}"
|
||||
AutoGenerateColumns="True" HorizontalAlignment="Left"
|
||||
Style="{StaticResource LayersDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}"
|
||||
SelectionUnit="Cell">
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Page>
|
||||
350
Pages/StructuresPage.xaml
Normal file
@@ -0,0 +1,350 @@
|
||||
<Page x:Class="GroundOrganizer.StructuresPage"
|
||||
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:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
Background="White" FontSize="14"
|
||||
Title="StructuresPage">
|
||||
|
||||
<Page.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<Grid x:Name="BoresStackGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
<TextBlock Text="Сооружения площадки: " HorizontalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NamePlayGround}" HorizontalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3">
|
||||
<Button Command="{Binding AddStructure}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumStructures}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateStructures}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportPlanningsFromDXF}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт планировки из *.dxf">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/interfaceDXF.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
ToolTip="{Binding StructureNote}"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="BoresDataGrid" Grid.Row="1"
|
||||
MaxHeight="250" MinColumnWidth="30"
|
||||
Margin="3" HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding ListStructure}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource StructuresDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
SelectedItem="{Binding SelectedStructure}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
<DataGridTextColumn Header="Наименование" Binding="{Binding Path=Name}"/>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=L}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="L"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=H}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="H"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Null}" MinWidth="100">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Абс. отметка"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Text="нуля" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridComboBoxColumn x:Name="flexListCbxCol"
|
||||
SelectedItemBinding="{Binding Path=flexStructure}">
|
||||
<DataGridComboBoxColumn.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Схема" />
|
||||
</StackPanel>
|
||||
</DataGridComboBoxColumn.Header>
|
||||
</DataGridComboBoxColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Описание" MinWidth="200">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path= Description}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Path= Description}" TextWrapping="Wrap" Background="LightGoldenrodYellow"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="1" >
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
<TextBlock Text="Вертикальная планировка сооружения: " HorizontalAlignment="Center" Margin="3" />
|
||||
<TextBlock Text="{Binding NameStructure}" HorizontalAlignment="Center" Margin="3" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<TabControl SelectedIndex="0" TabStripPlacement="Bottom">
|
||||
<TabItem x:Name="RedPointsTab" Header="Красные отметки" Background="LightPink">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3" HorizontalAlignment="Left">
|
||||
<Button Command="{Binding AddRedVertex}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumRedVertexes}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateRedPlanning}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportRedPlanningFromCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.csv">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-import-csv-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportRedPlanningToCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.csv">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-export-csv-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding CreateRedPlanningMesh}" Margin="3" Background="White" BorderThickness="0" ToolTip="Создать триангуляционную сеть">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-spiderweb-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="PlanningsDataGrid" Grid.Row="1"
|
||||
MaxHeight="250" MinColumnWidth="30"
|
||||
Margin="3" HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding RedPlanning}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource RedPlanningDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
SelectedItem="{Binding SelectedRedVertex}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=X}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="X"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Y}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Y"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Red}" MinWidth="120">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Красная отметка"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem x:Name="BlackPointsTab" Header="Черные отметки" Background="LightGray">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3" HorizontalAlignment="Left">
|
||||
<Button Command="{Binding AddBlackVertex}" Margin="3" Background="White" BorderThickness="0" ToolTip="Добавить">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Bookmark-add-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding RenumBlackVertexes}" Margin="3" Background="White" BorderThickness="0" ToolTip="Перенумеровать">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/text-list-numbers-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding UpdateBlackPlanning}" Margin="3" Background="White" BorderThickness="0" ToolTip="Сохранить в БД">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/database-accept-icon.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ImportBlackPlanningFromCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Импорт из *.csv">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-import-csv-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding ExportBlackPlanningToCSV}" Margin="3" Background="White" BorderThickness="0" ToolTip="Экспорт в *.csv">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-export-csv-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
<Button Command="{Binding CreateBlackPlanningMesh}" Margin="3" Background="White" BorderThickness="0" ToolTip="Создать триангуляционную сеть">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/icons8-spiderweb-32.png" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Width="32" HorizontalAlignment="Right"
|
||||
Command="" Margin="3" Background="White" BorderThickness="0">
|
||||
<Button.Content>
|
||||
<Image Source="/Images/Help-and-Support-icon32.png"/>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<DataGrid x:Name="BlackPointsDataGrid" Grid.Row="1"
|
||||
MaxHeight="250" MinColumnWidth="30"
|
||||
Margin="3" HorizontalAlignment="Left"
|
||||
ItemsSource="{Binding BlackPlanning}"
|
||||
SelectedItem="{Binding SelectedBlackVertex}"
|
||||
AutoGenerateColumns="False"
|
||||
Style="{StaticResource BlackPlanningDataGridStyle}"
|
||||
RowHeight="{DynamicResource rowsHeight}"
|
||||
ColumnHeaderStyle="{DynamicResource DataGridHeaderStyle}">
|
||||
<DataGrid.Columns >
|
||||
<DataGridTextColumn Header="#" Binding="{Binding Path=Number}" />
|
||||
<!--<DataGridTextColumn Header="Класс" Binding="{Binding Path=ClassId}" IsReadOnly="True" HeaderStyle="{StaticResource HeaderGridStyle}" />-->
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=X}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="X"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Y}" CellStyle="{StaticResource CellGridStyle}">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Y"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Path=Black}" MinWidth="120">
|
||||
<DataGridTextColumn.Header>
|
||||
<StackPanel >
|
||||
<TextBlock Text="Черная отметка"/>
|
||||
<TextBlock Text=" [м]" VerticalAlignment="Bottom" HorizontalAlignment="Center" Foreground="DarkGoldenrod"/>
|
||||
</StackPanel>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Page>
|
||||
31
Pages/StructuresPage.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для StructuresPage.xaml
|
||||
/// </summary>
|
||||
public partial class StructuresPage : Page
|
||||
{
|
||||
private ViewModel vm;
|
||||
public StructuresPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.MainWindow.DataContext;
|
||||
vm = DataContext as ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набор атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("GroundOrganizer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("GroundOrganizer")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// из модели COM, установите атрибут ComVisible для этого типа в значение true.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//Чтобы начать создание локализуемых приложений, задайте
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> в файле .csproj
|
||||
//в <PropertyGroup>. Например, при использовании английского (США)
|
||||
//в своих исходных файлах установите <UICulture> в en-US. Затем отмените преобразование в комментарий
|
||||
//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в
|
||||
//строка внизу для обеспечения соответствия настройки UICulture в файле проекта.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам
|
||||
//(используется, если ресурс не найден на странице,
|
||||
// или в словарях ресурсов приложения)
|
||||
ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов
|
||||
//(используется, если ресурс не найден на странице,
|
||||
// в приложении или в каких-либо словарях ресурсов для конкретной темы)
|
||||
)]
|
||||
|
||||
|
||||
// Сведения о версии для сборки включают четыре следующих значения:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Номер редакции
|
||||
//
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
140
Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,140 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GroundOrganizer.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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("GroundOrganizer.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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Icon, аналогичного (Значок).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon business_color_books_icon_icons_com_53474 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("business_color_books_icon_icons_com_53474", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] IGE {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("IGE", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ShemaFound {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ShemaFound", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ShemaLoads {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ShemaLoads", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ищет локализованную строку, похожую на 0;0;1;3.14
|
||||
///1;0.01;1.06;3.23
|
||||
///2;0.03;1.12;3.32
|
||||
///3;0.04;1.18;3.41
|
||||
///4;0.06;1.25;3.51
|
||||
///5;0.08;1.32;3.61
|
||||
///6;0.1;1.39;3.71
|
||||
///7;0.12;1.47;3.82
|
||||
///8;0.14;1.55;3.93
|
||||
///9;0.16;1.64;4.05
|
||||
///10;0.18;1.73;4.17
|
||||
///11;0.21;1.83;4.29
|
||||
///12;0.23;1.94;4.42
|
||||
///13;0.26;2.05;4.55
|
||||
///14;0.29;2.17;4.69
|
||||
///15;0.32;2.3;4.84
|
||||
///16;0.36;2.43;4.99
|
||||
///17;0.39;2.57;5.15
|
||||
///18;0.43;2.73;5.31
|
||||
///19;0.47;2.89;5.48
|
||||
///20;0.51;3.06;5.66
|
||||
///21;0.56;3.24;5.84
|
||||
///22;0.61;3.44;6.04
|
||||
///23;0.66;3.65;6.24
|
||||
///24;0.72;3.87;6.45
|
||||
///25;0.78;4.11;6.67
|
||||
///26;0.84;4.37;6.9
|
||||
///27;0.91;4.64;7.14
|
||||
/// [остаток строки не уместился]";.
|
||||
/// </summary>
|
||||
internal static string tabl_5_5 {
|
||||
get {
|
||||
return ResourceManager.GetString("tabl_5_5", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
136
Properties/Resources.resx
Normal file
@@ -0,0 +1,136 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="business_color_books_icon_icons_com_53474" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\business-color_books_icon-icons.com_53474.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="tabl_5_5" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\tabl_5_5.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="ShemaFound" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ShemaFound.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ShemaLoads" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ShemaLoads.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="IGE" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ИГЭ.xlsx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
38
Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GroundOrganizer.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.1.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;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string BasePath {
|
||||
get {
|
||||
return ((string)(this["BasePath"]));
|
||||
}
|
||||
set {
|
||||
this["BasePath"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Properties/Settings.settings
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="GroundOrganizer.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="BasePath" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
BIN
Resources/ShemaFound.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
Resources/ShemaLoads.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
Resources/business-color_books_icon-icons.com_53474.ico
Normal file
|
After Width: | Height: | Size: 66 KiB |
46
Resources/tabl_5_5.csv
Normal file
@@ -0,0 +1,46 @@
|
||||
0;0;1;3.14
|
||||
1;0.01;1.06;3.23
|
||||
2;0.03;1.12;3.32
|
||||
3;0.04;1.18;3.41
|
||||
4;0.06;1.25;3.51
|
||||
5;0.08;1.32;3.61
|
||||
6;0.1;1.39;3.71
|
||||
7;0.12;1.47;3.82
|
||||
8;0.14;1.55;3.93
|
||||
9;0.16;1.64;4.05
|
||||
10;0.18;1.73;4.17
|
||||
11;0.21;1.83;4.29
|
||||
12;0.23;1.94;4.42
|
||||
13;0.26;2.05;4.55
|
||||
14;0.29;2.17;4.69
|
||||
15;0.32;2.3;4.84
|
||||
16;0.36;2.43;4.99
|
||||
17;0.39;2.57;5.15
|
||||
18;0.43;2.73;5.31
|
||||
19;0.47;2.89;5.48
|
||||
20;0.51;3.06;5.66
|
||||
21;0.56;3.24;5.84
|
||||
22;0.61;3.44;6.04
|
||||
23;0.66;3.65;6.24
|
||||
24;0.72;3.87;6.45
|
||||
25;0.78;4.11;6.67
|
||||
26;0.84;4.37;6.9
|
||||
27;0.91;4.64;7.14
|
||||
28;0.98;4.93;7.4
|
||||
29;1.06;5.25;7.67
|
||||
30;1.15;5.59;7.95
|
||||
31;1.24;5.95;8.24
|
||||
32;1.34;6.34;8.55
|
||||
33;1.44;6.76;8.88
|
||||
34;1.55;7.22;9.22
|
||||
35;1.68;7.71;9.58
|
||||
36;1.81;8.24;9.97
|
||||
37;1.95;8.81;10.37
|
||||
38;2.11;9.44;10.8
|
||||
39;2.28;10.11;11.25
|
||||
40;2.46;10.85;11.73
|
||||
41;2.66;11.64;12.24
|
||||
42;2.88;12.51;12.79
|
||||
43;3.12;13.46;13.37
|
||||
44;3.38;14.5;13.98
|
||||
45;3.66;15.64;14.64
|
||||
|
BIN
Resources/Аннотация 2019-06-14 145047.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Resources/ИГЭ.xlsx
Normal file
28
Settings.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace GroundOrganizer.Properties {
|
||||
|
||||
|
||||
// Этот класс позволяет обрабатывать определенные события в классе параметров:
|
||||
// Событие SettingChanging возникает перед изменением значения параметра.
|
||||
// Событие PropertyChanged возникает после изменения значения параметра.
|
||||
// Событие SettingsLoaded возникает после загрузки значений параметров.
|
||||
// Событие SettingsSaving возникает перед сохранением значений параметров.
|
||||
internal sealed partial class Settings {
|
||||
|
||||
public Settings() {
|
||||
// // Для добавления обработчиков событий для сохранения и изменения параметров раскомментируйте приведенные ниже строки:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
// Добавьте здесь код для обработки события SettingChangingEvent.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
// Добавьте здесь код для обработки события SettingsSaving.
|
||||
}
|
||||
}
|
||||
}
|
||||
120
TestWindow.xaml
Normal file
@@ -0,0 +1,120 @@
|
||||
<RibbonWindow x:Class="GroundOrganizer.TestWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:GroundOrganizer"
|
||||
mc:Ignorable="d"
|
||||
Title="TestWindow" >
|
||||
|
||||
<Window.DataContext>
|
||||
<local:ViewModel/>
|
||||
</Window.DataContext>
|
||||
|
||||
<Grid x:Name="MainGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>-->
|
||||
|
||||
<Ribbon Grid.Row="0" Grid.Column="0" x:Name="mainRibbon" Background="White" SelectedIndex="0" >
|
||||
|
||||
<Ribbon.HelpPaneContent>
|
||||
<RibbonButton Label="Справка"/>
|
||||
</Ribbon.HelpPaneContent>
|
||||
|
||||
<!--<Ribbon.QuickAccessToolBar>
|
||||
<RibbonQuickAccessToolBar>
|
||||
<RibbonButton x:Name ="Save" />
|
||||
<RibbonSplitButton x:Name ="Undo" >
|
||||
<RibbonSplitMenuItem Header="Undo 1" />
|
||||
<RibbonSplitMenuItem Header="Undo 2" />
|
||||
<RibbonSplitMenuItem Header="Undo 3" />
|
||||
</RibbonSplitButton>
|
||||
<RibbonSplitButton x:Name="Redo" >
|
||||
<RibbonSplitMenuItem Header="Redo 1" />
|
||||
<RibbonSplitMenuItem Header="Redo 2" />
|
||||
</RibbonSplitButton>
|
||||
</RibbonQuickAccessToolBar>
|
||||
</Ribbon.QuickAccessToolBar>-->
|
||||
|
||||
<Ribbon.ApplicationMenu>
|
||||
<RibbonApplicationMenu KeyTip="F">
|
||||
<RibbonApplicationMenuItem Header="Настройки" />
|
||||
<RibbonApplicationMenuItem Header="Выход" />
|
||||
</RibbonApplicationMenu>
|
||||
</Ribbon.ApplicationMenu>
|
||||
|
||||
<RibbonTab x:Name="HomeTab" Header="Главная" KeyTip="P" >
|
||||
<!-- Home group-->
|
||||
<RibbonGroup x:Name="PlaygroundGroup" Header="Площадки">
|
||||
<RibbonButton LargeImageSource="/Images/Bookmark-add-icon32.png" Command="{Binding AddPlayGround}" KeyTip="AP"/>
|
||||
<RibbonButton LargeImageSource="/Images/text-list-numbers-icon32.png" Command="{Binding RenumPlayGrounds}" KeyTip="X" />
|
||||
<RibbonButton LargeImageSource="/Images/Save-icon32.png" Command="{Binding UpdatePlayGrounds}" KeyTip="Ctrl+S" />
|
||||
</RibbonGroup>
|
||||
|
||||
</RibbonTab>
|
||||
<!-- Ribbon Tab #2: -->
|
||||
<RibbonTab Header="Insert" KeyTip="I">
|
||||
</RibbonTab>
|
||||
<!-- Ribbon Tab #3: -->
|
||||
<RibbonTab Header="PageLayout" KeyTip="L">
|
||||
</RibbonTab>
|
||||
|
||||
</Ribbon>
|
||||
|
||||
<!--<Menu x:Name="mainMenu" Grid.Row="0" HorizontalAlignment="Left" Height="22" VerticalAlignment="Top">
|
||||
<MenuItem Header="Файл">
|
||||
<MenuItem Header="New Project" ></MenuItem>
|
||||
<MenuItem Header="Open Project" >
|
||||
<MenuItem Header="WinForms"></MenuItem>
|
||||
<MenuItem Header="WPF" ></MenuItem>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="Exit" ></MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Изменить" ></MenuItem>
|
||||
<MenuItem Header="Вид" ></MenuItem>
|
||||
<Button Content="Кнопка в меню" />
|
||||
</Menu>-->
|
||||
|
||||
|
||||
<Frame Grid.Row="1" Grid.Column="0" x:Name="contentFrame"
|
||||
NavigationUIVisibility="Hidden"
|
||||
VerticalAlignment="Bottom"
|
||||
Source="/Pages/MainPage.xaml"/>
|
||||
|
||||
<StatusBar Grid.Row="2" Grid.Column="0" VerticalAlignment="Bottom" Height="19">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding BasePath}" FontSize="10" Foreground="Gray"/>
|
||||
<TextBlock Text=" | " FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Площадка:" FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text=" " FontSize="10" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding NamePlayGround}" FontSize="10" Foreground="Blue" FontWeight="Bold"/>
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Скважина:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameBore}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Сооружение:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameStructure}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Фундамент:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameFoundation}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
<TextBlock Text=" | " FontSize="10" />
|
||||
<TextBlock Text="Нагрузка:" FontSize="10" />
|
||||
<TextBlock Text=" " FontSize="10" />
|
||||
<TextBlock Text="{Binding NameFoundLoad}" FontSize="10" Foreground="Blue" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</StatusBar>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</RibbonWindow>
|
||||
28
TestWindow.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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.Controls.Ribbon;
|
||||
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 GroundOrganizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для TestWindow.xaml
|
||||
/// </summary>
|
||||
public partial class TestWindow : RibbonWindow
|
||||
{
|
||||
public TestWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
208
VM/BoresVM.cs
Normal file
@@ -0,0 +1,208 @@
|
||||
using Microsoft.Win32;
|
||||
using OfficeOpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Meshing;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand addBore;
|
||||
private RelayCommand renumBore;
|
||||
private RelayCommand updateBore;
|
||||
private RelayCommand createBoresMesh;
|
||||
private RelayCommand importBoresFromXLSX;
|
||||
private RelayCommand exportBoresToXLSX;
|
||||
|
||||
int numBore = 1;
|
||||
string nameBore;
|
||||
private string boresNote;
|
||||
Bore selectedBore;
|
||||
ObservableCollection<Bore> listBore = new ObservableCollection<Bore>();
|
||||
public string BoresNote { get => boresNote; set { boresNote = value; OnPropertyChanged(); } }
|
||||
|
||||
public Bore SelectedBore { get => selectedBore; set { selectedBore = value; OnPropertyChanged(); ChangeSelectedBore(); } }
|
||||
|
||||
public string NameBore { get => nameBore; set { nameBore = value; OnPropertyChanged(); } }
|
||||
|
||||
public ObservableCollection<Bore> ListBore { get => listBore; set { listBore = value; OnPropertyChanged(); } }
|
||||
public TriangleNet.Mesh MeshBores { get; private set; }
|
||||
|
||||
|
||||
public RelayCommand AddBore
|
||||
{
|
||||
get { return addBore ?? (addBore = new RelayCommand(obj => { AddBoreToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateBores
|
||||
{
|
||||
get { return updateBore ?? (updateBore = new RelayCommand(obj => { UpdateBoreInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumBores
|
||||
{
|
||||
get { return renumBore ?? (renumBore = new RelayCommand(obj => { RenumberingBoreInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CreateBoresMesh
|
||||
{
|
||||
get { return createBoresMesh ?? (createBoresMesh = new RelayCommand(obj => { CreateMeshBores(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportBoresToXLSX
|
||||
{
|
||||
get { return exportBoresToXLSX ?? (exportBoresToXLSX = new RelayCommand(obj => { SaveBoresInXlsx(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportBoresFromXLSX
|
||||
{
|
||||
get { return importBoresFromXLSX ?? (importBoresFromXLSX = new RelayCommand(obj => { ReadBoresFromXlsx(); })); }
|
||||
}
|
||||
|
||||
//Чтение таблицы набора скважин из файла *.xlsx
|
||||
internal void ReadBoresFromXlsx()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.xlsx";
|
||||
ofd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
ofd.Title = "Заполнение таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListIGE.Clear();
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(ofd.FileName)))
|
||||
{
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p.Workbook.Worksheets["Скважины"];
|
||||
|
||||
object[,] content = ws.Cells.Value as object[,];
|
||||
List<object> source; Bore item;
|
||||
for (int i = 1; i < content.GetLength(0); i++)
|
||||
{
|
||||
source = new List<object>();
|
||||
for (int j = 0; j < content.GetLength(1); j++)
|
||||
{
|
||||
source.Add(content[i, j]);
|
||||
}
|
||||
item = new Bore(); item.ListToProps(source);
|
||||
ListBore.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Сохранение таблицы набора ИГЭ в файл *.csv
|
||||
internal void SaveBoresInXlsx()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.xlsx";
|
||||
sfd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = false;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
string path = "ИГЭ.xlsx";
|
||||
FileInfo fileInf = new FileInfo(path);
|
||||
if (fileInf.Exists != true)
|
||||
{
|
||||
using (FileStream fstream = new FileStream("ИГЭ.xlsx", FileMode.OpenOrCreate))
|
||||
{
|
||||
byte[] array = Properties.Resources.IGE;
|
||||
fstream.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
List<object[]> content = new List<object[]>();
|
||||
foreach (Bore item in listBore)
|
||||
{
|
||||
content.Add(item.PropsToList().ToArray());
|
||||
}
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(sfd.FileName)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var ws = p.Workbook.Worksheets["Скважины"];
|
||||
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
ExcelPackage p1 = new ExcelPackage(new FileInfo("ИГЭ.xlsx"));
|
||||
ExcelWorksheet ws1 = p1.Workbook.Worksheets["Скважины"];
|
||||
p.Workbook.Worksheets.Add("Скважины", ws1);
|
||||
ExcelWorksheet ws = p.Workbook.Worksheets["Скважины"];
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
ws.Select();
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateMeshBores()
|
||||
{
|
||||
if (listBore == null || listBore.Count == 0) return;
|
||||
|
||||
Polygon polygon = new Polygon();
|
||||
Vertex vrtx;
|
||||
int i = 1;
|
||||
foreach (Bore item in listBore)
|
||||
{
|
||||
vrtx = new Vertex(item.X, item.Y, item.Number, 2);
|
||||
polygon.Add(vrtx);
|
||||
i++;
|
||||
}
|
||||
|
||||
ConstraintOptions constraint = new ConstraintOptions() { Convex = true };
|
||||
MeshBores = (TriangleNet.Mesh)polygon.Triangulate(constraint);
|
||||
Alert("Триангуляционная сеть скважин создана");
|
||||
}
|
||||
|
||||
void AddBoreToList()
|
||||
{
|
||||
ListBore.Add(new Bore() { Number = numBore }); numBore++;
|
||||
//CreateListNumberTypeBet();
|
||||
//NameBore = listBore[0].Name;
|
||||
}
|
||||
void RenumberingBoreInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (Bore item in ListBore)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numBore = j;
|
||||
ListBore = new ObservableCollection<Bore>(ListBore);
|
||||
}
|
||||
void UpdateBoreInList()
|
||||
{
|
||||
ListBore = new ObservableCollection<Bore>(ListBore);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void ChangeSelectedBore()
|
||||
{
|
||||
if (listBore.Count == 0 || selectedBore == null) return;
|
||||
NameBore = selectedBore.Name;
|
||||
ListLayer = selectedBore.Layers;
|
||||
}
|
||||
}
|
||||
}
|
||||
175
VM/CalculationsVM.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
using netDxf;
|
||||
using netDxf.Entities;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand calcFoundsContours;
|
||||
private RelayCommand calcRinBore;
|
||||
private RelayCommand calcRinBores;
|
||||
private RelayCommand calcRinCoords;
|
||||
private RelayCommand calcSpInBore;
|
||||
private RelayCommand calcSpInBores;
|
||||
|
||||
private ObservableCollection<DataR> resR;
|
||||
private ObservableCollection<DataS> resS;
|
||||
private List<DataPair> resSdata;
|
||||
private List<DataPair> resRdata;
|
||||
private DataR resRselected;
|
||||
private List<TypeFound> listTypeFounds;
|
||||
|
||||
public DataR ResRselected { get => resRselected; set { resRselected = value; OnPropertyChanged(); ChangeSelectedResults(); } }
|
||||
public ObservableCollection<DataR> ResR { get => resR; set { resR = value; OnPropertyChanged(); } }
|
||||
public ObservableCollection<DataS> ResS { get => resS; set { resS = value; OnPropertyChanged(); } }
|
||||
public List<DataPair> ResRdata { get => resRdata; set { resRdata = value; OnPropertyChanged(); } }
|
||||
public List<DataPair> ResSdata { get => resSdata; set { resSdata = value; OnPropertyChanged(); } }
|
||||
|
||||
public RelayCommand CalcFoundsContours
|
||||
{
|
||||
get { return calcFoundsContours ?? (calcFoundsContours = new RelayCommand(obj => { CalculateContoursFounds(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalcRinBore
|
||||
{
|
||||
get { return calcRinBore ?? (calcRinBore = new RelayCommand(obj => { CalculateRinBore(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalcRinBores
|
||||
{
|
||||
get { return calcRinBores ?? (calcRinBores = new RelayCommand(obj => { CalculateRinBores(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalcRinCoords
|
||||
{
|
||||
get { return calcRinCoords ?? (calcRinCoords = new RelayCommand(obj => { CalculateRinCoords(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalcSpInBore
|
||||
{
|
||||
get { return calcSpInBore ?? (calcSpInBore = new RelayCommand(obj => { CalculateSpInBore(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalcSpInBores
|
||||
{
|
||||
get { return calcSpInBores ?? (calcSpInBores = new RelayCommand(obj => { CalculateSpInBores(); })); }
|
||||
}
|
||||
|
||||
private void CalculateContoursFounds()
|
||||
{
|
||||
if (listFoundation == null || listFoundation.Count == 0) return;
|
||||
|
||||
foreach (Foundation item in listFoundation) item.CalcContour();
|
||||
ListFoundation = new ObservableCollection<Foundation>(listFoundation);
|
||||
}
|
||||
|
||||
void ChangeSelectedResults()
|
||||
{
|
||||
if (resR == null || resR.Count == 0) return;
|
||||
ResRdata = resRselected.SmallData;
|
||||
}
|
||||
|
||||
void CalculateSpInBore()
|
||||
{
|
||||
if (selectedBore == null) { Alert("Не выбрана расчетная скважина"); return; }
|
||||
if (selectedFoundation == null) { Alert("Не выбран фундамент для расчета"); return; }
|
||||
if (selectedFoundLoad == null) { Alert("Не выбрана расчетная нагрузка"); return; }
|
||||
if (resS == null) ResS = new ObservableCollection<DataS>();
|
||||
ResS.Clear();
|
||||
DataS s = selectedFoundation.Sp(selectedBore, selectedFoundLoad);
|
||||
s.Bore = "Скв. " + nameBore;
|
||||
s.Base = nameFoundation;
|
||||
ResS.Add(s);
|
||||
ResultsPage resPage = new ResultsPage();
|
||||
MW.ResulsFrame.Content = resPage;
|
||||
resPage.ResultsDataGrid.ItemsSource = ResS;
|
||||
MW.MainTabControl.SelectedIndex = 5;
|
||||
//FoundationsPage foundPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
//resPage.resultExpander.IsExpanded = true;
|
||||
}
|
||||
|
||||
void CalculateSpInBores()
|
||||
{
|
||||
if (listBore == null) { Alert("Площадка не содержит ни одной скважины"); return; }
|
||||
if (selectedFoundation == null) { Alert("Не выбран фундамент для расчета"); return; }
|
||||
if (selectedFoundLoad == null) { Alert("Не выбрана расчетная нагрузка"); return; }
|
||||
if (resS == null) ResS = new ObservableCollection<DataS>();
|
||||
ResS.Clear();
|
||||
foreach (Bore item in listBore)
|
||||
{
|
||||
DataS s = selectedFoundation.Sp(item, selectedFoundLoad);
|
||||
s.Bore = "Скв. " + item.Name;
|
||||
s.Base = nameFoundation;
|
||||
ResS.Add(s);
|
||||
}
|
||||
ResultsPage resPage = new ResultsPage();
|
||||
MW.ResulsFrame.Content = resPage;
|
||||
resPage.ResultsDataGrid.ItemsSource = ResS;
|
||||
MW.MainTabControl.SelectedIndex = 5;
|
||||
//FoundationsPage foundPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
//foundPage.ResultsDataGrid.ItemsSource = ResS;
|
||||
//foundPage.resultExpander.IsExpanded = true;
|
||||
|
||||
}
|
||||
|
||||
void CalculateRinBore()
|
||||
{
|
||||
if (selectedBore == null) { Alert("Не выбрана расчетная скважина"); return; }
|
||||
if (selectedFoundation == null) { Alert("Не выбран фундамент для расчета"); return; }
|
||||
if (resR == null) ResR = new ObservableCollection<DataR>();
|
||||
ResR.Clear();
|
||||
DataR r = selectedFoundation.P(selectedBore, selectedStructure.flexStructure, selectedStructure.L, selectedStructure.H);
|
||||
ResR.Add(r);
|
||||
ResultsPage resPage = new ResultsPage();
|
||||
MW.ResulsFrame.Content = resPage;
|
||||
//resPage.ResultsDataGrid.ItemsSource = ResR;
|
||||
//resPage.DetailedResultsDataGrid.ItemsSource = ResRdata;
|
||||
MW.MainTabControl.SelectedIndex = 5;
|
||||
//FoundationsPage foundPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
//foundPage.ResultsDataGrid.ItemsSource = ResR;
|
||||
//foundPage.resultExpander.IsExpanded = true;
|
||||
}
|
||||
|
||||
private void CalculateRinBores()
|
||||
{
|
||||
if (listBore == null) { Alert("Площадка не содержит ни одной скважины"); return; }
|
||||
if (selectedFoundation == null) { Alert("Не выбран фундамент для расчета"); return; }
|
||||
ResR = selectedFoundation.P(ListBore, selectedStructure.flexStructure, selectedStructure.L, selectedStructure.H);
|
||||
ResultsPage resPage = new ResultsPage();
|
||||
MW.ResulsFrame.Content = resPage;
|
||||
//resPage.ResultsDataGrid.ItemsSource = ResR;
|
||||
//resPage.DetailedResultsDataGrid.ItemsSource = ResRdata;
|
||||
MW.MainTabControl.SelectedIndex = 5;
|
||||
//FoundationsPage foundPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
//foundPage.ResultsDataGrid.ItemsSource = ResR;
|
||||
//foundPage.resultExpander.IsExpanded = true;
|
||||
}
|
||||
|
||||
private void CalculateRinCoords()
|
||||
{
|
||||
if (selectedBore == null) return;
|
||||
if (resR == null) ResR = new ObservableCollection<DataR>();
|
||||
ResR.Clear();
|
||||
DataR r = SelectedFoundation.P(selectedBore, selectedStructure.flexStructure, selectedStructure.L, selectedStructure.H);
|
||||
r.Bore = "По координатам";
|
||||
r.Base = nameFoundation;
|
||||
ResR.Add(r);
|
||||
//FoundationsPage foundPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
//foundPage.ResultsDataGrid.ItemsSource = ResR;
|
||||
//foundPage.resultExpander.IsExpanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
VM/DrawingVM.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using netDxf;
|
||||
using netDxf.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private RelayCommand drowFoundations;
|
||||
private RelayCommand showFoundProps;
|
||||
|
||||
CanwasWindow cw;
|
||||
|
||||
public RelayCommand DrowFoundations
|
||||
{
|
||||
get { return drowFoundations ?? (drowFoundations = new RelayCommand(obj => { DrowFounds(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ShowFoundProps
|
||||
{
|
||||
get { return showFoundProps ?? (showFoundProps = new RelayCommand(obj => { ShowFoundPropsWindow(); })); }
|
||||
}
|
||||
|
||||
internal void ShowFoundPropsWindow()
|
||||
{
|
||||
if (listFoundation.Count == 0) return;
|
||||
if (listFoundation == null) return;
|
||||
|
||||
FoundPropWindow fpw = new FoundPropWindow();
|
||||
fpw.Owner = MW;
|
||||
fpw.DataContext = MW.DataContext;
|
||||
fpw.Top = 75;
|
||||
fpw.Left = 75;
|
||||
fpw.ShowDialog();
|
||||
}
|
||||
|
||||
internal void DrowFounds()
|
||||
{
|
||||
if (listFoundation.Count == 0) return;
|
||||
if (listFoundation == null) return;
|
||||
|
||||
CalculateContoursFounds();
|
||||
CreateSmallPropsFounds();
|
||||
int t = 75;
|
||||
int l = 75;
|
||||
double ws = SystemParameters.PrimaryScreenWidth;
|
||||
double hs = SystemParameters.PrimaryScreenHeight;
|
||||
cw = new CanwasWindow();
|
||||
cw.Top = t;
|
||||
cw.Left = l;
|
||||
cw.MaxHeight= hs - t - 37;
|
||||
cw.MaxWidth= ws - l - 5;
|
||||
cw.CanvasScrollViewer.MaxWidth = cw.MaxWidth;
|
||||
cw.CanvasScrollViewer.MaxHeight = cw.MaxHeight-60;
|
||||
cw.Owner = MW;
|
||||
CanvasDrafter.DrawFoundations(listFoundation, cw.drawArea, cw.MaxHeight - 120);
|
||||
cw.drawArea.MinHeight = cw.drawArea.Height;
|
||||
cw.drawArea.MinWidth = cw.drawArea.Width;
|
||||
cw.EventMouseEnter();
|
||||
cw.Show();
|
||||
}
|
||||
|
||||
internal void DrowFoundsNums()
|
||||
{
|
||||
if (cw == null || cw.IsActive == false) return;
|
||||
CanvasDrafter.DrawFoundationsNumbers(listFoundation, cw.drawArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
188
VM/FoundLoadsVM.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using Microsoft.Win32;
|
||||
using OfficeOpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand addFoundLoad;
|
||||
private RelayCommand updateFoundLoad;
|
||||
private RelayCommand renumFoundLoad;
|
||||
private RelayCommand exportFoundLoadsToCSV;
|
||||
private RelayCommand importFoundLoadsFromCSV;
|
||||
|
||||
int numFoundLoad = 1;
|
||||
string nameFoundLoad;
|
||||
FoundLoad selectedFoundLoad;
|
||||
ObservableCollection<FoundLoad> listFoundLoad = new ObservableCollection<FoundLoad>();
|
||||
|
||||
public ObservableCollection<FoundLoad> ListFoundLoad { get => listFoundLoad; set { listFoundLoad = value; OnPropertyChanged(); } }
|
||||
|
||||
|
||||
public RelayCommand AddFoundLoad
|
||||
{
|
||||
get { return addFoundLoad ?? (addFoundLoad = new RelayCommand(obj => { AddFoundLoadToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateFoundLoads
|
||||
{
|
||||
get { return updateFoundLoad ?? (updateFoundLoad = new RelayCommand(obj => { UpdateFoundLoadInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumFoundLoads
|
||||
{
|
||||
get { return renumFoundLoad ?? (renumFoundLoad = new RelayCommand(obj => { RenumberingFoundLoadInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportFoundLoadsToCSV
|
||||
{
|
||||
get { return exportFoundLoadsToCSV ?? (exportFoundLoadsToCSV = new RelayCommand(obj => { SaveLoadsInXlsx(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportFoundLoadsFromCSV
|
||||
{
|
||||
get { return importFoundLoadsFromCSV ?? (importFoundLoadsFromCSV = new RelayCommand(obj => { ReadLoadsFromXlsx(); })); }
|
||||
}
|
||||
public FoundLoad SelectedFoundLoad { get => selectedFoundLoad; set { selectedFoundLoad = value; OnPropertyChanged(); ChangeSelectedFoundLoad(); } }
|
||||
|
||||
public string NameFoundLoad { get => nameFoundLoad; set { nameFoundLoad = value; OnPropertyChanged(); } }
|
||||
|
||||
void AddFoundLoadToList()
|
||||
{
|
||||
ListFoundLoad.Add(new FoundLoad() { Number = numFoundLoad }); numFoundLoad++;
|
||||
//CreateListNumberTypeBet();
|
||||
//NameFoundLoad = listFoundLoad[0].Name;
|
||||
}
|
||||
void RenumberingFoundLoadInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (FoundLoad item in ListFoundLoad)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numFoundLoad = j;
|
||||
ListFoundLoad = new ObservableCollection<FoundLoad>(ListFoundLoad);
|
||||
SaveDB();
|
||||
}
|
||||
internal void UpdateFoundLoadInList()
|
||||
{
|
||||
ListFoundLoad = new ObservableCollection<FoundLoad>(ListFoundLoad);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void ChangeSelectedFoundLoad()
|
||||
{
|
||||
if (listFoundLoad.Count == 0 || selectedFoundLoad == null) return;
|
||||
NameFoundLoad = SelectedFoundLoad.Number.ToString();
|
||||
}
|
||||
|
||||
//Сохранение таблицы нагрузок в файл *.xlsx
|
||||
internal void SaveLoadsInXlsx()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.xlsx";
|
||||
sfd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = true;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
try
|
||||
{
|
||||
string path = "ИГЭ.xlsx";
|
||||
FileInfo fileInf = new FileInfo(path);
|
||||
if (fileInf.Exists != true)
|
||||
{
|
||||
using (FileStream fstream = new FileStream("ИГЭ.xlsx", FileMode.OpenOrCreate))
|
||||
{
|
||||
byte[] array = Properties.Resources.IGE;
|
||||
fstream.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(sfd.FileName)))
|
||||
{
|
||||
for (int i = 0; i < listFoundation.Count; i++)
|
||||
{
|
||||
List<object[]> content = new List<object[]>();
|
||||
foreach (FoundLoad fli in listFoundation[i].Loads)
|
||||
{
|
||||
content.Add(fli.PropsToList().ToArray());
|
||||
}
|
||||
ExcelPackage p1 = new ExcelPackage(new FileInfo("ИГЭ.xlsx"));
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p1.Workbook.Worksheets["Нагрузки"];
|
||||
p.Workbook.Worksheets.Add((i + 1).ToString(), ws);
|
||||
var wsi = p.Workbook.Worksheets[i + 1];
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
wsi.Cells["D1"].Value = listFoundation[i].Number;
|
||||
wsi.Cells["F1"].Value = listFoundation[i].Name;
|
||||
wsi.Cells["A3"].LoadFromArrays(content);
|
||||
}
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
//Чтение нагрузок из файла *.xlsx
|
||||
internal void ReadLoadsFromXlsx()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.xlsx";
|
||||
ofd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
ofd.Title = "Заполнение таблиц";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListFoundLoad.Clear();
|
||||
try
|
||||
{
|
||||
using (var p = new ExcelPackage(new FileInfo(ofd.FileName)))
|
||||
{
|
||||
int k = 0;
|
||||
foreach (ExcelWorksheet wsi in p.Workbook.Worksheets)
|
||||
{
|
||||
listFoundation[k].Loads = new ObservableCollection<FoundLoad>();
|
||||
|
||||
object[,] content = wsi.Cells.Value as object[,];
|
||||
List<object> source; FoundLoad item;
|
||||
for (int i = 2; i < content.GetLength(0); i++)
|
||||
{
|
||||
source = new List<object>();
|
||||
for (int j = 0; j < content.GetLength(1); j++)
|
||||
{
|
||||
source.Add(content[i, j]);
|
||||
}
|
||||
item = new FoundLoad(); item.ListToProps(source);
|
||||
listFoundation[k].Loads.Add(item);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
401
VM/FoundationsVM.cs
Normal file
@@ -0,0 +1,401 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Geo;
|
||||
using Microsoft.Win32;
|
||||
using netDxf;
|
||||
using netDxf.Entities;
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand addFoundation;
|
||||
private RelayCommand updateFoundation;
|
||||
private RelayCommand renumFoundation;
|
||||
private RelayCommand importFoundationsFromDXF;
|
||||
private RelayCommand replaceD1Found;
|
||||
private RelayCommand replaceDLFound;
|
||||
private RelayCommand replaceFLFound;
|
||||
private RelayCommand replaceDLFoundfromNULL;
|
||||
private RelayCommand calculateDLFound;
|
||||
private RelayCommand calculateLevelsFounds;
|
||||
private RelayCommand exportFoundationsToCSV;
|
||||
private RelayCommand importFoundationsFromCSV;
|
||||
|
||||
private double d1;
|
||||
private double dL;
|
||||
private double fL;
|
||||
|
||||
int numFoundation = 1;
|
||||
string nameFoundation;
|
||||
Foundation selectedFoundation;
|
||||
ObservableCollection<Foundation> listFoundation = new ObservableCollection<Foundation>();
|
||||
List<Foundation> bufferFoundations = new List<Foundation>();
|
||||
|
||||
public double D1 { get => d1; set { d1 = value; OnPropertyChanged(); /*ChangeD1();*/ } }
|
||||
public double DL { get => dL; set { dL = value; OnPropertyChanged(); /*ChangeDL();*/ } }
|
||||
public double FL { get => fL; set { fL = value; OnPropertyChanged(); /*ChangeFL();*/ } }
|
||||
|
||||
|
||||
public ObservableCollection<Foundation> ListFoundation { get => listFoundation; set { listFoundation = value; OnPropertyChanged(); } }
|
||||
public Foundation SelectedFoundation { get => selectedFoundation; set { selectedFoundation = value; OnPropertyChanged(); ChangeSelectedFoundation(); } }
|
||||
public string NameFoundation { get => nameFoundation; set { nameFoundation = value; OnPropertyChanged(); ChangeMark(); } }
|
||||
public List<TypeFound> ListTypeFounds { get => listTypeFounds; set { listTypeFounds = value; OnPropertyChanged(); } }
|
||||
public List<Foundation> BufferFoundations { get => bufferFoundations; set => bufferFoundations = value; }
|
||||
|
||||
#region Команды
|
||||
|
||||
public RelayCommand AddFoundation
|
||||
{
|
||||
get { return addFoundation ?? (addFoundation = new RelayCommand(obj => { AddFoundationToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateFoundations
|
||||
{
|
||||
get { return updateFoundation ?? (updateFoundation = new RelayCommand(obj => { UpdateFoundationInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumFoundations
|
||||
{
|
||||
get { return renumFoundation ?? (renumFoundation = new RelayCommand(obj => { RenumberingFoundationInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportFoundationsFromDXF
|
||||
{
|
||||
get { return importFoundationsFromDXF ?? (importFoundationsFromDXF = new RelayCommand(obj => { ReadFondationsFromDXF(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ReplaceD1Found
|
||||
{
|
||||
get { return replaceD1Found ?? (replaceD1Found = new RelayCommand(obj => { ChangeD1(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ReplaceDLFound
|
||||
{
|
||||
get { return replaceDLFound ?? (replaceDLFound = new RelayCommand(obj => { ChangeDL(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ReplaceFLFound
|
||||
{
|
||||
get { return replaceFLFound ?? (replaceFLFound = new RelayCommand(obj => { ChangeFL(); })); }
|
||||
}
|
||||
|
||||
|
||||
public RelayCommand ReplaceDLFoundfromNULL
|
||||
{
|
||||
get { return replaceDLFoundfromNULL ?? (replaceDLFoundfromNULL = new RelayCommand(obj => { ChangeDLfromNULL(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalculateDLFound
|
||||
{
|
||||
get { return calculateDLFound ?? (calculateDLFound = new RelayCommand(obj => { CalcDLFound(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CalculateLevelsFounds
|
||||
{
|
||||
get { return calculateLevelsFounds ?? (calculateLevelsFounds = new RelayCommand(obj => { CalcDLFoundsAll(); CalcNLFoundsAll(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportFoundationsToCSV
|
||||
{
|
||||
get { return exportFoundationsToCSV ?? (exportFoundationsToCSV = new RelayCommand(obj => { SaveFoundationsInCsv(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportFoundationsFromCSV
|
||||
{
|
||||
get { return importFoundationsFromCSV ?? (importFoundationsFromCSV = new RelayCommand(obj => { ReadFoundationsFromCsv(); })); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void AddFoundationToList()
|
||||
{
|
||||
ListFoundation.Add(new Foundation() { Number = numFoundation }); numFoundation++;
|
||||
//CreateListNumberTypeBet();
|
||||
//NameFoundation = listFoundation[0].Name;
|
||||
}
|
||||
void RenumberingFoundationInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (Foundation item in ListFoundation)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numFoundation = j;
|
||||
ListFoundation = new ObservableCollection<Foundation>(ListFoundation);
|
||||
}
|
||||
internal void UpdateFoundationInList()
|
||||
{
|
||||
ListFoundation = new ObservableCollection<Foundation>(ListFoundation);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void ChangeSelectedFoundation()
|
||||
{
|
||||
if (listFoundation.Count == 0 || selectedFoundation == null) return;
|
||||
NameFoundation = selectedFoundation.Name;
|
||||
ListFoundLoad = selectedFoundation.Loads;
|
||||
D1 = selectedFoundation.D1;
|
||||
FL = selectedFoundation.FL;
|
||||
DL = selectedFoundation.DL;
|
||||
}
|
||||
|
||||
void CreateListTypeFoundations()
|
||||
{
|
||||
if (listFoundation == null || listPlayGround == null) return;
|
||||
ListTypeFounds = new List<TypeFound> { TypeFound.Прямоугольный, TypeFound.Круглый, TypeFound.Ленточный };
|
||||
try
|
||||
{
|
||||
FoundationsPage foundationsPage = (FoundationsPage)MW.FoundationsFrame.Content;
|
||||
foundationsPage.typeFondsListCbxCol.ItemsSource = ListTypeFounds;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void ReadFondationsFromDXF()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.dxf";
|
||||
ofd.Filter = "Чертеж (*.dxf)|*.dxf";
|
||||
ofd.Title = "Импорт чертежа";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
DxfDocument dxfDocument = DxfDocument.Load(ofd.FileName);
|
||||
IEnumerable<LwPolyline> dxfLwPolylines = dxfDocument.LwPolylines;
|
||||
IEnumerable<LwPolylineVertex> dxfLwPolylinesVertexes = null;
|
||||
Foundation fnd;
|
||||
Quadrangle countFound; int i = 0;
|
||||
Point2d[] ptColl = new Point2d[4];
|
||||
foreach (LwPolyline item in dxfLwPolylines)
|
||||
{
|
||||
if (item.Layer.Name == "Foundations")
|
||||
{
|
||||
dxfLwPolylinesVertexes = item.Vertexes;
|
||||
int j = 0;
|
||||
foreach (LwPolylineVertex itemVrtx in dxfLwPolylinesVertexes)
|
||||
{
|
||||
ptColl[j] = new Point2d(itemVrtx.Position.X * 0.001, itemVrtx.Position.Y * 0.001);
|
||||
j++; if (j == 4) break;
|
||||
}
|
||||
countFound = new Quadrangle(ptColl[0], ptColl[1], ptColl[2], ptColl[3]);
|
||||
countFound.Units = UnitsLin.м;
|
||||
fnd = new Foundation(countFound) { Number = i + 1 };
|
||||
ListFoundation.Add(fnd);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dxfLwPolylinesVertexes == null) return;
|
||||
}
|
||||
|
||||
//Сохранение таблицы фундаментов в файл *.csv
|
||||
internal void SaveFoundationsInCsv()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.xlsx";
|
||||
sfd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = false;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
string path = "ИГЭ.xlsx";
|
||||
FileInfo fileInf = new FileInfo(path);
|
||||
if (fileInf.Exists != true)
|
||||
{
|
||||
using (FileStream fstream = new FileStream("ИГЭ.xlsx", FileMode.OpenOrCreate))
|
||||
{
|
||||
byte[] array = Properties.Resources.IGE;
|
||||
fstream.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
List<object[]> content = new List<object[]>();
|
||||
foreach (Foundation item in listFoundation)
|
||||
{
|
||||
content.Add(item.PropsToList().ToArray());
|
||||
}
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(sfd.FileName)))
|
||||
{
|
||||
try
|
||||
{
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p.Workbook.Worksheets["Фундаменты"];
|
||||
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
ExcelPackage p1 = new ExcelPackage(new FileInfo("ИГЭ.xlsx"));
|
||||
ExcelWorksheet ws1 = p1.Workbook.Worksheets["Фундаменты"];
|
||||
p.Workbook.Worksheets.Add("Фундаменты", ws1);
|
||||
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p.Workbook.Worksheets["Фундаменты"];
|
||||
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
ws.Select();
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Чтение таблицы фундаментов из файла *.xlsx
|
||||
internal void ReadFoundationsFromCsv()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.xlsx";
|
||||
ofd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
ofd.Title = "Заполнение таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListIGE.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
using (var p = new ExcelPackage(new FileInfo(ofd.FileName)))
|
||||
{
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p.Workbook.Worksheets["Фундаменты"];
|
||||
|
||||
object[,] content = ws.Cells.Value as object[,];
|
||||
List<object> source; Foundation item;
|
||||
for (int i = 1; i < content.GetLength(0); i++)
|
||||
{
|
||||
source = new List<object>();
|
||||
for (int j = 0; j < content.GetLength(1); j++)
|
||||
{
|
||||
source.Add(content[i, j]);
|
||||
}
|
||||
item = new Foundation(); item.ListToProps(source);
|
||||
ListFoundation.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeMark()
|
||||
{
|
||||
if (selectedFoundation == null) return;
|
||||
SelectedFoundation.Name = nameFoundation;
|
||||
}
|
||||
|
||||
void ChangeD1()
|
||||
{
|
||||
if (selectedFoundation == null || selectedStructure == null) return;
|
||||
SelectedFoundation.D1 = d1;
|
||||
SelectedFoundation.D1toFL(selectedStructure.Null);
|
||||
DL = selectedFoundation.DL;
|
||||
//FL = selectedFoundation.FL;
|
||||
}
|
||||
|
||||
void ChangeDL()
|
||||
{
|
||||
if (selectedFoundation == null || selectedStructure == null) return;
|
||||
SelectedFoundation.DL = dL;
|
||||
SelectedFoundation.DLtoD1(selectedStructure.Null);
|
||||
D1 = selectedFoundation.D1;
|
||||
//FL = selectedFoundation.FL;
|
||||
}
|
||||
|
||||
void ChangeFL()
|
||||
{
|
||||
if (selectedFoundation == null || selectedStructure == null) return;
|
||||
SelectedFoundation.FL = fL;
|
||||
SelectedFoundation.FLtoD1(selectedStructure.Null);
|
||||
D1 = selectedFoundation.D1;
|
||||
//DL = selectedFoundation.DL;
|
||||
}
|
||||
|
||||
private void ChangeDLfromNULL()
|
||||
{
|
||||
if (selectedFoundation == null || selectedStructure == null) return;
|
||||
SelectedFoundation.DL = selectedStructure.Null;
|
||||
DL = SelectedFoundation.DL;
|
||||
SelectedFoundation.DLtoD1(selectedStructure.Null);
|
||||
D1 = selectedFoundation.D1;
|
||||
}
|
||||
|
||||
private void CalcDLFound()
|
||||
{
|
||||
if (selectedFoundation == null || selectedStructure == null) return;
|
||||
if (MeshRedPlanning == null) CreateRedMesh();
|
||||
selectedFoundation.CalcDL(MeshRedPlanning);
|
||||
DL = SelectedFoundation.DL;
|
||||
SelectedFoundation.DLtoD1(selectedStructure.Null);
|
||||
D1 = selectedFoundation.D1;
|
||||
}
|
||||
|
||||
internal void CalcDLFoundsAll()
|
||||
{
|
||||
if (listFoundation == null || listFoundation.Count == 0) return;
|
||||
if (MeshRedPlanning == null) CreateRedMesh();
|
||||
if (MeshRedPlanning == null)
|
||||
{
|
||||
Alert("Сооружение не содержит планировочных отметок");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Foundation item in ListFoundation)
|
||||
{
|
||||
item.CalcDL(MeshRedPlanning);
|
||||
item.DLtoD1(selectedStructure.Null);
|
||||
}
|
||||
|
||||
Alert("Уровни планировки для всех фундаментов \nвычислены по триангуляционной сети");
|
||||
}
|
||||
|
||||
internal void CalcNLFoundsAll()
|
||||
{
|
||||
if (listFoundation == null || listFoundation.Count == 0) return;
|
||||
if (MeshBlackPlanning == null) CreateBlackMesh();
|
||||
if (MeshBlackPlanning == null)
|
||||
{
|
||||
Alert("Сооружение не содержит планировочных отметок");
|
||||
return;
|
||||
}
|
||||
foreach (Foundation item in ListFoundation)
|
||||
{
|
||||
item.CalcNL(MeshBlackPlanning);
|
||||
}
|
||||
|
||||
Alert("Отметки естественного рельефа для всех фундаментов \nвычислены по триангуляционной сети");
|
||||
}
|
||||
|
||||
internal void CreateSmallPropsFounds()
|
||||
{
|
||||
foreach (Foundation item in ListFoundation) item.CreateSmallPropsList();
|
||||
}
|
||||
}
|
||||
}
|
||||
94
VM/HelpsVM.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private RelayCommand helpFoundation;
|
||||
private RelayCommand helpLoads;
|
||||
public RelayCommand HelpFoundation
|
||||
{
|
||||
get { return helpFoundation ?? (helpFoundation = new RelayCommand(obj => { HelpFoundAlert(); })); }
|
||||
}
|
||||
public RelayCommand HelpLoads
|
||||
{
|
||||
get { return helpLoads ?? (helpLoads = new RelayCommand(obj => { HelpLoadsAlert(); })); }
|
||||
}
|
||||
|
||||
void HelpFoundAlert()
|
||||
{
|
||||
Alert(Properties.Resources.ShemaFound, 500);
|
||||
if (MW.OwnedWindows.Count > 0)
|
||||
{
|
||||
foreach (Window item in MW.OwnedWindows) item.Close();
|
||||
Alert(Properties.Resources.ShemaFound, 500);
|
||||
}
|
||||
}
|
||||
|
||||
void HelpLoadsAlert()
|
||||
{
|
||||
Alert(@"\Images\ShemaLoads.png", 200);
|
||||
if (MW.OwnedWindows.Count > 0)
|
||||
{
|
||||
foreach (Window item in MW.OwnedWindows) item.Close();
|
||||
Alert(@"\Images\ShemaLoads.png", 200);
|
||||
}
|
||||
}
|
||||
|
||||
void Alert(string alert)
|
||||
{
|
||||
AlertWindow aw = new AlertWindow();
|
||||
aw.Owner = MW;
|
||||
aw.alertLabel.Content = alert;
|
||||
//aw.WindowStyle = WindowStyle.None;
|
||||
aw.ShowDialog();
|
||||
}
|
||||
void Alert(string alert, string title)
|
||||
{
|
||||
AlertWindow aw = new AlertWindow();
|
||||
aw.Owner = MW;
|
||||
aw.alertLabel.Content = alert;
|
||||
aw.Title = title;
|
||||
aw.ShowDialog();
|
||||
}
|
||||
void Alert(Bitmap resource, int h = 250)
|
||||
{
|
||||
ImageWindow aw = new ImageWindow();
|
||||
//BitmapImage b =new BitmapImage(new Uri("pack://application:,,,/Resources/ShemaFound.png"));
|
||||
Bitmap br = resource;
|
||||
BitmapSource b = Imaging.CreateBitmapSourceFromHBitmap(br.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
||||
aw.alertImage.Source = b;
|
||||
aw.alertImage.Height = h;
|
||||
aw.Owner = MW;
|
||||
aw.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
aw.Top = MW.Top;
|
||||
aw.Left = MW.Left + MW.Width;
|
||||
aw.Show();
|
||||
}
|
||||
|
||||
void Alert(string filepath, int h = 250)
|
||||
{
|
||||
Uri uri = new Uri(filepath, UriKind.RelativeOrAbsolute);
|
||||
BitmapImage b = new BitmapImage(uri);
|
||||
ImageWindow aw = new ImageWindow();
|
||||
aw.alertImage.Source = b;
|
||||
aw.alertImage.Height = h;
|
||||
aw.Owner = MW;
|
||||
aw.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
aw.Top = MW.Top;
|
||||
aw.Left = MW.Left + MW.Width;
|
||||
aw.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
278
VM/IGEsVM.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
using Microsoft.Win32;
|
||||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
int numIGE = 1;
|
||||
ObservableCollection<IGE> listIGE = new ObservableCollection<IGE>();
|
||||
|
||||
public ObservableCollection<IGE> ListIGE { get => listIGE; set { listIGE = value; OnPropertyChanged(); } }
|
||||
|
||||
private RelayCommand addIGE;
|
||||
public RelayCommand AddIGE
|
||||
{
|
||||
get { return addIGE ?? (addIGE = new RelayCommand(obj => { AddIGEToList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand updateIGE;
|
||||
public RelayCommand UpdateIGEs
|
||||
{
|
||||
get { return updateIGE ?? (updateIGE = new RelayCommand(obj => { UpdateIGEInList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand renumIGE;
|
||||
public RelayCommand RenumIGEs
|
||||
{
|
||||
get { return renumIGE ?? (renumIGE = new RelayCommand(obj => { RenumberingIGEInList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand exportIGEtoCSV;
|
||||
public RelayCommand ExportIGEtoCSV
|
||||
{
|
||||
get { return exportIGEtoCSV ?? (exportIGEtoCSV = new RelayCommand(obj => { SaveIGEsInCsv(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand importIGEfromCSV;
|
||||
public RelayCommand ImportIGEfromCSV
|
||||
{
|
||||
get { return importIGEfromCSV ?? (importIGEfromCSV = new RelayCommand(obj => { ReadIGEsFromCsv(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand saveIGEsTable;
|
||||
public RelayCommand SaveIGEsTable
|
||||
{
|
||||
get { return saveIGEsTable ?? (saveIGEsTable = new RelayCommand(obj => { SaveIGEs(); })); }
|
||||
}
|
||||
|
||||
private IEnumerable<String> listNumIGEs;
|
||||
public IEnumerable<String> ListNumIGEs { get => listNumIGEs; set { listNumIGEs = value; OnPropertyChanged(); } }
|
||||
|
||||
void AddIGEToList()
|
||||
{
|
||||
ListIGE.Add(new IGE() { Number = numIGE }); numIGE++;
|
||||
CreateListNumIGEs();
|
||||
//CreateListNumberTypeBet();
|
||||
//NameIGE = listIGE[0].Name;
|
||||
}
|
||||
void RenumberingIGEInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (IGE item in ListIGE)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numIGE = j;
|
||||
ListIGE = new ObservableCollection<IGE>(ListIGE);
|
||||
CreateListNumIGEs();
|
||||
}
|
||||
void UpdateIGEInList()
|
||||
{
|
||||
ListIGE = new ObservableCollection<IGE>(ListIGE);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void CreateListNumIGEs()
|
||||
{
|
||||
if (listIGE == null || listPlayGround == null) return;
|
||||
ListNumIGEs = from bet in listIGE select bet.NumIGE;
|
||||
try
|
||||
{
|
||||
BoresPage boresPage = (BoresPage)MW.BoresFrame.Content;
|
||||
boresPage.IGEsListCbxCol.ItemsSource = listNumIGEs;
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
|
||||
//Сохранение таблицы набора ИГЭ в файл *.csv
|
||||
internal void SaveIGEsInCsv()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.xlsx";
|
||||
sfd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = false;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
string path = "ИГЭ.xlsx";
|
||||
FileInfo fileInf = new FileInfo(path);
|
||||
if (fileInf.Exists != true)
|
||||
{
|
||||
using (FileStream fstream = new FileStream("ИГЭ.xlsx", FileMode.OpenOrCreate))
|
||||
{
|
||||
byte[] array = Properties.Resources.IGE;
|
||||
fstream.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
List<object[]> content = new List<object[]>();
|
||||
foreach (IGE item in listIGE)
|
||||
{
|
||||
content.Add(item.PropsToList().ToArray());
|
||||
}
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(sfd.FileName)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var ws = p.Workbook.Worksheets["ИГЭ"];
|
||||
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
ExcelPackage p1 = new ExcelPackage(new FileInfo("ИГЭ.xlsx"));
|
||||
ExcelWorksheet ws1 = p1.Workbook.Worksheets["ИГЭ"];
|
||||
p.Workbook.Worksheets.Add("ИГЭ", ws1);
|
||||
ExcelWorksheet ws = p.Workbook.Worksheets["ИГЭ"];
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
ws.Cells["A2"].LoadFromArrays(content);
|
||||
ws.Select();
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
}
|
||||
|
||||
//try
|
||||
//{
|
||||
// using (StreamWriter sw = new StreamWriter(sfd.FileName, false, System.Text.Encoding.Default))
|
||||
// {
|
||||
// foreach (IGE item in listIGE)
|
||||
// {
|
||||
// sw.WriteLine(item.PropsToString());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// Alert(e.Message);
|
||||
//}
|
||||
}
|
||||
|
||||
//Чтение таблицы набора ИГЭ из файла *.csv
|
||||
internal void ReadIGEsFromCsv()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.xlsx";
|
||||
ofd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
ofd.Title = "Заполнение таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListIGE.Clear();
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(ofd.FileName)))
|
||||
{
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p.Workbook.Worksheets["ИГЭ"];
|
||||
|
||||
object[,] content = ws.Cells.Value as object[,];
|
||||
List<object> source; IGE item;
|
||||
for (int i = 1; i < content.GetLength(0); i++)
|
||||
{
|
||||
source = new List<object>();
|
||||
for (int j = 0; j < content.GetLength(1); j++)
|
||||
{
|
||||
source.Add(content[i, j]);
|
||||
}
|
||||
item = new IGE(); item.ListToProps(source);
|
||||
ListIGE.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//OpenFileDialog ofd = new OpenFileDialog();
|
||||
//ofd.DefaultExt = "*.*";
|
||||
//ofd.Filter = "Текстовый файл (*.csv)|*.csv|Все файлы (*.*)|*.*";
|
||||
//ofd.Title = "Заполнение таблицы";
|
||||
//ofd.ShowDialog();
|
||||
|
||||
//if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListIGE.Clear();
|
||||
//try
|
||||
//{
|
||||
// using (StreamReader sr = new StreamReader(ofd.FileName, System.Text.Encoding.Default))
|
||||
// {
|
||||
// string line;
|
||||
// IGE ige;
|
||||
// while ((line = sr.ReadLine()) != null)
|
||||
// {
|
||||
// ige = new IGE();
|
||||
// ige.StringToProps(line);
|
||||
// ListIGE.Add(ige);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// Alert(e.Message);
|
||||
//}
|
||||
}
|
||||
|
||||
internal void SaveIGEs()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.igedb";
|
||||
sfd.Filter = "Таблица ИГЭ (*.igedb)|*.igedb";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = true;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
// получаем поток, куда будем записывать сериализованный объект
|
||||
using (FileStream fs = new FileStream(sfd.FileName, FileMode.OpenOrCreate))
|
||||
{
|
||||
formatter.Serialize(fs, ListIGE);
|
||||
}
|
||||
//Alert("Введенные данные успешно сохранены");
|
||||
}
|
||||
|
||||
internal void ReadIGEs()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.igedb";
|
||||
ofd.Filter = "Таблица ИГЭ (*.igedb)|*.igedb";
|
||||
ofd.Title = "Открытие таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
if (File.Exists(ofd.FileName) == true)
|
||||
{
|
||||
// создаем объект BinaryFormatter
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
using (FileStream fs = new FileStream(ofd.FileName, FileMode.OpenOrCreate))
|
||||
{
|
||||
List<IGE> tmp = new List<IGE>(ListIGE);
|
||||
tmp.AddRange(formatter.Deserialize(fs) as ObservableCollection<IGE>);
|
||||
ListIGE = new ObservableCollection<IGE>(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
244
VM/LayersVM.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
using Microsoft.Win32;
|
||||
using OfficeOpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand addLayer;
|
||||
private RelayCommand updateLayer;
|
||||
private RelayCommand renumLayer;
|
||||
private RelayCommand recalcLayerH;
|
||||
private RelayCommand recalcLayerDown;
|
||||
private RelayCommand exportLayersToXLSX;
|
||||
private RelayCommand importLayersFromXLSX;
|
||||
|
||||
int numLayer = 1;
|
||||
ObservableCollection<Layer> listLayer = new ObservableCollection<Layer>();
|
||||
|
||||
public ObservableCollection<Layer> ListLayer { get => listLayer; set { listLayer = value; OnPropertyChanged(); } }
|
||||
|
||||
public RelayCommand AddLayer
|
||||
{
|
||||
get { return addLayer ?? (addLayer = new RelayCommand(obj => { AddLayerToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateLayers
|
||||
{
|
||||
get { return updateLayer ?? (updateLayer = new RelayCommand(obj => { UpdateLayerInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumLayers
|
||||
{
|
||||
get { return renumLayer ?? (renumLayer = new RelayCommand(obj => { RenumberingLayerInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RecalcLayerH
|
||||
{
|
||||
get { return recalcLayerH ?? (recalcLayerH = new RelayCommand(obj => { RecalcInLayersH(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RecalcLayerDown
|
||||
{
|
||||
get { return recalcLayerDown ?? (recalcLayerDown = new RelayCommand(obj => { RecalcInLayersDown(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportLayersToXLSX
|
||||
{
|
||||
get { return exportLayersToXLSX ?? (exportLayersToXLSX = new RelayCommand(obj => { SaveLayersInXlsx(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportLayersFromXLSX
|
||||
{
|
||||
get { return importLayersFromXLSX ?? (importLayersFromXLSX = new RelayCommand(obj => { ReadLayersFromXlsx(); })); }
|
||||
}
|
||||
|
||||
void AddLayerToList()
|
||||
{
|
||||
ListLayer.Add(new Layer() { Number = numLayer }); numLayer++;
|
||||
//CreateListNumberTypeBet();
|
||||
//NameLayer = listLayer[0].Name;
|
||||
}
|
||||
void RenumberingLayerInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (Layer item in listLayer)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numLayer = j;
|
||||
ListLayer = new ObservableCollection<Layer>(listLayer);
|
||||
}
|
||||
void UpdateLayerInList()
|
||||
{
|
||||
foreach (Layer lay in listLayer)
|
||||
{
|
||||
foreach (IGE ige in listIGE)
|
||||
{
|
||||
if (lay.NumIGE==ige.NumIGE)
|
||||
{
|
||||
lay.IGE = ige.Clone();
|
||||
lay.Description = ige.Description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ListLayer = new ObservableCollection<Layer>(listLayer);
|
||||
selectedBore.Layers = listLayer;
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void RecalcInLayersH()
|
||||
{
|
||||
if (listLayer == null) return;
|
||||
if (listLayer.Count == 0) return;
|
||||
if (selectedBore == null) return;
|
||||
|
||||
UpdateLayerInList();
|
||||
|
||||
double down = 0;
|
||||
double up = 0;
|
||||
double z = selectedBore.Z;
|
||||
foreach (Layer item in listLayer)
|
||||
{
|
||||
z -= item.H;
|
||||
down += item.H;
|
||||
item.Down = down;
|
||||
item.Z = z;
|
||||
item.Up = up;
|
||||
up += item.H;
|
||||
}
|
||||
ListLayer = new ObservableCollection<Layer>(listLayer);
|
||||
}
|
||||
|
||||
void RecalcInLayersDown()
|
||||
{
|
||||
if (listLayer == null) return;
|
||||
if (listLayer.Count == 0) return;
|
||||
if (selectedBore == null) return;
|
||||
|
||||
UpdateLayerInList();
|
||||
|
||||
double up = 0;
|
||||
double z = selectedBore.Z;
|
||||
foreach (Layer item in listLayer)
|
||||
{
|
||||
item.Up = up;
|
||||
item.H = item.Down - item.Up;
|
||||
z -= item.H;
|
||||
item.Z = z;
|
||||
up += item.H;
|
||||
}
|
||||
ListLayer = new ObservableCollection<Layer>(listLayer);
|
||||
}
|
||||
|
||||
//Сохранение таблиц наборов слоев в файл *.xlsx
|
||||
internal void SaveLayersInXlsx()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.xlsx";
|
||||
sfd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = true;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
try
|
||||
{
|
||||
string path = "ИГЭ.xlsx";
|
||||
FileInfo fileInf = new FileInfo(path);
|
||||
if (fileInf.Exists != true)
|
||||
{
|
||||
using (FileStream fstream = new FileStream("ИГЭ.xlsx", FileMode.OpenOrCreate))
|
||||
{
|
||||
byte[] array = Properties.Resources.IGE;
|
||||
fstream.Write(array, 0, array.Length);
|
||||
}
|
||||
}
|
||||
|
||||
using (var p = new ExcelPackage(new FileInfo(sfd.FileName)))
|
||||
{
|
||||
for (int i = 0; i < listBore.Count; i++)
|
||||
{
|
||||
List<object[]> content = new List<object[]>();
|
||||
foreach (Layer fli in listBore[i].Layers)
|
||||
{
|
||||
content.Add(fli.PropsToList().ToArray());
|
||||
}
|
||||
ExcelPackage p1 = new ExcelPackage(new FileInfo("ИГЭ.xlsx"));
|
||||
//A workbook must have at least on cell, so lets add one...
|
||||
var ws = p1.Workbook.Worksheets["Слои"];
|
||||
p.Workbook.Worksheets.Add((i + 1).ToString(), ws);
|
||||
var wsi = p.Workbook.Worksheets[i + 1];
|
||||
//To set values in the spreadsheet use the Cells indexer.
|
||||
wsi.Cells["D1"].Value = listBore[i].Name;
|
||||
wsi.Cells["A3"].LoadFromArrays(content);
|
||||
}
|
||||
|
||||
//Save the new workbook. We haven't specified the filename so use the Save as method.
|
||||
p.SaveAs(new FileInfo(sfd.FileName));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
//Чтение наборов слоев из файла *.xlsx
|
||||
internal void ReadLayersFromXlsx()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.xlsx";
|
||||
ofd.Filter = "Файл Excel (*.xlsx)|*.xlsx";
|
||||
ofd.Title = "Заполнение таблиц";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
//ListFoundLoad.Clear();
|
||||
try
|
||||
{
|
||||
using (var p = new ExcelPackage(new FileInfo(ofd.FileName)))
|
||||
{
|
||||
int k = 0;
|
||||
foreach (ExcelWorksheet wsi in p.Workbook.Worksheets)
|
||||
{
|
||||
listBore[k].Layers = new ObservableCollection<Layer>();
|
||||
|
||||
object[,] content = wsi.Cells.Value as object[,];
|
||||
List<object> source; Layer item;
|
||||
for (int i = 2; i < content.GetLength(0); i++)
|
||||
{
|
||||
source = new List<object>();
|
||||
for (int j = 0; j < content.GetLength(1); j++)
|
||||
{
|
||||
source.Add(content[i, j]);
|
||||
}
|
||||
item = new Layer(); item.ListToProps(source);
|
||||
listBore[k].Layers.Add(item);
|
||||
SelectedBore = listBore[k];
|
||||
UpdateLayerInList();
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
363
VM/PlanningVM.cs
Normal file
@@ -0,0 +1,363 @@
|
||||
using Microsoft.Win32;
|
||||
using netDxf;
|
||||
using netDxf.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TriangleNet;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Meshing;
|
||||
using TriangleNet.Tools;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private RelayCommand addRedVertex;
|
||||
private RelayCommand addBlackVertex;
|
||||
private RelayCommand updateRedPlanning;
|
||||
private RelayCommand updateBlackPlanning;
|
||||
private RelayCommand renumRedVertexes;
|
||||
private RelayCommand renumBlackVertexes;
|
||||
private RelayCommand importPlanningsFromDXF;
|
||||
private RelayCommand importRedPlanningFromCSV;
|
||||
private RelayCommand importBlackPlanningFromCSV;
|
||||
private RelayCommand exportRedPlanningToCSV;
|
||||
private RelayCommand exportBlackPlanningToCSV;
|
||||
private RelayCommand createRedPlanningMesh;
|
||||
private RelayCommand createBlackPlanningMesh;
|
||||
|
||||
int numVertex = 1;
|
||||
PlanningVertex selectedRedVertex;
|
||||
PlanningVertex selectedBlackVertex;
|
||||
ObservableCollection<PlanningVertex> redPlanning = new ObservableCollection<PlanningVertex>();
|
||||
ObservableCollection<PlanningVertex> blackPlanning = new ObservableCollection<PlanningVertex>();
|
||||
|
||||
public ObservableCollection<PlanningVertex> RedPlanning { get => redPlanning; set { redPlanning = value; OnPropertyChanged(); } }
|
||||
public ObservableCollection<PlanningVertex> BlackPlanning { get => blackPlanning; set { blackPlanning = value; OnPropertyChanged(); } }
|
||||
public PlanningVertex SelectedRedVertex { get => selectedRedVertex; set { selectedRedVertex = value; OnPropertyChanged(); } }
|
||||
public PlanningVertex SelectedBlackVertex { get => selectedBlackVertex; set { selectedBlackVertex = value; OnPropertyChanged(); } }
|
||||
public TriangleNet.Mesh MeshRedPlanning { get; private set; }
|
||||
public TriangleNet.Mesh MeshBlackPlanning { get; private set; }
|
||||
|
||||
|
||||
public RelayCommand AddRedVertex
|
||||
{
|
||||
get { return addRedVertex ?? (addRedVertex = new RelayCommand(obj => { AddRedVertexToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateRedPlanning
|
||||
{
|
||||
get { return updateRedPlanning ?? (updateRedPlanning = new RelayCommand(obj => { UpdateRedVertexesInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumRedVertexes
|
||||
{
|
||||
get { return renumRedVertexes ?? (renumRedVertexes = new RelayCommand(obj => { RenumberingRedVertexesInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand AddBlackVertex
|
||||
{
|
||||
get { return addBlackVertex ?? (addBlackVertex = new RelayCommand(obj => { AddBlackVertexToList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand UpdateBlackPlanning
|
||||
{
|
||||
get { return updateBlackPlanning ?? (updateBlackPlanning = new RelayCommand(obj => { UpdateBlackVertexesInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand RenumBlackVertexes
|
||||
{
|
||||
get { return renumBlackVertexes ?? (renumBlackVertexes = new RelayCommand(obj => { RenumberingBlackVertexesInList(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportPlanningsFromDXF
|
||||
{
|
||||
get { return importPlanningsFromDXF ?? (importPlanningsFromDXF = new RelayCommand(obj => { ReadPlanningsDXF(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ImportRedPlanningFromCSV
|
||||
{
|
||||
get { return importRedPlanningFromCSV ?? (importRedPlanningFromCSV = new RelayCommand(obj => { ReadRedPlanningCSV(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportRedPlanningToCSV
|
||||
{
|
||||
get { return exportRedPlanningToCSV ?? (exportRedPlanningToCSV = new RelayCommand(obj => { SaveRedPlanningInCsv(); })); }
|
||||
}
|
||||
|
||||
|
||||
public RelayCommand ImportBlackPlanningFromCSV
|
||||
{
|
||||
get { return importBlackPlanningFromCSV ?? (importBlackPlanningFromCSV = new RelayCommand(obj => { ReadBlackPlanningCSV(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand ExportBlackPlanningToCSV
|
||||
{
|
||||
get { return exportBlackPlanningToCSV ?? (exportBlackPlanningToCSV = new RelayCommand(obj => { SaveBlackPlanningInCsv(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CreateRedPlanningMesh
|
||||
{
|
||||
get { return createRedPlanningMesh ?? (createRedPlanningMesh = new RelayCommand(obj => { CreateRedMesh(); })); }
|
||||
}
|
||||
|
||||
public RelayCommand CreateBlackPlanningMesh
|
||||
{
|
||||
get { return createBlackPlanningMesh ?? (createBlackPlanningMesh = new RelayCommand(obj => { CreateBlackMesh(); })); }
|
||||
}
|
||||
|
||||
private void ReadRedPlanningCSV()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.*";
|
||||
ofd.Filter = "Текстовый файл (*.csv)|*.csv|Все файлы (*.*)|*.*";
|
||||
ofd.Title = "Заполнение таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
RedPlanning.Clear();
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(ofd.FileName, System.Text.Encoding.Default))
|
||||
{
|
||||
string line;
|
||||
PlanningVertex vert;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
vert = new PlanningVertex();
|
||||
vert.StringToProps(line);
|
||||
RedPlanning.Add(vert);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SaveRedPlanningInCsv()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.csv";
|
||||
sfd.Filter = "Текстовый файл (*.csv)|*.csv";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = true;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(sfd.FileName, false, System.Text.Encoding.Default))
|
||||
{
|
||||
foreach (PlanningVertex item in RedPlanning)
|
||||
{
|
||||
sw.WriteLine(item.PropsToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadBlackPlanningCSV()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.*";
|
||||
ofd.Filter = "Текстовый файл (*.csv)|*.csv|Все файлы (*.*)|*.*";
|
||||
ofd.Title = "Заполнение таблицы";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
|
||||
BlackPlanning.Clear();
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(ofd.FileName, System.Text.Encoding.Default))
|
||||
{
|
||||
string line;
|
||||
PlanningVertex vert;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
vert = new PlanningVertex();
|
||||
vert.StringToProps(line);
|
||||
BlackPlanning.Add(vert);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SaveBlackPlanningInCsv()
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "*.csv";
|
||||
sfd.Filter = "Текстовый файл (*.csv)|*.csv";
|
||||
sfd.Title = "Сохранение таблицы";
|
||||
//sfd.AddExtension = true;
|
||||
sfd.OverwritePrompt = true;
|
||||
sfd.ShowDialog();
|
||||
|
||||
if (sfd.FileName == null || sfd.FileName == "") return;
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(sfd.FileName, false, System.Text.Encoding.Default))
|
||||
{
|
||||
foreach (PlanningVertex item in BlackPlanning)
|
||||
{
|
||||
sw.WriteLine(item.PropsToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Alert(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadPlanningsDXF()
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.DefaultExt = "*.dxf";
|
||||
ofd.Filter = "Чертеж (*.dxf)|*.dxf";
|
||||
ofd.Title = "Импорт чертежа";
|
||||
ofd.ShowDialog();
|
||||
|
||||
if (ofd.FileName == null || ofd.FileName == "") return;
|
||||
if (selectedStructure == null) return;
|
||||
RedPlanning.Clear(); BlackPlanning.Clear();
|
||||
DxfDocument dxfDocument = DxfDocument.Load(ofd.FileName);
|
||||
IEnumerable<Text> dxfTexts = dxfDocument.Texts;
|
||||
PlanningVertex vert; int j = 1; int k = 1;
|
||||
foreach (Text item in dxfTexts)
|
||||
{
|
||||
if (item.Layer.Name == "Red")
|
||||
{
|
||||
vert = new PlanningVertex
|
||||
{
|
||||
X = Math.Round(item.Position.X * 0.001, 3),
|
||||
Y = Math.Round(item.Position.Y * 0.001, 3),
|
||||
Number = j,
|
||||
Red = double.Parse(item.Value)
|
||||
};
|
||||
RedPlanning.Add(vert);
|
||||
j++;
|
||||
}
|
||||
else if (item.Layer.Name == "Black")
|
||||
{
|
||||
vert = new PlanningVertex
|
||||
{
|
||||
X = Math.Round(item.Position.X * 0.001, 3),
|
||||
Y = Math.Round(item.Position.Y * 0.001, 3),
|
||||
Number = k,
|
||||
Black = double.Parse(item.Value)
|
||||
};
|
||||
BlackPlanning.Add(vert);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddRedVertexToList()
|
||||
{
|
||||
RedPlanning.Add(new PlanningVertex() { Number = numVertex }); numVertex++;
|
||||
//NameStructure = listStructure[0].Name;
|
||||
}
|
||||
void RenumberingRedVertexesInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (PlanningVertex item in RedPlanning)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numVertex = j;
|
||||
RedPlanning = new ObservableCollection<PlanningVertex>(RedPlanning);
|
||||
}
|
||||
void UpdateRedVertexesInList()
|
||||
{
|
||||
RedPlanning = new ObservableCollection<PlanningVertex>(RedPlanning);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void AddBlackVertexToList()
|
||||
{
|
||||
BlackPlanning.Add(new PlanningVertex() { Number = numVertex }); numVertex++;
|
||||
//NameStructure = listStructure[0].Name;
|
||||
}
|
||||
void RenumberingBlackVertexesInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (PlanningVertex item in BlackPlanning)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numVertex = j;
|
||||
BlackPlanning = new ObservableCollection<PlanningVertex>(BlackPlanning);
|
||||
}
|
||||
void UpdateBlackVertexesInList()
|
||||
{
|
||||
BlackPlanning = new ObservableCollection<PlanningVertex>(BlackPlanning);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
internal void CreateRedMesh()
|
||||
{
|
||||
if (selectedStructure == null || selectedStructure.RedPlanning == null || selectedStructure.RedPlanning.Count == 0) return;
|
||||
|
||||
Polygon polygon = new Polygon();
|
||||
Vertex vrtx;
|
||||
int i = 1;
|
||||
foreach (PlanningVertex item in selectedStructure.RedPlanning)
|
||||
{
|
||||
vrtx = new Vertex(item.X, item.Y, item.Number, 1);
|
||||
vrtx.Attributes[0] = item.Red;
|
||||
polygon.Add(vrtx);
|
||||
i++;
|
||||
}
|
||||
GenericMesher mesher = new GenericMesher();
|
||||
ConstraintOptions constraint = new ConstraintOptions();
|
||||
constraint.Convex = true;
|
||||
MeshRedPlanning = (TriangleNet.Mesh)mesher.Triangulate(polygon, constraint);
|
||||
Alert("\"Красная\" триангуляционная сеть создана");
|
||||
}
|
||||
|
||||
internal void CreateBlackMesh()
|
||||
{
|
||||
if (selectedStructure == null || selectedStructure.BlackPlanning == null || selectedStructure.BlackPlanning.Count == 0) return;
|
||||
|
||||
Polygon polygon = new Polygon();
|
||||
Vertex vrtx;
|
||||
int i = 1;
|
||||
foreach (PlanningVertex item in selectedStructure.BlackPlanning)
|
||||
{
|
||||
vrtx = new Vertex(item.X, item.Y, item.Number, 1);
|
||||
vrtx.Attributes[0] = item.Black;
|
||||
polygon.Add(vrtx);
|
||||
i++;
|
||||
}
|
||||
GenericMesher mesher = new GenericMesher();
|
||||
ConstraintOptions constraint = new ConstraintOptions();
|
||||
constraint.Convex = true;
|
||||
MeshBlackPlanning = (TriangleNet.Mesh)mesher.Triangulate(polygon, constraint);
|
||||
Alert("\"Черная\" триангуляционная сеть создана");
|
||||
}
|
||||
}
|
||||
}
|
||||
87
VM/PlayGroundVM.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
int numPG = 1;
|
||||
PlayGround selectedPlayGround;
|
||||
string namePlayGround;
|
||||
ObservableCollection<PlayGround> listPlayGround = new ObservableCollection<PlayGround>();
|
||||
|
||||
public ObservableCollection<PlayGround> ListPlayGround { get => listPlayGround; set { listPlayGround = value; OnPropertyChanged(); } }
|
||||
public string NamePlayGround { get => namePlayGround; set { namePlayGround = value; OnPropertyChanged(); } }
|
||||
public PlayGround SelectedPlayGround { get => selectedPlayGround; set { selectedPlayGround = value; OnPropertyChanged(); ChangeSelectedPlayGround(); } }
|
||||
|
||||
private RelayCommand addPlayGround;
|
||||
public RelayCommand AddPlayGround
|
||||
{
|
||||
get { return addPlayGround ?? (addPlayGround = new RelayCommand(obj => { AddPlayGroundToList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand updatePlayGround;
|
||||
public RelayCommand UpdatePlayGrounds
|
||||
{
|
||||
get { return updatePlayGround ?? (updatePlayGround = new RelayCommand(obj => { UpdatePlayGroundInList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand renumPlayGround;
|
||||
public RelayCommand RenumPlayGrounds
|
||||
{
|
||||
get { return renumPlayGround ?? (renumPlayGround = new RelayCommand(obj => { RenumberingPlayGroundInList(); })); }
|
||||
}
|
||||
|
||||
void AddPlayGroundToList()
|
||||
{
|
||||
ListPlayGround.Add(new PlayGround() { Number = numPG }); numPG++;
|
||||
//CreateListNumberTypeBet();
|
||||
//NamePlayGround = listPlayGround[0].Name;
|
||||
}
|
||||
void RenumberingPlayGroundInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (PlayGround item in ListPlayGround)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numPG = j;
|
||||
ListPlayGround = new ObservableCollection<PlayGround>(ListPlayGround);
|
||||
}
|
||||
void UpdatePlayGroundInList()
|
||||
{
|
||||
ListPlayGround = new ObservableCollection<PlayGround>(ListPlayGround);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
//void ChangeSelClassBet()
|
||||
//{
|
||||
// //if (selectedBet==null) return;
|
||||
// CreateListNumberTypeBet();
|
||||
//}
|
||||
|
||||
//void CreateListNumberTypeBet()
|
||||
//{
|
||||
// //listNumberTypeArm = new List<int>();
|
||||
// ListNumberTypeBet = from bet in listBet select bet.Id;
|
||||
//}
|
||||
|
||||
void ChangeSelectedPlayGround()
|
||||
{
|
||||
if (listPlayGround.Count == 0 || selectedPlayGround == null) return;
|
||||
NamePlayGround = SelectedPlayGround.Name;
|
||||
ListIGE = selectedPlayGround.IGEs;
|
||||
ListBore = selectedPlayGround.Bores;
|
||||
ListStructure = selectedPlayGround.Structures;
|
||||
CreateListNumIGEs();
|
||||
CreateListShemas();
|
||||
CreateListTypeFoundations();
|
||||
}
|
||||
}
|
||||
}
|
||||
38
VM/RelayCommand.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
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)
|
||||
{
|
||||
return this.canExecute == null || this.canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
96
VM/StructuresVM.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
int numStructure = 1;
|
||||
string nameStructure;
|
||||
private string structureNote;
|
||||
Structure selectedStructure;
|
||||
ObservableCollection<Structure> listStructure = new ObservableCollection<Structure>();
|
||||
|
||||
public ObservableCollection<Structure> ListStructure { get => listStructure; set { listStructure = value; OnPropertyChanged(); } }
|
||||
|
||||
private IEnumerable<TypeFlexStructure> listShemas;
|
||||
public IEnumerable<TypeFlexStructure> ListShemas { get => listShemas; set { listShemas = value; OnPropertyChanged(); } }
|
||||
public string StructureNote { get => structureNote; set { structureNote = value; OnPropertyChanged(); } }
|
||||
|
||||
private RelayCommand addStructure;
|
||||
public RelayCommand AddStructure
|
||||
{
|
||||
get { return addStructure ?? (addStructure = new RelayCommand(obj => { AddStructureToList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand updateStructure;
|
||||
public RelayCommand UpdateStructures
|
||||
{
|
||||
get { return updateStructure ?? (updateStructure = new RelayCommand(obj => { UpdateStructureInList(); })); }
|
||||
}
|
||||
|
||||
private RelayCommand renumStructure;
|
||||
|
||||
public RelayCommand RenumStructures
|
||||
{
|
||||
get { return renumStructure ?? (renumStructure = new RelayCommand(obj => { RenumberingStructureInList(); })); }
|
||||
}
|
||||
|
||||
public Structure SelectedStructure { get => selectedStructure; set { selectedStructure = value; OnPropertyChanged(); ChangeSelectedStructure(); } }
|
||||
|
||||
public string NameStructure { get => nameStructure; set { nameStructure = value; OnPropertyChanged(); } }
|
||||
|
||||
void AddStructureToList()
|
||||
{
|
||||
ListStructure.Add(new Structure() { Number = numStructure }); numStructure++;
|
||||
//NameStructure = listStructure[0].Name;
|
||||
}
|
||||
void RenumberingStructureInList()
|
||||
{
|
||||
int j = 1;
|
||||
foreach (Structure item in ListStructure)
|
||||
{
|
||||
item.Number = j;
|
||||
j++;
|
||||
}
|
||||
numStructure = j;
|
||||
ListStructure = new ObservableCollection<Structure>(ListStructure);
|
||||
}
|
||||
void UpdateStructureInList()
|
||||
{
|
||||
ListStructure = new ObservableCollection<Structure>(ListStructure);
|
||||
SaveDB();
|
||||
}
|
||||
|
||||
void ChangeSelectedStructure()
|
||||
{
|
||||
if (listStructure.Count == 0 || selectedStructure == null) return;
|
||||
NameStructure = selectedStructure.Name;
|
||||
ListFoundation = selectedStructure.Foundations;
|
||||
RedPlanning = selectedStructure.RedPlanning;
|
||||
BlackPlanning = selectedStructure.BlackPlanning;
|
||||
if (redPlanning == null) RedPlanning = new ObservableCollection<PlanningVertex>();
|
||||
if (blackPlanning == null) BlackPlanning = new ObservableCollection<PlanningVertex>();
|
||||
}
|
||||
|
||||
void CreateListShemas()
|
||||
{
|
||||
if (listStructure == null || listPlayGround == null) return;
|
||||
ListShemas = new List<TypeFlexStructure>() { TypeFlexStructure.Гибкая, TypeFlexStructure.Жесткая };
|
||||
try
|
||||
{
|
||||
StructuresPage structuresPage = (StructuresPage)MW.StructuresFrame.Content;
|
||||
structuresPage.flexListCbxCol.ItemsSource = listShemas;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
131
VM/UnitsViewModel .cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
UnitsLin[] unitsL = { UnitsLin.м, UnitsLin.см, UnitsLin.мм };
|
||||
UnitsArea[] unitsA = { UnitsArea.м, UnitsArea.см, UnitsArea.мм };
|
||||
UnitsForce[] unitsF = { UnitsForce.т, UnitsForce.кН, UnitsForce.Н };
|
||||
UnitsStress[] unitsS = { UnitsStress.т, UnitsStress.кН, UnitsStress.Н, UnitsStress.МПа, UnitsStress.кПа };
|
||||
UnitsLin unitsLId = UnitsLin.м;
|
||||
UnitsLin unitsSectId = UnitsLin.см;
|
||||
UnitsLin unitsDarmId = UnitsLin.мм;
|
||||
UnitsArea unitsAarmId = UnitsArea.см;
|
||||
UnitsArea unitsAMatId = UnitsArea._;
|
||||
UnitsLin unitsLForcId = UnitsLin.м;
|
||||
UnitsArea unitsAStressId = UnitsArea._;
|
||||
UnitsLin unitsCrackId = UnitsLin.мм;
|
||||
UnitsStress unitsSMatId = UnitsStress.МПа;
|
||||
UnitsStress unitsSStressId = UnitsStress.МПа;
|
||||
UnitsForce unitsFForceId = UnitsForce.кН;
|
||||
internal double scaleDimLength = 1;
|
||||
internal double scaleDimSect = 0.01;
|
||||
internal double scaleDimDarm = 0.001;
|
||||
internal double scaleDimAarm = 0.0001;
|
||||
internal double scaleDimLfrc = 1;
|
||||
internal double scaleDimFfrc = 1;
|
||||
internal double scaleDimStress = 0.001;
|
||||
internal double scaleDimMat = 0.001;
|
||||
internal double scaleDimCrack = 0.001;
|
||||
|
||||
public UnitsLin[] UnitsL { get => unitsL; set => unitsL = value; }
|
||||
public UnitsArea[] UnitsA { get => unitsA; set => unitsA = value; }
|
||||
public UnitsForce[] UnitsF { get => unitsF; set => unitsF = value; }
|
||||
public UnitsStress[] UnitsS { get => unitsS; set => unitsS = value; }
|
||||
|
||||
public UnitsLin UnitsLId { get => unitsLId; set { unitsLId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsLin UnitsSectId { get => unitsSectId; set { unitsSectId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsLin UnitsDarmId { get => unitsDarmId; set { unitsDarmId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsArea UnitsAarmId { get => unitsAarmId; set { unitsAarmId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsArea UnitsAMatId { get => unitsAMatId; set { unitsAMatId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsLin UnitsLForcId { get => unitsLForcId; set { unitsLForcId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsArea UnitsAStressId { get => unitsAStressId; set { unitsAStressId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsLin UnitsCrackId { get => unitsCrackId; set { unitsCrackId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsForce UnitsFForceId { get => unitsFForceId; set { unitsFForceId = value; OnPropertyChanged(); ChangeUnits(); } }
|
||||
public UnitsStress UnitsSMatId { get => unitsSMatId; set { unitsSMatId = value; OnPropertyChanged(); ChangeUnits();
|
||||
if (value == UnitsStress.МПа || value == UnitsStress.кПа) UnitsAMatId = UnitsArea._; } }
|
||||
public UnitsStress UnitsSStressId { get => unitsSStressId; set { unitsSStressId = value; OnPropertyChanged(); ChangeUnits();
|
||||
if (value == UnitsStress.МПа || value == UnitsStress.кПа) UnitsAStressId = UnitsArea._; } }
|
||||
|
||||
|
||||
void ChangeUnits()
|
||||
{
|
||||
scaleDimAarm = ScaleAUnits(unitsAarmId);
|
||||
scaleDimCrack = ScaleLUnits(unitsCrackId);
|
||||
scaleDimDarm = ScaleLUnits(unitsDarmId);
|
||||
scaleDimFfrc = ScaleFUnits(unitsFForceId);
|
||||
scaleDimLength = ScaleLUnits(unitsLId);
|
||||
scaleDimLfrc = ScaleLUnits(unitsLForcId);
|
||||
scaleDimSect = ScaleLUnits(unitsSectId);
|
||||
scaleDimMat = ScaleSUnits(unitsSMatId,unitsAMatId);
|
||||
scaleDimStress = ScaleSUnits(unitsSStressId, unitsAStressId);
|
||||
//Bfloat = B / scaleDimSect;
|
||||
//Hfloat = H / scaleDimSect;
|
||||
//Dfloat = D / scaleDimSect;
|
||||
//D1float = D1 / scaleDimSect;
|
||||
}
|
||||
|
||||
void ChangeValues()
|
||||
{
|
||||
//B = bfloat * scaleDimSect;
|
||||
//H = hfloat * scaleDimSect;
|
||||
//D = dfloat * scaleDimSect;
|
||||
//D1 = d1float * scaleDimSect;
|
||||
}
|
||||
|
||||
double ScaleLUnits(UnitsLin unit)
|
||||
{
|
||||
double res = 1;
|
||||
switch (unit)
|
||||
{
|
||||
case UnitsLin.мм: res = 1E-3; break;
|
||||
case UnitsLin.см: res = 1E-2; break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double ScaleAUnits(UnitsArea unit)
|
||||
{
|
||||
double res = 1;
|
||||
switch (unit)
|
||||
{
|
||||
case UnitsArea.мм: res = 1E-6; break;
|
||||
case UnitsArea.см: res = 1E-4; break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double ScaleFUnits(UnitsForce unit)
|
||||
{
|
||||
double res = 1;
|
||||
switch (unit)
|
||||
{
|
||||
case UnitsForce.Н: res = 1E+3; break;
|
||||
case UnitsForce.т: res = 0.10194; break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double ScaleSUnits(UnitsStress unitS, UnitsArea unitA)
|
||||
{
|
||||
double res = 1;
|
||||
if (unitS == UnitsStress.кН && unitA == UnitsArea.см) res = 1E-4;
|
||||
if (unitS == UnitsStress.кН && unitA == UnitsArea.мм) res = 1E-6;
|
||||
if (unitS == UnitsStress.Н && unitA == UnitsArea.м) res = 1E+3;
|
||||
if (unitS == UnitsStress.Н && unitA == UnitsArea.см) res = 0.1;
|
||||
if (unitS == UnitsStress.Н && unitA == UnitsArea.мм) res = 1E-3;
|
||||
if (unitS == UnitsStress.т && unitA == UnitsArea.м) res = 0.10194;
|
||||
if (unitS == UnitsStress.т && unitA == UnitsArea.см) res = 1E-5;
|
||||
if (unitS == UnitsStress.т && unitA == UnitsArea.мм) res = 1.01937E-7;
|
||||
if (unitS == UnitsStress.МПа) res = 1E-3;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
101
VM/ViewModel.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace GroundOrganizer
|
||||
{
|
||||
public partial class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
string title;
|
||||
ToSerializ ser = new ToSerializ();
|
||||
MainWindow MW;
|
||||
//MainPage MP;
|
||||
private string basePath;
|
||||
|
||||
public string BasePath { get => basePath; set { basePath = value; OnPropertyChanged(); } }
|
||||
|
||||
public ViewModel()
|
||||
{
|
||||
title = "GroundOrganizer";
|
||||
MW = App.Current.MainWindow as MainWindow;
|
||||
//MW.contentFrame.Content = MP;
|
||||
MW.Title = title;
|
||||
BasePath = Properties.Settings.Default.BasePath;
|
||||
StructureNote = "к числу зданий и сооружений с жесткой конструктивной схемой относятся:" +
|
||||
"\n- здания панельные, блочные и кирпичные, в которых междуэтажные" +
|
||||
"\nперекрытия опираются по всему контуру на поперечные и продольные" +
|
||||
"\nстены или только на поперечные несущие стены при малом их шаге;" +
|
||||
"\n- сооружения типа башен, силосных корпусов, дымовых труб, домен и др.";
|
||||
BoresNote = "* положительное значение отметки уровня грунтовых вод относительно устья скважины";
|
||||
|
||||
}
|
||||
|
||||
private RelayCommand openGroundBase;
|
||||
public RelayCommand OpenGroundBase
|
||||
{
|
||||
get { return openGroundBase ?? (openGroundBase = new RelayCommand(obj => { ReadDB(); })); }
|
||||
}
|
||||
|
||||
public string Title { get => title; set => title = value; }
|
||||
|
||||
string GetGroundBaseFile()
|
||||
{
|
||||
Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
|
||||
ofd.DefaultExt = "*.*";
|
||||
ofd.Filter = "База данных инженерно-геологических площадок (*.grndb)|*.grndb|Все файлы (*.*)|*.*";
|
||||
ofd.Title = "Выбор файла с базой данных инженерно-геологических площадок";
|
||||
ofd.ShowDialog();
|
||||
return ofd.FileName;
|
||||
}
|
||||
|
||||
internal void SaveDB()
|
||||
{
|
||||
//ser = new ToSerializ { PlayGroundList = ListPlayGround };
|
||||
// создаем объект BinaryFormatter
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
// получаем поток, куда будем записывать сериализованный объект
|
||||
using (FileStream fs = new FileStream(Properties.Settings.Default.BasePath, FileMode.OpenOrCreate))
|
||||
{
|
||||
formatter.Serialize(fs, ListPlayGround);
|
||||
}
|
||||
//Alert("Введенные данные успешно сохранены");
|
||||
}
|
||||
|
||||
internal void ReadDB()
|
||||
{
|
||||
Properties.Settings.Default.BasePath = GetGroundBaseFile();
|
||||
Properties.Settings.Default.Save();
|
||||
BasePath = Properties.Settings.Default.BasePath;
|
||||
if (File.Exists(Properties.Settings.Default.BasePath) == true)
|
||||
{
|
||||
// создаем объект BinaryFormatter
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
|
||||
using (FileStream fs = new FileStream(Properties.Settings.Default.BasePath, FileMode.OpenOrCreate))
|
||||
{
|
||||
//ToSerializ ser = (ToSerializ)formatter.Deserialize(fs);
|
||||
ListPlayGround = formatter.Deserialize(fs) as ObservableCollection<PlayGround>;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged([CallerMemberName]string prop = "")
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(prop));
|
||||
}
|
||||
}
|
||||
}
|
||||