Changeset 4577 in ntrip for trunk/BNC/src/rinex/graphwin.cpp


Ignore:
Timestamp:
Aug 29, 2012, 3:32:18 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/graphwin.cpp

    r4573 r4577  
    4242#include "qwt_scale_widget.h"
    4343#include <qwt_scale_engine.h>
     44#include <qwt_plot_renderer.h>
    4445
    4546using namespace std;
     
    159160// Save the Widget as PNG Files
    160161////////////////////////////////////////////////////////////////////////////
    161 void t_graphWin::savePNG(const QString& dirName, QByteArray ext) {
     162void t_graphWin::savePNG(const QString& dirName, QByteArray ext,
     163                         QwtPlot* plot) {
    162164  if (dirName.isEmpty()) {
    163165    return;
    164166  }
    165   QImage image(_canvas->size(), QImage::Format_RGB32);
    166   QPainter painter(&image);
    167   _canvas->render(&painter);
     167
    168168  QDir dir(dirName);
    169169  QFileInfo fileInfo(_fileName);
     
    173173  QString fileName = dir.path() + QDir::separator()
    174174                   + 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  }
    176188}
Note: See TracChangeset for help on using the changeset viewer.