Changeset 437 in flair-src for trunk/tools/FlairGCS/src
- Timestamp:
- Aug 24, 2021, 5:33:19 PM (3 years ago)
- Location:
- trunk/tools/FlairGCS/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/FlairGCS/src/ComboBox.cpp
r269 r437 8 8 #include <QFormLayout> 9 9 10 ComboBox::ComboBox(Layout *parent, int row, int col, QString name, int value)10 ComboBox::ComboBox(Layout *parent, int row, int col, QString name, uint16_t value) 11 11 : FormLayout(parent, row, col, name, "ComboBox") { 12 12 combobox = new QComboBox(); -
trunk/tools/FlairGCS/src/ComboBox.h
r269 r437 15 15 16 16 public: 17 ComboBox(Layout *parent, int row, int col, QString name, int value);17 ComboBox(Layout *parent, int row, int col, QString name, uint16_t value); 18 18 ~ComboBox(); 19 19 20 20 private: 21 21 QComboBox *combobox; 22 int combobox_value;22 uint16_t combobox_value; 23 23 void XmlEvent(QDomElement *dom); 24 24 void SetUptodate(void); -
trunk/tools/FlairGCS/src/DataPlot1D.cpp
r436 r437 13 13 14 14 DataPlot1D::DataPlot1D(Layout *parent, int row, int col, QString title, 15 float ymin, float ymax, bool enabled, int period)15 float ymin, float ymax, bool enabled, uint16_t period, uint16_t nb_buffering) 16 16 : ScopeFixedStep(title, ymin, ymax, period / 1000.), 17 DataRemote(title, "DataPlot1D", parent, enabled, period ) {17 DataRemote(title, "DataPlot1D", parent, enabled, period, nb_buffering) { 18 18 19 19 setEnabled(enabled); -
trunk/tools/FlairGCS/src/DataPlot1D.h
r269 r437 15 15 public: 16 16 DataPlot1D(Layout *parent, int row, int col, QString title, float ymin, 17 float ymax, bool enabled, int period);17 float ymax, bool enabled, uint16_t period, uint16_t nb_buffering=1); 18 18 ~DataPlot1D(); 19 19 -
trunk/tools/FlairGCS/src/DataPlot2D.cpp
r269 r437 22 22 DataPlot2D::DataPlot2D(Layout *parent, int row, int col, QString plot_name, 23 23 QString x_name, QString y_name, float xmin, float xmax, 24 float ymin, float ymax, bool enabled, int period)25 : DataRemote(plot_name, "DataPlot2D", parent, enabled, period ) {24 float ymin, float ymax, bool enabled, uint16_t period, uint16_t nb_buffering) 25 : DataRemote(plot_name, "DataPlot2D", parent, enabled, period, nb_buffering) { 26 26 plot = new QwtPlot(NULL); 27 27 plot->setEnabled(enabled); -
trunk/tools/FlairGCS/src/DataPlot2D.h
r269 r437 22 22 DataPlot2D(Layout *parent, int row, int col, QString plot_name, 23 23 QString x_name, QString y_name, float xmin, float xmax, float ymin, 24 float ymax, bool enabled, int period);24 float ymax, bool enabled, uint16_t period, uint16_t nb_buffering=1); 25 25 ~DataPlot2D(); 26 26 void addCurve(QPen pen, QString legend, QString type); -
trunk/tools/FlairGCS/src/DataRemote.cpp
r436 r437 10 10 11 11 DataRemote::DataRemote(QString name, QString type, XmlWidget *parent, 12 bool enabled, int period)12 bool enabled, uint16_t period, uint16_t nb_buffering) 13 13 : XmlWidget(name, type, parent) { 14 14 auto_refresh = enabled; … … 16 16 receivesize = 0; 17 17 refresh_rate = (double)period / 1000.; 18 18 this->nb_buffering=nb_buffering; 19 19 20 connectionLayout()->addDataRemote(this); 20 21 … … 28 29 menu->addSeparator(); 29 30 30 autoRefresh = menu->addAction("auto refresh");31 autoRefresh->setCheckable(true);32 autoRefresh->setChecked(auto_refresh);31 SetAutoRefresh = menu->addAction("auto refresh"); 32 SetAutoRefresh->setCheckable(true); 33 SetAutoRefresh->setChecked(auto_refresh); 33 34 34 35 setRefreshRate = menu->addAction(QString("set refresh rate (%1ms)") 35 36 .arg((uint16_t)(qRound(refresh_rate * 1000)))); 36 37 setRefreshRate->setEnabled(auto_refresh); 38 39 menu->addSeparator(); 40 setNbBuffering = menu->addAction(QString("set nb buffering (%1)").arg(nb_buffering)); 41 37 42 /* menu->addSeparator(); 38 43 … … 48 53 action = menu->exec(point); 49 54 50 if (action == autoRefresh) {51 SendPeriod(RefreshRate_ms(), autoRefresh->isChecked());55 if (action == SetAutoRefresh) { 56 SendPeriod(RefreshRate_ms(), SetAutoRefresh->isChecked()); 52 57 } 53 58 … … 58 63 parent, "Set refresh rate ", "Value (ms):", 59 64 (uint16_t)(qRound(refresh_rate * 1000)), 1, 65535, 10, &ok); 60 if (ok == true&& time != qRound(refresh_rate * 1000)) {65 if (ok && time != qRound(refresh_rate * 1000)) { 61 66 // refresh_rate=time/1000.; 62 SendPeriod(time, autoRefresh->isChecked()); 67 SendPeriod(time, SetAutoRefresh->isChecked()); 68 } 69 } 70 71 if (action == setNbBuffering) { 72 bool ok; 73 74 uint16_t nb_buffering = QInputDialog::getInt( 75 parent, "Set nb buffering ", "Value :", 76 this->nb_buffering, 1, 65535, 10, &ok); 77 if (ok && nb_buffering !=this->nb_buffering) { 78 SendNbBuffering(nb_buffering); 63 79 } 64 80 } … … 73 89 bool DataRemote::IsEnabled(void) { return auto_refresh; } 74 90 75 void DataRemote::SendPeriod( int period, bool auto_refresh) {91 void DataRemote::SendPeriod(uint16_t period, bool auto_refresh) { 76 92 RemoveAllAttributes(); 77 93 … … 83 99 } 84 100 101 void DataRemote::SendNbBuffering(uint16_t nb_buffering) { 102 RemoveAllAttributes(); 103 104 SetAttribute("nb_buf", nb_buffering); 105 connectionLayout()->XmlToSend(XmlDoc()); 106 RemoveAttribute("nb_buf"); 107 } 108 85 109 int DataRemote::ReceiveSize(void) { return receivesize; } 86 110 87 111 void DataRemote::XmlSetup(QDomElement *dom) { 88 refresh_rate = dom->attribute("period").toInt() / 1000.; 112 refresh_rate = dom->attribute("period").toUShort() / 1000.; 113 nb_buffering = dom->attribute("nb_buf").toUShort(); 89 114 if (dom->attribute("enabled") == "1") 90 115 auto_refresh = true; -
trunk/tools/FlairGCS/src/DataRemote.h
r269 r437 16 16 public: 17 17 DataRemote(QString name, QString type, XmlWidget *parent, bool enabled, 18 int period);18 uint16_t period, uint16_t nb_buffering=1); 19 19 ~DataRemote(); 20 20 uint16_t RefreshRate_ms(void); … … 31 31 double refresh_rate; // en s 32 32 int receivesize; 33 uint16_t nb_buffering; 33 34 34 35 void XmlSetup(QDomElement *dom); 35 36 36 37 private: 37 void SendPeriod(int period, bool auto_refresh); 38 QAction *autoRefresh, *setRefreshRate; 38 void SendPeriod(uint16_t period, bool auto_refresh); 39 void SendNbBuffering(uint16_t nb_buffering); 40 QAction *SetAutoRefresh, *setRefreshRate,*setNbBuffering; 39 41 //QAction **log;//todo implement this feature (log directly in gcs, in case of uav program crash) 40 42 }; -
trunk/tools/FlairGCS/src/DoubleSpinBox.cpp
r269 r437 13 13 DoubleSpinBox::DoubleSpinBox(Layout *parent, int row, int col, QString name, 14 14 QString suffix, QString value, float min, 15 float max, float step, int decimals)15 float max, float step, uint16_t decimals) 16 16 : FormLayout(parent, row, col, name, "DoubleSpinBox") { 17 17 doublespinbox = new QDoubleSpinBox(); -
trunk/tools/FlairGCS/src/DoubleSpinBox.h
r269 r437 17 17 // handle value as string, becouse double value are not exact 18 18 DoubleSpinBox(Layout *parent, int row, int col, QString name, QString suffix, 19 QString value, float min, float max, float step, int decimals);19 QString value, float min, float max, float step, uint16_t decimals); 20 20 ~DoubleSpinBox(); 21 21 -
trunk/tools/FlairGCS/src/Layout.cpp
r269 r437 127 127 double max = dom->attribute("max").toDouble(); 128 128 double step = dom->attribute("step").toDouble(); 129 int decimals = dom->attribute("decimals").toInt();129 uint16_t decimals = dom->attribute("decimals").toUShort(); 130 130 widget = new DoubleSpinBox(this, row, col, name, suffix, value, min, max, 131 131 step, decimals); … … 139 139 double max = dom->attribute("max").toDouble(); 140 140 double step = dom->attribute("step").toDouble(); 141 int decimals = dom->attribute("decimals").toInt();141 uint16_t decimals = dom->attribute("decimals").toUShort(); 142 142 widget = new Vector3DSpinBox(this, row, col, name, value, min, max, step, 143 143 decimals); … … 148 148 } 149 149 if (type == "ComboBox") { 150 int value = dom->attribute("value").toInt();150 uint16_t value = dom->attribute("value").toUShort(); 151 151 widget = new ComboBox(this, row, col, name, value); 152 152 } … … 158 158 float ymax = dom->attribute("max").toFloat(); 159 159 int enabled = dom->attribute("enabled").toInt(); 160 int period = dom->attribute("period").toInt(); 161 if (enabled == 1) { 162 widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period); 163 } else { 164 widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100); 160 uint16_t period = dom->attribute("period").toUShort(); 161 uint16_t nb_buffering = dom->attribute("nb_buf").toUShort(); 162 if (enabled == 1) { 163 widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period,nb_buffering); 164 } else { 165 widget = new DataPlot1D(this, row, col, name, ymin, ymax, false, 100,nb_buffering); 165 166 } 166 167 } … … 173 174 QString y_name = dom->attribute("y_name"); 174 175 int enabled = dom->attribute("enabled").toInt(); 175 int period = dom->attribute("period").toInt(); 176 uint16_t period = dom->attribute("period").toUShort(); 177 uint16_t nb_buffering = dom->attribute("nb_buf").toUShort(); 176 178 if (enabled == 1) { 177 179 widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax, 178 ymin, ymax, true, period );180 ymin, ymax, true, period,nb_buffering); 179 181 } else { 180 182 widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax, 181 ymin, ymax, false, 100 );183 ymin, ymax, false, 100,nb_buffering); 182 184 } 183 185 } … … 187 189 QString y_name = dom->attribute("y_name"); 188 190 int enabled = dom->attribute("enabled").toInt(); 189 int period = dom->attribute("period").toInt();191 uint16_t period = dom->attribute("period").toUShort(); 190 192 QString type = dom->attribute("type"); 191 193 int samples = dom->attribute("samples").toInt(); … … 210 212 uint32_t nb_samples = dom->attribute("nb_samples").toUInt(); 211 213 int enabled = dom->attribute("enabled").toInt(); 212 int period = dom->attribute("period").toInt();214 uint16_t period = dom->attribute("period").toUShort(); 213 215 int invert_axis = dom->attribute("invert_axis").toInt(); 214 216 bool invert_axis_bool; … … 234 236 int height = dom->attribute("height").toInt(); 235 237 int enabled = dom->attribute("enabled").toInt(); 236 int period = dom->attribute("period").toInt();238 uint16_t period = dom->attribute("period").toUShort(); 237 239 if (enabled == 1) { 238 240 widget = new Picture(this, row, col, name, width, height, true, period); … … 242 244 } 243 245 if (type == "Map") { 244 int period = dom->attribute("period").toInt();246 uint16_t period = dom->attribute("period").toUShort(); 245 247 int enabled = dom->attribute("enabled").toInt(); 246 248 int i = 0; -
trunk/tools/FlairGCS/src/Map.cpp
r269 r437 24 24 25 25 Map::Map(Layout *parent, int row, int col, QString name, 26 QList<QGeoCoordinate> coordinates, bool enabled, int period)26 QList<QGeoCoordinate> coordinates, bool enabled, uint16_t period) 27 27 : DataRemote(name, "Map", parent, enabled, period) { 28 28 visible_widget = new QWidget(); -
trunk/tools/FlairGCS/src/Map.h
r269 r437 30 30 public: 31 31 Map(Layout *parent, int row, int col, QString name, 32 QList<QtMobility::QGeoCoordinate> coordinates, bool enabled, int period);32 QList<QtMobility::QGeoCoordinate> coordinates, bool enabled, uint16_t period); 33 33 ~Map(); 34 34 void setCenteredPoint(int i); -
trunk/tools/FlairGCS/src/Picture.cpp
r269 r437 13 13 14 14 Picture::Picture(Layout *parent, int row, int col, QString name, uint16_t width, 15 uint16_t height, bool enabled, int period)15 uint16_t height, bool enabled, uint16_t period) 16 16 : DataRemote(name, "Picture", parent, enabled, period) { 17 17 box = new QGroupBox(name); -
trunk/tools/FlairGCS/src/Picture.h
r269 r437 22 22 public: 23 23 Picture(Layout *parent, int row, int col, QString name, uint16_t width, 24 uint16_t height, bool enabled, int period);24 uint16_t height, bool enabled, uint16_t period); 25 25 ~Picture(); 26 26 -
trunk/tools/FlairGCS/src/RangeFinderPlot.cpp
r269 r437 23 23 float start_angle, float end_angle, 24 24 uint32_t nb_samples, QString data_type, 25 bool invert_axis, bool enabled, int period)25 bool invert_axis, bool enabled, uint16_t period) 26 26 : DataRemote(name, "RangeFinderPlot", parent, enabled, period) { 27 27 invert_axis = true; -
trunk/tools/FlairGCS/src/RangeFinderPlot.h
r269 r437 22 22 float ymin, float ymax, float start_angle, float end_angle, 23 23 uint32_t nb_samples, QString data_type, bool invert_axis, 24 bool enabled, int period);24 bool enabled, uint16_t period); 25 25 ~RangeFinderPlot(); 26 26 -
trunk/tools/FlairGCS/src/UsSensorPlot.cpp
r269 r437 24 24 25 25 UsSensorPlot::UsSensorPlot(Layout *parent, int row, int col, QString plot_name, 26 QString y_name, float ymin, float ymax, uint32_t nbSamples,QString datasType,bool enabled, int period)26 QString y_name, float ymin, float ymax, uint32_t nbSamples,QString datasType,bool enabled, uint16_t period) 27 27 : DataRemote(plot_name, "UsSensorPlot", parent, enabled, period) { 28 28 visible_widget = new QWidget(); -
trunk/tools/FlairGCS/src/UsSensorPlot.h
r269 r437 23 23 public: 24 24 UsSensorPlot(Layout *parent, int row, int col, QString plot_name, 25 QString y_name, float ymin,float ymax, uint32_t nbSamples,QString datasType,bool enabled, int period);25 QString y_name, float ymin,float ymax, uint32_t nbSamples,QString datasType,bool enabled, uint16_t period); 26 26 ~UsSensorPlot(); 27 27 -
trunk/tools/FlairGCS/src/Vector3DSpinBox.cpp
r269 r437 13 13 Vector3DSpinBox::Vector3DSpinBox(Layout *parent, int row, int col, QString name, 14 14 QString value[3], float min, float max, 15 float step, int decimals)15 float step, uint16_t decimals) 16 16 : XmlWidget(name, "Vector3DSpinBox", parent) { 17 17 for (int i = 0; i < 3; i++) { -
trunk/tools/FlairGCS/src/Vector3DSpinBox.h
r269 r437 20 20 Vector3DSpinBox(Layout *parent, int row, int col, QString name, 21 21 QString value[3], float min, float max, float step, 22 int decimals);22 uint16_t decimals); 23 23 ~Vector3DSpinBox(); 24 24
Note:
See TracChangeset
for help on using the changeset viewer.