1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

GCS/OPMap-Added missing header information. Did some cleaning

This commit is contained in:
PT_Dreamer 2012-06-25 19:41:59 +01:00
parent 55af80ffaf
commit ecbf02fd33
18 changed files with 388 additions and 253 deletions

View File

@ -1,3 +1,30 @@
/**
******************************************************************************
*
* @file flightdatamodel.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "flightdatamodel.h"
#include <QMessageBox>
#include <QDomDocument>
@ -517,7 +544,6 @@ void flightDataModel::readFromFile(QString fileName)
removeRows(0,rowCount());
QFile file(fileName);
QDomDocument doc("PathPlan");
qDebug()<<"FILE OPEN"<<file.open(QFile::ReadOnly|QFile::Text);
if (!doc.setContent(file.readAll())) {
QMessageBox msgBox;
msgBox.setText(tr("File Parsing Failed."));
@ -544,13 +570,11 @@ void flightDataModel::readFromFile(QString fileName)
while (!node.isNull()) {
QDomElement e = node.toElement();
if (e.tagName() == "waypoint") {
qDebug()<<"waypoint number"<<e.attribute("number");
QDomNode fieldNode=e.firstChild();
data=new pathPlanData;
while (!fieldNode.isNull()) {
QDomElement field = fieldNode.toElement();
if (field.tagName() == "field") {
qDebug()<<field.attribute("name");
if(field.attribute("name")=="altitude")
data->altitude=field.attribute("value").toDouble();
else if(field.attribute("name")=="description")
@ -602,7 +626,6 @@ void flightDataModel::readFromFile(QString fileName)
}
fieldNode=fieldNode.nextSibling();
qDebug()<<"field node is null"<<fieldNode.isNull();
}
beginInsertRows(QModelIndex(),dataStorage.length(),dataStorage.length());
dataStorage.append(data);

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file flightdatamodel.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLIGHTDATAMODEL_H
#define FLIGHTDATAMODEL_H
#include <QAbstractTableModel>
@ -51,11 +77,6 @@ private:
QList<pathPlanData *> dataStorage;
QVariant getColumnByIndex(const pathPlanData *row, const int index) const;
bool setColumnByIndex(pathPlanData *row, const int index, const QVariant value);
signals:
//void dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
};
#endif // FLIGHTDATAMODEL_H

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file homeeditor.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "homeeditor.h"
#include "ui_homeeditor.h"

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file homeeditor.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef HOMEEDITOR_H
#define HOMEEDITOR_H

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file pathplanmanager.cpp
* @file modelmapproxy.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
@ -37,15 +37,6 @@ modelMapProxy::modelMapProxy(QObject *parent,OPMapWidget *map,flightDataModel *
connect(myMap,SIGNAL(WPValuesChanged(WayPointItem*)),this,SLOT(on_WPValuesChanged(WayPointItem*)));
}
void modelMapProxy::on_WPDeleted(int wp_numberint,WayPointItem * wp)
{
}
void modelMapProxy::on_WPInserted(int wp_number, WayPointItem * wp)
{
}
void modelMapProxy::on_WPValuesChanged(WayPointItem * wp)
{
QModelIndex index;
@ -87,18 +78,18 @@ modelMapProxy::overlayType modelMapProxy::overlayTranslate(int type)
{
switch(type)
{
case ComboBoxDelegate::MODE_FLYENDPOINT:
case ComboBoxDelegate::MODE_FLYVECTOR:
case ComboBoxDelegate::MODE_DRIVEENDPOINT:
case ComboBoxDelegate::MODE_DRIVEVECTOR:
case mapDataDelegate::MODE_FLYENDPOINT:
case mapDataDelegate::MODE_FLYVECTOR:
case mapDataDelegate::MODE_DRIVEENDPOINT:
case mapDataDelegate::MODE_DRIVEVECTOR:
return OVERLAY_LINE;
break;
case ComboBoxDelegate::MODE_FLYCIRCLERIGHT:
case ComboBoxDelegate::MODE_DRIVECIRCLERIGHT:
case mapDataDelegate::MODE_FLYCIRCLERIGHT:
case mapDataDelegate::MODE_DRIVECIRCLERIGHT:
return OVERLAY_CIRCLE_RIGHT;
break;
case ComboBoxDelegate::MODE_FLYCIRCLELEFT:
case ComboBoxDelegate::MODE_DRIVECIRCLELEFT:
case mapDataDelegate::MODE_FLYCIRCLELEFT:
case mapDataDelegate::MODE_DRIVECIRCLELEFT:
return OVERLAY_CIRCLE_LEFT;
break;
default:
@ -172,23 +163,23 @@ void modelMapProxy::refreshOverlays()
createOverlay(wp_current,findWayPointNumber(wp_error),wp_error_overlay,Qt::red);
switch(model->data(model->index(x,flightDataModel::COMMAND)).toInt())
{
case ComboBoxDelegate::COMMAND_ONCONDITIONNEXTWAYPOINT:
case mapDataDelegate::COMMAND_ONCONDITIONNEXTWAYPOINT:
wp_next=findWayPointNumber(x+1);
createOverlay(wp_current,wp_next,wp_next_overlay,Qt::green);
break;
case ComboBoxDelegate::COMMAND_ONCONDITIONJUMPWAYPOINT:
case mapDataDelegate::COMMAND_ONCONDITIONJUMPWAYPOINT:
wp_next=findWayPointNumber(wp_jump);
createOverlay(wp_current,wp_next,wp_jump_overlay,Qt::green);
break;
case ComboBoxDelegate::COMMAND_ONNOTCONDITIONJUMPWAYPOINT:
case mapDataDelegate::COMMAND_ONNOTCONDITIONJUMPWAYPOINT:
wp_next=findWayPointNumber(wp_jump);
createOverlay(wp_current,wp_next,wp_jump_overlay,Qt::yellow);
break;
case ComboBoxDelegate::COMMAND_ONNOTCONDITIONNEXTWAYPOINT:
case mapDataDelegate::COMMAND_ONNOTCONDITIONNEXTWAYPOINT:
wp_next=findWayPointNumber(x+1);
createOverlay(wp_current,wp_next,wp_next_overlay,Qt::yellow);
break;
case ComboBoxDelegate::COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT:
case mapDataDelegate::COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT:
wp_next=findWayPointNumber(wp_jump);
createOverlay(wp_current,wp_next,wp_jump_overlay,Qt::green);
wp_next=findWayPointNumber(x+1);
@ -207,8 +198,6 @@ WayPointItem * modelMapProxy::findWayPointNumber(int number)
void modelMapProxy::on_rowsRemoved(const QModelIndex &parent, int first, int last)
{
qDebug()<<"modelMapProxy::on_rowsRemoved"<<"first"<<first<<"last"<<last;
for(int x=last;x>first-1;x--)
{
myMap->WPDelete(x);

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file modelmapproxy.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MODELMAPPROXY_H
#define MODELMAPPROXY_H
#include <QWidget>
@ -26,9 +52,6 @@ private slots:
void on_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
void on_rowsInserted ( const QModelIndex & parent, int first, int last );
void on_rowsRemoved ( const QModelIndex & parent, int first, int last );
void on_WPDeleted(int wp_numberint, WayPointItem *);
void on_WPInserted(int,WayPointItem*);
void on_WPValuesChanged(WayPointItem *wp);
void on_currentRowChanged(QModelIndex,QModelIndex);
void on_selectedWPChanged(QList<WayPointItem*>);

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file modeluavproxy.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "modeluavoproxy.h"
#include "extensionsystem/pluginmanager.h"
#include <math.h>
@ -11,32 +37,7 @@ modelUavoProxy::modelUavoProxy(QObject *parent,flightDataModel * model):QObject(
Q_ASSERT(waypointObj != NULL);
pathactionObj=PathAction::GetInstance(objManager);
Q_ASSERT(pathactionObj != NULL);
/*
int instances=objManager->getNumInstances(pathactionObj->getObjID());
PathAction * actionObj=new PathAction;
actionObj->initialize(instances,actionObj->getMetaObject());
objManager->registerObject(actionObj);
actionObj->updated();
instances=objManager->getNumInstances(pathactionObj->getObjID());
actionObj=new PathAction;
actionObj->initialize(instances,actionObj->getMetaObject());
objManager->registerObject(actionObj);
actionObj->updated();
instances=objManager->getNumInstances(pathactionObj->getObjID());
actionObj=new PathAction;
actionObj->initialize(instances,actionObj->getMetaObject());
objManager->registerObject(actionObj);
actionObj->updated();
*/
}
/*WPDESCRITPTION,LATPOSITION,LNGPOSITION,DISRELATIVE,BEARELATIVE,ISRELATIVE,ALTITUDE,
VELOCITY,MODE,MODE_PARAMS0,MODE_PARAMS1,MODE_PARAMS2,MODE_PARAMS3,
CONDITION,CONDITION_PARAMS0,CONDITION_PARAMS1,CONDITION_PARAMS2,CONDITION_PARAMS3,
COMMAND,JUMPDESTINATION,ERRORDESTINATION,LOCKED
*/
void modelUavoProxy::modelToObjects()
{
PathAction * act=NULL;

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
*
* @file modeluavproxy.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MODELUAVOPROXY_H
#define MODELUAVOPROXY_H

View File

@ -42,43 +42,39 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstract
connect(ui->cbMode,SIGNAL(currentIndexChanged(int)),this,SLOT(setupModeWidgets()));
connect(ui->cbCondition,SIGNAL(currentIndexChanged(int)),this,SLOT(setupConditionWidgets()));
ComboBoxDelegate::loadComboBox(ui->cbMode,flightDataModel::MODE);
ComboBoxDelegate::loadComboBox(ui->cbCondition,flightDataModel::CONDITION);
ComboBoxDelegate::loadComboBox(ui->cbCommand,flightDataModel::COMMAND);
// VELOCITY,
mapDataDelegate::loadComboBox(ui->cbMode,flightDataModel::MODE);
mapDataDelegate::loadComboBox(ui->cbCondition,flightDataModel::CONDITION);
mapDataDelegate::loadComboBox(ui->cbCommand,flightDataModel::COMMAND);
mapper = new QDataWidgetMapper(this);
mapper->setItemDelegate(new ComboBoxDelegate(this));
mapper->setItemDelegate(new mapDataDelegate(this));
connect(mapper,SIGNAL(currentIndexChanged(int)),this,SLOT(on_currentIndexChanged(int)));
mapper->setModel(model);
//mapper->addMapping(ui->spinBoxNumber,
mapper->addMapping(ui->checkBoxLocked,flightDataModel::LOCKED);
mapper->addMapping(ui->doubleSpinBoxLatitude,flightDataModel::LATPOSITION);
mapper->addMapping(ui->doubleSpinBoxLongitude,flightDataModel::LNGPOSITION);
mapper->addMapping(ui->doubleSpinBoxAltitude,flightDataModel::ALTITUDE);
mapper->addMapping(ui->lineEditDescription,flightDataModel::WPDESCRITPTION);
mapper->addMapping(ui->checkBoxRelative,flightDataModel::ISRELATIVE);
mapper->addMapping(ui->doubleSpinBoxBearing,flightDataModel::BEARELATIVE);
mapper->addMapping(ui->doubleSpinBoxVelocity,flightDataModel::VELOCITY);
mapper->addMapping(ui->spinBoxDistance,flightDataModel::DISRELATIVE);
mapper->addMapping(ui->cbMode,flightDataModel::MODE);
mapper->addMapping(ui->dsb_modeParam1,flightDataModel::MODE_PARAMS0);
mapper->addMapping(ui->dsb_modeParam2,flightDataModel::MODE_PARAMS1);
mapper->addMapping(ui->dsb_modeParam3,flightDataModel::MODE_PARAMS2);
mapper->addMapping(ui->dsb_modeParam4,flightDataModel::MODE_PARAMS3);
mapper->setModel(model);
mapper->addMapping(ui->checkBoxLocked,flightDataModel::LOCKED);
mapper->addMapping(ui->doubleSpinBoxLatitude,flightDataModel::LATPOSITION);
mapper->addMapping(ui->doubleSpinBoxLongitude,flightDataModel::LNGPOSITION);
mapper->addMapping(ui->doubleSpinBoxAltitude,flightDataModel::ALTITUDE);
mapper->addMapping(ui->lineEditDescription,flightDataModel::WPDESCRITPTION);
mapper->addMapping(ui->checkBoxRelative,flightDataModel::ISRELATIVE);
mapper->addMapping(ui->doubleSpinBoxBearing,flightDataModel::BEARELATIVE);
mapper->addMapping(ui->doubleSpinBoxVelocity,flightDataModel::VELOCITY);
mapper->addMapping(ui->spinBoxDistance,flightDataModel::DISRELATIVE);
mapper->addMapping(ui->cbMode,flightDataModel::MODE);
mapper->addMapping(ui->dsb_modeParam1,flightDataModel::MODE_PARAMS0);
mapper->addMapping(ui->dsb_modeParam2,flightDataModel::MODE_PARAMS1);
mapper->addMapping(ui->dsb_modeParam3,flightDataModel::MODE_PARAMS2);
mapper->addMapping(ui->dsb_modeParam4,flightDataModel::MODE_PARAMS3);
mapper->addMapping(ui->cbCondition,flightDataModel::CONDITION);
mapper->addMapping(ui->dsb_condParam1,flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->dsb_condParam2,flightDataModel::CONDITION_PARAMS1);
mapper->addMapping(ui->dsb_condParam3,flightDataModel::CONDITION_PARAMS2);
mapper->addMapping(ui->dsb_condParam4,flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->cbCondition,flightDataModel::CONDITION);
mapper->addMapping(ui->dsb_condParam1,flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->dsb_condParam2,flightDataModel::CONDITION_PARAMS1);
mapper->addMapping(ui->dsb_condParam3,flightDataModel::CONDITION_PARAMS2);
mapper->addMapping(ui->dsb_condParam4,flightDataModel::CONDITION_PARAMS0);
mapper->addMapping(ui->cbCommand,flightDataModel::COMMAND);
mapper->addMapping(ui->sbJump,flightDataModel::JUMPDESTINATION);
mapper->addMapping(ui->sbError,flightDataModel::ERRORDESTINATION);
connect(itemSelection,SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),this,SLOT(on_currentRowChanged(QModelIndex,QModelIndex)));
mapper->addMapping(ui->cbCommand,flightDataModel::COMMAND);
mapper->addMapping(ui->sbJump,flightDataModel::JUMPDESTINATION);
mapper->addMapping(ui->sbError,flightDataModel::ERRORDESTINATION);
connect(itemSelection,SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),this,SLOT(on_currentRowChanged(QModelIndex,QModelIndex)));
}
void opmap_edit_waypoint_dialog::on_currentIndexChanged(int index)
{
@ -90,44 +86,31 @@ void opmap_edit_waypoint_dialog::on_currentIndexChanged(int index)
itemSelection->setCurrentIndex(idx,QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
// destrutor
opmap_edit_waypoint_dialog::~opmap_edit_waypoint_dialog()
{
delete ui;
}
// *********************************************************************
void opmap_edit_waypoint_dialog::on_pushButtonOK_clicked()
{
close();
}
void opmap_edit_waypoint_dialog::on_pushButtonApply_clicked()
{
}
void opmap_edit_waypoint_dialog::on_pushButtonRevert_clicked()
{
}
void opmap_edit_waypoint_dialog::setupModeWidgets()
{
ComboBoxDelegate::ModeOptions mode=(ComboBoxDelegate::ModeOptions)ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt();
mapDataDelegate::ModeOptions mode=(mapDataDelegate::ModeOptions)ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt();
switch(mode)
{
case ComboBoxDelegate::MODE_FLYENDPOINT:
case ComboBoxDelegate::MODE_FLYVECTOR:
case ComboBoxDelegate::MODE_FLYCIRCLERIGHT:
case ComboBoxDelegate::MODE_FLYCIRCLELEFT:
case ComboBoxDelegate::MODE_DRIVEENDPOINT:
case ComboBoxDelegate::MODE_DRIVEVECTOR:
case ComboBoxDelegate::MODE_DRIVECIRCLELEFT:
case ComboBoxDelegate::MODE_DRIVECIRCLERIGHT:
case ComboBoxDelegate::MODE_DISARMALARM:
case mapDataDelegate::MODE_FLYENDPOINT:
case mapDataDelegate::MODE_FLYVECTOR:
case mapDataDelegate::MODE_FLYCIRCLERIGHT:
case mapDataDelegate::MODE_FLYCIRCLELEFT:
case mapDataDelegate::MODE_DRIVEENDPOINT:
case mapDataDelegate::MODE_DRIVEVECTOR:
case mapDataDelegate::MODE_DRIVECIRCLELEFT:
case mapDataDelegate::MODE_DRIVECIRCLERIGHT:
case mapDataDelegate::MODE_DISARMALARM:
ui->modeParam1->setVisible(false);
ui->modeParam2->setVisible(false);
ui->modeParam3->setVisible(false);
@ -137,7 +120,7 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
ui->dsb_modeParam3->setVisible(false);
ui->dsb_modeParam4->setVisible(false);
break;
case ComboBoxDelegate::MODE_FIXEDATTITUDE:
case mapDataDelegate::MODE_FIXEDATTITUDE:
ui->modeParam1->setText("pitch");
ui->modeParam2->setText("roll");
ui->modeParam3->setText("yaw");
@ -151,7 +134,7 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
ui->dsb_modeParam3->setVisible(true);
ui->dsb_modeParam4->setVisible(true);
break;
case ComboBoxDelegate::MODE_SETACCESSORY:
case mapDataDelegate::MODE_SETACCESSORY:
ui->modeParam1->setText("Acc.channel");
ui->modeParam2->setText("Value");
ui->modeParam1->setVisible(true);
@ -167,12 +150,12 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
}
void opmap_edit_waypoint_dialog::setupConditionWidgets()
{
ComboBoxDelegate::EndConditionOptions mode=(ComboBoxDelegate::EndConditionOptions)ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt();
mapDataDelegate::EndConditionOptions mode=(mapDataDelegate::EndConditionOptions)ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt();
switch(mode)
{
case ComboBoxDelegate::ENDCONDITION_NONE:
case ComboBoxDelegate::ENDCONDITION_IMMEDIATE:
case ComboBoxDelegate::ENDCONDITION_PYTHONSCRIPT:
case mapDataDelegate::ENDCONDITION_NONE:
case mapDataDelegate::ENDCONDITION_IMMEDIATE:
case mapDataDelegate::ENDCONDITION_PYTHONSCRIPT:
ui->condParam1->setVisible(false);
ui->condParam2->setVisible(false);
ui->condParam3->setVisible(false);
@ -182,7 +165,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->dsb_condParam3->setVisible(false);
ui->dsb_condParam4->setVisible(false);
break;
case ComboBoxDelegate::ENDCONDITION_TIMEOUT:
case mapDataDelegate::ENDCONDITION_TIMEOUT:
ui->condParam1->setVisible(true);
ui->condParam2->setVisible(false);
ui->condParam3->setVisible(false);
@ -193,7 +176,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->dsb_condParam4->setVisible(false);
ui->condParam1->setText("Timeout(ms)");
break;
case ComboBoxDelegate::ENDCONDITION_DISTANCETOTARGET:
case mapDataDelegate::ENDCONDITION_DISTANCETOTARGET:
ui->condParam1->setVisible(true);
ui->condParam2->setVisible(true);
ui->condParam3->setVisible(false);
@ -205,7 +188,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->condParam1->setText("Distance(m)");
ui->condParam2->setText("Flag(0=2D,1=3D)");//FIXME
break;
case ComboBoxDelegate::ENDCONDITION_LEGREMAINING:
case mapDataDelegate::ENDCONDITION_LEGREMAINING:
ui->condParam1->setVisible(true);
ui->condParam2->setVisible(false);
ui->condParam3->setVisible(false);
@ -216,7 +199,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->dsb_condParam4->setVisible(false);
ui->condParam1->setText("Relative Distance(0=complete,1=just starting)");
break;
case ComboBoxDelegate::ENDCONDITION_ABOVEALTITUDE:
case mapDataDelegate::ENDCONDITION_ABOVEALTITUDE:
ui->condParam1->setVisible(true);
ui->condParam2->setVisible(false);
ui->condParam3->setVisible(false);
@ -227,7 +210,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
ui->dsb_condParam4->setVisible(false);
ui->condParam1->setText("Altitude in meters (negative)");
break;
case ComboBoxDelegate::ENDCONDITION_POINTINGTOWARDSNEXT:
case mapDataDelegate::ENDCONDITION_POINTINGTOWARDSNEXT:
ui->condParam1->setVisible(true);
ui->condParam2->setVisible(false);
ui->condParam3->setVisible(false);
@ -249,16 +232,6 @@ void opmap_edit_waypoint_dialog::on_pushButtonCancel_clicked()
close();
}
int opmap_edit_waypoint_dialog::saveSettings()
{
}
void opmap_edit_waypoint_dialog::loadFromWP(mapcontrol::WayPointItem *waypoint_item)
{
}
void opmap_edit_waypoint_dialog::editWaypoint(mapcontrol::WayPointItem *waypoint_item)
{
if (!waypoint_item) return;
@ -266,8 +239,6 @@ void opmap_edit_waypoint_dialog::editWaypoint(mapcontrol::WayPointItem *waypoint
mapper->setCurrentIndex(waypoint_item->Number());
}
// *********************************************************************
void opmap_edit_waypoint_dialog::on_pushButton_clicked()
{
mapper->toPrevious();

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file opmap_edit_waypoint_dialog.cpp
* @file opmap_edit_waypoint_dialog.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
@ -51,12 +51,9 @@ public:
*/
void editWaypoint(mapcontrol::WayPointItem *waypoint_item);
void loadFromWP(mapcontrol::WayPointItem *waypoint_item);
private:
Ui::opmap_edit_waypoint_dialog *ui;
mapcontrol::WayPointItem * my_waypoint;
int saveSettings();
QDataWidgetMapper *mapper;
QAbstractItemModel * model;
QItemSelectionModel * itemSelection;
@ -68,8 +65,6 @@ private slots:
void setupPositionWidgets(bool isRelative);
void setupConditionWidgets();
void on_pushButtonCancel_clicked();
void on_pushButtonRevert_clicked();
void on_pushButtonApply_clicked();
void on_pushButtonOK_clicked();
void on_pushButton_clicked();
void on_pushButton_2_clicked();

View File

@ -33,7 +33,6 @@
#include "opmapgadgetconfiguration.h"
class IUAVGadget;
//class QList<int>;
class QWidget;
class QString;
class OPMapGadgetWidget;

View File

@ -289,17 +289,17 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
delete m_map;
m_map = NULL;
}
if(model)
if(!model.isNull())
delete model;
if(table)
if(!table.isNull())
delete table;
if(selectionModel)
if(!selectionModel.isNull())
delete selectionModel;
if(mapProxy)
if(!mapProxy.isNull())
delete mapProxy;
if(waypoint_edit_dialog)
if(!waypoint_edit_dialog.isNull())
delete waypoint_edit_dialog;
if(UAVProxy)
if(!UAVProxy.isNull())
delete UAVProxy;
}
@ -625,9 +625,6 @@ void OPMapGadgetWidget::updateMousePos()
// find out if we are over the home position
mapcontrol::HomeItem *home = qgraphicsitem_cast<mapcontrol::HomeItem *>(item);
// find out if we are over the UAV
mapcontrol::UAVItem *uav = qgraphicsitem_cast<mapcontrol::UAVItem *>(item);
// find out if we have a waypoint under the mouse cursor
mapcontrol::WayPointItem *wp = qgraphicsitem_cast<mapcontrol::WayPointItem *>(item);
@ -658,19 +655,6 @@ void OPMapGadgetWidget::updateMousePos()
s += " " + QString::number(dist * 1000, 'f', 1) + "m";
s += " " + QString::number(bear, 'f', 1) + "deg";
}
else
if (uav)
{
s += " uav";
double latitude;
double longitude;
double altitude;
if (getUAVPosition(latitude, longitude, altitude)) // get current UAV position
{
internals::PointLatLng uav_pos = internals::PointLatLng(latitude, longitude);
}
}
m_widget->labelMousePos->setText(s);
}
@ -1459,10 +1443,6 @@ void OPMapGadgetWidget::createActions()
uavTrailDistance_act->setData(uav_trail_distance);
uavTrailDistanceAct.append(uavTrailDistance_act);
}
// *****
// ***********************
}
void OPMapGadgetWidget::onReloadAct_triggered()

