Esempio n. 1
0
        public async Task <List <Feature> > GetSnappings(string northEast, string southWest)
        {
            var northEastCooridnate = new Coordinate().FromLatLng(northEast);
            var southWestCoordinate = new Coordinate().FromLatLng(southWest);
            var highways            = await _elasticSearchGateway.GetHighways(northEastCooridnate, southWestCoordinate);

            var points = await _elasticSearchGateway.GetPointsOfInterest(northEastCooridnate, southWestCoordinate, Categories.Points.Concat(new[] { Categories.NONE }).ToArray(), Languages.ALL);

            return(highways.Concat(points).ToList());
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task <PointOfInterest[]> GetPointsOfInterest(Coordinate northEast, Coordinate southWest, string[] categories, string language)
        {
            var features = await _elasticSearchGateway.GetPointsOfInterest(northEast, southWest, categories, language);

            var points = features.Where(f => f.IsProperPoi(language)).Select(f => ConvertToPoiItem <PointOfInterest>(f, language)).ToArray();

            foreach (var pointOfInterest in points.Where(p => string.IsNullOrWhiteSpace(p.Icon)))
            {
                pointOfInterest.Icon = SEARCH_ICON;
            }
            return(points);
        }
Esempio n. 3
0
        public void GetSnappings_ShouldGetSome()
        {
            var list = new List <Feature> {
                new Feature(new LineString(new Coordinate[0]), new AttributesTable())
            };

            _elasticSearchGateway.GetHighways(Arg.Any <Coordinate>(), Arg.Any <Coordinate>()).Returns(list);
            _elasticSearchGateway.GetPointsOfInterest(Arg.Any <Coordinate>(), Arg.Any <Coordinate>(), Arg.Any <string[]>(), Arg.Any <string>()).Returns(new List <Feature>());

            var results = _controller.GetSnappings("0,0", "1,1").Result;

            Assert.AreEqual(list.Count, results.Count);
        }
Esempio n. 4
0
        public void GetPointsOfInterest_FilterRelevant_ShouldReturnEmptyElist()
        {
            _elasticSearchGateway.GetPointsOfInterest(null, null, null).Returns(new List <Feature>
            {
                new Feature {
                    Geometry = new Point(null), Attributes = new AttributesTable()
                }
            });

            var results = _adapter.GetPointsOfInterest(null, null, null, null).Result;

            Assert.AreEqual(0, results.Length);
        }
Esempio n. 5
0
        /// <inheritdoc />
        public async Task <PointOfInterest[]> GetPointsOfInterest(Coordinate northEast, Coordinate southWest, string[] categories, string language)
        {
            var features = await _elasticSearchGateway.GetPointsOfInterest(northEast, southWest, categories);

            var tasks = features.Where(f => IsFeatureAProperPoi(f, language)).Select(f => ConvertToPoiItem <PointOfInterest>(f, language));

            return(await Task.WhenAll(tasks));
        }
Esempio n. 6
0
        public async Task <List <Feature> > GetSnappings(string northEast, string southWest)
        {
            var northEastCooridnate = new Coordinate().FromLatLng(northEast);
            var southWestCoordinate = new Coordinate().FromLatLng(southWest);
            var highways            = await _elasticSearchGateway.GetHighways(northEastCooridnate, southWestCoordinate);

            var points = await _elasticSearchGateway.GetPointsOfInterest(northEastCooridnate, southWestCoordinate, Categories.Points);

            return(highways.Concat(points.Where(p => Sources.OSM.Equals(p.Attributes[FeatureAttributes.POI_SOURCE]))).ToList());
        }