public void TestGetAllAttractions() { ScreenerLib.OSMMap osm = new ScreenerLib.OSMMap(@"..\..\..\map.xml", new string[] { "tourism", "attraction", "leisure", "natural" }); List <ScreenerLib.Attraction> attractionList = osm.GetAllAttractions(); Assert.AreNotEqual(attractionList.Count, 0); }
protected void go_Click(object sender, EventArgs e) { string[] source = sourceCoords.Text.Trim().Split(','); string[] dest = destCoords.Text.Trim().Split(','); ScreenerLib.OSMMap osm = new ScreenerLib.OSMMap(Server.MapPath("~/map.xml"), new string[] { "tourism", "attraction", "leisure", "natural" }); List <ScreenerLib.Attraction> attractionList = osm.GetAllAttractions(); // 40.746366, -74.001142, 40.762195, -73.972364 List <ScreenerLib.Attraction> nearbyAttrs = osm.GetNearbyAttractions(attractionList, double.Parse(source[0]), double.Parse(source[1]), double.Parse(dest[0]), double.Parse(dest[1])); string script = @"<script>$(document).ready(function(){ var mymap = L.map('mapid').setView([40.7588954, -73.9903364], 13); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {}).addTo(mymap); L.marker([" + source[0] + "," + source[1] + @"]).addTo(mymap) .bindPopup('Start') .openPopup(); L.marker([" + dest[0] + "," + dest[1] + @"]).addTo(mymap) .bindPopup('Destination') .openPopup();"; foreach (ScreenerLib.Attraction attr in nearbyAttrs) { script += @" L.marker([" + attr.NodeLat + "," + attr.NodeLon + @"]).addTo(mymap) .bindPopup('" + HttpUtility.HtmlEncode(attr.TagName) + @"');"; } script += @" }); </script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", script, false); }
public void TestGetSpeficicAttractionsOnRoute() { ScreenerLib.OSMMap osm = new ScreenerLib.OSMMap(@"..\..\..\map.xml", new string[] { "tourism", "attraction", "leisure", "natural" }); List <ScreenerLib.Attraction> attractionList = osm.GetAllAttractions(); List <ScreenerLib.Attraction> nearbyAttrs = osm.GetNearbyAttractions(attractionList, 40.746366, -74.001142, 40.762195, -73.972364); Assert.AreNotEqual(attractionList.Count, 0); }