Changeset 269 in flair-src for trunk/tools/FlairGCS/src/Layout.cpp


Ignore:
Timestamp:
Oct 4, 2018, 1:53:11 PM (7 years ago)
Author:
Sanahuja Guillaume
Message:

flairgcs:
speed up processing time when receiving datas from uav
triger watchdog while receiving datas from uav
(avoids connection lost in uav)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/FlairGCS/src/Layout.cpp

    r244 r269  
    6969QGridLayout *Layout::getQGridLayout() { return qgridlayout; }
    7070
    71 void Layout::XmlEvent(QDomElement dom) {
     71void Layout::XmlEvent(QDomElement *dom) {
    7272  XmlWidget *widget = NULL;
    73   QString type = dom.tagName();
    74   QString name = dom.attribute("name");
    75   QString old_name = dom.attribute("old_name");
    76   int row = dom.attribute("row").toInt();
    77   int col = dom.attribute("col").toInt();
     73  QString type = dom->tagName();
     74  QString name = dom->attribute("name");
     75  QString old_name = dom->attribute("old_name");
     76  int row = dom->attribute("row").toInt();
     77  int col = dom->attribute("col").toInt();
    7878
    7979  // initially rowCount()=1 and columnCount()=1 but count()=0 !
     
    103103
    104104  if (type == "TabWidget") {
    105     int position = dom.attribute("position").toInt();
     105    int position = dom->attribute("position").toInt();
    106106    widget =
    107107        new TabWidget(this, row, col, name, (QTabWidget::TabPosition)position);
     
    114114  }
    115115  if (type == "SpinBox") {
    116     int value = dom.attribute("value").toInt();
    117     QString suffix = dom.attribute("suffix");
    118     int min = dom.attribute("min").toInt();
    119     int max = dom.attribute("max").toInt();
    120     int step = dom.attribute("step").toInt();
     116    int value = dom->attribute("value").toInt();
     117    QString suffix = dom->attribute("suffix");
     118    int min = dom->attribute("min").toInt();
     119    int max = dom->attribute("max").toInt();
     120    int step = dom->attribute("step").toInt();
    121121    widget = new SpinBox(this, row, col, name, suffix, value, min, max, step);
    122122  }
    123123  if (type == "DoubleSpinBox") {
    124     QString value = dom.attribute("value");
    125     QString suffix = dom.attribute("suffix");
    126     double min = dom.attribute("min").toDouble();
    127     double max = dom.attribute("max").toDouble();
    128     double step = dom.attribute("step").toDouble();
    129     int decimals = dom.attribute("decimals").toInt();
     124    QString value = dom->attribute("value");
     125    QString suffix = dom->attribute("suffix");
     126    double min = dom->attribute("min").toDouble();
     127    double max = dom->attribute("max").toDouble();
     128    double step = dom->attribute("step").toDouble();
     129    int decimals = dom->attribute("decimals").toInt();
    130130    widget = new DoubleSpinBox(this, row, col, name, suffix, value, min, max,
    131131                               step, decimals);
     
    133133  if (type == "Vector3DSpinBox") {
    134134    QString value[3];
    135     value[0] = dom.attribute("value_x");
    136     value[1] = dom.attribute("value_y");
    137     value[2] = dom.attribute("value_z");
    138     double min = dom.attribute("min").toDouble();
    139     double max = dom.attribute("max").toDouble();
    140     double step = dom.attribute("step").toDouble();
    141     int decimals = dom.attribute("decimals").toInt();
     135    value[0] = dom->attribute("value_x");
     136    value[1] = dom->attribute("value_y");
     137    value[2] = dom->attribute("value_z");
     138    double min = dom->attribute("min").toDouble();
     139    double max = dom->attribute("max").toDouble();
     140    double step = dom->attribute("step").toDouble();
     141    int decimals = dom->attribute("decimals").toInt();
    142142    widget = new Vector3DSpinBox(this, row, col, name, value, min, max, step,
    143143                                 decimals);
    144144  }
    145145  if (type == "CheckBox") {
    146     int value = dom.attribute("value").toInt();
     146    int value = dom->attribute("value").toInt();
    147147    widget = new CheckBox(this, row, col, name, value);
    148148  }
    149149  if (type == "ComboBox") {
    150     int value = dom.attribute("value").toInt();
     150    int value = dom->attribute("value").toInt();
    151151    widget = new ComboBox(this, row, col, name, value);
    152152  }
     
    155155  }
    156156  if (type == "DataPlot1D") {
    157     float ymin = dom.attribute("min").toFloat();
    158     float ymax = dom.attribute("max").toFloat();
    159     int enabled = dom.attribute("enabled").toInt();
    160     int period = dom.attribute("period").toInt();
     157    float ymin = dom->attribute("min").toFloat();
     158    float ymax = dom->attribute("max").toFloat();
     159    int enabled = dom->attribute("enabled").toInt();
     160    int period = dom->attribute("period").toInt();
    161161    if (enabled == 1) {
    162162      widget = new DataPlot1D(this, row, col, name, ymin, ymax, true, period);
     
    166166  }
    167167  if (type == "DataPlot2D") {
    168     float xmin = dom.attribute("xmin").toFloat();
    169     float xmax = dom.attribute("xmax").toFloat();
    170     float ymin = dom.attribute("ymin").toFloat();
    171     float ymax = dom.attribute("ymax").toFloat();
    172     QString x_name = dom.attribute("x_name");
    173     QString y_name = dom.attribute("y_name");
    174     int enabled = dom.attribute("enabled").toInt();
    175     int period = dom.attribute("period").toInt();
     168    float xmin = dom->attribute("xmin").toFloat();
     169    float xmax = dom->attribute("xmax").toFloat();
     170    float ymin = dom->attribute("ymin").toFloat();
     171    float ymax = dom->attribute("ymax").toFloat();
     172    QString x_name = dom->attribute("x_name");
     173    QString y_name = dom->attribute("y_name");
     174    int enabled = dom->attribute("enabled").toInt();
     175    int period = dom->attribute("period").toInt();
    176176    if (enabled == 1) {
    177177      widget = new DataPlot2D(this, row, col, name, x_name, y_name, xmin, xmax,
     
    183183  }
    184184  if (type == "UsSensorPlot") {
    185     float ymin = dom.attribute("ymin").toFloat();
    186     float ymax = dom.attribute("ymax").toFloat();
    187     QString y_name = dom.attribute("y_name");
    188     int enabled = dom.attribute("enabled").toInt();
    189     int period = dom.attribute("period").toInt();
    190     QString type = dom.attribute("type");
    191     int samples = dom.attribute("samples").toInt();
     185    float ymin = dom->attribute("ymin").toFloat();
     186    float ymax = dom->attribute("ymax").toFloat();
     187    QString y_name = dom->attribute("y_name");
     188    int enabled = dom->attribute("enabled").toInt();
     189    int period = dom->attribute("period").toInt();
     190    QString type = dom->attribute("type");
     191    int samples = dom->attribute("samples").toInt();
    192192    if (enabled == 1) {
    193193      widget = new UsSensorPlot(this, row, col, name, y_name,
     
    199199  }
    200200  if (type == "RangeFinderPlot") {
    201     float xmin = dom.attribute("xmin").toFloat();
    202     float xmax = dom.attribute("xmax").toFloat();
    203     float ymin = dom.attribute("ymin").toFloat();
    204     float ymax = dom.attribute("ymax").toFloat();
    205     QString x_name = dom.attribute("x_name");
    206     QString y_name = dom.attribute("y_name");
    207     QString data_type = dom.attribute("type");
    208     float start_angle = dom.attribute("start_angle").toFloat();
    209     float end_angle = dom.attribute("end_angle").toFloat();
    210     uint32_t nb_samples = dom.attribute("nb_samples").toUInt();
    211     int enabled = dom.attribute("enabled").toInt();
    212     int period = dom.attribute("period").toInt();
    213     int invert_axis = dom.attribute("invert_axis").toInt();
     201    float xmin = dom->attribute("xmin").toFloat();
     202    float xmax = dom->attribute("xmax").toFloat();
     203    float ymin = dom->attribute("ymin").toFloat();
     204    float ymax = dom->attribute("ymax").toFloat();
     205    QString x_name = dom->attribute("x_name");
     206    QString y_name = dom->attribute("y_name");
     207    QString data_type = dom->attribute("type");
     208    float start_angle = dom->attribute("start_angle").toFloat();
     209    float end_angle = dom->attribute("end_angle").toFloat();
     210    uint32_t nb_samples = dom->attribute("nb_samples").toUInt();
     211    int enabled = dom->attribute("enabled").toInt();
     212    int period = dom->attribute("period").toInt();
     213    int invert_axis = dom->attribute("invert_axis").toInt();
    214214    bool invert_axis_bool;
    215215    if (invert_axis == 0) {
     
    231231  }
    232232  if (type == "Picture") {
    233     int width = dom.attribute("width").toInt();
    234     int height = dom.attribute("height").toInt();
    235     int enabled = dom.attribute("enabled").toInt();
    236     int period = dom.attribute("period").toInt();
     233    int width = dom->attribute("width").toInt();
     234    int height = dom->attribute("height").toInt();
     235    int enabled = dom->attribute("enabled").toInt();
     236    int period = dom->attribute("period").toInt();
    237237    if (enabled == 1) {
    238238      widget = new Picture(this, row, col, name, width, height, true, period);
     
    242242  }
    243243  if (type == "Map") {
    244     int period = dom.attribute("period").toInt();
    245     int enabled = dom.attribute("enabled").toInt();
     244    int period = dom->attribute("period").toInt();
     245    int enabled = dom->attribute("enabled").toInt();
    246246    int i = 0;
    247247    QList<QtMobility::QGeoCoordinate> coordinates;
    248     while (dom.hasAttribute("lat" + QString::number(i))) {
    249       double latitude = dom.attribute("lat" + QString::number(i)).toDouble();
    250       double longitude = dom.attribute("long" + QString::number(i)).toDouble();
    251       double alt = dom.attribute("alt" + QString::number(i)).toDouble();
     248    while (dom->hasAttribute("lat" + QString::number(i))) {
     249      double latitude = dom->attribute("lat" + QString::number(i)).toDouble();
     250      double longitude = dom->attribute("long" + QString::number(i)).toDouble();
     251      double alt = dom->attribute("alt" + QString::number(i)).toDouble();
    252252      QtMobility::QGeoCoordinate coordinate =
    253253          QtMobility::QGeoCoordinate(latitude, longitude, alt);
     
    272272    QStringList items;
    273273    int count = 0;
    274     while (dom.hasAttribute("item" + QString::number(count))) {
    275       QString item = dom.attribute("item" + QString::number(count));
     274    while (dom->hasAttribute("item" + QString::number(count))) {
     275      QString item = dom->attribute("item" + QString::number(count));
    276276      items.append(item);
    277277      count++;
Note: See TracChangeset for help on using the changeset viewer.