Esempio n. 1
0
 public static void InitTestSuite(TestContext testContext)
 {
     // simulate previous prefab build
     airline = new Airline(lat, lon);
     airline.ResetTRackId();
     airline.Build();
     highway = new Highway(lat, lon);
 }
Esempio n. 2
0
        public void CanBuild()
        {
            Assert.IsInstanceOfType(airline, typeof(Airline));
            airline.Build();
            Assert.AreEqual(1, airline.Tracks.Count);
            Assert.AreEqual(181, airline.Tracks[0].Nodes.Count);
            Assert.AreEqual(-MapSize / 2, airline.Tracks[0].Nodes[0].MapY);
            Assert.AreEqual(MapSize / 2, airline.Tracks[0].Nodes[180].MapY);
            Assert.AreEqual("Airplane Path", airline.Tracks[0].Nodes[0].Prefab);
            Assert.AreEqual("North/South connection", airline.Tracks[0].Nodes[180].Name);
            Assert.AreEqual(1100, airline.Tracks[0].Nodes[180].Elevation);
            Assert.AreEqual(Tracktype.Airline, airline.Tracks[0].Type);

            airline.ToCSV(@"D:\Downloads\airlines.csv");
        }
Esempio n. 3
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);
                }
            }
        }