/// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="elevationDataStorage"></param>
 /// <param name="clentsFactory"></param>
 /// <param name="osmGeoJsonPreprocessorExecutor"></param>
 /// <param name="osmRepository"></param>
 /// <param name="dataContainerConverterService"></param>
 /// <param name="wikipediaGateway"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="latestFileFetcherExecutor"></param>
 /// <param name="tagsHelper"></param>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 public OsmPointsOfInterestAdapter(IElasticSearchGateway elasticSearchGateway,
                                   IElevationDataStorage elevationDataStorage,
                                   IClientsFactory clentsFactory,
                                   IOsmGeoJsonPreprocessorExecutor osmGeoJsonPreprocessorExecutor,
                                   IOsmRepository osmRepository,
                                   IDataContainerConverterService dataContainerConverterService,
                                   IWikipediaGateway wikipediaGateway,
                                   IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                   IOsmLatestFileFetcherExecutor latestFileFetcherExecutor,
                                   ITagsHelper tagsHelper,
                                   IOptions <ConfigurationData> options,
                                   ILogger logger) :
     base(dataContainerConverterService,
          logger)
 {
     _clientsFactory = clentsFactory;
     _osmGeoJsonPreprocessorExecutor = osmGeoJsonPreprocessorExecutor;
     _osmRepository             = osmRepository;
     _wikipediaGateway          = wikipediaGateway;
     _tagsHelper                = tagsHelper;
     _latestFileFetcherExecutor = latestFileFetcherExecutor;
     _elevationDataStorage      = elevationDataStorage;
     _wgs84ItmMathTransform     = itmWgs84MathTransfromFactory.CreateInverse();
     _options = options.Value;
     _elasticSearchGateway = elasticSearchGateway;
 }
 /// <summary>
 /// Service's constructor
 /// </summary>
 /// <param name="clinetsFactory"></param>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="osmGeoJsonPreprocessorExecutor"></param>
 /// <param name="tagsHelper"></param>
 /// <param name="osmRepository"></param>
 /// <param name="pointsOfInterestAdapterFactory"></param>
 /// <param name="featuresMergeExecutor"></param>
 /// <param name="latestFileFetcherExecutor"></param>
 /// <param name="graphHopperGateway"></param>
 /// <param name="pointsOfInterestFilesCreatorExecutor"></param>
 /// <param name="elevationDataStorage"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="logger"></param>
 public DatabasesUpdaterService(IClientsFactory clinetsFactory,
                                IElasticSearchGateway elasticSearchGateway,
                                IOsmGeoJsonPreprocessorExecutor osmGeoJsonPreprocessorExecutor,
                                ITagsHelper tagsHelper, IOsmRepository osmRepository,
                                IPointsOfInterestAdapterFactory pointsOfInterestAdapterFactory,
                                IFeaturesMergeExecutor featuresMergeExecutor,
                                IOsmLatestFileFetcherExecutor latestFileFetcherExecutor,
                                IGraphHopperGateway graphHopperGateway,
                                IPointsOfInterestFilesCreatorExecutor pointsOfInterestFilesCreatorExecutor,
                                IElevationDataStorage elevationDataStorage,
                                IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                ILogger logger)
 {
     _elasticSearchGateway           = elasticSearchGateway;
     _osmGeoJsonPreprocessorExecutor = osmGeoJsonPreprocessorExecutor;
     _tagsHelper    = tagsHelper;
     _osmRepository = osmRepository;
     _pointsOfInterestAdapterFactory       = pointsOfInterestAdapterFactory;
     _pointsOfInterestFilesCreatorExecutor = pointsOfInterestFilesCreatorExecutor;
     _featuresMergeExecutor     = featuresMergeExecutor;
     _latestFileFetcherExecutor = latestFileFetcherExecutor;
     _graphHopperGateway        = graphHopperGateway;
     _osmGateway           = clinetsFactory.CreateNonAuthClient();
     _elevationDataStorage = elevationDataStorage;
     _logger        = logger;
     _mathTransform = itmWgs84MathTransfromFactory.CreateInverse();
 }
