Changeset 4651 in ntrip


Ignore:
Timestamp:
Sep 6, 2012, 2:16:38 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncmap.h

    r4636 r4651  
    2929
    3030class QwtPlot;
     31class QwtPlotZoomer;
    3132
    3233class t_bncMap : public QDialog {
     
    4647 protected:
    4748  virtual void closeEvent(QCloseEvent *);
     49  virtual void showEvent(QShowEvent *);
    4850
    4951 private:
    50   QwtPlot*     _mapPlot;
    51   QPushButton* _buttonClose;
    52   QPushButton* _buttonPrint;
     52  QwtPlot*       _mapPlot;
     53  QwtPlotZoomer* _mapPlotZoomer;
     54  QPushButton*   _buttonClose;
     55  QPushButton*   _buttonPrint;
     56  double         _minPointLat;
     57  double         _maxPointLat;
     58  double         _minPointLon;
     59  double         _maxPointLon;
    5360};
    5461
  • trunk/BNC/src/bncmap_svg.cpp

    r4636 r4651  
    4747#include <qwt_plot_marker.h>
    4848#include <qwt_plot_canvas.h>
    49 #include <qwt_plot_panner.h>
    5049#include <qwt_plot_zoomer.h>
    51 #include <qwt_plot_magnifier.h>
    5250#include <qwt_plot_renderer.h>
    5351
     
    6563  _mapPlot->setAxisScale(QwtPlot::yLeft,    -90.0,  90.0);
    6664
    67   //  (void)new QwtPlotPanner(_mapPlot->canvas());
    68   //  (void)new QwtPlotMagnifier(_mapPlot->canvas());
    69   (void)new QwtPlotZoomer(_mapPlot->canvas());
     65  _mapPlotZoomer = new QwtPlotZoomer(_mapPlot->canvas());
    7066
    7167  _mapPlot->canvas()->setFocusPolicy(Qt::WheelFocus);
     
    9793  mainLayout->addLayout(buttonLayout);
    9894
     95  // Minimal and Maximal Coordinates
     96  // -------------------------------
     97  _minPointLat = 0.0;
     98  _maxPointLat = 0.0;
     99  _minPointLon = 0.0;
     100  _maxPointLon = 0.0;
     101
    99102  // Important
    100103  // ---------
     
    123126  marker->setSymbol(symbol);
    124127  marker->attach(_mapPlot);
     128
     129  // Remeber minimal and maximal coordinates
     130  // ---------------------------------------
     131  if (_minPointLat == 0.0 && _maxPointLat == 0.0 &&
     132      _minPointLon == 0.0 && _maxPointLon == 0.0) {
     133    _minPointLat = latDeg;
     134    _maxPointLat = latDeg;
     135    _minPointLon = lonDeg;
     136    _maxPointLon = lonDeg;
     137  }
     138  else {
     139    if      (_maxPointLat < latDeg) {
     140      _maxPointLat = latDeg;
     141    }
     142    else if (_minPointLat > latDeg) {
     143      _minPointLat = latDeg;
     144    }
     145    if      (_maxPointLon < lonDeg) {
     146      _maxPointLon = lonDeg;
     147    }
     148    else if (_minPointLon > lonDeg) {
     149      _minPointLon = lonDeg;
     150    }
     151  }
    125152}
    126153
     
    135162void t_bncMap::closeEvent(QCloseEvent* event) {
    136163  QDialog::closeEvent(event);
     164}
     165
     166//
     167////////////////////////////////////////////////////////////////////////////
     168void t_bncMap::showEvent(QShowEvent* event) {
     169  double width  = _maxPointLon - _minPointLon;
     170  double height = _maxPointLat - _minPointLat;
     171  if (width > 0 && height > 0) {
     172    QRectF rect(_minPointLon, _minPointLat, width, height);
     173    qDebug() << rect;
     174    _mapPlotZoomer->zoom(rect);
     175  }
     176  QDialog::showEvent(event);
    137177}
    138178
  • trunk/BNC/src/src.pro

    r4625 r4651  
    66# Switch to debug configuration
    77# -----------------------------
    8 CONFIG -= debug
    9 CONFIG += release
     8CONFIG -= release
     9CONFIG += debug
    1010
    1111DEFINES += NO_RTCM3_MAIN
Note: See TracChangeset for help on using the changeset viewer.