Пример #1
0
        private SearchResult DoSearch(object state)
        {
            var settings        = (SearchSettings)state;
            var progressHandler = new ProgressHandler(this);

            SeriesSearcher searcher;
            double         tileWidth, tileHeight;

            if (settings.CatalogSettings.TypeOfCatalog == TypeOfCatalog.HisCentral)
            {
                searcher   = new HISCentralSearcher(settings.CatalogSettings.HISCentralUrl);
                tileWidth  = 1.0;
                tileHeight = 1.0;
            }
            else
            {
                searcher   = new MetadataCacheSearcher();
                tileWidth  = 2.0;
                tileHeight = 2.0;
            }

            SearchResult result;

            var webServices = settings.WebServicesSettings.TotalCount == settings.WebServicesSettings.CheckedCount &&
                              settings.WebServicesSettings.TotalCount > 1
                                  ? new WebServiceNode[] {}
                                  : settings.WebServicesSettings.WebServices.Where(item => item.Checked).ToArray();

            var keywords = settings.KeywordsSettings.SelectedKeywords.ToList();

            if (settings.CatalogSettings.TypeOfCatalog == TypeOfCatalog.LocalMetadataCache)
            {
                if (keywords.Contains(Constants.RootName))
                {
                    keywords.Clear();
                }
            }
            else
            {
                keywords = HisCentralKeywordsList.RefineKeywordList(settings.KeywordsSettings.OntologyDesc, keywords);
            }

            if (settings.AreaSettings.AreaRectangle != null)
            {
                var box = Area.AreaHelper.ReprojectBoxToWGS84(settings.AreaSettings.AreaRectangle,
                                                              settings.AreaSettings.RectangleProjection);

                result = searcher.GetSeriesCatalogInRectangle(box, keywords.ToArray(), tileWidth, tileHeight,
                                                              settings.DateSettings.StartDate,
                                                              settings.DateSettings.EndDate,
                                                              webServices, progressHandler);
            }
            else
            {
                var polygons = Area.AreaHelper.ReprojectPolygonsToWGS84(settings.AreaSettings.Polygons);

                result = searcher.GetSeriesCatalogInPolygon(polygons, keywords.ToArray(), tileWidth, tileHeight,
                                                            settings.DateSettings.StartDate,
                                                            settings.DateSettings.EndDate,
                                                            webServices, progressHandler);
            }
            return(result);
        }
Пример #2
0
        private SearchResult DoSearch(object state)
        {
            var settings = (SearchSettings) state;
            var progressHandler = new ProgressHandler(this);

            SeriesSearcher searcher;
            double tileWidth, tileHeight;
            if (settings.CatalogSettings.TypeOfCatalog == TypeOfCatalog.HisCentral)
            {
                searcher = new HISCentralSearcher(settings.CatalogSettings.HISCentralUrl);
                tileWidth = 1.0;
                tileHeight = 1.0;
            }
            else
            {
                searcher = new MetadataCacheSearcher();
                tileWidth = 2.0;
                tileHeight = 2.0;
            }

            SearchResult result;

            var webServices = settings.WebServicesSettings.TotalCount == settings.WebServicesSettings.CheckedCount &&
                              settings.WebServicesSettings.TotalCount > 1
                                  ? new WebServiceNode[] {}
                                  : settings.WebServicesSettings.WebServices.Where(item => item.Checked).ToArray();

            var keywords = settings.KeywordsSettings.SelectedKeywords.ToList();
            if (settings.CatalogSettings.TypeOfCatalog == TypeOfCatalog.LocalMetadataCache)
            {
                if (keywords.Contains(Constants.RootName))
                {
                    keywords.Clear();
                }
            }else
            {
                keywords = HisCentralKeywordsList.RefineKeywordList(settings.KeywordsSettings.OntologyDesc, keywords);
            }

            if (settings.AreaSettings.AreaRectangle != null)
            {
                var box = Area.AreaHelper.ReprojectBoxToWGS84(settings.AreaSettings.AreaRectangle,
                                                              settings.AreaSettings.RectangleProjection);

                result = searcher.GetSeriesCatalogInRectangle(box, keywords.ToArray(), tileWidth, tileHeight,
                                                              settings.DateSettings.StartDate,
                                                              settings.DateSettings.EndDate,
                                                              webServices, progressHandler);
            }
            else
            {
                var polygons = Area.AreaHelper.ReprojectPolygonsToWGS84(settings.AreaSettings.Polygons);

                result = searcher.GetSeriesCatalogInPolygon(polygons, keywords.ToArray(), tileWidth, tileHeight,
                                                            settings.DateSettings.StartDate,
                                                            settings.DateSettings.EndDate,
                                                            webServices, progressHandler);
            }
            return result;
        }