Ejemplo n.º 1
0
        public string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            if (item.Links == null)
            {
                return("");
            }

            // retrieve all enclosure links
            var links = item.Links.Where(l => l.RelationshipType == "enclosure");

            // Enclosure availability control function
            if (!parameters.AllKeys.Contains("disableEnclosureControl") && !parameters.AllKeys.Contains("allEnclosures"))
            {
                links = RemoveNonAvailableLinks(links);
            }

            string enclosure;

            if (links.IsEmpty())
            {
                enclosure = "";
            }
            else if (parameters.AllKeys.Contains("allEnclosures"))
            {
                enclosure = string.Join("|", links.Select(l => l.Uri.ToString()));
            }
            else
            {
                enclosure = links.First().Uri.ToString();
            }
            return(enclosure);
        }
Ejemplo n.º 2
0
        public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string date = null;

            if (date == null)
            {
                foreach (SyndicationElementExtension ext in item.ElementExtensions)
                {
                    if (ext.OuterName == "date")
                    {
                        date = ext.GetObject <string>();
                        if (date.Contains("/"))
                        {
                            date = DateTime.Parse(date.Split('/')[1]).ToUniversalTime().ToString("O");
                        }
                        break;
                    }
                    if (ext.OuterName == "dtend" && ext.OuterNamespace == "http://www.w3.org/2002/12/cal/ical#")
                    {
                        date = DateTime.Parse(ext.GetObject <string>(), null, System.Globalization.DateTimeStyles.AssumeUniversal).ToUniversalTime().ToString("O");
                        break;
                    }
                }
            }

            return(date);
        }
Ejemplo n.º 3
0
        public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string title = "";

            if (item.Title != null)
            {
                title = item.Title.Text;
            }

            return(title);
        }
Ejemplo n.º 4
0
        public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string date  = base.GetMetadata(item, specifier);
            var    start = Terradue.Metadata.EarthObservation.OpenSearch.Extensions.EarthObservationOpenSearchResultExtensions.FindStartDate(item);

            if (start != DateTime.MinValue)
            {
                date = start.ToUniversalTime().ToString("O");
            }

            return(date);
        }
Ejemplo n.º 5
0
        public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string ident = base.GetMetadata(item, specifier);

            if (ident == null)
            {
                var identifier = Terradue.Metadata.EarthObservation.OpenSearch.Extensions.EarthObservationOpenSearchResultExtensions.FindIdentifier(item);
                if (identifier != null)
                {
                    ident = identifier;
                }
            }

            return(ident);
        }
        public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string geom = base.GetMetadata(item, specifier);

            if (geom == null)
            {
                var geometry = Terradue.Metadata.EarthObservation.OpenSearch.Extensions.EarthObservationOpenSearchResultExtensions.FindGeometry(item);
                if (geometry != null)
                {
                    geom = geometry.ToWkt();
                }
            }

            return(geom);
        }
Ejemplo n.º 7
0
        public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string ident = null;

            if (ident == null)
            {
                foreach (SyndicationElementExtension ext in item.ElementExtensions)
                {
                    if (ext.OuterName == "identifier")
                    {
                        ident = ext.GetObject <string>();
                        break;
                    }
                }
            }

            return(ident);
        }
Ejemplo n.º 8
0
        public string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            var link = item.Links.FirstOrDefault(l => {
                if (l.RelationshipType == specifier)
                {
                    bool ret = true;

                    return(ret);
                }
                return(false);
            });

            if (link != null)
            {
                return(link.Uri.ToString());
            }

            return("");
        }
        public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
        {
            string wkt = null;

            if (item is Feature)
            {
                wkt = WktExtensions.ToWkt((Feature)item);
            }
            if (!string.IsNullOrEmpty(wkt))
            {
                return(wkt);
            }
            var geom = item.FindGeometry();

            if (geom == null)
            {
                foreach (SyndicationElementExtension ext in item.ElementExtensions.ToArray())
                {
                    if (ext.OuterNamespace == "http://www.georss.org/georss/10")
                    {
                        geom = Terradue.GeoJson.GeoRss10.GeoRss10Extensions.ToGeometry(Terradue.GeoJson.GeoRss10.GeoRss10Helper.Deserialize(ext.GetReader()));
                    }

                    if (ext.OuterNamespace == "http://www.georss.org/georss")
                    {
                        geom = Terradue.GeoJson.GeoRss.GeoRssExtensions.ToGeometry(Terradue.GeoJson.GeoRss.GeoRssHelper.Deserialize(ext.GetReader()));
                    }
                }
            }
            if (geom != null)
            {
                return(geom.ToWkt());
            }

            return(null);
        }
 public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
 {
     return(item.Id);
 }
Ejemplo n.º 11
0
 public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier)
 {
     return(item.LastUpdatedTime.ToUniversalTime().ToString("O"));
 }