Пример #1
0
        public IEnumerable <WebServiceNode> GetWebServices()
        {
            //added to fix compile problem needs tobe implemented correctly!!
            //var searcher = new HISCentralSearcher("");

            var result = new List <WebServiceNode>();

            string desciptionUrl = null;
            string serviceUrl    = null;
            string title         = null;
            int    serviceID     = -1;
            string serviceCode   = null;
            string organization  = null;

            int    variables = -1, values = -1, sites = -1;
            double xmin = double.NaN, xmax = double.NaN, ymin = double.NaN, ymax = double.NaN;

            var boundingBox = (Box)null;

            var node = new WebServiceNode(title, serviceCode, serviceID, desciptionUrl, serviceUrl, boundingBox, organization, sites, variables, values);

            result.Add(node);

            return(result.ToList());
            //return new MetadataCacheSearcher().GetWebServices().Select(
            //    service =>
            //    new WebServiceNode(service.ServiceTitle,
            //                       service.ServiceCode, (int)service.Id, service.DescriptionURL, service.EndpointURL,
            //                       new Box(service.WestLongitude, service.EastLongitude,
            //                               service.SouthLatitude, service.NorthLatitude), service.SiteCount, service.VariableCount, (int)service.ValueCount)).ToList();
        }
Пример #2
0
        public IEnumerable<WebServiceNode> GetWebServices()
        {
            //added to fix compile problem needs tobe implemented correctly!!
            //var searcher = new HISCentralSearcher("");

            var result = new List<WebServiceNode>();

            string desciptionUrl = null;
            string serviceUrl = null;
            string title = null;
            int serviceID = -1;
            string serviceCode = null;
            string organization = null;

            int variables = -1, values = -1, sites = -1;
            double xmin = double.NaN, xmax = double.NaN, ymin = double.NaN, ymax = double.NaN;

            var boundingBox = (Box)null;

            var node = new WebServiceNode(title, serviceCode, serviceID, desciptionUrl, serviceUrl, boundingBox, organization, sites, variables, values);
            result.Add(node);

            return result.ToList();
            //return new MetadataCacheSearcher().GetWebServices().Select(
            //    service =>
            //    new WebServiceNode(service.ServiceTitle,
            //                       service.ServiceCode, (int)service.Id, service.DescriptionURL, service.EndpointURL,
            //                       new Box(service.WestLongitude, service.EastLongitude,
            //                               service.SouthLatitude, service.NorthLatitude), service.SiteCount, service.VariableCount, (int)service.ValueCount)).ToList();
        }
Пример #3
0
        /// <summary>
        /// Create deep copy of current instance.
        /// </summary>
        /// <returns>Deep copy.</returns>
        public WebServiceNode Copy()
        {
            var result = new WebServiceNode();

            result.Copy(this);
            return(result);
        }
Пример #4
0
        //, BusinessObjects.Models.IProgressHandler bgWorker)
        public SearchResult GetSeriesCatalogInRectangle(Box extentBox, string[] keywords, double tileWidth, double tileHeight,
            DateTime startDate, DateTime endDate, WebServiceNode[] serviceIDs)
        {
            if (extentBox == null) throw new ArgumentNullException("extentBox");
            if (serviceIDs == null) throw new ArgumentNullException("serviceIDs");
            //if (bgWorker == null) throw new ArgumentNullException("bgWorker");

            if (keywords == null || keywords.Length == 0)
            {
                keywords = new[] { String.Empty };
            }

            //bgWorker.CheckForCancel();
            var extent = new Extent(extentBox.XMin, extentBox.YMin, extentBox.XMax, extentBox.YMax);
            var fullSeriesList = GetSeriesListForExtent(extent, keywords, tileWidth, tileHeight, startDate, endDate,
                                                        serviceIDs, //bgWorker,
                                                        series => true);
            SearchResult resultFs = null;
            if (fullSeriesList.Count > 0)
            {
                //bgWorker.ReportMessage("Calculating Points...");
                resultFs = SearchHelper.ToFeatureSetsByDataSource(fullSeriesList);
            }

            //bgWorker.CheckForCancel();
            //var message = string.Format("{0} Series found.", totalSeriesCount);
            //bgWorker.ReportProgress(100, "Search Finished. " + message);
            return resultFs;
        }
