Esempio n. 1
0
 public void getWMSLayerQoSSummaryInfo(ClientSideRecord record)
 {
     if (record != null)
     {
         ServiceInfoForSummary serviceInfoForSummary = new ServiceInfoForSummary();
         serviceInfoForSummary.serviceType = record.Type;
         serviceInfoForSummary.serviceURL  = record.RealServiceURL;
         this.proxy.getWMSLayersQoSSummaryInfoAsync(serviceInfoForSummary);
     }
 }
Esempio n. 2
0
 public void getWMSLayerQoSHistoralInfo(ClientSideRecord record, string layerName, DateTime fromDate, DateTime toDate)
 {
     if (record != null && layerName != null && !layerName.Trim().Equals(""))
     {
         LayerInfoForHistory layerInfoForHistory = new LayerInfoForHistory();
         layerInfoForHistory.serviceType = record.Type;
         layerInfoForHistory.serviceURL  = record.RealServiceURL;
         layerInfoForHistory.layerName   = layerName;
         string endDate   = toDate.ToString("yyyy-MM-dd");
         string startDate = fromDate.ToString("yyyy-MM-dd");
         layerInfoForHistory.startdate = startDate;
         layerInfoForHistory.enddate   = endDate;
         this.proxy.getWMSLayersQoSHistoricalInfoAsync(layerInfoForHistory);
     }
 }
