[4836] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
| 3 | * RTNet GUI
|
---|
| 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
[5406] | 6 | * Class: t_map_stations
|
---|
[4836] | 7 | *
|
---|
| 8 | * Purpose: Plot map of stations/satellites
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 05-Jan-2013
|
---|
| 13 | *
|
---|
| 14 | * Changes:
|
---|
| 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
[5418] | 18 | #include <iostream>
|
---|
[4836] | 19 | #include <QtSvg>
|
---|
| 20 |
|
---|
| 21 | #include <qwt_symbol.h>
|
---|
| 22 | #include <qwt_plot.h>
|
---|
| 23 | #include <qwt_plot_svgitem.h>
|
---|
| 24 | #include <qwt_plot_curve.h>
|
---|
| 25 | #include <qwt_plot_marker.h>
|
---|
| 26 | #include <qwt_plot_canvas.h>
|
---|
| 27 | #include <qwt_plot_zoomer.h>
|
---|
| 28 | #include <qwt_plot_renderer.h>
|
---|
| 29 |
|
---|
[5406] | 30 | #include "map_stations.h"
|
---|
[5420] | 31 | #include "worldplot.h"
|
---|
[5416] | 32 | #include "thriftclient.h"
|
---|
[4836] | 33 |
|
---|
[4858] | 34 | using namespace std;
|
---|
[5001] | 35 | using namespace GnssCenter;
|
---|
[4858] | 36 |
|
---|
[5406] | 37 | Q_EXPORT_PLUGIN2(gnsscenter_map_stations, GnssCenter::t_map_stationsFactory)
|
---|
[5018] | 38 |
|
---|
[4836] | 39 | // Constructor
|
---|
| 40 | /////////////////////////////////////////////////////////////////////////////
|
---|
[5420] | 41 | t_map_stations::t_map_stations() : QMainWindow() {
|
---|
[4836] | 42 |
|
---|
[5420] | 43 | // World Plot
|
---|
| 44 | // ----------
|
---|
| 45 | _plot = new t_worldPlot();
|
---|
| 46 | setCentralWidget(_plot);
|
---|
[4836] | 47 |
|
---|
[5422] | 48 | // Tool Bar
|
---|
| 49 | // --------
|
---|
| 50 | QToolBar* toolBar = new QToolBar("t_map_stations_ToolBar");
|
---|
| 51 | addToolBar(Qt::BottomToolBarArea, toolBar);
|
---|
| 52 | QAction* actStartThrift = new QAction("Start Thrift", 0);
|
---|
| 53 | toolBar->addAction(actStartThrift);
|
---|
| 54 | connect(actStartThrift, SIGNAL(triggered()), this, SLOT(slotStartThrift()));
|
---|
| 55 |
|
---|
[5410] | 56 | // Thrift Client;
|
---|
[5415] | 57 | // --------------
|
---|
[5422] | 58 | _thriftClient = 0;
|
---|
[5427] | 59 | _results = 0;
|
---|
[4836] | 60 | }
|
---|
| 61 |
|
---|
| 62 | // Destructor
|
---|
| 63 | /////////////////////////////////////////////////////////////////////////////
|
---|
[5422] | 64 | t_map_stations::~t_map_stations() {
|
---|
| 65 | if (_thriftClient) {
|
---|
| 66 | _thriftClient->stop();
|
---|
| 67 | }
|
---|
[4836] | 68 | }
|
---|
| 69 |
|
---|
[5422] | 70 | //
|
---|
| 71 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 72 | void t_map_stations::slotStartThrift() {
|
---|
| 73 | if (!_thriftClient) {
|
---|
| 74 | _thriftClient = new t_thriftClient(this);
|
---|
| 75 | _thriftClient->start();
|
---|
| 76 | }
|
---|
[5423] | 77 | //// beg test
|
---|
| 78 | else {
|
---|
| 79 | _plot->slotNewPoint("AAAA", 50.0, 15.0);
|
---|
| 80 | }
|
---|
| 81 | //// end test
|
---|
[5422] | 82 | }
|
---|
[4836] | 83 |
|
---|
[5415] | 84 | //
|
---|
| 85 | /////////////////////////////////////////////////////////////////////////////
|
---|
[5427] | 86 | void t_map_stations::putThriftResults(std::vector<t_thriftResult*>* results) {
|
---|
| 87 | if (_results) {
|
---|
| 88 | while (!_results->empty()) {
|
---|
| 89 | delete _results->back();
|
---|
| 90 | _results->pop_back();
|
---|
| 91 | }
|
---|
| 92 | delete _results;
|
---|
| 93 | }
|
---|
| 94 | _results = results;
|
---|
| 95 | // beg test
|
---|
| 96 | for (unsigned ii = 0; ii < _results->size(); ii++) {
|
---|
| 97 | const t_thriftResult* result = _results->at(ii);
|
---|
| 98 | cout << result->_name << ' '
|
---|
| 99 | << result->_nGPS << ' ' << result->_nGLO << ' '
|
---|
| 100 | << result->_x << ' ' << result->_y << ' ' << result->_z << endl;
|
---|
| 101 | }
|
---|
| 102 | // end test
|
---|
[5415] | 103 | }
|
---|