public void YZProfileFromTabulatedCrossSections() { var branchGeometry = new LineString(new[] { new Coordinate(111, 0), new Coordinate(11, 0) }); var channel = new Channel { Geometry = branchGeometry }; var crossSection = new CrossSection { CrossSectionType = CrossSectionType.HeightFlowStorageWidth, Offset = 10 }; NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset); crossSection.HeightFlowStorageWidthData.Add(new HeightFlowStorageWidth(-10.0, 15, 25)); crossSection.HeightFlowStorageWidthData.Add(new HeightFlowStorageWidth(0.0, 20, 30)); CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.YZTable); Assert.AreEqual(CrossSectionType.YZTable, crossSection.CrossSectionType); Assert.AreEqual(4, crossSection.YZValues.Count); }
public void GeometryToYzToGeometryOrThereAndBackAgain() { var branchGeometry = new LineString(new[] { new Coordinate(111, 0), new Coordinate(11, 0) }); var channel = new Channel { Geometry = branchGeometry }; IList <ICoordinate> yzCoordinates = new List <ICoordinate> { // note: x, y of coordinate are interpreted as the yz for // the cross section. new Coordinate(0.0, 0.0), new Coordinate(5.0, -20.0), new Coordinate(15.0, -20.0), new Coordinate(20.0, 0.0) }; IGeometry geometry = CrossSectionHelper.CreateCrossSectionGeometryForXyzCrossSectionFromYZ(branchGeometry, 30, yzCoordinates); CrossSection crossSection = new CrossSection { Geometry = geometry, Offset = 10 }; NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset); Assert.AreEqual(CrossSectionType.GeometryBased, crossSection.CrossSectionType); const int coordinateCount = 4; Assert.AreEqual(coordinateCount, crossSection.Geometry.Coordinates.Length); Assert.AreEqual(coordinateCount, crossSection.YZValues.Count); CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.YZTable); Assert.AreEqual(coordinateCount, crossSection.YZValues.Count); Assert.AreEqual(2, crossSection.Geometry.Coordinates.Length); Assert.AreEqual(4, crossSection.YZValues.Count); CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.GeometryBased); Assert.AreEqual(CrossSectionType.GeometryBased, crossSection.CrossSectionType); Assert.AreEqual(coordinateCount, crossSection.Geometry.Coordinates.Length); }