Beispiel #1
0
        public void CanBuildRiver()
        {
            Assert.IsInstanceOfType(river, typeof(River));
            string xml        = UnittestTools.ReadResource("testriver.xml");
            int    unresolved = river.Build(xml);

            Assert.AreEqual(0, unresolved);
            Assert.AreEqual(11, river.Tracks.Count);
            Assert.AreEqual("Geul", river.Tracks[0].Name);

            Assert.AreEqual(Tracktype.Water, river.Tracks[0].Type);

            TestRiver testRiver = new TestRiver(lat, lon);

            Assert.AreEqual("[waterway=river]", testRiver.TestQuery);

            // for debugging
            //river.ToCSV(@"D:\Downloads\rivers.csv");
        }
Beispiel #2
0
        private void BuildButtonClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            Debug.Log("Starting build");

            // generate Airplane line, north / south
            Airline airline = new Airline(lat, lon);

            airline.Build();
            foreach (Track track in airline.Tracks)
            {
                foreach (Node node in track.Nodes)
                {
                    //BuildTool.instance.ActionQueue.Enqueue(node);
                }
            }
            Debug.Log("Airline generated");

            Builds.Stream stream     = new Builds.Stream(lat, lon);
            int           unresolved = stream.Build();

            Debug.Log($"OSM canals fetched, {stream.Tracks.Count} tracks,  {unresolved} unresolved segments!");

            foreach (Track track in stream.Tracks)
            {
                foreach (Node node in track.Nodes)
                {
                    Vector3 pos = new Vector3(node.MapX, 0, node.MapY);
                    node.TerrainHeight = TerrainManager.instance.SampleRawHeightSmooth(pos);
                    BuildTool.instance.ActionQueue.Enqueue(node);
                }
            }

            Canal canal = new Canal(lat, lon);

            unresolved = canal.Build();

            Debug.Log($"OSM canals fetched, {canal.Tracks.Count} tracks,  {unresolved} unresolved segments!");

            foreach (Track track in canal.Tracks)
            {
                foreach (Node node in track.Nodes)
                {
                    Vector3 pos = new Vector3(node.MapX, 0, node.MapY);
                    node.TerrainHeight = TerrainManager.instance.SampleRawHeightSmooth(pos);
                    BuildTool.instance.ActionQueue.Enqueue(node);
                }
            }

            River river = new River(lat, lon);

            unresolved = river.Build();

            Debug.Log($"OSM rivers fetched, {river.Tracks.Count} tracks,  {unresolved} unresolved segments!");

            foreach (Track track in river.Tracks)
            {
                foreach (Node node in track.Nodes)
                {
                    Vector3 pos = new Vector3(node.MapX, 0, node.MapY);
                    node.TerrainHeight = TerrainManager.instance.SampleRawHeightSmooth(pos);
                    BuildTool.instance.ActionQueue.Enqueue(node);
                }
            }


            Highway highway = new Highway(lat, lon);

            unresolved = highway.Build();

            Debug.Log($"OSM highways fetched, {highway.Tracks.Count} tracks, {unresolved} unresolved segments!");

            foreach (Track track in highway.Tracks)
            {
                foreach (Node node in track.Nodes)
                {
                    BuildTool.instance.ActionQueue.Enqueue(node);
                }
            }
        }