Пример #5
0
        public SearchResult GetSeriesCatalogInPolygon(IList<IFeature> polygons, string[] keywords, double tileWidth, double tileHeight,
            DateTime startDate, DateTime endDate, WebServiceNode[] serviceIDs, BusinessObjects.Models.IProgressHandler bgWorker)
        {
            if (polygons == null) throw new ArgumentNullException("polygons");
            if (bgWorker == null) throw new ArgumentNullException("bgWorker");
            if (polygons.Count == 0)
            {
                throw new ArgumentException("The number of polygons must be greater than zero.");
            }

            if (keywords == null || keywords.Length == 0)
            {
                keywords = new[] { String.Empty };
            }

            var fullSeriesList = new List<BusinessObjects.Models.SeriesDataCartModel.SeriesDataCart>();
            for (int index = 0; index < polygons.Count; index++)
            {
                if (polygons.Count > 1)
                {
                    bgWorker.ReportMessage(string.Format("Processing polygons: {0} of {1}", index + 1, polygons.Count));
                }

                bgWorker.CheckForCancel();
                var polygon = polygons[index];
                var extentBox = new Extent(polygon.Envelope);
                var seriesForPolygon = GetSeriesListForExtent(extentBox, keywords, tileWidth, tileHeight, startDate,
                                                              endDate,
                                                              serviceIDs, //bgWorker,
                                                              item => polygon.Intersects(new Coordinate(item.Longitude, item.Latitude)));
                fullSeriesList.AddRange(seriesForPolygon);
            }

            SearchResult resultFs = null;
            if (fullSeriesList.Count > 0)
            {
                bgWorker.ReportMessage("Calculating Points...");
                resultFs = SearchHelper.ToFeatureSetsByDataSource(fullSeriesList);
            }

            bgWorker.CheckForCancel();
            var message = string.Format("{0} Series found.", totalSeriesCount);
            bgWorker.ReportProgress(100, "Search Finished. " + message);
            return resultFs;
        }
Пример #6
0
        /// <summary>
        /// Create deep from source into current instance.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <exception cref="ArgumentNullException"><paramref name="source"/>must be not null.</exception>
        public void Copy(WebServiceNode source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            ServiceID          = source.ServiceID;
            ServiceCode        = source.ServiceCode;
            Title              = source.Title;
            DescriptionUrl     = source.DescriptionUrl;
            ServiceUrl         = source.ServiceUrl;
            Checked            = source.Checked;
            ServiceBoundingBox = source.ServiceBoundingBox == null
                                     ? null
                                     : new Box(source.ServiceBoundingBox.XMin,
                                               source.ServiceBoundingBox.XMax, source.ServiceBoundingBox.YMin,
                                               source.ServiceBoundingBox.YMax);
            Organization = source.Organization;
            Sites        = source.Sites;
            Variables    = source.Variables;
            Values       = source.Values;
        }
Пример #7
0
        /// <summary>
        /// Create deep from source into current instance.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <exception cref="ArgumentNullException"><paramref name="source"/>must be not null.</exception>
        public void Copy(WebServiceNode source)
        {
            if (source == null) throw new ArgumentNullException("source");

            ServiceID = source.ServiceID;
            ServiceCode = source.ServiceCode;
            Title = source.Title;
            DescriptionUrl = source.DescriptionUrl;
            ServiceUrl = source.ServiceUrl;
            Checked = source.Checked;
            ServiceBoundingBox = source.ServiceBoundingBox == null
                                     ? null
                                     : new Box(source.ServiceBoundingBox.XMin,
                                               source.ServiceBoundingBox.XMax, source.ServiceBoundingBox.YMin,
                                               source.ServiceBoundingBox.YMax);
            Organization = source.Organization;
            Sites = source.Sites;
            Variables = source.Variables;
            Values = source.Values;
        }
Пример #8
0
 /// <summary>
 /// Create deep copy of current instance.
 /// </summary>
 /// <returns>Deep copy.</returns>
 public WebServiceNode Copy()
 {
     var result = new WebServiceNode();
     result.Copy(this);
     return result;
 }
