/// <summary> /// Displays search results (all data series and sites complying to the search criteria) /// </summary> public IEnumerable <IMapPointLayer> ShowSearchResults(SearchResult searchResult) { //try to save the search result layer and re-add it var hdProjectPath = HydroDesktop.Configuration.Settings.Instance.CurrentProjectDirectory; String timeStamp = string.Format("{0}_{1}{2}{3}", DateTime.Now.Date.ToString("yyyy-MM-dd"), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); var loadedFeatures = new List <SearchResultItem>(searchResult.ResultItems.Count()); Debug.WriteLine(searchResult.ResultItems.Count()); foreach (var key in searchResult.ResultItems) { Debug.WriteLine("hdProjectPath: " + hdProjectPath + "/Search Results"); Debug.WriteLine("The other part: " + string.Format(HydroDesktop.Plugins.Search.Properties.Settings.Default.SearchResultNameMask, key.ServiceCode, timeStamp)); var fs = key.FeatureSet; var filename = Path.Combine(hdProjectPath + "/Search Results", string.Format(HydroDesktop.Plugins.Search.Properties.Settings.Default.SearchResultNameMask, key.ServiceCode, timeStamp)); fs.Filename = filename; fs.Save(); loadedFeatures.Add(new SearchResultItem(key.ServiceCode, FeatureSet.OpenFile(filename))); } Debug.WriteLine("Loop done."); var _searchSettings = new SearchSettings(); var searchLayerCreator = new SearchLayerCreator(App.Map, new SearchResult(loadedFeatures), _searchSettings); return(searchLayerCreator.Create()); }
public void AddFeatures(List <Tuple <string, IFeatureSet> > featuresPerCode) { var loadedFeatures = new List <SearchResultItem>(featuresPerCode.Count()); loadedFeatures.AddRange(featuresPerCode.Select(item => new SearchResultItem(item.Item1, item.Item2))); var searchLayerCreator = new SearchLayerCreator(App.Map, new SearchResult(loadedFeatures)); searchLayerCreator.Create(); }
/// <summary> /// Displays search results (all data series and sites complying to the search criteria) /// </summary> private void ShowSearchResults(SearchResult searchResult) { //try to save the search result layer and re-add it var hdProjectPath = HydroDesktop.Configuration.Settings.Instance.CurrentProjectDirectory; var loadedFeatures = new List <SearchResultItem>(searchResult.ResultItems.Count()); foreach (var key in searchResult.ResultItems) { var fs = key.FeatureSet; var filename = Path.Combine(hdProjectPath, string.Format(Properties.Settings.Default.SearchResultNameMask, key.ServiceCode)); fs.Filename = filename; fs.Save(); loadedFeatures.Add(new SearchResultItem(key.ServiceCode, FeatureSet.OpenFile(filename))); } var searchLayerCreator = new SearchLayerCreator(App.Map, new SearchResult(loadedFeatures)); searchLayerCreator.Create(); }