Changeset 4577 in ntrip for trunk/BNC/src/rinex/graphwin.cpp
- Timestamp:
- Aug 29, 2012, 3:32:18 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/rinex/graphwin.cpp
r4573 r4577 42 42 #include "qwt_scale_widget.h" 43 43 #include <qwt_scale_engine.h> 44 #include <qwt_plot_renderer.h> 44 45 45 46 using namespace std; … … 159 160 // Save the Widget as PNG Files 160 161 //////////////////////////////////////////////////////////////////////////// 161 void t_graphWin::savePNG(const QString& dirName, QByteArray ext) { 162 void t_graphWin::savePNG(const QString& dirName, QByteArray ext, 163 QwtPlot* plot) { 162 164 if (dirName.isEmpty()) { 163 165 return; 164 166 } 165 QImage image(_canvas->size(), QImage::Format_RGB32); 166 QPainter painter(&image); 167 _canvas->render(&painter); 167 168 168 QDir dir(dirName); 169 169 QFileInfo fileInfo(_fileName); … … 173 173 QString fileName = dir.path() + QDir::separator() 174 174 + fileInfo.completeBaseName() + ext; 175 image.save(fileName,"PNG"); 175 176 if (plot) { 177 QwtPlotRenderer renderer; 178 renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false); 179 renderer.setLayoutFlag(QwtPlotRenderer::KeepFrames, true); 180 renderer.renderDocument(plot, fileName, QSizeF(300, 200), 85); 181 } 182 else { 183 QImage image(_canvas->size(), QImage::Format_RGB32); 184 QPainter painter(&image); 185 _canvas->render(&painter); 186 image.save(fileName,"PNG"); 187 } 176 188 }
Note:
See TracChangeset
for help on using the changeset viewer.