public void CreateSoilLayerAreas_SurfaceLineOnTopOrAboveSoilLayer_ReturnsSoilLayerPointsAsRectangle() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty); surfaceLine.SetGeometry(new[] { new Point3D(0, 0, 4), new Point3D(0, 0, 3.2), new Point3D(2, 0, 4) }); var soilLayer = new PipingSoilLayer(3.2); var soilProfile = new PipingSoilProfile("name", 2.0, new[] { soilLayer }, SoilProfileType.SoilProfile1D); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, soilProfile, surfaceLine).ToList(); // Assert Assert.AreEqual(1, areas.Count()); CollectionAssert.AreEqual(new[] { new Point2D(0, 3.2), new Point2D(2, 3.2), new Point2D(2, 2), new Point2D(0, 2) }, areas.ElementAt(0)); }
private void SetSoilProfileChartData() { PipingSoilProfile soilProfile = data.InputParameters.StochasticSoilProfile?.SoilProfile; // If necessary, regenerate all soil layer chart data if (!ReferenceEquals(currentSoilProfile, soilProfile)) { currentSoilProfile = soilProfile; soilProfileChartData.Clear(); soilLayerChartDataLookup.Clear(); GetSoilLayers().Select(PipingChartDataFactory.CreateSoilLayerChartData) .ForEachElementDo(sl => { soilProfileChartData.Insert(0, sl); soilLayerChartDataLookup.Add(sl); }); PipingChartDataFactory.UpdateSoilProfileChartDataName(soilProfileChartData, currentSoilProfile); } // Update the areas of all soil layer chart data IEnumerable <PipingSoilLayer> soilLayers = GetSoilLayers(); for (var i = 0; i < soilLayers.Count(); i++) { ChartMultipleAreaData soilLayerData = soilLayerChartDataLookup[i]; soilLayerData.Areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayers.ElementAt(i), currentSoilProfile, data.InputParameters.SurfaceLine); } }
public void CreateSoilLayerAreas_SurfaceLineEndsBelowLayerTopButAboveBottom_ReturnsSoilLayerPointsAsRectangleFollowingSurfaceLine() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty); surfaceLine.SetGeometry(new[] { new Point3D(0, 0, 3.0), new Point3D(1, 0, 2.0), new Point3D(2, 0, 2.0) }); const double bottom = 1.5; const double top = 2.5; var soilLayer = new PipingSoilLayer(top); var soilProfile = new PipingSoilProfile("name", bottom, new[] { soilLayer }, SoilProfileType.SoilProfile1D); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, soilProfile, surfaceLine).ToList(); // Assert Assert.AreEqual(1, areas.Count()); CollectionAssert.AreEqual(new[] { new Point2D(0.5, top), new Point2D(1, 2.0), new Point2D(2, 2.0), new Point2D(2, bottom), new Point2D(0, bottom), new Point2D(0, top) }, areas.ElementAt(0)); }
public void CreateEntryPointPoint_PipingInputNull_ReturnsEmptyPointsArray() { // Call Point2D[] points = PipingChartDataPointsFactory.CreateEntryPointPoint(null); // Assert CollectionAssert.IsEmpty(points); }
public void CreateDikeToeAtPolderPoint_SurfaceLineNull_ReturnsEmptyPointsArray() { // Call Point2D[] points = PipingChartDataPointsFactory.CreateDikeToeAtPolderPoint(null); // Assert CollectionAssert.IsEmpty(points); }
public void CreateBottomDitchDikeSidePoint_BottomDitchDikeSideNull_ReturnsEmptyPointsArray() { // Setup PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call Point2D[] points = PipingChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); }
public void CreateSurfaceLinePoints_GivenSurfaceLine_ReturnsSurfaceLinePointsArray() { // Setup PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call Point2D[] points = PipingChartDataPointsFactory.CreateSurfaceLinePoints(surfaceLine); // Assert AssertEqualPointCollections(surfaceLine.LocalGeometry, points); }
public void CreateDikeToeAtPolderPoint_DikeToeAtPolderNull_ReturnsEmptyPointsArray() { // Setup PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call Point2D[] points = PipingChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); }
public void CreateSoilLayerAreas_SoilProfileNull_ReturnsEmptyAreasCollection() { // Setup var soilLayer = new PipingSoilLayer(3.2); PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, null, surfaceLine); // Assert CollectionAssert.IsEmpty(areas); }
public void CreateDikeToeAtPolderPoint_GivenSurfaceLineWithDikeToeAtPolder_ReturnsDikeToeAtPolderPointsArray() { // Setup var dikeToeAtPolder = new Point3D(1.2, 2.3, 4.0); PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); surfaceLine.SetDikeToeAtPolderAt(dikeToeAtPolder); // Call Point2D[] points = PipingChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); // Assert AssertEqualLocalPointCollection(dikeToeAtPolder, surfaceLine, points); }
public void CreateBottomDitchDikeSidePoint_GivenSurfaceLineWithBottomDitchDikeSide_ReturnsBottomDitchDikeSidePointsArray() { // Setup var bottomDitchDikeSide = new Point3D(1.2, 2.3, 4.0); PipingSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); surfaceLine.SetBottomDitchDikeSideAt(bottomDitchDikeSide); // Call Point2D[] points = PipingChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(bottomDitchDikeSide, surfaceLine, points); }
public void CreateEntryPointPoint_EntryPointNaN_ReturnsEmptyPointsArray() { // Setup var pipingInput = new TestPipingInput { SurfaceLine = GetSurfaceLineWithGeometry(), EntryPointL = RoundedDouble.NaN }; // Call Point2D[] points = PipingChartDataPointsFactory.CreateEntryPointPoint(pipingInput); // Assert CollectionAssert.IsEmpty(points); }
public void CreateEntryPointPoint_SurfaceLineNull_ReturnsEmptyPointsArray() { // Setup var pipingInput = new TestPipingInput { SurfaceLine = null, EntryPointL = (RoundedDouble)10.0 }; // Call Point2D[] points = PipingChartDataPointsFactory.CreateEntryPointPoint(pipingInput); // Assert CollectionAssert.IsEmpty(points); }
public void CreateSoilLayerAreas_SurfaceLineNull_ReturnsEmptyAreasCollection() { // Setup var soilLayer = new PipingSoilLayer(3.2); var soilProfile = new PipingSoilProfile("name", 2.0, new[] { soilLayer }, SoilProfileType.SoilProfile1D); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, soilProfile, null); // Assert CollectionAssert.IsEmpty(areas); }
public void CreateExitPointPoint_GivenPipingInput_ReturnsExitPointPointsArray() { // Setup var pipingInput = new TestPipingInput { SurfaceLine = GetSurfaceLineWithGeometry() }; // Call Point2D[] points = PipingChartDataPointsFactory.CreateExitPointPoint(pipingInput); // Assert var exitPointOnLine = new Point2D(pipingInput.ExitPointL, pipingInput.SurfaceLine.GetZAtL(pipingInput.ExitPointL)); AssertEqualPointCollections(new[] { exitPointOnLine }, points); }
private void SetChartData() { PipingInput pipingInput = data.InputParameters; PipingSurfaceLine surfaceLine = data.InputParameters.SurfaceLine; PipingChartDataFactory.UpdateSurfaceLineChartDataName(surfaceLineChartData, surfaceLine); surfaceLineChartData.Points = PipingChartDataPointsFactory.CreateSurfaceLinePoints(surfaceLine); ditchPolderSideChartData.Points = PipingChartDataPointsFactory.CreateDitchPolderSidePoint(surfaceLine); bottomDitchPolderSideChartData.Points = PipingChartDataPointsFactory.CreateBottomDitchPolderSidePoint(surfaceLine); bottomDitchDikeSideChartData.Points = PipingChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); ditchDikeSideChartData.Points = PipingChartDataPointsFactory.CreateDitchDikeSidePoint(surfaceLine); dikeToeAtPolderChartData.Points = PipingChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); dikeToeAtRiverChartData.Points = PipingChartDataPointsFactory.CreateDikeToeAtRiverPoint(surfaceLine); exitPointChartData.Points = PipingChartDataPointsFactory.CreateExitPointPoint(pipingInput); entryPointChartData.Points = PipingChartDataPointsFactory.CreateEntryPointPoint(pipingInput); SetSoilProfileChartData(); }
public void CreateSoilLayerAreas_SurfaceLineZigZagsThroughSoilLayer_ReturnsSoilLayerPointsSplitInMultipleAreas() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty); surfaceLine.SetGeometry(new[] { new Point3D(0, 0, 4.0), new Point3D(4, 0, 0.0), new Point3D(8, 0, 4.0) }); const int bottom = 1; const int top = 3; var soilLayer = new PipingSoilLayer(top); var soilProfile = new PipingSoilProfile("name", bottom, new[] { soilLayer }, SoilProfileType.SoilProfile1D); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, soilProfile, surfaceLine).ToList(); // Assert Assert.AreEqual(2, areas.Count()); CollectionAssert.AreEqual(new[] { new Point2D(1, top), new Point2D(3, bottom), new Point2D(0, bottom), new Point2D(0, top) }, areas.ElementAt(0)); CollectionAssert.AreEqual(new[] { new Point2D(5, bottom), new Point2D(7, top), new Point2D(8, top), new Point2D(8, bottom) }, areas.ElementAt(1)); }
public void CreateSoilLayerAreas_SurfaceLineBelowSoilLayer_ReturnsEmptyAreasCollection() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty); surfaceLine.SetGeometry(new[] { new Point3D(0, 0, 2.0), new Point3D(2, 0, 2.0) }); var soilLayer = new PipingSoilLayer(3.2); var soilProfile = new PipingSoilProfile("name", 2.0, new[] { soilLayer }, SoilProfileType.SoilProfile1D); // Call IEnumerable <Point2D[]> areas = PipingChartDataPointsFactory.CreateSoilLayerAreas(soilLayer, soilProfile, surfaceLine); // Assert CollectionAssert.IsEmpty(areas); }