Skip to content

Commit

Permalink
Remove pdf export chart (#1535)
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre authored Mar 8, 2022
1 parent c22d004 commit 66f5b65
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 52 deletions.
1 change: 0 additions & 1 deletion src/OSPSuite.Assets/UIConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,6 @@ public static class MenuNames
{
public static string AsDeveloperOnly(string menuName) => $"{menuName} (Developer only)...";

public static readonly string ExportToPDF = "Export to PDF...";
public static readonly string ExportToExcel = "Export to Excel...";
public static readonly string CopyToClipboard = "Copy to Clipboard";
public static readonly string ResetZoom = "Reset Zoom";
Expand Down
10 changes: 0 additions & 10 deletions src/OSPSuite.Core/Events/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ public RenamedEvent(IWithName renameObject)
}
}

public class ExportToPDFEvent
{
public object ObjectToExport { get; private set; }

public ExportToPDFEvent(object objectToExport)
{
ObjectToExport = objectToExport;
}
}

public class ChartTemplatesChangedEvent
{
public IWithChartTemplates WithChartTemplates { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ public interface IChartDisplayPresenter :
/// </summary>
void RefreshAxisBinders();

/// <summary>
/// Action to call when exporting to PDF
/// </summary>
Action ExportToPDF { get; set; }

/// <summary>
/// <summary>
/// Action to call when a point is hot tracked in the chart view
/// </summary>
Action<int> HotTracked { set; }
Expand Down Expand Up @@ -189,7 +184,7 @@ public class ChartDisplayPresenter : AbstractPresenter<IChartDisplayView, IChart
private readonly Cache<string, ICurveBinder> _quickCurveBinderCache;
private bool _isLLOQVisible;
private ChartFontAndSizeSettings _displayChartFontAndSizeSettings;
public Action ExportToPDF { get; set; }

public event EventHandler<IDragEvent> DragOver = delegate { };
public event EventHandler<IDragEvent> DragDrop = delegate { };

Expand Down Expand Up @@ -217,7 +212,6 @@ public ChartDisplayPresenter(IChartDisplayView chartDisplayView,
_curveBinders = new Cache<string, ICurveBinder>(c => c.Id, onMissingKey: key => null);
_quickCurveBinderCache = new Cache<string, ICurveBinder>(onMissingKey: key => null);
_displayChartFontAndSizeSettings = new ChartFontAndSizeSettings();
ExportToPDF = () => throw new OSPSuiteException(Error.NotImplemented);
}

public CurveChart Chart { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public SimpleChartPresenter(ISimpleChartView view, IChartDisplayPresenter chartD
_dimensionFactory = dimensionFactory;
_view.AddView(_chartDisplayPresenter.View);
_chartDisplayPresenter.DisableCurveAndAxisEdits();
_chartDisplayPresenter.ExportToPDF = exportToPDF;
LogLinSelectionEnabled = false;
AddSubPresenters(_chartDisplayPresenter);
}
Expand All @@ -114,12 +113,6 @@ public bool LogLinSelectionEnabled
set => _view.LogLinSelectionEnabled = value;
}

private void exportToPDF()
{
if (Chart == null) return;
_eventPublisher.PublishEvent(new ExportToPDFEvent(Chart));
}

public CurveChart Plot(TableFormula tableFormula)
{
Chart = _chartFactory.CreateChartFor(tableFormula);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ protected override IEnumerable<IMenuBarItem> AllMenuItemsFor(CurveChart curveCha
.WithIcon(ApplicationIcons.Copy)
.AsGroupStarter();

yield return CreateMenuButton.WithCaption(MenuNames.ExportToPDF)
.WithActionCommand(chartDisplayPresenter.ExportToPDF)
.WithIcon(ApplicationIcons.PDF);

yield return CreateMenuButton.WithCaption(MenuNames.ExportToExcel)
.WithActionCommand(chartDisplayPresenter.ExportToExcel)
.WithIcon(ApplicationIcons.Excel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,28 +174,6 @@ public void the_chart_should_have_axis_scaling_set_to_linear()
}
}

public class When_exporting_a_chart_to_pdf : concern_for_SimpleChartPresenter
{
private DataRepository _dataRepository;

protected override void Context()
{
base.Context();
_dataRepository= A.Fake<DataRepository>();
sut.Plot(_dataRepository);
}

protected override void Because()
{
_chartDisplayPresenter.ExportToPDF();
}

[Observation]
public void should_raise_the_export_to_pdf_event_with_the_chart()
{
A.CallTo(() => _eventPublisher.PublishEvent(A<ExportToPDFEvent>._)).MustHaveHappened();
}
}
public class When_the_simple_chart_presenter_is_told_to_plot_the_chart_for_a_table_formula : concern_for_SimpleChartPresenter
{
private TableFormula _tableFormula;
Expand Down

0 comments on commit 66f5b65

Please sign in to comment.