예제 #1
0
 public PdfPlotterTests()
 {
     PlotterFactory = new PdfPlotterFactory()
     {
         Workspace = Workspace // faking the import
     };
 }
예제 #2
0
        public async Task <Stream> PlotToStream(ViewPortViewModelBase viewModel, Drawing drawing, ViewPort viewPort)
        {
            var             stream         = new MemoryStream();
            IPlotterFactory plotterFactory = viewModel switch
            {
                PdfPlotterViewModel _ => _pdfPlotterFactory,
                SvgPlotterViewModel _ => _svgPlotterFactory,
                            _ => throw new System.Exception($"Unexpected view model: {viewModel?.GetType().Name}"),
            };
            var plotter = plotterFactory.CreatePlotter(viewModel);
            await plotter.Plot(drawing, viewPort, stream, _workspace.FileSystemService.GetContentResolverRelativeToPath(drawing.Settings.FileName));

            stream.Seek(0, SeekOrigin.Begin);
            return(stream);
        }
예제 #3
0
 public PdfPlotterTests()
 {
     PlotterFactory = new PdfPlotterFactory(Workspace);
 }