Changeset 4577 in ntrip for trunk/BNC


Ignore:
Timestamp:
Aug 29, 2012, 3:32:18 PM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
4 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}
  • trunk/BNC/src/rinex/graphwin.h

    r4573 r4577  
    2929#include <QtGui>
    3030#include <qwt_color_map.h>
     31#include <qwt_plot.h>
    3132
    3233class QwtScaleWidget;
     
    5758  ~t_graphWin();
    5859
    59   void savePNG(const QString& dirName, QByteArray ext);
     60  void savePNG(const QString& dirName, QByteArray ext, QwtPlot* plot);
    6061
    6162 signals:
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r4576 r4577  
    4242#include <iomanip>
    4343
    44 #include <qwt_plot.h>
    45 #include <qwt_plot_curve.h>
    46 #include <qwt_symbol.h>
    47 
    4844#include "reqcanalyze.h"
    4945#include "bncapp.h"
     
    5450#include "graphwin.h"
    5551#include "polarplot.h"
     52#include "availplot.h"
    5653
    5754using namespace std;
     
    169166    if (!dirName.isEmpty()) {
    170167      QByteArray ext = scaleTitle.isEmpty() ? "_SNR.png" : "_MP.png";
    171       graphWin->savePNG(dirName, ext);
     168      graphWin->savePNG(dirName, ext, 0);
    172169    }
    173170  }
     
    516513  if (dynamic_cast<bncApp*>(qApp)->GUIenabled()) {
    517514
    518     QwtPlot* plot = new QwtPlot();
    519 
    520     int iC = 0;
    521     QMapIterator<QString, QVector<int> > it(*prnAvail);
    522     while (it.hasNext()) {
    523       it.next();
    524       ++iC;
    525       const QString&      prn    = it.key();
    526       const QVector<int>& epochs = it.value();
    527 
    528       QVector<QPointF> samples;
    529       for (int ii = 0; ii < epochs.size(); ii++) {
    530         samples << QPointF(epochs[ii], iC);
    531       }
    532 
    533       QwtPlotCurve* curve = new QwtPlotCurve(prn);
    534       curve->setStyle( QwtPlotCurve::NoCurve );
    535       QwtSymbol* symbol = new QwtSymbol( QwtSymbol::XCross );
    536       symbol->setSize( 4 );
    537       curve->setSymbol( symbol );
    538       curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol );
    539       curve->setSamples(samples);
    540       curve->attach(plot);
    541     }
     515    t_availPlot* plot = new t_availPlot(0, prnAvail);
    542516
    543517    QVector<QWidget*> plots;
     
    550524    if (!dirName.isEmpty()) {
    551525      QByteArray ext = "_AVAIL.png";
    552       graphWin->savePNG(dirName, ext);
    553     }
    554   }
    555 }
     526      graphWin->savePNG(dirName, ext, plot);
     527    }
     528  }
     529}
  • trunk/BNC/src/src.pro

    r4440 r4577  
    115115             rinex/rnxnavfile.h       rinex/corrfile.h     \
    116116             rinex/reqcedit.h         rinex/reqcanalyze.h  \
    117              rinex/graphwin.h         rinex/polarplot.h
     117             rinex/graphwin.h         rinex/polarplot.h    \
     118             rinex/availplot.h
    118119  SOURCES += rinex/bncpostprocess.cpp rinex/rnxobsfile.cpp \
    119120             rinex/rnxnavfile.cpp     rinex/corrfile.cpp   \
    120121             rinex/reqcedit.cpp       rinex/reqcanalyze.cpp \
    121              rinex/graphwin.cpp       rinex/polarplot.cpp
     122             rinex/graphwin.cpp       rinex/polarplot.cpp   \
     123             rinex/availplot.cpp
    122124}
    123125
Note: See TracChangeset for help on using the changeset viewer.