示例#1
0
        private static void ProcessBitmapImage(CliOptions options, ITagsCloudVisualizator visualizator)
        {
            var image    = new Bitmap(options.Width, options.Height);
            var graphics = Graphics.FromImage(image);

            visualizator.CreateTagsCloud(graphics);
            image.Save(options.OutputFilename);
        }
示例#2
0
        private IEnumerable <ITagsPreparer> GetPreparers(CliOptions options)
        {
            yield return(new NormalizeTagsTransformer());

            yield return(new LetterTagsFilter());

            yield return(new StemTagTransform());

            yield return(new StopWordsFilter());

            if (options.MaxTagsCount.HasValue)
            {
                yield return(new FirstTagsTaker(options.MaxTagsCount.Value));
            }
        }
示例#3
0
        public IContainer BuildDependencies(CliOptions options)
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule(new TagsCreatorBuild(options.InputFilename));
            builder.RegisterModule(new StrictOrderEnumerationBuild <ITagsPreparer>(GetPreparers(options)));

            builder.RegisterInstance(new FixedFamilyFontProvider(FontFamily.GenericMonospace))
            .As <IFontProvider>();
            builder.RegisterInstance(options.Layouter).As <ITagsCloudLayouter>();

            builder.RegisterModule(new StrictOrderEnumerationBuild <ITagsDecorator>(GetDecorators(options)));
            builder.RegisterModule(
                new StrictOrderEnumerationBuild <IBackgroundDecorator>(GetBackgroundDecorators(options)));

            builder.RegisterModule(new FrequencyTagsCloudWrapperBuild(options.MaximumFontSize));
            builder.RegisterModule(new TagsCloudVisualizatorBuild());

            return(builder.Build());
        }
示例#4
0
 private static void ProcessWinFormsApplication(CliOptions options, ITagsCloudVisualizator visualizator)
 {
     Application.Run(
         new TagsCloudDisplayForm(visualizator, options.Width, options.Height)
         );
 }
示例#5
0
 private IEnumerable <IBackgroundDecorator> GetBackgroundDecorators(CliOptions options)
 {
     yield return(new SolidBackgroundDecorator(options.BackgroundColor));
 }
示例#6
0
 private IEnumerable <ITagsDecorator> GetDecorators(CliOptions options)
 {
     yield return(new SolidColorTagsDecorator(options.ForegroundColor));
 }