public RoadMaker2(OSM.OSMInterface osm) { this.osm = osm; this.rand = new Randomizer(0u); var roadTypes = Enum.GetNames(typeof(RoadTypes)); for (var i = 0; i < PrefabCollection<NetInfo>.PrefabCount(); i += 1) { var pp = PrefabCollection<NetInfo>.GetPrefab((uint)i); if (pp != null) { if (roadTypes.Contains(pp.name.Replace(" ", ""))) { netInfos.Add((RoadTypes)Enum.Parse(typeof(RoadTypes), pp.name.Replace(" ", "")), pp); } } } }
public RoadMaker2(OSM.OSMInterface osm) { this.osm = osm; this.rand = new Randomizer(0u); var roadTypes = Enum.GetNames(typeof(RoadTypes)); for (var i = 0; i < PrefabCollection <NetInfo> .PrefabCount(); i += 1) { var pp = PrefabCollection <NetInfo> .GetPrefab((uint)i); if (pp != null) { if (roadTypes.Contains(pp.name.Replace(" ", ""))) { netInfos.Add((RoadTypes)Enum.Parse(typeof(RoadTypes), pp.name.Replace(" ", "")), pp); } } } }
private void loadMapButton_eventClick(UIComponent component, UIMouseEventParameter eventParam) { var path = pathTextBox.text.Trim(); if (!File.Exists(path)) { path += ".osm"; if (!File.Exists(path)) { errorLabel.text = "Cannot find osm file: " + path; return; } } try { var osm = new OSMInterface(pathTextBox.text.Trim(), double.Parse(scaleTextBox.text.Trim()), double.Parse(tolerance.text.Trim()), double.Parse(curveTolerance.text.Trim()), double.Parse(tiles.text.Trim())); currentIndex = 0; roadMaker = new RoadMaker2(osm); errorLabel.text = "File Loaded."; okButton.Enable(); loadMapButton.Disable(); loadAPIButton.Disable(); } catch (Exception ex) { errorLabel.text = ex.ToString(); } }
private void loadAPIButton_eventClick(UIComponent component, UIMouseEventParameter eventParam) { try { decimal startLat = 0M; decimal startLon = 0M; decimal endLat = 0M; decimal endLon = 0M; var scale = double.Parse(scaleTextBox.text.Trim()); var tt = double.Parse(tiles.text.Trim()); if (!GetCoordinates(tt,scale,ref startLon, ref startLat, ref endLon, ref endLat)) { return; } var ob = new osmBounds(); ob.minlon = startLon; ob.minlat = startLat; ob.maxlon = endLon; ob.maxlat = endLat; var osm = new OSMInterface(ob, scale, double.Parse(tolerance.text.Trim()), double.Parse(curveTolerance.text.Trim()), tt); currentIndex = 0; roadMaker = new RoadMaker2(osm); errorLabel.text = "Data Loaded."; okButton.Enable(); loadMapButton.Disable(); loadAPIButton.Disable(); } catch (Exception ex) { errorLabel.text = ex.ToString(); } }