/// <summary>
        /// Creates a simple test network of 1 branch amd 2 nodes. The branch has '3' parts, in the center of
        /// the first aand last is a cross section.
        ///                 n
        ///                /
        ///               /
        ///              cs
        ///             /
        ///     -------/
        ///    /
        ///   cs
        ///  /
        /// n
        /// </summary>
        /// <returns></returns>
        private static IHydroNetwork CreateTestNetwork()
        {
            var network = new Hydro.HydroNetwork();
            var branch1 = new Channel
                              {
                                  Geometry = new LineString(new[]
                                                                {
                                                                    new Coordinate(0, 0), new Coordinate(30, 40),
                                                                    new Coordinate(70, 40), new Coordinate(100, 100)
                                                                })
                              };

            var node1 = new HydroNode {Network = network, Geometry = new Point(new Coordinate(0, 0))};
            var node2 = new HydroNode {Network = network, Geometry = new Point(new Coordinate(100, 100))};

            network.Branches.Add(branch1);
            network.Nodes.Add(node1);
            network.Nodes.Add(node2);

            var crossSection1 = new CrossSection { Geometry = new LineString(new[] {new Coordinate(15, 20), new Coordinate(15, 20)}) };
            double offset1 = Math.Sqrt(15 * 15 + 20 * 20);
            crossSection1.Offset = offset1;

            var crossSection2 = new CrossSection { Geometry = new LineString(new[] {new Coordinate(85, 70), new Coordinate(85, 70)}) };
            double offset2 = Math.Sqrt(30 * 30 + 40 * 40) + 40 + Math.Sqrt(15 * 15 + 20 * 20);
            crossSection2.Offset = offset2;

            branch1.Source = node1;
            branch1.Target = node2;
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection1, crossSection1.Offset);
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection2, crossSection2.Offset);

            return network;
        }
Beispiel #2
0
        /// <summary>
        /// Creates a simple test network of 1 branch amd 2 nodes. The branch has '3' parts, in the center of
        /// the first aand last is a cross section.
        ///                 n
        ///                /
        ///               /
        ///              cs
        ///             /
        ///     -------/
        ///    /
        ///   cs
        ///  /
        /// n
        /// </summary>
        /// <returns></returns>
        private static IHydroNetwork CreateSegmentTestNetwork()
        {
            var network = new Hydro.HydroNetwork();
            var branch1 = new Channel
            {
                Geometry = new LineString(new[]
                {
                    new Coordinate(0, 0), new Coordinate(0, 100),
                })
            };

            var node1 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(0, 0))
            };
            var node2 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(100, 0))
            };

            network.Branches.Add(branch1);
            network.Nodes.Add(node1);
            network.Nodes.Add(node2);

            branch1.Source = node1;
            branch1.Target = node2;

            return(network);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a simple test network of 1 branch amd 2 nodes. The branch has '3' parts, in the center of
        /// the first aand last is a cross section.
        ///                 n
        ///                /
        ///               /
        ///              cs
        ///             /
        ///     -------/
        ///    /
        ///   cs
        ///  /
        /// n
        /// </summary>
        /// <returns></returns>
        private static IHydroNetwork CreateTestNetwork()
        {
            var network = new Hydro.HydroNetwork();
            var branch1 = new Channel
            {
                Geometry = new LineString(new[]
                {
                    new Coordinate(0, 0), new Coordinate(30, 40),
                    new Coordinate(70, 40), new Coordinate(100, 100)
                })
            };

            var node1 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(0, 0))
            };
            var node2 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(100, 100))
            };

            network.Branches.Add(branch1);
            network.Nodes.Add(node1);
            network.Nodes.Add(node2);

            var crossSection1 = new CrossSection {
                Geometry = new LineString(new[] { new Coordinate(15, 20), new Coordinate(15, 20) })
            };
            double offset1 = Math.Sqrt(15 * 15 + 20 * 20);

            crossSection1.Offset = offset1;

            var crossSection2 = new CrossSection {
                Geometry = new LineString(new[] { new Coordinate(85, 70), new Coordinate(85, 70) })
            };
            double offset2 = Math.Sqrt(30 * 30 + 40 * 40) + 40 + Math.Sqrt(15 * 15 + 20 * 20);

            crossSection2.Offset = offset2;

            branch1.Source = node1;
            branch1.Target = node2;
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection1, crossSection1.Offset);
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection2, crossSection2.Offset);

            return(network);
        }
        /// <summary>
        /// Creates a simple test network of 1 branch amd 2 nodes. The branch has '3' parts, in the center of
        /// the first aand last is a cross section.
        ///                 n
        ///                /
        ///               /
        ///              cs
        ///             /
        ///     -------/
        ///    /
        ///   cs
        ///  /
        /// n
        /// </summary>
        /// <returns></returns>
        private static IHydroNetwork CreateSegmentTestNetwork()
        {
            var network = new Hydro.HydroNetwork();
            var branch1 = new Channel
                              {
                                  Geometry = new LineString(new[]
                                                                {
                                                                    new Coordinate(0, 0), new Coordinate(0, 100),
                                                                })
                              };

            var node1 = new HydroNode { Network = network, Geometry = new Point(new Coordinate(0, 0)) };
            var node2 = new HydroNode { Network = network, Geometry = new Point(new Coordinate(100, 0)) };

            network.Branches.Add(branch1);
            network.Nodes.Add(node1);
            network.Nodes.Add(node2);

            branch1.Source = node1;
            branch1.Target = node2;

            return network;
        }