public static void DataPlottables(Settings settings) { if (settings.gfxData == null) { return; } // Construct the dimensions object to be injected into plottables during rendering. var dims = new PlotDimensions(settings.figureSize, settings.dataSize, settings.dataOrigin, settings.axes.Limits); for (int i = 0; i < settings.plottables.Count; i++) { Plottable plottable = settings.plottables[i]; if (plottable.visible) { try { if (plottable is IPlottable modernPlottable) { // use the new render method (that injections dimensions and the bitmap to draw on) modernPlottable.Render(dims, settings.bmpData); } else { // use the old render method (that reads state from settings module and draws on the bitmap stored there) plottable.Render(settings); } } catch (OverflowException) { Debug.WriteLine($"OverflowException plotting: {plottable}"); } } } }
public static void DataPlottables(Settings settings) { if (settings.gfxData == null) { return; } for (int i = 0; i < settings.plottables.Count; i++) { Plottable pltThing = settings.plottables[i]; try { pltThing.Render(settings); } catch (OverflowException) { Debug.WriteLine($"OverflowException plotting: {pltThing}"); } } }