View File

@ -208,58 +208,30 @@ private slots:
void on_tbFind_clicked();
void onHomeDoubleClick(HomeItem*);
private:
// *****
int m_min_zoom;
int m_max_zoom;
double m_heading; // uav heading
internals::PointLatLng m_mouse_lat_lon;
internals::PointLatLng m_context_menu_lat_lon;
int m_prev_tile_number;
opMapModeType m_map_mode;
int m_maxUpdateRate;
t_home m_home_position;
QStringList findPlaceWordList;
QCompleter *findPlaceCompleter;
QTimer *m_updateTimer;
QTimer *m_statusUpdateTimer;
Ui::OPMap_Widget *m_widget;
mapcontrol::OPMapWidget *m_map;
ExtensionSystem::PluginManager *pm;
UAVObjectManager *obm;
UAVObjectUtilManager *obum;
opmap_edit_waypoint_dialog * waypoint_edit_dialog;
QPointer<opmap_edit_waypoint_dialog> waypoint_edit_dialog;
QStandardItemModel wayPoint_treeView_model;
mapcontrol::WayPointItem *m_mouse_waypoint;
modelUavoProxy * UAVProxy;
QPointer<modelUavoProxy> UAVProxy;
QMutex m_map_mutex;
bool m_telemetry_connected;
// *****
void createActions();
QAction *closeAct1;
QAction *closeAct2;
QAction *reloadAct;
@ -314,15 +286,11 @@ private:
QActionGroup *maxUpdateRateActGroup;
QList<QAction *> maxUpdateRateAct;
// *****
void createActions();
void homeMagicWaypoint();
void moveToMagicWaypointPosition();
void hideMagicWaypointControls();
void showMagicWaypointControls();
void keepMagicWaypointWithInSafeArea();
double distance(internals::PointLatLng from, internals::PointLatLng to);
@ -340,10 +308,10 @@ private:
internals::PointLatLng lastLatLngMouse;
WayPointItem * magicWayPoint;
flightDataModel * model;
pathPlanner * table;
modelMapProxy * mapProxy;
QItemSelectionModel * selectionModel;
QPointer<flightDataModel> model;
QPointer<pathPlanner> table;
QPointer<modelMapProxy> mapProxy;
QPointer<QItemSelectionModel> selectionModel;
};
#endif /* OPMAP_GADGETWIDGET_H_ */