Пример #9
0
        private List<WebServiceNode> getWebserviceNodeList(string xmlData)
        {
            var list = new List<WebServiceNode>();

            var xmlReaderSettings = new XmlReaderSettings
            {
                CloseInput = true,
                IgnoreComments = true,
                IgnoreWhitespace = true,
            };

            using (var reader = XmlReader.Create(new StringReader(xmlData), xmlReaderSettings))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                        {
                            //Empty element - advance and continue...
                            continue;
                        }

                        if (reader.Name == "ServiceInfo")
                        {
                            string desciptionUrl = null;
                            string serviceUrl = null;
                            string title = null;
                            int serviceID = -1;
                            string serviceCode = null;
                            string organization = null;

                            int variables = -1, values = -1, sites = -1;
                            double xmin = double.NaN, xmax = double.NaN, ymin = double.NaN, ymax = double.NaN;

                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "ServiceInfo")
                                {
                                    break;
                                }

                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                                    {
                                        //Empty element - advance and continue...
                                        continue;
                                    }

                                    switch (reader.Name)
                                    {
                                        case "Title":
                                            if (!reader.Read()) continue;
                                            title = reader.Value.Trim();
                                            break;
                                        case "ServiceID":
                                            if (!reader.Read()) continue;
                                            serviceID = Convert.ToInt32(reader.Value.Trim());
                                            break;
                                        case "ServiceDescriptionURL":
                                            if (!reader.Read()) continue;
                                            desciptionUrl = reader.Value.Trim();
                                            break;
                                        case "organization":
                                            if (!reader.Read()) continue;
                                            organization = reader.Value.Trim();
                                            break;
                                        case "servURL":
                                            if (!reader.Read()) continue;
                                            serviceUrl = reader.Value.Trim();
                                            break;
                                        case "valuecount":
                                            if (!reader.Read()) continue;
                                            values = Convert.ToInt32(reader.Value.Trim());
                                            break;
                                        case "variablecount":
                                            if (!reader.Read()) continue;
                                            variables = Convert.ToInt32(reader.Value.Trim());
                                            break;
                                        case "sitecount":
                                            if (!reader.Read()) continue;
                                            sites = Convert.ToInt32(reader.Value.Trim());
                                            break;
                                        case "NetworkName":
                                            if (!reader.Read()) continue;
                                            serviceCode = reader.Value.Trim();
                                            break;
                                        case "minx":
                                            if (!reader.Read()) continue;
                                            double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                            out xmin);
                                            break;
                                        case "maxx":
                                            if (!reader.Read()) continue;
                                            double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                            out xmax);
                                            break;
                                        case "miny":
                                            if (!reader.Read()) continue;
                                            double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                            out ymin);
                                            break;
                                        case "maxy":
                                            if (!reader.Read()) continue;
                                            double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                            out ymax);
                                            break;
                                    }
                                }
                            }

                            var boundingBox = (Box)null;
                            if (!double.IsNaN(xmin) && !double.IsNaN(xmax) && !double.IsNaN(ymin) && !double.IsNaN(ymax))
                                boundingBox = new Box(xmin, xmax, ymin, ymax);

                            var node = new WebServiceNode(title, serviceCode, serviceID, desciptionUrl, serviceUrl, boundingBox, organization, sites, variables, values);
                            list.Add(node);
                        }
                    }
                }
            }

            return list;
        }
Пример #10
0
        public IEnumerable <WebServiceNode> GetWebServices()
        {
            var searcher = new HISCentralSearcher(_hisCentralUrl);

            RefreshListFromHisCentral(searcher);
            var xmlReaderSettings = new XmlReaderSettings
            {
                CloseInput       = true,
                IgnoreComments   = true,
                IgnoreWhitespace = true,
            };

            var result = new List <WebServiceNode>();

            using (var reader = XmlReader.Create(WebServicesFilename, xmlReaderSettings))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                        {
                            //Empty element - advance and continue...
                            continue;
                        }

                        if (reader.Name == "ServiceInfo")
                        {
                            string desciptionUrl = null;
                            string serviceUrl    = null;
                            string title         = null;
                            int    serviceID     = -1;
                            string serviceCode   = null;
                            string organization  = null;

                            int    variables = -1, values = -1, sites = -1;
                            double xmin = double.NaN, xmax = double.NaN, ymin = double.NaN, ymax = double.NaN;

                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "ServiceInfo")
                                {
                                    break;
                                }

                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                                    {
                                        //Empty element - advance and continue...
                                        continue;
                                    }

                                    switch (reader.Name)
                                    {
                                    case "Title":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        title = reader.Value.Trim();
                                        break;

                                    case "ServiceID":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        serviceID = Convert.ToInt32(reader.Value.Trim());
                                        break;

                                    case "ServiceDescriptionURL":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        desciptionUrl = reader.Value.Trim();
                                        break;

                                    case "organization":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        organization = reader.Value.Trim();
                                        break;

                                    case "servURL":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        serviceUrl = reader.Value.Trim();
                                        break;

                                    case "valuecount":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        values = Convert.ToInt32(reader.Value.Trim());
                                        break;

                                    case "variablecount":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        variables = Convert.ToInt32(reader.Value.Trim());
                                        break;

                                    case "sitecount":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        sites = Convert.ToInt32(reader.Value.Trim());
                                        break;

                                    case "NetworkName":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        serviceCode = reader.Value.Trim();
                                        break;

                                    case "minx":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                        out xmin);
                                        break;

                                    case "maxx":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                        out xmax);
                                        break;

                                    case "miny":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                        out ymin);
                                        break;

                                    case "maxy":
                                        if (!reader.Read())
                                        {
                                            continue;
                                        }
                                        double.TryParse(reader.Value.Trim(), NumberStyles.Number, CultureInfo.InvariantCulture,
                                                        out ymax);
                                        break;
                                    }
                                }
                            }

                            var boundingBox = (Box)null;
                            if (!double.IsNaN(xmin) && !double.IsNaN(xmax) && !double.IsNaN(ymin) && !double.IsNaN(ymax))
                            {
                                boundingBox = new Box(xmin, xmax, ymin, ymax);
                            }

                            var node = new WebServiceNode(title, serviceCode, serviceID, desciptionUrl, serviceUrl, boundingBox, organization, sites, variables, values);
                            result.Add(node);
                        }
                    }
                }
            }

            return(result);
        }