Esempio n. 3
0
        public static ClientSideRecord cloneRecord(Record record)
        {
            if (record != null)
            {
                ClientSideRecord newRecord = new ClientSideRecord();
                newRecord.Abstract                = record.Abstract;
                newRecord.AccessURL               = record.AccessURL;
                newRecord.bbox                    = record.bbox;
                newRecord.GeneralType             = record.GeneralType;
                newRecord.GeoExtensionDescription = record.GeoExtensionDescription;
                newRecord.ID                        = record.ID;
                newRecord.isDataCore                = record.isDataCore;
                newRecord.MetadataAccessURL         = record.MetadataAccessURL;
                newRecord.Provider                  = record.Provider;
                newRecord.Quality                   = record.Quality;
                newRecord.RealServiceURL            = record.RealServiceURL;
                newRecord.Relevance                 = record.Relevance;
                newRecord.ServerLocationDescription = record.ServerLocationDescription;
                newRecord.Source                    = record.Source;
                newRecord.Title                     = record.Title;
                newRecord.Type                      = record.Type;
                newRecord.URLLocation               = record.URLLocation;

                if (record.SBAs.Count > 0)
                {
                    newRecord.SBAs = new StringList();
                    newRecord.SBAs.AddRange(record.SBAs);
                }

                if (record.DescriptiveKeywords.Count > 0)
                {
                    newRecord.DescriptiveKeywords = new StringList();
                    newRecord.DescriptiveKeywords.AddRange(record.DescriptiveKeywords);
                }

                if (record.Formats.Count > 0)
                {
                    newRecord.Formats = new StringList();
                    newRecord.Formats.AddRange(record.Formats);
                }

                return(newRecord);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 public void setBasicContent(ClientSideRecord record, QualityQueryFunctions queryPerformanceFunctions, DateTime from, DateTime to)
 {
     this.record = record;
     if (record.Type.Equals(ConstantCollection.ServiceType_WMS))
     {
         Button_WMS_Layers_QoS.Visibility = Visibility.Visible;
     }
     else
     {
         Button_WMS_Layers_QoS.Visibility = Visibility.Collapsed;
     }
     this.queryPerformanceFunctions = queryPerformanceFunctions;
     setServiceQoSDateTimeFromAndTo(from, to);
     setServiceQoSDatePickerFromAndTo();
     TextBox_Title.DataContext = record;
 }
Esempio n. 5
0
        public void getGeospatialServiceQoSHistoricalInfo(ClientSideRecord record, DateTime fromDate, DateTime toDate)
        {
            if (record != null)
            {
                ObservableCollection <ServiceInfoForHistory> serviceInfoForHistoryList = new ObservableCollection <ServiceInfoForHistory>();
                ServiceInfoForHistory serviceInfoForHistory = new ServiceInfoForHistory();
                serviceInfoForHistory.serviceType = record.Type;
                serviceInfoForHistory.serviceURL  = record.RealServiceURL;
                string endDate   = toDate.ToString("yyyy-MM-dd");
                string startDate = fromDate.ToString("yyyy-MM-dd");
                serviceInfoForHistory.enddate   = endDate;
                serviceInfoForHistory.startdate = startDate;
                serviceInfoForHistoryList.Add(serviceInfoForHistory);

                this.proxy.getServiceQoSHistoricalInfoAsync(serviceInfoForHistoryList);
            }
        }
Esempio n. 6
0
        private void iterateGetAllRecords(CSWGetRecordsSearchResults results)
        {
            if (results == null)
            {
                return;
            }
            // if current searched records num equal or larger than expect, then stop current search and do not add records into result list any more.
            if (currentGotRecordsNumber >= maxRecordsExpectToGet)
            {
                return;
            }

            TimeSpan tspan        = DateTime.Now.Subtract(time_BeforeSearch);
            double   time1        = tspan.TotalMilliseconds;
            double   responseTime = time1 / 1000;

            allSearchTimeFromFirstRequest.Add(responseTime);

            int numberOfRecordsMatchedInCurrentCatalog = results.numberOfRecordsMatched;

            string catalogURL = results.MetadataRepositoryURL;
            CatalogsSearchStatus currentCatalogStatus = null;

            foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList)
            {
                if (catalogsSearchStatus.CatalogURL.Equals(catalogURL))
                {
                    currentCatalogStatus = catalogsSearchStatus;
                }
            }
            if (!currentCatalogStatus.hasGotTotalMatchedNumber)
            {
                allMatchedRecordsNumberInSearchedCatalogs    += results.numberOfRecordsMatched;
                currentCatalogStatus.matchedNumber            = results.numberOfRecordsMatched;
                currentCatalogStatus.hasGotTotalMatchedNumber = true;
            }

            ObservableCollection <Record> records = null;

            records = results.recordList;
            bool   continueSearching = false;
            string seachingStatus    = ConstantCollection.searchStatus_InProcessing;

            //foreach (Record record in records)
            //{
            //    StringList a = new StringList();
            //    a.AddRange(record.SBAs);
            //    record.SBAListObject = a;
            //}

            if (ConstantCollection.isQueryServicePerformanceScore && (!ConstantCollection.queryServicePerformanceScoreAtServerSide))
            {
                if (records != null && records.Count > 0)
                {
                    queryPerformanceFunctions.getGeospatialServiceQoSSummaryInfo(records);
                }
            }
            if (ConstantCollection.isQueryServerLocationLonLat && (!ConstantCollection.queryServerLocationLonLatAtServerSide))
            {
                if (records != null && records.Count > 0)
                {
                    ObservableCollection <string> URLList = new ObservableCollection <string>();
                    foreach (Record record in records)
                    {
                        //currently, we only query the server information of OGC web services
                        if (record.Type.Equals(ConstantCollection.ServiceType_CSW) || record.Type.Equals(ConstantCollection.ServiceType_WMS) || record.Type.Equals(ConstantCollection.ServiceType_WCS) || record.Type.Equals(ConstantCollection.ServiceType_WPS) || record.Type.Equals(ConstantCollection.ServiceType_WFS))
                        {
                            if (record.URLLocation == null || record.URLLocation.Trim().Equals(""))
                            {
                                URLList.Add(record.AccessURL);
                            }
                        }
                    }

                    if (URLList.Count > 0)
                    {
                        otherQueryFuntions.getServerInformationFromURLS(URLList, ID);
                    }
                }
            }


            int local_potentialNumber = currentGotRecordsNumber + results.numberOfRecordsReturned;
            int potentialNumber       = local_potentialNumber;

            foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList)
            {
                if (catalogsSearchStatus.isTerminated == false && catalogsSearchStatus.potentioalRetrieveNumber > 0)
                {
                    potentialNumber += catalogsSearchStatus.potentioalRetrieveNumber;
                }
            }

            int nextRecordInCurrentCatalog = results.nextRecord;

            if (nextRecordInCurrentCatalog == 0 || nextRecordInCurrentCatalog > numberOfRecordsMatchedInCurrentCatalog)
            {
                nextRecordInCurrentCatalog = numberOfRecordsMatchedInCurrentCatalog;
            }
            currentCatalogStatus.nextRecord = nextRecordInCurrentCatalog;

            //if potentialNumber less than maxRecordsWantToResult, and nextRecordInCurrentCatalog less then numberOfRecordsMatchedInCurrentCatalog, then continue search
            if (potentialNumber < maxRecordsExpectToGet && nextRecordInCurrentCatalog < numberOfRecordsMatchedInCurrentCatalog)
            {
                continueSearching = true;
                seachingStatus    = ConstantCollection.searchStatus_InProcessing;
                //User can start a new search now, no needs to want all the records of current are queried.
                cannotStartSearchYet = false;
            }
            else
            {
                cannotStartSearchYet = false;
                continueSearching    = false;

                //if local potentialNumber greater than maxRecordsWantToResult, then change status
                if (local_potentialNumber >= maxRecordsExpectToGet)
                {
                    seachingStatus        = ConstantCollection.searchStatus_Finished;
                    isAllSearchTerminated = true;
                }
                else if (nextRecordInCurrentCatalog >= numberOfRecordsMatchedInCurrentCatalog)
                {
                    currentCatalogStatus.isTerminated = true;

                    bool allFinished = true;
                    foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList)
                    {
                        if (catalogsSearchStatus.isTerminated == false)
                        {
                            allFinished = false;
                        }
                    }

                    if (allFinished)
                    {
                        seachingStatus        = ConstantCollection.searchStatus_Finished;
                        isAllSearchTerminated = true;
                    }
                    else
                    {
                        seachingStatus = ConstantCollection.searchStatus_InProcessing;
                    }
                }
            }

            //if zero record is responsed and the search status is abnormal, then set the search status to show the problems.
            if (results.numberOfRecordsMatched == 0 && results.numberOfRecordsReturned == 0 && results.SearchStatus != null)
            {
                seachingStatus = results.SearchStatus;

                //if response error also means this catalog's search is over
                currentCatalogStatus.isTerminated = true;
                currentCatalogStatus.isFailed     = true;

                bool allFinished = true;
                bool allFailed   = true;
                foreach (CatalogsSearchStatus catalogsSearchStatus in catalogsSearchStatusList)
                {
                    if (catalogsSearchStatus.isTerminated == false)
                    {
                        allFinished = false;
                    }
                    if (catalogsSearchStatus.isFailed == false)
                    {
                        allFailed = false;
                    }
                }

                if (allFinished)
                {
                    isAllSearchTerminated = true;
                    if (!allFailed)
                    {
                        seachingStatus = ConstantCollection.searchStatus_Finished;
                    }
                }
            }

            //if currentSearchedNum less than maxRecordsWantToResult and numOfRecords, continue search
            if (continueSearching)
            {
                int requestRecordsNumber = ConstantCollection.eachInvokeSearchNum_ExceptFirstTime;
                if (potentialNumber < maxRecordsExpectToGet)
                {
                    //if (maxRecordsExpectToGet - potentialNumber) < retrieve interval, set retrieve interval to that value
                    int num = maxRecordsExpectToGet - potentialNumber;
                    if (num < requestRecordsNumber)
                    {
                        requestRecordsNumber = num;
                    }
                }
                //if number of rest matched records is less then retrieve interval, just set current retrieve interval to the rest number
                int num1 = currentCatalogStatus.matchedNumber - results.nextRecord + 1;
                if (num1 > 0 && num1 < requestRecordsNumber)
                {
                    requestRecordsNumber = num1;
                }


                int nextRecord = results.nextRecord;
                if (searchingContentObject != null)
                {
                    cswQueryServiceClient.getRecords_AdvancedSearchAsync(searchingContentObject, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance);
                }
                else if (vocabularyObject != null)
                {
                    cswQueryServiceClient.getRecords_QuickSearchBySBAAsync(vocabularyObject, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance);
                }
                else
                {
                    cswQueryServiceClient.getRecords_BasicSearchAsync(contentToSearching, nextRecord + "", requestRecordsNumber + "", catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance);
                }

                currentCatalogStatus.potentioalRetrieveNumber = requestRecordsNumber;
            }
            SearchingResultPage currentResultPage = null;

            if (isFirstInvokeToSearch)
            {
                currentGotRecordsNumber = results.numberOfRecordsReturned;
                SearchingResultPage.showSearchingResultPage(contentToSearching, currentGotRecordsNumber, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus, records, sortingRule, isResult_CategorizedInTabItems);
                isFirstInvokeToSearch = false;
            }
            else
            {
                App       app       = (App)Application.Current;
                UIElement uiElement = app.RootVisual;
                if (uiElement is UserControl)
                {
                    UserControl control = uiElement as UserControl;
                    UIElement   root    = control.Content;
                    if (root is SearchingResultPage)
                    {
                        currentResultPage = root as SearchingResultPage;
                        //if user trigger new search during current search stage, current search results will be ignored and this iterative search will be ended.
                        //if not, these search results will be add to current result page
                        if (SearchingResultPage.ID == ID)
                        {
                            int  newAddNum    = results.numberOfRecordsReturned;
                            bool willOverflow = false;
                            if (currentGotRecordsNumber + newAddNum > maxRecordsExpectToGet)
                            {
                                newAddNum    = maxRecordsExpectToGet - currentGotRecordsNumber;
                                willOverflow = true;
                            }
                            int numAfterAddOperation = newAddNum + currentGotRecordsNumber;
                            currentResultPage.setSearchStutusBarInformation(numAfterAddOperation, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus);

                            if (!willOverflow)
                            {
                                if (currentResultPage.noRecord == true)
                                {
                                    currentResultPage.setResultPageContents(contentToSearching, numAfterAddOperation, allMatchedRecordsNumberInSearchedCatalogs, responseTime, seachingStatus, records, sortingRule);
                                }

                                else
                                {
                                    if (records != null)
                                    {
                                        foreach (Record record in records)
                                        {
                                            ClientSideRecord newRecord = ClientSideRecord.cloneRecord(record);
                                            currentResultPage.insertRecordsIntoResultPage(newRecord, sortingRule);
                                        }
                                    }
                                    currentResultPage.setRecordCountTextBlockValue();
                                }
                            }
                            else
                            {
                                int i = 0;
                                foreach (Record record in records)
                                {
                                    if (i++ < newAddNum)
                                    {
                                        ClientSideRecord newRecord = ClientSideRecord.cloneRecord(record);
                                        currentResultPage.insertRecordsIntoResultPage(newRecord, sortingRule);
                                    }
                                }
                                currentResultPage.setRecordCountTextBlockValue();
                            }
                            currentGotRecordsNumber = numAfterAddOperation;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                currentCatalogStatus.potentioalRetrieveNumber = 0;
            }

            if (isAllSearchTerminated)
            {
                if (currentResultPage != null)
                {
                    currentResultPage.SearchSummaryViewer.Visibility = Visibility.Visible;
                }
            }
        }