View File

@ -1,3 +1,30 @@
/**
******************************************************************************
*
* @file pathplanner.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pathplanner.h"
#include "ui_pathplanner.h"
#include "widgetdelegates.h"
@ -6,7 +33,7 @@
pathPlanner::pathPlanner(QWidget *parent) :
QWidget(parent),
ui(new Ui::testTable),wid(NULL),myModel(NULL)
ui(new Ui::pathPlannerUI),wid(NULL),myModel(NULL)
{
ui->setupUi(this);
}
@ -23,7 +50,7 @@ void pathPlanner::setModel(flightDataModel *model,QItemSelectionModel *selection
ui->tableView->setModel(model);
ui->tableView->setSelectionModel(selection);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setItemDelegate(new ComboBoxDelegate(this));
ui->tableView->setItemDelegate(new mapDataDelegate(this));
connect(model,SIGNAL(rowsInserted(const QModelIndex&,int,int)),this,SLOT(on_rowsInserted(const QModelIndex&,int,int)));
wid=new opmap_edit_waypoint_dialog(NULL,model,selection);
ui->tableView->resizeColumnsToContents();
@ -82,7 +109,6 @@ void pathPlanner::on_groupBox_clicked()
void pathPlanner::on_groupBox_toggled(bool arg1)
{
// wid->close();
wid->setVisible(arg1);
}

View File

@ -1,11 +1,38 @@
#ifndef TESTTABLE_H
#define TESTTABLE_H
/**
******************************************************************************
*
* @file pathplanner.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PATHPLANNER_H
#define PATHPLANNER_H
#include <QWidget>
#include "flightdatamodel.h"
#include "opmap_edit_waypoint_dialog.h"
namespace Ui {
class testTable;
class pathPlannerUI;
}
class pathPlanner : public QWidget
@ -41,7 +68,7 @@ private slots:
void on_tbFetchFromUAV_clicked();
private:
Ui::testTable *ui;
Ui::pathPlannerUI *ui;
opmap_edit_waypoint_dialog * wid;
flightDataModel * myModel;
signals:
@ -49,4 +76,4 @@ signals:
void receivePathPlanFromUAV();
};
#endif // TESTTABLE_H
#endif // PATHPLANNER_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>testTable</class>
<widget class="QWidget" name="testTable">
<class>pathPlannerUI</class>
<widget class="QWidget" name="pathPlannerUI">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -1,8 +1,34 @@
/**
******************************************************************************
*
* @file widgetdelegates.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "widgetdelegates.h"
#include <QComboBox>
#include <QRadioButton>
#include <QDebug>
QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
QWidget *mapDataDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option,
const QModelIndex & index) const
{
@ -12,18 +38,18 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
{
case flightDataModel::MODE:
box=new QComboBox(parent);
ComboBoxDelegate::loadComboBox(box,flightDataModel::MODE);
mapDataDelegate::loadComboBox(box,flightDataModel::MODE);
return box;
break;
case flightDataModel::CONDITION:
box=new QComboBox(parent);
ComboBoxDelegate::loadComboBox(box,flightDataModel::CONDITION);
mapDataDelegate::loadComboBox(box,flightDataModel::CONDITION);
return box;
break;
case flightDataModel::COMMAND:
box=new QComboBox(parent);
ComboBoxDelegate::loadComboBox(box,flightDataModel::COMMAND);
mapDataDelegate::loadComboBox(box,flightDataModel::COMMAND);
return box;
break;
default:
@ -35,7 +61,7 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
return editor;
}
void ComboBoxDelegate::setEditorData(QWidget *editor,
void mapDataDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
QString className=editor->metaObject()->className();
@ -46,16 +72,11 @@ void ComboBoxDelegate::setEditorData(QWidget *editor,
qDebug()<<"VALUE="<<x;
comboBox->setCurrentIndex(x);
}
/* else if (className.contains("QRadioButton")) {
bool value = index.model()->data(index, Qt::EditRole).toBool();
QRadioButton *radioButton = static_cast<QRadioButton*>(editor);
radioButton->setChecked(value);
}*/
else
QItemDelegate::setEditorData(editor, index);
}
void ComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
void mapDataDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
QString className=editor->metaObject()->className();
@ -63,23 +84,18 @@ void ComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
QComboBox *comboBox = static_cast<QComboBox*>(editor);
int value = comboBox->itemData(comboBox->currentIndex()).toInt();
model->setData(index, value, Qt::EditRole);
}/*
else if (className.contains("QRadioButton")) {
QRadioButton *radioButton = static_cast<QRadioButton*>(editor);
bool value = radioButton->isChecked();
model->setData(index, value, Qt::EditRole);
}*/
}
else
QItemDelegate::setModelData(editor,model,index);
}
void ComboBoxDelegate::updateEditorGeometry(QWidget *editor,
void mapDataDelegate::updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
{
editor->setGeometry(option.rect);
}
void ComboBoxDelegate::loadComboBox(QComboBox *combo, flightDataModel::pathPlanDataEnum type)
void mapDataDelegate::loadComboBox(QComboBox *combo, flightDataModel::pathPlanDataEnum type)
{
switch(type)
{
@ -119,15 +135,7 @@ void ComboBoxDelegate::loadComboBox(QComboBox *combo, flightDataModel::pathPlanD
break;
}
}
/*
void ComboBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionComboBox opt;
opt.rect=option.rect;
QApplication::style()->drawComplexControl(QStyle::CC_ComboBox, &opt,
painter,createEditor(this,option,index));
}*/
ComboBoxDelegate::ComboBoxDelegate(QObject *parent):QItemDelegate(parent)
mapDataDelegate::mapDataDelegate(QObject *parent):QItemDelegate(parent)
{
}

View File

@ -1,3 +1,30 @@
/**
******************************************************************************
*
* @file widgetdelegates.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin OpenPilot Map Plugin
* @{
* @brief The OpenPilot Map plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WIDGETDELEGATES_H
#define WIDGETDELEGATES_H
#include <QItemDelegate>
@ -5,7 +32,7 @@
#include "flightdatamodel.h"
class ComboBoxDelegate : public QItemDelegate
class mapDataDelegate : public QItemDelegate
{
Q_OBJECT
@ -20,7 +47,7 @@ class ComboBoxDelegate : public QItemDelegate
COMMAND_ONCONDITIONJUMPWAYPOINT=2, COMMAND_ONNOTCONDITIONJUMPWAYPOINT=3,
COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT=4 } CommandOptions;
ComboBoxDelegate(QObject *parent = 0);
mapDataDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
@ -32,7 +59,6 @@ class ComboBoxDelegate : public QItemDelegate
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
static void loadComboBox(QComboBox * combo,flightDataModel::pathPlanDataEnum type);
//void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // WIDGETDELEGATES_H