public void Test_Equals() { var xyzs = new XYZS(1, 2, 3, 4, 5); var xyzs2 = new XYZS(1, 2, 3, 4, 5); var xyzs3 = new XYZS(2, 3, 4, 5, 6); xyzs.Equals(xyzs2).Should().BeTrue(); xyzs.Equals(xyzs3).Should().BeFalse(); }
public void Creation() { var xyzs = new XYZS(); xyzs.Station.Should().Be(0); xyzs.TriIndex.Should().Be(0); xyzs.X.Should().Be(0); xyzs.Y.Should().Be(0); xyzs.Z.Should().Be(0); }
public void Creation2() { var xyzs = new XYZS(1, 2, 3, 4, 5); xyzs.X.Should().Be(1); xyzs.Y.Should().Be(2); xyzs.Z.Should().Be(3); xyzs.Station.Should().Be(4); xyzs.TriIndex.Should().Be(5); }
public void Test_ToString() { var xyzs = new XYZS(1, 2, 3, 4, 5); xyzs.ToString().Should().Be($"X:{1:F3}, Y:{2:F3}, Z:{3:F3} Station:{4:F3}, TriIndex:{5}"); }
/// <summary> /// Performs the donkey work of the profile calculation /// </summary> private List <XYZS> Calc(CalculateDesignProfileArgument arg, out DesignProfilerRequestResult calcResult) { calcResult = DesignProfilerRequestResult.UnknownError; var siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(arg.ProjectID); var Design = Designs.Lock(arg.ReferenceDesign.DesignID, siteModel, arg.CellSize, out DesignLoadResult LockResult); var arg2 = new CalculateDesignProfileArgument_ClusterCompute { ProjectID = arg.ProjectID, CellSize = arg.CellSize, ReferenceDesign = arg.ReferenceDesign, }; if (arg.PositionsAreGrid) { arg2.ProfilePathNEE = new[] { arg.StartPoint, arg.EndPoint }.Select(x => new XYZ(x.Lon, x.Lat)).ToArray(); } else { if (siteModel != null) { arg2.ProfilePathNEE = DIContext.Obtain <ICoreXWrapper>().WGS84ToCalibration( siteModel.CSIB(), new[] { arg.StartPoint, arg.EndPoint } .ToCoreX_WGS84Point(), CoreX.Types.InputAs.Radians) .ToTRex_XYZ(); } } if (Design == null) { Log.LogWarning($"Failed to read file for design {arg.ReferenceDesign.DesignID} lock result was {LockResult}"); calcResult = DesignProfilerRequestResult.FailedToLoadDesignFile; return(null); } try { var result = Design.ComputeProfile(arg2.ProfilePathNEE, arg.CellSize); //Apply any offset to the profile if (arg.ReferenceDesign.Offset != 0) { for (var i = 0; i < result.Count; i++) { result[i] = new XYZS(result[i].X, result[i].Y, result[i].Z + arg.ReferenceDesign.Offset, result[i].Station, result[i].TriIndex); } } calcResult = DesignProfilerRequestResult.OK; return(result); } finally { Designs.UnLock(arg.ReferenceDesign.DesignID, Design); } }