GetDefaultInstance() публичный статический Метод

public static GetDefaultInstance ( ) : MapThumb
Результат MapThumb
Пример #1
0
        public static async Task <IEnumerable <ThumbnailInfo> > GetThumbnailsAsync(PostClass post, CancellationToken token)
        {
            var thumbnails = new List <ThumbnailInfo>();

            if (post.Media != null)
            {
                foreach (var media in post.Media)
                {
                    var thumbInfo = await ThumbnailGenerator.GetThumbnailInfoAsync(media, post, token)
                                    .ConfigureAwait(false);

                    if (thumbInfo != null)
                    {
                        thumbnails.Add(thumbInfo);
                    }

                    token.ThrowIfCancellationRequested();
                }
            }

            if (post.PostGeo != null && !(post.PostGeo.Lat == 0 && post.PostGeo.Lng == 0))
            {
                var map = MapThumb.GetDefaultInstance();
                thumbnails.Add(new ThumbnailInfo()
                {
                    ImageUrl     = map.CreateMapLinkUrl(post.PostGeo.Lat, post.PostGeo.Lng),
                    ThumbnailUrl = map.CreateStaticMapUrl(post.PostGeo.Lat, post.PostGeo.Lng),
                    TooltipText  = null,
                });
            }

            return(thumbnails);
        }
Пример #2
0
        public static List <ThumbnailInfo> GetThumbnails(PostClass post)
        {
            var thumbnails = new List <ThumbnailInfo>();

            if (post.Media != null)
            {
                foreach (var media in post.Media)
                {
                    var thumbInfo = ThumbnailGenerator.GetThumbnailInfo(media.Value, post);
                    if (thumbInfo != null)
                    {
                        thumbnails.Add(thumbInfo);
                    }
                }
            }

            if (post.PostGeo != null && !(post.PostGeo.Lat == 0 && post.PostGeo.Lng == 0))
            {
                var map = MapThumb.GetDefaultInstance();
                thumbnails.Add(new ThumbnailInfo()
                {
                    ImageUrl     = map.CreateMapLinkUrl(post.PostGeo.Lat, post.PostGeo.Lng),
                    ThumbnailUrl = map.CreateStaticMapUrl(post.PostGeo.Lat, post.PostGeo.Lng),
                    TooltipText  = null,
                });
            }

            return(thumbnails);
        }
Пример #3
0
        public static async Task <IEnumerable <ThumbnailInfo> > GetThumbnailsAsync(PostClass post, CancellationToken token)
        {
            var thumbnails = new List <ThumbnailInfo>();

            var expandedUrls = Enumerable.Concat(
                post.GetExpandedUrls(), post.Media.Select(x => x.Url));

            foreach (var expandedUrl in expandedUrls)
            {
                var thumbInfo = await ThumbnailGenerator.GetThumbnailInfoAsync(expandedUrl, post, token)
                                .ConfigureAwait(false);

                if (thumbInfo != null)
                {
                    thumbnails.Add(thumbInfo);
                }

                token.ThrowIfCancellationRequested();
            }

            if (post.PostGeo != null)
            {
                var map   = MapThumb.GetDefaultInstance();
                var thumb = await map.GetThumbnailInfoAsync(post.PostGeo.Value)
                            .ConfigureAwait(false);

                thumbnails.Add(thumb);
            }

            return(thumbnails);
        }