UpdateStrategy for Actions was added
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Exceptions
|
||||
{
|
||||
public static class ErrorCommonProcessor
|
||||
{
|
||||
public static void ObjectTypeIsUnknown(Type expectedType, Type actualType)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"\n Expected: {expectedType},\n But was: {actualType}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,17 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for update object of type <typeparamref name="T"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
public interface IUpdateStrategy<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Update properties of target object from source object
|
||||
/// </summary>
|
||||
/// <param name="targetObject">Target object</param>
|
||||
/// <param name="sourceObject">Source object</param>
|
||||
void Update(T targetObject, T sourceObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,6 +11,8 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class DesignForcePair : IDesignForcePair
|
||||
{
|
||||
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public IPoint2D ForcePoint { get; set; }
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
@@ -17,12 +20,16 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public IForceTuple LongForceTuple { get; set; }
|
||||
public IForceTuple FullForceTuple { get; set; }
|
||||
|
||||
public DesignForcePair()
|
||||
|
||||
public DesignForcePair(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
LongForceTuple = new ForceTuple();
|
||||
FullForceTuple = new ForceTuple();
|
||||
}
|
||||
|
||||
public DesignForcePair() : this(Guid.NewGuid()) {}
|
||||
|
||||
public IForceCombinationList GetCombinations()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -30,7 +37,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var newItem = new DesignForcePair();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
@@ -12,6 +13,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// <inheritdoc/>
|
||||
public class ForceCombinationByFactor : IForceCombinationByFactor
|
||||
{
|
||||
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
@@ -23,8 +27,11 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public double ULSFactor { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double LongTermFactor { get; set; }
|
||||
public ForceCombinationByFactor()
|
||||
|
||||
|
||||
public ForceCombinationByFactor(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Factored Load";
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D();
|
||||
@@ -32,6 +39,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
LongTermFactor = 1d;
|
||||
ULSFactor = 1.2d;
|
||||
}
|
||||
public ForceCombinationByFactor() : this (Guid.NewGuid()) { }
|
||||
public IForceCombinationList GetCombinations()
|
||||
{
|
||||
var result = new ForceCombinationList();
|
||||
@@ -57,10 +65,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new ForceCombinationByFactor();
|
||||
ForceActionService.CopyActionProps(this, newItem);
|
||||
newItem.FullSLSForces = FullSLSForces.Clone() as IForceTuple;
|
||||
newItem.LongTermFactor = LongTermFactor;
|
||||
newItem.ULSFactor = ULSFactor;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
|
||||
@@ -10,6 +12,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// <inheritdoc/>
|
||||
public class ForceCombinationList : IForceCombinationList
|
||||
{
|
||||
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -18,9 +23,11 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public IPoint2D ForcePoint { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public List<IDesignForceTuple> DesignForces { get; private set; }
|
||||
|
||||
public ForceCombinationList()
|
||||
|
||||
|
||||
public ForceCombinationList(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D() { X = 0, Y = 0 };
|
||||
DesignForces = new List<IDesignForceTuple>
|
||||
@@ -31,17 +38,12 @@ namespace StructureHelperCommon.Models.Forces
|
||||
new DesignForceTuple(LimitStates.SLS, CalcTerms.LongTerm)
|
||||
};
|
||||
}
|
||||
public ForceCombinationList() : this (Guid.NewGuid()) { }
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new ForceCombinationList();
|
||||
ForceActionService.CopyActionProps(this, newItem);
|
||||
newItem.DesignForces.Clear();
|
||||
foreach (var item in DesignForces)
|
||||
{
|
||||
var newForce = item.Clone() as IDesignForceTuple;
|
||||
newItem.DesignForces.Add(newForce);
|
||||
}
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
@@ -6,6 +7,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// <inheritdoc/>
|
||||
public class ForceTuple : IForceTuple
|
||||
{
|
||||
private readonly IUpdateStrategy<IForceTuple> updateStrategy = new ForceTupleUpdateStrategy();
|
||||
/// <inheritdoc/>
|
||||
public double Mx { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -22,8 +24,9 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
ForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz};
|
||||
return forceTuple;
|
||||
var newItem = new ForceTuple();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
public static ForceTuple operator +(ForceTuple first) => first;
|
||||
public static ForceTuple operator +(ForceTuple first, ForceTuple second)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IAction
|
||||
public interface IAction : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,10 +7,23 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IForceAction : IAction, ICloneable
|
||||
/// <summary>
|
||||
/// Action as force load
|
||||
/// </summary>
|
||||
public interface IForceAction : IAction
|
||||
{
|
||||
/// <summary>
|
||||
/// True means force action is put in center of gravity
|
||||
/// </summary>
|
||||
bool SetInGravityCenter { get; set; }
|
||||
/// <summary>
|
||||
/// Point of applying of force load
|
||||
/// </summary>
|
||||
IPoint2D ForcePoint { get; set; }
|
||||
/// <summary>
|
||||
/// Return combination of forces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IForceCombinationList GetCombinations();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ActionUpdateStrategy : IUpdateStrategy<IAction>
|
||||
{
|
||||
readonly IUpdateStrategy<IForceAction> forceUpdateStrategy = new ForceActionUpdateStrategy();
|
||||
public void Update(IAction targetObject, IAction sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
targetObject.Name = sourceObject.Name;
|
||||
if (targetObject is IForceAction forceAction)
|
||||
{
|
||||
forceUpdateStrategy.Update(forceAction, (IForceAction)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(IAction), sourceObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class FactorCombinationUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
|
||||
{
|
||||
readonly IUpdateStrategy<IForceTuple> tupleUpdateStrategy = new ForceTupleUpdateStrategy();
|
||||
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
|
||||
targetObject.ULSFactor = sourceObject.ULSFactor;
|
||||
targetObject.LongTermFactor = sourceObject.LongTermFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
||||
public void Update(IForceAction targetObject, IForceAction sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
targetObject.SetInGravityCenter = sourceObject.SetInGravityCenter;
|
||||
pointStrategy.Update(targetObject.ForcePoint, sourceObject.ForcePoint);
|
||||
UpdateChildProperties(targetObject, sourceObject);
|
||||
}
|
||||
|
||||
private void UpdateChildProperties(IForceAction targetObject, IForceAction sourceObject)
|
||||
{
|
||||
if (targetObject is IDesignForcePair pair)
|
||||
{
|
||||
forcePairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationByFactor combination)
|
||||
{
|
||||
factorUpdateStrategy.Update(combination, (IForceCombinationByFactor)sourceObject);
|
||||
}
|
||||
else if (targetObject is IForceCombinationList forceCombinationList)
|
||||
{
|
||||
forceListUpdateStrategy.Update(forceCombinationList, (IForceCombinationList)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(IForceAction), targetObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceCombinationListUpdateStrategy : IUpdateStrategy<IForceCombinationList>
|
||||
{
|
||||
public void Update(IForceCombinationList targetObject, IForceCombinationList sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
var forcesList = new List<IDesignForceTuple>(sourceObject.DesignForces);
|
||||
targetObject.DesignForces.Clear();
|
||||
foreach (var item in forcesList)
|
||||
{
|
||||
targetObject.DesignForces.Add((IDesignForceTuple)item.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForcePairUpdateStrategy : IUpdateStrategy<IDesignForcePair>
|
||||
{
|
||||
private readonly IUpdateStrategy<IForceTuple> tupleUpdateStrategy = new ForceTupleUpdateStrategy();
|
||||
public void Update(IDesignForcePair targetObject, IDesignForcePair sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
tupleUpdateStrategy.Update(targetObject.LongForceTuple, sourceObject.LongForceTuple);
|
||||
tupleUpdateStrategy.Update(targetObject.FullForceTuple, sourceObject.FullForceTuple);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
internal class ForceTupleUpdateStrategy : IUpdateStrategy<IForceTuple>
|
||||
{
|
||||
public void Update(IForceTuple targetObject, IForceTuple sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, ": target object ");
|
||||
CheckObject.IsNull(sourceObject, ": source object ");
|
||||
|
||||
targetObject.Mx = sourceObject.Mx;
|
||||
targetObject.My = sourceObject.My;
|
||||
targetObject.Nz = targetObject.Nz;
|
||||
targetObject.Qx = targetObject.Qx;
|
||||
targetObject.Qy = targetObject.Qy;
|
||||
targetObject.Mz = sourceObject.Mz;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
@@ -6,15 +7,15 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
/// Interface for point of center of some shape
|
||||
/// Интерфейс для точки центра некоторой формы
|
||||
/// </summary>
|
||||
public interface IPoint2D : ICloneable
|
||||
public interface IPoint2D : ISaveable, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis X, m
|
||||
/// Coordinate of center of point by local axis X, m
|
||||
/// Координата центра вдоль локальной оси X, м
|
||||
/// </summary>
|
||||
double X { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis Y, m
|
||||
/// Coordinate of center of point by local axis Y, m
|
||||
/// Координата центра вдоль локальной оси Y, м
|
||||
/// </summary>
|
||||
double Y { get; set; }
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PointUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
{
|
||||
targetObject.X = sourceObject.X;
|
||||
targetObject.Y = sourceObject.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,32 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Point2D : IPoint2D
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointUpdateStrategy();
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
public double X { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Y { get; set; }
|
||||
|
||||
public Point2D(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Point2D() : this(Guid.NewGuid()) { }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var point = new Point2D() { X = X, Y = Y };
|
||||
return point;
|
||||
var newItem = new Point2D();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
38
StructureHelperCommon/Services/CheckObject.cs
Normal file
38
StructureHelperCommon/Services/CheckObject.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Processor for checking objects
|
||||
/// </summary>
|
||||
public static class CheckObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares types of two objects, throws exception if result is not valid
|
||||
/// </summary>
|
||||
/// <param name="targetObject"></param>
|
||||
/// <param name="sourceObject"></param>
|
||||
/// <exception cref="StructureHelperException"></exception>
|
||||
public static void CompareTypes(object targetObject, object sourceObject)
|
||||
{
|
||||
IsNull(targetObject, "target object");
|
||||
IsNull(targetObject, "source object");
|
||||
if (targetObject.GetType() != sourceObject.GetType())
|
||||
{
|
||||
throw new StructureHelperException
|
||||
($"{ErrorStrings.DataIsInCorrect}: target type is {targetObject.GetType()},\n does not coinside with source type {sourceObject.GetType()}");
|
||||
}
|
||||
}
|
||||
public static void IsNull(object item, string message = "")
|
||||
{
|
||||
if (item is null) {throw new StructureHelperException (ErrorStrings.ParameterIsNull + message);}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,6 @@ namespace StructureHelperCommon.Services.Forces
|
||||
{
|
||||
internal static class ForceActionService
|
||||
{
|
||||
public static void CopyActionProps(IForceAction source, IForceAction target)
|
||||
{
|
||||
target.Name = source.Name;
|
||||
target.SetInGravityCenter = source.SetInGravityCenter;
|
||||
target.ForcePoint.X = source.ForcePoint.X;
|
||||
target.ForcePoint.Y = source.ForcePoint.Y;
|
||||
}
|
||||
|
||||
public static List<IDesignForcePair> ConvertCombinationToPairs(IForceCombinationList combinations)
|
||||
{
|
||||
var resultList = new List<IDesignForcePair>();
|
||||
|
||||
Reference in New Issue
Block a user