コード例 #1
0
        public void SetDefaultGeometryWithBrancheGeometry()
        {
            const double defaultLength = 2;
            var          hydroNetwork  = new HydroNetwork();

            var channel = new Channel {
                Geometry = new LineString(new[] { new Coordinate(0, 0), new Coordinate(20, 0) })
            };

            var crossSection = new CrossSection
            {
                CrossSectionType = CrossSectionType.GeometryBased,
                Geometry         = new LineString(new[] { new Coordinate(10, 0), new Coordinate(10, 0) }),
                ThalWay          = defaultLength / 2
            };

            hydroNetwork.Branches.Add(channel);
            NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset);
            crossSection.Offset = 12;

            CrossSectionHelper.SetDefaultGeometry(crossSection, defaultLength);

            Assert.AreEqual(defaultLength, crossSection.Geometry.Length);
            Assert.AreEqual(2, crossSection.Geometry.Coordinates.Length);

            Assert.AreEqual(12, crossSection.Geometry.Coordinates[0].X);
            Assert.AreEqual(12, crossSection.Geometry.Coordinates[1].X);
            Assert.AreEqual(-defaultLength / 2, crossSection.Geometry.Coordinates[0].Y);
            Assert.AreEqual(defaultLength / 2, crossSection.Geometry.Coordinates[1].Y);
        }
コード例 #2
0
        public void SetDefaultGeometryNoBranche()
        {
            var crossSection = new CrossSection();

            CrossSectionHelper.SetDefaultGeometry(crossSection, 1);
        }