diff --git a/aoqplot/controllers/aoqplotpagecontroller.cpp b/aoqplot/controllers/aoqplotpagecontroller.cpp index cc268a06184b1436a87b40067de9faadd1b4c7bf..23316c0bdb45bd36c575557f296b169885467f5a 100644 --- a/aoqplot/controllers/aoqplotpagecontroller.cpp +++ b/aoqplot/controllers/aoqplotpagecontroller.cpp @@ -144,7 +144,7 @@ void AOQPlotPageController::SavePdf( updatePlotForSettings(kinds, pols, phases); - _plot.SavePdf(filename); + _plot.SavePdf(filename, 640, 480); } void AOQPlotPageController::SetStatistics( diff --git a/plot/plotbase.cpp b/plot/plotbase.cpp index ff72926ec567ce95eddb131face43b09419eaae8..a4a3364cf5cb11d621fb1a5f958dde7cc63d98f8 100644 --- a/plot/plotbase.cpp +++ b/plot/plotbase.cpp @@ -1,7 +1,6 @@ #include "plotbase.h" -PlotBase::PlotBase() - : _xZoomStart(0.0), _xZoomEnd(1.0), _yZoomStart(0.0), _yZoomEnd(1.0) { +PlotBase::PlotBase() { _horizontalScale.SignalLinkedRedraw().connect(_signalLinkedRedraw); } diff --git a/plot/plotbase.h b/plot/plotbase.h index c02a36026d0c1b36e7b9e92ec86df6044dff0857..941bdc427b2bc3387f179f0acdaa0769eb745b4f 100644 --- a/plot/plotbase.h +++ b/plot/plotbase.h @@ -71,10 +71,10 @@ class PlotBase { virtual void SavePng(const std::string& filename, size_t width, size_t height) = 0; - protected: size_t Width() const { return _width; } size_t Height() const { return _height; } + protected: struct Rectangle { double x, y; double width, height; @@ -96,13 +96,13 @@ class PlotBase { sigc::signal<void> _onZoomChanged; /** - * Values between 0.0 and 1.0 indication the zoom. + * Values between 0.0 and 1.0 indicating the zoom. * @{ */ - double _xZoomStart, _xZoomEnd; - double _yZoomStart, _yZoomEnd; - size_t _width, _height; + double _xZoomStart = 0.0, _xZoomEnd = 1.0; + double _yZoomStart = 0.0, _yZoomEnd = 1.0; /** @} */ + size_t _width = 0, _height = 0; }; #endif // PLOT_PLOTBASE_H diff --git a/plot/plotpropertieswindow.cpp b/plot/plotpropertieswindow.cpp index a444988260846cb4f7bf0dd5e1e552f49a2b4b8d..3b0122e2eb5f5a21eaf18d11f9c9270a943de31d 100644 --- a/plot/plotpropertieswindow.cpp +++ b/plot/plotpropertieswindow.cpp @@ -308,10 +308,10 @@ void PlotPropertiesWindow::onExportClicked() { if (result == Gtk::RESPONSE_OK) { const Glib::RefPtr<Gtk::FileFilter> filter = dialog.get_filter(); if (filter->get_name() == pdfName) - _plot.SavePdf(dialog.get_filename()); + _plot.SavePdf(dialog.get_filename(), _plot.Width(), _plot.Height()); else if (filter->get_name() == svgName) - _plot.SaveSvg(dialog.get_filename()); + _plot.SaveSvg(dialog.get_filename(), _plot.Width(), _plot.Height()); else - _plot.SavePng(dialog.get_filename()); + _plot.SavePng(dialog.get_filename(), _plot.Width(), _plot.Height()); } } diff --git a/plot/xyplot.cpp b/plot/xyplot.cpp index 45c27af9893a2f88ae88c02541b0e6adea9efdf9..a7014b56f5e8a020bfdd5cfba78651f646037b9f 100644 --- a/plot/xyplot.cpp +++ b/plot/xyplot.cpp @@ -13,7 +13,7 @@ void XYPlot::Clear() { XYPointSet& XYPlot::StartLine(const std::string& label, const std::string& xDesc, const std::string& yDesc, - enum XYPointSet::DrawingStyle drawingStyle) { + XYPointSet::DrawingStyle drawingStyle) { _pointSets.emplace_back(std::make_unique<XYPointSet>(_pointSets.size())); XYPointSet& newSet = *_pointSets.back(); newSet.SetLabel(label); @@ -27,7 +27,7 @@ void XYPlot::SavePdf(const std::string& filename, size_t width, size_t height) { const Cairo::RefPtr<Cairo::PdfSurface> surface = Cairo::PdfSurface::create(filename, width, height); const Cairo::RefPtr<Cairo::Context> cairo = Cairo::Context::create(surface); - Draw(cairo); + PlotBase::Draw(cairo, width, height); cairo->show_page(); surface->finish(); } @@ -36,7 +36,7 @@ void XYPlot::SaveSvg(const std::string& filename, size_t width, size_t height) { const Cairo::RefPtr<Cairo::SvgSurface> surface = Cairo::SvgSurface::create(filename, width, height); const Cairo::RefPtr<Cairo::Context> cairo = Cairo::Context::create(surface); - Draw(cairo); + PlotBase::Draw(cairo, width, height); cairo->show_page(); surface->finish(); } @@ -45,7 +45,7 @@ void XYPlot::SavePng(const std::string& filename, size_t width, size_t height) { const Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, width, height); const Cairo::RefPtr<Cairo::Context> cairo = Cairo::Context::create(surface); - Draw(cairo); + PlotBase::Draw(cairo, width, height); surface->write_to_png(filename); } diff --git a/plot/xyplot.h b/plot/xyplot.h index fe9c4cfa890d2876476f0d02d788f8e45a2e0af0..9bbb71e3331590bf90e62d52445b2db2bda57c37 100644 --- a/plot/xyplot.h +++ b/plot/xyplot.h @@ -114,15 +114,6 @@ class XYPlot final : public PlotBase { size_t height) override; void SavePng(const std::string& filename, size_t width, size_t height) override; - void SavePdf(const std::string& filename) { - SavePdf(filename, Width(), Height()); - } - void SaveSvg(const std::string& filename) { - SaveSvg(filename, Width(), Height()); - } - void SavePng(const std::string& filename) { - SavePng(filename, Width(), Height()); - } const std::string& GetTitle() const { return _title.Text(); }