Пример #1
0
        public Result <Bitmap> DrawTag(ReaderSettings readerSettings, DrawerSettings drawerSettings,
                                       LayouterSettings layouterSettings)
        {
            var words = wordsProvider.GetObjectSource(readerSettings);

            if (!words.IsSuccess)
            {
                return(Result.Fail <Bitmap>(words.Error));
            }

            var frequency     = frequencyProvider.GetFrequencyDictionary(words.Value);
            var orderedSource = frequency.OrderByDescending(kv => kv.Value)
                                .Take(readerSettings.MaxObjectsCount).ToList();
            var sizableSource      = sizableProvider.GetSizableSource(orderedSource, drawerSettings);
            var drawableWordSource = drawableProvider.GetDrawableSource(sizableSource, layouterSettings);

            if (!drawableWordSource.IsSuccess)
            {
                return(Result.Fail <Bitmap>(drawableWordSource.Error));
            }

            var cloudInfo = new CloudInfo(drawableWordSource.Value);
            var bitmap    = drawer.GetBitmap(cloudInfo, drawerSettings);

            return(bitmap);
        }