예제 #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));
 }