source: ntrip/trunk/GnssCenter/map_stations/map_stations.cpp@ 5428

Last change on this file since 5428 was 5428, checked in by mervart, 8 years ago
File size: 2.7 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * RTNet GUI
4 * -------------------------------------------------------------------------
5 *
6 * Class: t_map_stations
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
18#include <iostream>
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
30#include "map_stations.h"
31#include "worldplot.h"
32#include "thriftclient.h"
33
34using namespace std;
35using namespace GnssCenter;
36
37Q_EXPORT_PLUGIN2(gnsscenter_map_stations, GnssCenter::t_map_stationsFactory)
38
39// Constructor
40/////////////////////////////////////////////////////////////////////////////
41t_map_stations::t_map_stations() : QMainWindow() {
42
43 // World Plot
44 // ----------
45 _plot = new t_worldPlot();
46 setCentralWidget(_plot);
47
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
56 // Thrift Client;
57 // --------------
58 _thriftClient = 0;
59 _results = 0;
60}
61
62// Destructor
63/////////////////////////////////////////////////////////////////////////////
64t_map_stations::~t_map_stations() {
65 if (_thriftClient) {
66 _thriftClient->stopAndDestroy();
67 }
68 if (_results) {
69 while (!_results->empty()) {
70 delete _results->back();
71 _results->pop_back();
72 }
73 delete _results;
74 }
75}
76
77//
78/////////////////////////////////////////////////////////////////////////////
79void t_map_stations::slotStartThrift() {
80 if (!_thriftClient) {
81 _thriftClient = new t_thriftClient(this);
82 _thriftClient->start();
83 }
84 //// beg test
85 else {
86 _plot->slotNewPoint("AAAA", 50.0, 15.0);
87 }
88 //// end test
89}
90
91//
92/////////////////////////////////////////////////////////////////////////////
93void t_map_stations::putThriftResults(std::vector<t_thriftResult*>* results) {
94 if (_results) {
95 while (!_results->empty()) {
96 delete _results->back();
97 _results->pop_back();
98 }
99 delete _results;
100 }
101 _results = results;
102 // beg test
103 for (unsigned ii = 0; ii < _results->size(); ii++) {
104 const t_thriftResult* result = _results->at(ii);
105 cout << result->_name << ' '
106 << result->_nGPS << ' ' << result->_nGLO << ' '
107 << result->_x << ' ' << result->_y << ' ' << result->_z << endl;
108 }
109 // end test
110}
Note: See TracBrowser for help on using the repository browser.