Esempio n. 3
0
 /// <summary>
 /// Controller's constructor
 /// </summary>
 /// <param name="graphHopperGateway"></param>
 /// <param name="elevationDataStorage"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="geometryFactory"></param>
 public RoutingController(IGraphHopperGateway graphHopperGateway,
                          IElevationDataStorage elevationDataStorage,
                          IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                          GeometryFactory geometryFactory)
 {
     _graphHopperGateway    = graphHopperGateway;
     _elevationDataStorage  = elevationDataStorage;
     _geometryFactory       = geometryFactory;
     _wgs84ItmMathTransform = itmWgs84MathTransfromFactory.CreateInverse();
 }
Esempio n. 4
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="adaptersFactory"></param>
 /// <param name="elevationDataStorage"></param>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="logger"></param>
 public ExternalSourcesController(IPointsOfInterestAdapterFactory adaptersFactory,
                                  IElevationDataStorage elevationDataStorage,
                                  IElasticSearchGateway elasticSearchGateway,
                                  IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                  ILogger logger)
 {
     _adaptersFactory      = adaptersFactory;
     _elevationDataStorage = elevationDataStorage;
     _elasticSearchGateway = elasticSearchGateway;
     _wgs84ItmTransform    = itmWgs84MathTransfromFactory.CreateInverse();
     _logger = logger;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="elevationDataStorage"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="osmGeoJsonConverter"></param>
 /// <param name="tagsHelper"></param>
 public OsmGeoJsonPreprocessorExecutor(ILogger logger,
                                       IElevationDataStorage elevationDataStorage,
                                       IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                       IOsmGeoJsonConverter osmGeoJsonConverter,
                                       ITagsHelper tagsHelper)
 {
     _logger = logger;
     _osmGeoJsonConverter  = osmGeoJsonConverter;
     _elevationDataStorage = elevationDataStorage;
     _wgs84ItmConverter    = itmWgs84MathTransfromFactory.CreateInverse();
     _tagsHelper           = tagsHelper;
 }
Esempio n. 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="options"></param>
 /// <param name="geoJsonPreprocessorExecutor"></param>
 /// <param name="httpGatewayFactory"></param>
 public OsmLineAdderService(IElasticSearchGateway elasticSearchGateway,
                            IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                            IOptions <ConfigurationData> options,
                            IOsmGeoJsonPreprocessorExecutor geoJsonPreprocessorExecutor,
                            IHttpGatewayFactory httpGatewayFactory)
 {
     _elasticSearchGateway  = elasticSearchGateway;
     _itmWgs84MathTransform = itmWgs84MathTransfromFactory.Create();
     _wgs84ItmMathTransform = itmWgs84MathTransfromFactory.CreateInverse();
     _options = options.Value;
     _geoJsonPreprocessorExecutor = geoJsonPreprocessorExecutor;
     _httpGatewayFactory          = httpGatewayFactory;
 }
Esempio n. 7
0
 /// <summary>
 /// Adapter's constructor
 /// </summary>
 /// <param name="elevationDataStorage"></param>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="dataContainerConverterService"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 protected BasePointsOfInterestAdapter(IElevationDataStorage elevationDataStorage,
                                       IElasticSearchGateway elasticSearchGateway,
                                       IDataContainerConverterService dataContainerConverterService,
                                       IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                       IOptions <ConfigurationData> options,
                                       ILogger logger)
 {
     _elevationDataStorage          = elevationDataStorage;
     _elasticSearchGateway          = elasticSearchGateway;
     _dataContainerConverterService = dataContainerConverterService;
     _wgs84ItmMathTransform         = itmWgs84MathTransfromFactory.CreateInverse();
     _options = options.Value;
     _logger  = logger;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="gpxLoopsSplitterExecutor"></param>
 /// <param name="gpxProlongerExecutor"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="options"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="logger"></param>
 public AddibleGpxLinesFinderService(IGpxLoopsSplitterExecutor gpxLoopsSplitterExecutor,
                                     IGpxProlongerExecutor gpxProlongerExecutor,
                                     IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                     IElasticSearchGateway elasticSearchGateway,
                                     IOptions <ConfigurationData> options,
                                     GeometryFactory geometryFactory,
                                     ILogger logger)
 {
     _gpxLoopsSplitterExecutor = gpxLoopsSplitterExecutor;
     _gpxProlongerExecutor     = gpxProlongerExecutor;
     _itmWgs84MathTransform    = itmWgs84MathTransfromFactory.Create();
     _wgs84ItmMathTransform    = itmWgs84MathTransfromFactory.CreateInverse();
     _elasticSearchGateway     = elasticSearchGateway;
     _geometryFactory          = geometryFactory;
     _logger  = logger;
     _options = options.Value;
 }
        /// <inheritdoc />
        public override async Task <List <Feature> > GetPointsForIndexing()
        {
            _logger.LogInformation("Start getting wikipedia pages for indexing");
            var startCoordinate = new Coordinate(34, 29);
            var endCoordinate   = new Coordinate(36, 34);

            var    itmToWgs84 = _itmWgs84MathTransfromFactory.Create();
            var    wgs84ToItm = _itmWgs84MathTransfromFactory.CreateInverse();
            double step       = 10000 * 2 / Math.Sqrt(2);
            var    tasksList  = new List <Task <List <Feature> > >();

            foreach (var language in Languages.Array)
            {
                var currentCoordinate = new Coordinate(startCoordinate);
                while (currentCoordinate.X < endCoordinate.X && currentCoordinate.Y < endCoordinate.Y)
                {
                    var itm = wgs84ToItm.Transform(currentCoordinate);
                    itm.X            += step;
                    currentCoordinate = itmToWgs84.Transform(itm);
                    if (currentCoordinate.X > endCoordinate.X)
                    {
                        currentCoordinate.X = startCoordinate.X;
                        itm               = wgs84ToItm.Transform(currentCoordinate);
                        itm.Y            += step;
                        currentCoordinate = itmToWgs84.Transform(itm);
                    }
                    tasksList.Add(_wikipediaGateway.GetByLocation(currentCoordinate, language));
                }
            }

            _logger.LogInformation($"Created {tasksList.Count} tasks to fetch wikipedia data.");
            var lists = await Task.WhenAll(tasksList);

            var wikiFeatures = lists.SelectMany(l => l)
                               .GroupBy(f => f.Attributes[FeatureAttributes.ID])
                               .Select(g => g.First())
                               .ToList();

            _logger.LogInformation($"Finished getting Wikipedia pages for indexing, got {wikiFeatures.Count} pages.");
            return(wikiFeatures);
        }
Esempio n. 10
0
 /// <summary>
 /// Controller's constructor
 /// </summary>
 /// <param name="httpGatewayFactory"></param>
 /// <param name="dataContainerConverterService"></param>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="elasticSearchGateway"></param>
 /// <param name="addibleGpxLinesFinderService"></param>
 /// <param name="osmLineAdderService"></param>
 /// <param name="options"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="cache"></param>
 public OsmController(IHttpGatewayFactory httpGatewayFactory,
                      IDataContainerConverterService dataContainerConverterService,
                      IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                      IElasticSearchGateway elasticSearchGateway,
                      IAddibleGpxLinesFinderService addibleGpxLinesFinderService,
                      IOsmLineAdderService osmLineAdderService,
                      IOptions <ConfigurationData> options,
                      IGeometryFactory geometryFactory,
                      LruCache <string, TokenAndSecret> cache)
 {
     _httpGatewayFactory            = httpGatewayFactory;
     _dataContainerConverterService = dataContainerConverterService;
     _itmWgs84MathTransform         = itmWgs84MathTransfromFactory.Create();
     _wgs84ItmMathTransform         = itmWgs84MathTransfromFactory.CreateInverse();
     _elasticSearchGateway          = elasticSearchGateway;
     _addibleGpxLinesFinderService  = addibleGpxLinesFinderService;
     _osmLineAdderService           = osmLineAdderService;
     _options         = options.Value;
     _geometryFactory = geometryFactory;
     _cache           = cache;
 }
Esempio n. 11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 /// <param name="options"></param>
 public RouteDataSplitterService(IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory,
                                 IOptions <ConfigurationData> options)
 {
     _wgs84ItmMathTransform = itmWgs84MathTransfromFactory.CreateInverse();
     _options = options.Value;
 }
 /// <summary>
 /// Controller's constructor
 /// </summary>
 /// <param name="itmWgs84MathTransfromFactory"></param>
 public ItmGridController(IItmWgs84MathTransfromFactory itmWgs84MathTransfromFactory)
 {
     _wgs84ItmMathTransform = itmWgs84MathTransfromFactory.CreateInverse();
 }