Tools for graphs were added

This commit is contained in:
Evgeny Redikultsev
2023-05-06 21:10:02 +05:00
parent 3cb6e60fc9
commit 79c24f2cd5
31 changed files with 553 additions and 77 deletions

View File

@@ -0,0 +1,37 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Parameters
{
public class ArrayParameter<T> : IArrayParameter<T>
{
private string[] columnLabels;
public string[] ColumnLabels
{
get { return columnLabels; }
set
{
var labelCount = value.Count();
var columnCount = Data.GetLength(1);
if (labelCount != columnCount)
{
throw new StructureHelperException(ErrorStrings.IncorrectValue + $" of label count: expected {columnCount}, but was {labelCount}");
}
columnLabels = value;
}
}
public T[,] Data { get; private set; }
public ArrayParameter(int rowCount, int columnCount, string[] columnLabels = null)
{
Data = new T[rowCount, columnCount];
if (columnLabels is not null) { ColumnLabels = columnLabels; }
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Parameters
{
public interface IArrayParameter<T>
{
T[,] Data { get; }
string[] ColumnLabels { get; set; }
}
}

View File

@@ -3,16 +3,18 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace StructureHelperCommon.Models.Parameters
{
public interface ITextParameter
public interface IValueParameter<T>
{
bool IsValid { get; set; }
string Name { get; set; }
string ShortName { get; set; }
Color Color { get; set; }
string MeasurementUnit { get; set; }
double Value { get; set; }
T Value { get; set; }
string Description { get; set; }
}
}

View File

@@ -3,16 +3,18 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace StructureHelperCommon.Models.Parameters
{
public class TextParameter : ITextParameter
public class ValueParameter<T> : IValueParameter<T>
{
public bool IsValid { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public Color Color { get; set; }
public string MeasurementUnit { get; set; }
public double Value { get; set; }
public T Value { get; set; }
public string Description { get; set; }
}
}