GCS/OPmap lib - changed the flight planner to a model view aproach
@ -55,6 +55,7 @@ namespace mapcontrol
|
||||
connect(map->core,SIGNAL(OnTileLoadStart()),this,SIGNAL(OnTileLoadStart()));
|
||||
connect(map->core,SIGNAL(OnTilesStillToLoad(int)),this,SIGNAL(OnTilesStillToLoad(int)));
|
||||
connect(map,SIGNAL(wpdoubleclicked(WayPointItem*)),this,SIGNAL(OnWayPointDoubleClicked(WayPointItem*)));
|
||||
connect(&mscene,SIGNAL(selectionChanged()),this,SLOT(OnSelectionChanged()));
|
||||
SetShowDiagnostics(showDiag);
|
||||
this->setMouseTracking(followmouse);
|
||||
SetShowCompass(true);
|
||||
@ -301,6 +302,37 @@ namespace mapcontrol
|
||||
emit WPDeleted(item->Number(),item);
|
||||
delete item;
|
||||
}
|
||||
void OPMapWidget::WPDelete(int number)
|
||||
{
|
||||
foreach(QGraphicsItem* i,map->childItems())
|
||||
{
|
||||
WayPointItem* w=qgraphicsitem_cast<WayPointItem*>(i);
|
||||
if(w)
|
||||
{
|
||||
if(w->Number()==number)
|
||||
{
|
||||
emit WPDeleted(w->Number(),w);
|
||||
delete w;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WayPointItem * OPMapWidget::WPFind(int number)
|
||||
{
|
||||
foreach(QGraphicsItem* i,map->childItems())
|
||||
{
|
||||
WayPointItem* w=qgraphicsitem_cast<WayPointItem*>(i);
|
||||
if(w)
|
||||
{
|
||||
if(w->Number()==number)
|
||||
{
|
||||
return w;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void OPMapWidget::WPSetVisibleAll(bool value)
|
||||
{
|
||||
foreach(QGraphicsItem* i,map->childItems())
|
||||
@ -378,6 +410,8 @@ namespace mapcontrol
|
||||
{
|
||||
connect(item,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),this,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),Qt::DirectConnection);
|
||||
connect(item,SIGNAL(WPValuesChanged(WayPointItem*)),this,SIGNAL(WPValuesChanged(WayPointItem*)),Qt::DirectConnection);
|
||||
connect(item,SIGNAL(localPositionChanged(QPointF,WayPointItem*)),this,SIGNAL(WPLocalPositionChanged(QPointF,WayPointItem*)),Qt::DirectConnection);
|
||||
connect(item,SIGNAL(manualCoordChange(WayPointItem*)),this,SIGNAL(WPManualCoordChange(WayPointItem*)),Qt::DirectConnection);
|
||||
connect(this,SIGNAL(WPInserted(int,WayPointItem*)),item,SLOT(WPInserted(int,WayPointItem*)),Qt::DirectConnection);
|
||||
connect(this,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),item,SLOT(WPRenumbered(int,int,WayPointItem*)),Qt::DirectConnection);
|
||||
connect(this,SIGNAL(WPDeleted(int,WayPointItem*)),item,SLOT(WPDeleted(int,WayPointItem*)),Qt::DirectConnection);
|
||||
@ -438,4 +472,28 @@ namespace mapcontrol
|
||||
{
|
||||
new MapRipper(core,map->SelectedArea());
|
||||
}
|
||||
|
||||
void OPMapWidget::setSelectedWP(QList<WayPointItem * >list)
|
||||
{
|
||||
this->scene()->clearSelection();
|
||||
foreach(WayPointItem * wp,list)
|
||||
{
|
||||
wp->setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapWidget::OnSelectionChanged()
|
||||
{
|
||||
QList<QGraphicsItem*> list;
|
||||
QList<WayPointItem*> wplist;
|
||||
list=this->scene()->selectedItems();
|
||||
foreach(QGraphicsItem* item,list)
|
||||
{
|
||||
WayPointItem * wp=qgraphicsitem_cast<WayPointItem*>(item);
|
||||
if(wp)
|
||||
wplist.append(wp);
|
||||
}
|
||||
if(wplist.length()>0)
|
||||
emit selectedWPChanged(wplist);
|
||||
}
|
||||
}
|
||||
|
@ -369,6 +369,9 @@ namespace mapcontrol
|
||||
void WPSetVisibleAll(bool value);
|
||||
WayPointItem *magicWPCreate();
|
||||
bool WPPresent();
|
||||
void WPDelete(int number);
|
||||
WayPointItem *WPFind(int number);
|
||||
void setSelectedWP(QList<WayPointItem *> list);
|
||||
private:
|
||||
internals::Core *core;
|
||||
MapGraphicItem *map;
|
||||
@ -434,6 +437,9 @@ namespace mapcontrol
|
||||
* @param number number of the deleted WayPoint
|
||||
*/
|
||||
void WPDeleted(int const& number,WayPointItem* waypoint);
|
||||
|
||||
void WPLocalPositionChanged(QPointF,WayPointItem*);
|
||||
void WPManualCoordChange(WayPointItem*);
|
||||
/**
|
||||
* @brief Fires When a WayPoint is Reached
|
||||
*
|
||||
@ -493,11 +499,13 @@ namespace mapcontrol
|
||||
*/
|
||||
void OnTilesStillToLoad(int number);
|
||||
void OnWayPointDoubleClicked(WayPointItem * waypoint);
|
||||
void selectedWPChanged(QList<WayPointItem*>);
|
||||
public slots:
|
||||
/**
|
||||
* @brief Ripps the current selection to the DB
|
||||
*/
|
||||
void RipMap();
|
||||
void OnSelectionChanged();
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord,int const& altitu
|
||||
map->Projection()->offSetFromLatLngs(myHome->Coord(),coord,relativeCoord.distance,relativeCoord.bearing);
|
||||
connect(myHome,SIGNAL(homePositionChanged(internals::PointLatLng)),this,SLOT(onHomePositionChanged(internals::PointLatLng)));
|
||||
connect(this,SIGNAL(waypointdoubleclick(WayPointItem*)),map,SIGNAL(wpdoubleclicked(WayPointItem*)));
|
||||
emit manualCoordChange(this);
|
||||
}
|
||||
|
||||
WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(false),description(""),shownumber(true),isDragging(false),altitude(0),map(map)
|
||||
@ -95,6 +96,7 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
connect(myHome,SIGNAL(homePositionChanged(internals::PointLatLng)),this,SLOT(onHomePositionChanged(internals::PointLatLng)));
|
||||
}
|
||||
connect(this,SIGNAL(waypointdoubleclick(WayPointItem*)),map,SIGNAL(wpdoubleclicked(WayPointItem*)));
|
||||
emit manualCoordChange(this);
|
||||
}
|
||||
WayPointItem::WayPointItem(const internals::PointLatLng &coord,int const& altitude, const QString &description, MapGraphicItem *map,wptype type):coord(coord),reached(false),description(description),shownumber(true),isDragging(false),altitude(altitude),map(map),myType(type)
|
||||
{
|
||||
@ -123,6 +125,8 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
connect(myHome,SIGNAL(homePositionChanged(internals::PointLatLng)),this,SLOT(onHomePositionChanged(internals::PointLatLng)));
|
||||
}
|
||||
connect(this,SIGNAL(waypointdoubleclick(WayPointItem*)),map,SIGNAL(wpdoubleclicked(WayPointItem*)));
|
||||
qDebug()<<"Waypoint CTOR distance"<<relativeCoord.distance;
|
||||
emit manualCoordChange(this);
|
||||
}
|
||||
|
||||
WayPointItem::WayPointItem(const distBearing &relativeCoordenate, const int &altitude, const QString &description, MapGraphicItem *map):relativeCoord(relativeCoordenate),reached(false),description(description),shownumber(true),isDragging(false),altitude(altitude),map(map)
|
||||
@ -153,7 +157,7 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
RefreshToolTip();
|
||||
RefreshPos();
|
||||
connect(this,SIGNAL(waypointdoubleclick(WayPointItem*)),map,SIGNAL(wpdoubleclicked(WayPointItem*)));
|
||||
|
||||
emit manualCoordChange(this);
|
||||
}
|
||||
|
||||
void WayPointItem::setWPType(wptype type)
|
||||
@ -174,6 +178,7 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->drawPixmap(-picture.width()/2,-picture.height(),picture);
|
||||
painter->setPen(Qt::green);
|
||||
if(this->isSelected())
|
||||
painter->drawRect(QRectF(-picture.width()/2,-picture.height(),picture.width()-1,picture.height()-1));
|
||||
}
|
||||
@ -220,7 +225,8 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
|
||||
isDragging=false;
|
||||
RefreshToolTip();
|
||||
emit localPositionChanged(this->pos());
|
||||
emit manualCoordChange(this);
|
||||
emit localPositionChanged(this->pos(),this);
|
||||
emit WPValuesChanged(this);
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
@ -239,7 +245,7 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
QString relativeCoord_str = QString::number(relativeCoord.distance) + "m " + QString::number(relativeCoord.bearing*180/M_PI)+"deg";
|
||||
text->setText(coord_str+"\n"+relativeCoord_str);
|
||||
textBG->setRect(text->boundingRect());
|
||||
emit localPositionChanged(this->pos());
|
||||
emit localPositionChanged(this->pos(),this);
|
||||
emit WPValuesChanged(this);
|
||||
}
|
||||
QGraphicsItem::mouseMoveEvent(event);
|
||||
@ -266,10 +272,21 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
}
|
||||
void WayPointItem::SetCoord(const internals::PointLatLng &value)
|
||||
{
|
||||
if(this->WPType()==relative)
|
||||
return;
|
||||
bool abs_coord=false;
|
||||
bool rel_coord=false;
|
||||
if(coord!=value)
|
||||
abs_coord=true;
|
||||
coord=value;
|
||||
distBearing back=relativeCoord;
|
||||
qDebug()<<"SET COORD"<<value.Lat()<<value.Lng();
|
||||
if(myHome)
|
||||
map->Projection()->offSetFromLatLngs(myHome->Coord(),coord,relativeCoord.distance,relativeCoord.bearing);
|
||||
emit WPValuesChanged(this);
|
||||
if(back.distance!=relativeCoord.distance||back.bearing!=relativeCoord.bearing)
|
||||
rel_coord=true;
|
||||
if(abs_coord||rel_coord)
|
||||
emit WPValuesChanged(this);
|
||||
RefreshPos();
|
||||
RefreshToolTip();
|
||||
this->update();
|
||||
@ -354,6 +371,12 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
RefreshToolTip();
|
||||
this->update();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myHome)
|
||||
map->Projection()->offSetFromLatLngs(myHome->Coord(),coord,relativeCoord.distance,relativeCoord.bearing);
|
||||
emit WPValuesChanged(this);
|
||||
}
|
||||
}
|
||||
void WayPointItem::WPRenumbered(const int &oldnumber, const int &newnumber, WayPointItem *waypoint)
|
||||
{
|
||||
@ -388,7 +411,7 @@ WayPointItem::WayPointItem(MapGraphicItem *map, bool magicwaypoint):reached(fals
|
||||
{
|
||||
core::Point point=map->FromLatLngToLocal(coord);
|
||||
this->setPos(point.X(),point.Y());
|
||||
emit localPositionChanged(this->pos());
|
||||
emit localPositionChanged(this->pos(),this);
|
||||
}
|
||||
void WayPointItem::RefreshToolTip()
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ struct distBearing
|
||||
{
|
||||
double distance;
|
||||
double bearing;
|
||||
double bearingToDegrees(){return bearing*180/M_PI;}
|
||||
void setBearingFromDegrees(double degrees){bearing=degrees*M_PI/180;}
|
||||
};
|
||||
class HomeItem;
|
||||
/**
|
||||
@ -227,9 +229,11 @@ signals:
|
||||
*
|
||||
* @param waypoint a pointer to this WayPoint
|
||||
*/
|
||||
|
||||
void WPValuesChanged(WayPointItem* waypoint);
|
||||
void waypointdoubleclick(WayPointItem* waypoint);
|
||||
void localPositionChanged(QPointF point);
|
||||
void localPositionChanged(QPointF point,WayPointItem* waypoint);
|
||||
void manualCoordChange(WayPointItem *);
|
||||
void aboutToBeDeleted(WayPointItem *);
|
||||
};
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ WayPointLine::WayPointLine(HomeItem *from, WayPointItem *to, MapGraphicItem *map
|
||||
{
|
||||
this->setLine(to->pos().x(),to->pos().y(),from->pos().x(),from->pos().y());
|
||||
connect(from,SIGNAL(homePositionChanged(internals::PointLatLng)),this,SLOT(refreshLocations()));
|
||||
connect(to,SIGNAL(localPositionChanged(QPointF)),this,SLOT(refreshLocations()));
|
||||
connect(to,SIGNAL(localPositionChanged(QPointF,WayPointItem*)),this,SLOT(refreshLocations()));
|
||||
connect(to,SIGNAL(aboutToBeDeleted(WayPointItem*)),this,SLOT(waypointdeleted()));
|
||||
}
|
||||
int WayPointLine::type() const
|
||||
|
583
ground/openpilotgcs/src/plugins/opmap/flightdatamodel.cpp
Normal file
@ -0,0 +1,583 @@
|
||||
#include "flightdatamodel.h"
|
||||
#include <QMessageBox>
|
||||
#include <QDomDocument>
|
||||
flightDataModel::flightDataModel(QObject *parent):QAbstractTableModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int flightDataModel::rowCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return dataStorage.length();
|
||||
}
|
||||
|
||||
int flightDataModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
|
||||
QVariant flightDataModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole||role==Qt::EditRole)
|
||||
{
|
||||
int rowNumber=index.row();
|
||||
int columnNumber=index.column();
|
||||
if(rowNumber>dataStorage.length()-1)
|
||||
return QVariant();
|
||||
pathPlanData * myRow=dataStorage.at(rowNumber);
|
||||
QVariant ret=getColumnByIndex(myRow,columnNumber);
|
||||
return ret;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const QVariant value)
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case WPDESCRITPTION:
|
||||
row->wpDescritption=value.toString();
|
||||
return true;
|
||||
break;
|
||||
case LATPOSITION:
|
||||
row->latPosition=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case LNGPOSITION:
|
||||
row->lngPosition=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case DISRELATIVE:
|
||||
row->disRelative=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case BEARELATIVE:
|
||||
row->beaRelative=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case ISRELATIVE:
|
||||
row->isRelative=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case ALTITUDE:
|
||||
row->altitude=value.toDouble();
|
||||
return true;
|
||||
break;
|
||||
case VELOCITY:
|
||||
row->velocity=value.toFloat();
|
||||
return true;
|
||||
break;
|
||||
case MODE:
|
||||
row->mode=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case MODE_PARAMS0:
|
||||
row->mode_params[0]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case MODE_PARAMS1:
|
||||
row->mode_params[1]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case MODE_PARAMS2:
|
||||
row->mode_params[2]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case MODE_PARAMS3:
|
||||
row->mode_params[3]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case CONDITION:
|
||||
row->condition=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case CONDITION_PARAMS0:
|
||||
row->condition_params[0]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case CONDITION_PARAMS1:
|
||||
row->condition_params[1]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case CONDITION_PARAMS2:
|
||||
row->condition_params[2]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case CONDITION_PARAMS3:
|
||||
row->condition_params[3]=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case COMMAND:
|
||||
row->command=value.toInt();
|
||||
break;
|
||||
case JUMPDESTINATION:
|
||||
row->jumpdestination=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case ERRORDESTINATION:
|
||||
row->errordestination=value.toInt();
|
||||
return true;
|
||||
break;
|
||||
case LOCKED:
|
||||
row->locked=value.toBool();
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
QVariant flightDataModel::getColumnByIndex(const pathPlanData *row,const int index) const
|
||||
{
|
||||
switch(index)
|
||||
{
|
||||
case WPDESCRITPTION:
|
||||
return row->wpDescritption;
|
||||
break;
|
||||
case LATPOSITION:
|
||||
return row->latPosition;
|
||||
break;
|
||||
case LNGPOSITION:
|
||||
return row->lngPosition;
|
||||
break;
|
||||
case DISRELATIVE:
|
||||
return row->disRelative;
|
||||
break;
|
||||
case BEARELATIVE:
|
||||
return row->beaRelative;
|
||||
break;
|
||||
case ISRELATIVE:
|
||||
return row->isRelative;
|
||||
break;
|
||||
case ALTITUDE:
|
||||
return row->altitude;
|
||||
break;
|
||||
case VELOCITY:
|
||||
return row->velocity;
|
||||
break;
|
||||
case MODE:
|
||||
return row->mode;
|
||||
break;
|
||||
case MODE_PARAMS0:
|
||||
return row->mode_params[0];
|
||||
break;
|
||||
case MODE_PARAMS1:
|
||||
return row->mode_params[1];
|
||||
break;
|
||||
case MODE_PARAMS2:
|
||||
return row->mode_params[2];
|
||||
break;
|
||||
case MODE_PARAMS3:
|
||||
return row->mode_params[3];
|
||||
break;
|
||||
case CONDITION:
|
||||
return row->condition;
|
||||
break;
|
||||
case CONDITION_PARAMS0:
|
||||
return row->condition_params[0];
|
||||
break;
|
||||
case CONDITION_PARAMS1:
|
||||
return row->condition_params[1];
|
||||
break;
|
||||
case CONDITION_PARAMS2:
|
||||
return row->condition_params[2];
|
||||
break;
|
||||
case CONDITION_PARAMS3:
|
||||
return row->condition_params[3];
|
||||
break;
|
||||
case COMMAND:
|
||||
return row->command;
|
||||
break;
|
||||
case JUMPDESTINATION:
|
||||
return row->jumpdestination;
|
||||
break;
|
||||
case ERRORDESTINATION:
|
||||
return row->errordestination;
|
||||
break;
|
||||
case LOCKED:
|
||||
return row->locked;
|
||||
}
|
||||
}
|
||||
QVariant flightDataModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
if(orientation==Qt::Vertical)
|
||||
{
|
||||
return QString::number(section);
|
||||
}
|
||||
else if (orientation == Qt::Horizontal) {
|
||||
switch (section)
|
||||
{
|
||||
case WPDESCRITPTION:
|
||||
return QString("Description");
|
||||
break;
|
||||
case LATPOSITION:
|
||||
return QString("Latitude");
|
||||
break;
|
||||
case LNGPOSITION:
|
||||
return QString("Longitude");
|
||||
break;
|
||||
case DISRELATIVE:
|
||||
return QString("Distance to home");
|
||||
break;
|
||||
case BEARELATIVE:
|
||||
return QString("Bearing from home");
|
||||
break;
|
||||
case ISRELATIVE:
|
||||
return QString("Relative to home");
|
||||
break;
|
||||
case ALTITUDE:
|
||||
return QString("Altitude");
|
||||
break;
|
||||
case VELOCITY:
|
||||
return QString("Velocity");
|
||||
break;
|
||||
case MODE:
|
||||
return QString("Mode");
|
||||
break;
|
||||
case MODE_PARAMS0:
|
||||
return QString("Mode parameter 0");
|
||||
break;
|
||||
case MODE_PARAMS1:
|
||||
return QString("Mode parameter 1");
|
||||
break;
|
||||
case MODE_PARAMS2:
|
||||
return QString("Mode parameter 2");
|
||||
break;
|
||||
case MODE_PARAMS3:
|
||||
return QString("Mode parameter 3");
|
||||
break;
|
||||
case CONDITION:
|
||||
return QString("Condition");
|
||||
break;
|
||||
case CONDITION_PARAMS0:
|
||||
return QString("Condition parameter 0");
|
||||
break;
|
||||
case CONDITION_PARAMS1:
|
||||
return QString("Condition parameter 1");
|
||||
break;
|
||||
case CONDITION_PARAMS2:
|
||||
return QString("Condition parameter 2");
|
||||
break;
|
||||
case CONDITION_PARAMS3:
|
||||
return QString("Condition parameter 3");
|
||||
break;
|
||||
case COMMAND:
|
||||
return QString("Command");
|
||||
break;
|
||||
case JUMPDESTINATION:
|
||||
return QString("Jump Destination");
|
||||
break;
|
||||
case ERRORDESTINATION:
|
||||
return QString("Error Destination");
|
||||
break;
|
||||
case LOCKED:
|
||||
return QString("Locked");
|
||||
break;
|
||||
default:
|
||||
return QString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
bool flightDataModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (role == Qt::EditRole)
|
||||
{
|
||||
//save value from editor to member m_gridData
|
||||
int columnIndex=index.column();
|
||||
int rowIndex=index.row();
|
||||
if(rowIndex>dataStorage.length()-1)
|
||||
return false;
|
||||
pathPlanData * myRow=dataStorage.at(rowIndex);
|
||||
setColumnByIndex(myRow,columnIndex,value);
|
||||
emit dataChanged(index,index);
|
||||
//for presentation purposes only: build and emit a joined string
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Qt::ItemFlags flightDataModel::flags(const QModelIndex & /*index*/) const
|
||||
{
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ;
|
||||
}
|
||||
|
||||
bool flightDataModel::insertRows(int row, int count, const QModelIndex &/*parent*/)
|
||||
{
|
||||
pathPlanData * data;
|
||||
beginInsertRows(QModelIndex(),row,row+count-1);
|
||||
for(int x=0; x<count;++x)
|
||||
{
|
||||
data=new pathPlanData;
|
||||
data->latPosition=0;
|
||||
data->lngPosition=0;
|
||||
data->disRelative=0;
|
||||
data->beaRelative=0;
|
||||
data->isRelative=0;
|
||||
data->altitude=0;
|
||||
data->velocity=0;
|
||||
data->mode=0;
|
||||
data->mode_params[0]=0;
|
||||
data->mode_params[1]=0;
|
||||
data->mode_params[2]=0;
|
||||
data->mode_params[3]=0;
|
||||
data->condition=0;
|
||||
data->condition_params[0]=0;
|
||||
data->condition_params[1]=0;
|
||||
data->condition_params[2]=0;
|
||||
data->condition_params[3]=0;
|
||||
data->command=0;
|
||||
data->jumpdestination=0;
|
||||
data->errordestination=0;
|
||||
data->locked=false;
|
||||
dataStorage.insert(row,data);
|
||||
}
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
bool flightDataModel::removeRows(int row, int count, const QModelIndex &/*parent*/)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(),row,row+count-1);
|
||||
for(int x=0; x<count;++x)
|
||||
{
|
||||
delete dataStorage.at(row);
|
||||
dataStorage.removeAt(row);
|
||||
}
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
bool flightDataModel::writeToFile(QString fileName)
|
||||
{
|
||||
|
||||
QFile file(fileName);
|
||||
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::information(NULL, tr("Unable to open file"), file.errorString());
|
||||
return false;
|
||||
}
|
||||
QDataStream out(&file);
|
||||
QDomDocument doc("PathPlan");
|
||||
QDomElement root = doc.createElement("waypoints");
|
||||
doc.appendChild(root);
|
||||
|
||||
foreach(pathPlanData * obj,dataStorage)
|
||||
{
|
||||
|
||||
QDomElement waypoint = doc.createElement("waypoint");
|
||||
waypoint.setAttribute("number",dataStorage.indexOf(obj));
|
||||
root.appendChild(waypoint);
|
||||
QDomElement field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->wpDescritption);
|
||||
field.setAttribute("name","description");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->latPosition);
|
||||
field.setAttribute("name","latitude");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->lngPosition);
|
||||
field.setAttribute("name","longitude");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->disRelative);
|
||||
field.setAttribute("name","distance_to_home");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->beaRelative);
|
||||
field.setAttribute("name","bearing_from_home");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->isRelative);
|
||||
field.setAttribute("name","is_relative_to_home");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->altitude);
|
||||
field.setAttribute("name","altitude");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->velocity);
|
||||
field.setAttribute("name","velocity");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->mode);
|
||||
field.setAttribute("name","mode");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->mode_params[0]);
|
||||
field.setAttribute("name","mode_param0");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->mode_params[1]);
|
||||
field.setAttribute("name","mode_param1");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->mode_params[2]);
|
||||
field.setAttribute("name","mode_param2");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->mode_params[3]);
|
||||
field.setAttribute("name","mode_param3");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->condition);
|
||||
field.setAttribute("name","condition");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->condition_params[0]);
|
||||
field.setAttribute("name","condition_param0");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->condition_params[1]);
|
||||
field.setAttribute("name","condition_param1");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->condition_params[2]);
|
||||
field.setAttribute("name","condition_param2");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->condition_params[3]);
|
||||
field.setAttribute("name","condition_param3");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->command);
|
||||
field.setAttribute("name","command");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->jumpdestination);
|
||||
field.setAttribute("name","jumpdestination");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->errordestination);
|
||||
field.setAttribute("name","errordestination");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
field=doc.createElement("field");
|
||||
field.setAttribute("value",obj->locked);
|
||||
field.setAttribute("name","is_locked");
|
||||
waypoint.appendChild(field);
|
||||
|
||||
}
|
||||
file.write(doc.toString().toAscii());
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
void flightDataModel::readFromFile(QString fileName)
|
||||
{
|
||||
//TODO warning message
|
||||
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."));
|
||||
msgBox.setInformativeText(tr("This file is not a correct XML file"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
|
||||
if (root.isNull() || (root.tagName() != "waypoints")) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("Wrong file contents"));
|
||||
msgBox.setInformativeText(tr("This file does not contain correct UAVSettings"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
pathPlanData * data=NULL;
|
||||
QDomNode node = root.firstChild();
|
||||
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")
|
||||
data->wpDescritption=field.attribute("value");
|
||||
else if(field.attribute("name")=="latitude")
|
||||
data->latPosition=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="longitude")
|
||||
data->lngPosition=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="distance_to_home")
|
||||
data->disRelative=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="bearing_from_home")
|
||||
data->beaRelative=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="is_relative_to_home")
|
||||
data->isRelative=field.attribute("value").toInt();
|
||||
else if(field.attribute("name")=="altitude")
|
||||
data->altitude=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="velocity")
|
||||
data->velocity=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="mode")
|
||||
data->mode=field.attribute("value").toInt();
|
||||
else if(field.attribute("name")=="mode_param0")
|
||||
data->mode_params[0]=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="mode_param1")
|
||||
data->mode_params[1]=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="mode_param2")
|
||||
data->mode_params[2]=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="mode_param3")
|
||||
data->mode_params[3]=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="condition")
|
||||
data->condition=field.attribute("value").toDouble();
|
||||
else if(field.attribute("name")=="condition_param0")
|
||||
data->condition_params[0]=field.attribute("value").toFloat();
|
||||
else if(field.attribute("name")=="condition_param1")
|
||||
data->condition_params[1]=field.attribute("value").toFloat();
|
||||
else if(field.attribute("name")=="condition_param2")
|
||||
data->condition_params[2]=field.attribute("value").toFloat();
|
||||
else if(field.attribute("name")=="condition_param3")
|
||||
data->condition_params[3]=field.attribute("value").toFloat();
|
||||
else if(field.attribute("name")=="command")
|
||||
data->command=field.attribute("value").toInt();
|
||||
else if(field.attribute("name")=="jumpdestination")
|
||||
data->jumpdestination=field.attribute("value").toInt();
|
||||
else if(field.attribute("name")=="errordestination")
|
||||
data->errordestination=field.attribute("value").toInt();
|
||||
else if(field.attribute("name")=="is_locked")
|
||||
data->locked=field.attribute("value").toInt();
|
||||
|
||||
}
|
||||
fieldNode=fieldNode.nextSibling();
|
||||
qDebug()<<"field node is null"<<fieldNode.isNull();
|
||||
}
|
||||
beginInsertRows(QModelIndex(),dataStorage.length(),dataStorage.length());
|
||||
dataStorage.append(data);
|
||||
endInsertRows();
|
||||
}
|
||||
node=node.nextSibling();
|
||||
}
|
||||
}
|
||||
|
59
ground/openpilotgcs/src/plugins/opmap/flightdatamodel.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef FLIGHTDATAMODEL_H
|
||||
#define FLIGHTDATAMODEL_H
|
||||
#include <QAbstractTableModel>
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
|
||||
struct pathPlanData
|
||||
{
|
||||
QString wpDescritption;
|
||||
double latPosition;
|
||||
double lngPosition;
|
||||
double disRelative;
|
||||
double beaRelative;
|
||||
bool isRelative;
|
||||
double altitude;
|
||||
float velocity;
|
||||
int mode;
|
||||
float mode_params[4];
|
||||
int condition;
|
||||
float condition_params[4];
|
||||
int command;
|
||||
int jumpdestination;
|
||||
int errordestination;
|
||||
bool locked;
|
||||
};
|
||||
|
||||
class flightDataModel:public QAbstractTableModel
|
||||
{
|
||||
public:
|
||||
enum pathPlanDataEnum
|
||||
{
|
||||
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
|
||||
};
|
||||
flightDataModel(QObject *parent);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
|
||||
Qt::ItemFlags flags(const QModelIndex & index) const ;
|
||||
bool insertRows ( int row, int count, const QModelIndex & parent = QModelIndex() );
|
||||
bool removeRows ( int row, int count, const QModelIndex & parent = QModelIndex() );
|
||||
bool writeToFile(QString filename);
|
||||
void readFromFile(QString fileName);
|
||||
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
|
After Width: | Height: | Size: 3.2 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/down_alt.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/forward_alt.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/new archive.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/plus3.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/star.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/stopb.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/unarchive.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
ground/openpilotgcs/src/plugins/opmap/images/up_alt.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
270
ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp
Normal file
@ -0,0 +1,270 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file pathplanmanager.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 "modelmapproxy.h"
|
||||
|
||||
modelMapProxy::modelMapProxy(QObject *parent,OPMapWidget *map,flightDataModel * model,QItemSelectionModel * selectionModel):QObject(parent),myMap(map),model(model),selection(selectionModel)
|
||||
{
|
||||
connect(model,SIGNAL(rowsInserted(const QModelIndex&,int,int)),this,SLOT(on_rowsInserted(const QModelIndex&,int,int)));
|
||||
connect(model,SIGNAL(rowsRemoved(const QModelIndex&,int,int)),this,SLOT(on_rowsRemoved(const QModelIndex&,int,int)));
|
||||
connect(selection,SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),this,SLOT(on_currentRowChanged(QModelIndex,QModelIndex)));
|
||||
connect(model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(on_dataChanged(QModelIndex,QModelIndex)));
|
||||
connect(myMap,SIGNAL(selectedWPChanged(QList<WayPointItem*>)),this,SLOT(on_selectedWPChanged(QList<WayPointItem*>)));
|
||||
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;
|
||||
index=model->index(wp->Number(),flightDataModel::LATPOSITION);
|
||||
if(!index.isValid())
|
||||
return;
|
||||
model->setData(index,wp->Coord().Lat(),Qt::EditRole);
|
||||
index=model->index(wp->Number(),flightDataModel::LNGPOSITION);
|
||||
model->setData(index,wp->Coord().Lng(),Qt::EditRole);
|
||||
index=model->index(wp->Number(),flightDataModel::DISRELATIVE);
|
||||
model->setData(index,wp->getRelativeCoord().distance,Qt::EditRole);
|
||||
index=model->index(wp->Number(),flightDataModel::BEARELATIVE);
|
||||
model->setData(index,wp->getRelativeCoord().bearingToDegrees(),Qt::EditRole);
|
||||
}
|
||||
|
||||
void modelMapProxy::on_currentRowChanged(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
QList<WayPointItem*> list;
|
||||
WayPointItem * wp=findWayPointNumber(current.row());
|
||||
if(!wp)
|
||||
return;
|
||||
list.append(wp);
|
||||
myMap->setSelectedWP(list);
|
||||
}
|
||||
|
||||
void modelMapProxy::on_selectedWPChanged(QList<WayPointItem *> list)
|
||||
{
|
||||
selection->clearSelection();
|
||||
foreach(WayPointItem * wp,list)
|
||||
{
|
||||
QModelIndex index=model->index(wp->Number(),0);
|
||||
selection->setCurrentIndex(index,QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
/*
|
||||
typedef enum { MODE_FLYENDPOINT=0, MODE_FLYVECTOR=1, MODE_FLYCIRCLERIGHT=2, MODE_FLYCIRCLELEFT=3,
|
||||
MODE_DRIVEENDPOINT=4, MODE_DRIVEVECTOR=5, MODE_DRIVECIRCLELEFT=6, MODE_DRIVECIRCLERIGHT=7,
|
||||
MODE_FIXEDATTITUDE=8, MODE_SETACCESSORY=9, MODE_DISARMALARM=10 } ModeOptions;
|
||||
typedef enum { ENDCONDITION_NONE=0, ENDCONDITION_TIMEOUT=1, ENDCONDITION_DISTANCETOTARGET=2,
|
||||
ENDCONDITION_LEGREMAINING=3, ENDCONDITION_ABOVEALTITUDE=4, ENDCONDITION_POINTINGTOWARDSNEXT=5,
|
||||
ENDCONDITION_PYTHONSCRIPT=6, ENDCONDITION_IMMEDIATE=7 } EndConditionOptions;
|
||||
typedef enum { COMMAND_ONCONDITIONNEXTWAYPOINT=0, COMMAND_ONNOTCONDITIONNEXTWAYPOINT=1,
|
||||
COMMAND_ONCONDITIONJUMPWAYPOINT=2, COMMAND_ONNOTCONDITIONJUMPWAYPOINT=3,
|
||||
COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT=4 } CommandOptions;
|
||||
*/
|
||||
void modelMapProxy::refreshOverlays()
|
||||
{
|
||||
/*
|
||||
QMutexLocker locker(&wplistmutex);
|
||||
myMap->deleteAllOverlays();
|
||||
foreach(WayPointItem * wp,*waypoints)
|
||||
{
|
||||
customData data=wp->data(0).value<customData>();
|
||||
|
||||
switch(data.condition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
switch(data.mode)
|
||||
{
|
||||
case PathAction::MODE_FLYENDPOINT:
|
||||
case PathAction::MODE_FLYVECTOR:
|
||||
case PathAction::MODE_DRIVEENDPOINT:
|
||||
case PathAction::MODE_DRIVEVECTOR:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPLineCreate((HomeItem*)myMap->Home,wp);
|
||||
else
|
||||
myMap->WPLineCreate(findWayPointNumber(wp->Number()-1),wp);
|
||||
break;
|
||||
case PathAction::MODE_FLYCIRCLERIGHT:
|
||||
case PathAction::MODE_DRIVECIRCLERIGHT:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPCircleCreate((HomeItem*)myMap->Home,wp,true);
|
||||
myMap->WPCircleCreate(findWayPointNumber(wp->Number()-1),wp,true);
|
||||
break;
|
||||
case PathAction::MODE_FLYCIRCLELEFT:
|
||||
case PathAction::MODE_DRIVECIRCLELEFT:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPCircleCreate((HomeItem*)myMap->Home,wp,false);
|
||||
myMap->WPCircleCreate(findWayPointNumber(wp->Number()-1),wp,false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
WayPointItem * modelMapProxy::findWayPointNumber(int number)
|
||||
{
|
||||
if(number<0)
|
||||
return NULL;
|
||||
return myMap->WPFind(number);
|
||||
}
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void modelMapProxy::on_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
{
|
||||
WayPointItem * item=findWayPointNumber(topLeft.row());
|
||||
if(!item)
|
||||
return;
|
||||
internals::PointLatLng latlng;
|
||||
int x=topLeft.row();
|
||||
distBearing distBearing;
|
||||
double altitude;
|
||||
bool relative;
|
||||
QModelIndex index;
|
||||
QString desc;
|
||||
switch(topLeft.column())
|
||||
{
|
||||
case flightDataModel::WPDESCRITPTION:
|
||||
index=model->index(x,flightDataModel::WPDESCRITPTION);
|
||||
desc=index.data(Qt::DisplayRole).toString();
|
||||
item->SetDescription(desc);
|
||||
break;
|
||||
case flightDataModel::LATPOSITION:
|
||||
latlng=item->Coord();
|
||||
index=model->index(x,flightDataModel::LATPOSITION);
|
||||
latlng.SetLat(index.data(Qt::DisplayRole).toDouble());
|
||||
item->SetCoord(latlng);
|
||||
break;
|
||||
case flightDataModel::LNGPOSITION:
|
||||
latlng=item->Coord();
|
||||
index=model->index(x,flightDataModel::LNGPOSITION);
|
||||
latlng.SetLng(index.data(Qt::DisplayRole).toDouble());
|
||||
item->SetCoord(latlng);
|
||||
break;
|
||||
case flightDataModel::BEARELATIVE:
|
||||
distBearing=item->getRelativeCoord();
|
||||
index=model->index(x,flightDataModel::BEARELATIVE);
|
||||
distBearing.setBearingFromDegrees(index.data(Qt::DisplayRole).toDouble());
|
||||
break;
|
||||
case flightDataModel::DISRELATIVE:
|
||||
distBearing=item->getRelativeCoord();
|
||||
index=model->index(x,flightDataModel::DISRELATIVE);
|
||||
distBearing.distance=index.data(Qt::DisplayRole).toDouble();
|
||||
break;
|
||||
|
||||
case flightDataModel::ISRELATIVE:
|
||||
index=model->index(x,flightDataModel::ISRELATIVE);
|
||||
relative=index.data(Qt::DisplayRole).toBool();
|
||||
if(relative)
|
||||
item->setWPType(mapcontrol::WayPointItem::relative);
|
||||
break;
|
||||
case flightDataModel::ALTITUDE:
|
||||
index=model->index(x,flightDataModel::ALTITUDE);
|
||||
altitude=index.data(Qt::DisplayRole).toDouble();
|
||||
item->SetAltitude(altitude);
|
||||
break;
|
||||
case flightDataModel::LOCKED:
|
||||
index=model->index(x,flightDataModel::LOCKED);
|
||||
item->setFlag(QGraphicsItem::ItemIsMovable,!index.data(Qt::DisplayRole).toBool());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void modelMapProxy::on_rowsInserted(const QModelIndex &parent, int first, int last)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
for(int x=first;x<last+1;x++)
|
||||
{
|
||||
QModelIndex index;
|
||||
WayPointItem * item;
|
||||
internals::PointLatLng latlng;
|
||||
distBearing distBearing;
|
||||
double altitude;
|
||||
bool relative;
|
||||
index=model->index(x,flightDataModel::WPDESCRITPTION);
|
||||
QString desc=index.data(Qt::DisplayRole).toString();
|
||||
index=model->index(x,flightDataModel::LATPOSITION);
|
||||
latlng.SetLat(index.data(Qt::DisplayRole).toDouble());
|
||||
index=model->index(x,flightDataModel::LNGPOSITION);
|
||||
latlng.SetLng(index.data(Qt::DisplayRole).toDouble());
|
||||
index=model->index(x,flightDataModel::DISRELATIVE);
|
||||
distBearing.distance=index.data(Qt::DisplayRole).toDouble();
|
||||
index=model->index(x,flightDataModel::BEARELATIVE);
|
||||
distBearing.setBearingFromDegrees(index.data(Qt::DisplayRole).toDouble());
|
||||
index=model->index(x,flightDataModel::ISRELATIVE);
|
||||
relative=index.data(Qt::DisplayRole).toBool();
|
||||
index=model->index(x,flightDataModel::ALTITUDE);
|
||||
altitude=index.data(Qt::DisplayRole).toDouble();
|
||||
item=myMap->WPInsert(latlng,altitude,desc,x);
|
||||
item->setRelativeCoord(distBearing);
|
||||
if(relative)
|
||||
item->setWPType(mapcontrol::WayPointItem::relative);
|
||||
}
|
||||
}
|
||||
void modelMapProxy::deleteWayPoint(int number)
|
||||
{
|
||||
model->removeRow(number,QModelIndex());
|
||||
}
|
||||
|
||||
void modelMapProxy::createWayPoint(internals::PointLatLng coord)
|
||||
{
|
||||
model->insertRow(model->rowCount(),QModelIndex());
|
||||
QModelIndex index=model->index(model->rowCount()-1,flightDataModel::LATPOSITION,QModelIndex());
|
||||
model->setData(index,coord.Lat(),Qt::EditRole);
|
||||
index=model->index(model->rowCount()-1,flightDataModel::LNGPOSITION,QModelIndex());
|
||||
model->setData(index,coord.Lng(),Qt::EditRole);
|
||||
}
|
||||
void modelMapProxy::deleteAll()
|
||||
{
|
||||
model->removeRows(0,model->rowCount(),QModelIndex());
|
||||
}
|
41
ground/openpilotgcs/src/plugins/opmap/modelmapproxy.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef MODELMAPPROXY_H
|
||||
#define MODELMAPPROXY_H
|
||||
#include <QWidget>
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
#include "pathaction.h"
|
||||
#include "waypoint.h"
|
||||
#include "QMutexLocker"
|
||||
#include "QPointer"
|
||||
#include "flightdatamodel.h"
|
||||
#include <QItemSelectionModel>
|
||||
|
||||
|
||||
|
||||
using namespace mapcontrol;
|
||||
class modelMapProxy:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit modelMapProxy(QObject *parent,OPMapWidget * map,flightDataModel * model,QItemSelectionModel * selectionModel);
|
||||
WayPointItem *findWayPointNumber(int number);
|
||||
void createWayPoint(internals::PointLatLng coord);
|
||||
void deleteWayPoint(int number);
|
||||
void deleteAll();
|
||||
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*>);
|
||||
private:
|
||||
OPMapWidget * myMap;
|
||||
flightDataModel * model;
|
||||
void refreshOverlays();
|
||||
QItemSelectionModel * selection;
|
||||
};
|
||||
|
||||
#endif // MODELMAPPROXY_H
|
@ -1,4 +1,4 @@
|
||||
QT += webkit network
|
||||
QT += xml
|
||||
TEMPLATE = lib
|
||||
TARGET = OPMapGadget
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
@ -15,12 +15,13 @@ HEADERS += opmapplugin.h \
|
||||
opmapgadgetconfiguration.h \
|
||||
opmapgadget.h \
|
||||
opmapgadgetwidget.h \
|
||||
opmap_waypointeditor_dialog.h \
|
||||
opmap_edit_waypoint_dialog.h \
|
||||
opmap_zoom_slider_widget.h \
|
||||
opmap_statusbar_widget.h \
|
||||
opmap_overlay_widget.h \
|
||||
pathplanmanager.h
|
||||
flightdatamodel.h \
|
||||
modelmapproxy.h \
|
||||
widgetdelegates.h \
|
||||
pathplanner.h
|
||||
|
||||
SOURCES += opmapplugin.cpp \
|
||||
opmapgadgetwidget.cpp \
|
||||
@ -28,22 +29,22 @@ SOURCES += opmapplugin.cpp \
|
||||
opmapgadgetfactory.cpp \
|
||||
opmapgadgetconfiguration.cpp \
|
||||
opmapgadget.cpp \
|
||||
opmap_waypointeditor_dialog.cpp \
|
||||
opmap_edit_waypoint_dialog.cpp \
|
||||
opmap_zoom_slider_widget.cpp \
|
||||
opmap_statusbar_widget.cpp \
|
||||
opmap_overlay_widget.cpp \
|
||||
pathplanmanager.cpp
|
||||
flightdatamodel.cpp \
|
||||
modelmapproxy.cpp \
|
||||
widgetdelegates.cpp \
|
||||
pathplanner.cpp
|
||||
|
||||
OTHER_FILES += OPMapGadget.pluginspec
|
||||
|
||||
FORMS += opmapgadgetoptionspage.ui \
|
||||
opmap_widget.ui \
|
||||
opmap_waypointeditor_dialog.ui \
|
||||
opmap_edit_waypoint_dialog.ui \
|
||||
opmap_zoom_slider_widget.ui \
|
||||
opmap_statusbar_widget.ui \
|
||||
opmap_overlay_widget.ui \
|
||||
pathplanmanager.ui
|
||||
pathplanner.ui
|
||||
|
||||
RESOURCES += opmap.qrc
|
||||
|
@ -25,5 +25,15 @@
|
||||
<file>images/home_wp.png</file>
|
||||
<file>images/move_to_wp.png</file>
|
||||
<file>images/center_wp.png</file>
|
||||
<file>images/Ekisho Deep Ocean HD1.png</file>
|
||||
<file>images/forward button white.png</file>
|
||||
<file>images/new archive.png</file>
|
||||
<file>images/rewind button white.png</file>
|
||||
<file>images/stopb.png</file>
|
||||
<file>images/unarchive.png</file>
|
||||
<file>images/up_alt.png</file>
|
||||
<file>images/plus3.png</file>
|
||||
<file>images/forward_alt.png</file>
|
||||
<file>images/star.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -28,48 +28,66 @@
|
||||
#include "opmap_edit_waypoint_dialog.h"
|
||||
#include "ui_opmap_edit_waypoint_dialog.h"
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
#include "widgetdelegates.h"
|
||||
// *********************************************************************
|
||||
typedef enum { MODE_FLYENDPOINT=0, MODE_FLYVECTOR=1, MODE_FLYCIRCLERIGHT=2, MODE_FLYCIRCLELEFT=3,
|
||||
MODE_DRIVEENDPOINT=4, MODE_DRIVEVECTOR=5, MODE_DRIVECIRCLELEFT=6, MODE_DRIVECIRCLERIGHT=7,
|
||||
MODE_FIXEDATTITUDE=8, MODE_SETACCESSORY=9, MODE_DISARMALARM=10 } ModeOptions;
|
||||
typedef enum { ENDCONDITION_NONE=0, ENDCONDITION_TIMEOUT=1, ENDCONDITION_DISTANCETOTARGET=2,
|
||||
ENDCONDITION_LEGREMAINING=3, ENDCONDITION_ABOVEALTITUDE=4, ENDCONDITION_POINTINGTOWARDSNEXT=5,
|
||||
ENDCONDITION_PYTHONSCRIPT=6, ENDCONDITION_IMMEDIATE=7 } EndConditionOptions;
|
||||
|
||||
|
||||
// constructor
|
||||
opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent) :
|
||||
QDialog(parent, Qt::Dialog),
|
||||
opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent,QAbstractItemModel * model,QItemSelectionModel * selection) :
|
||||
QWidget(parent),model(model),itemSelection(selection),
|
||||
ui(new Ui::opmap_edit_waypoint_dialog)
|
||||
{
|
||||
{
|
||||
ui->setupUi(this);
|
||||
my_waypoint = NULL;
|
||||
connect(ui->rbRelative,SIGNAL(toggled(bool)),this,SLOT(setupPositionWidgets(bool)));
|
||||
connect(ui->checkBoxLocked,SIGNAL(toggled(bool)),this,SLOT(enableEditWidgets(bool)));
|
||||
connect(ui->cbMode,SIGNAL(currentIndexChanged(int)),this,SLOT(setupModeWidgets()));
|
||||
connect(ui->cbCondition,SIGNAL(currentIndexChanged(int)),this,SLOT(setupConditionWidgets()));
|
||||
ui->cbMode->addItem("Fly Direct",MODE_FLYENDPOINT);
|
||||
ui->cbMode->addItem("Fly Vector",MODE_FLYVECTOR);
|
||||
ui->cbMode->addItem("Fly Circle Right",MODE_FLYCIRCLERIGHT);
|
||||
ui->cbMode->addItem("Fly Circle Left",MODE_FLYCIRCLELEFT);
|
||||
|
||||
ui->cbMode->addItem("Drive Direct",MODE_DRIVEENDPOINT);
|
||||
ui->cbMode->addItem("Drive Vector",MODE_DRIVEVECTOR);
|
||||
ui->cbMode->addItem("Drive Circle Right",MODE_DRIVECIRCLELEFT);
|
||||
ui->cbMode->addItem("Drive Circle Left",MODE_DRIVECIRCLERIGHT);
|
||||
ComboBoxDelegate::loadComboBox(ui->cbMode,flightDataModel::MODE);
|
||||
ComboBoxDelegate::loadComboBox(ui->cbCondition,flightDataModel::CONDITION);
|
||||
ComboBoxDelegate::loadComboBox(ui->cbCommand,flightDataModel::COMMAND);
|
||||
|
||||
ui->cbMode->addItem("Fixed Attitude",MODE_FIXEDATTITUDE);
|
||||
ui->cbMode->addItem("Set Accessory",MODE_SETACCESSORY);
|
||||
ui->cbMode->addItem("Disarm Alarm",MODE_DISARMALARM);
|
||||
// VELOCITY,
|
||||
|
||||
ui->cbCondition->addItem("None",ENDCONDITION_NONE);
|
||||
ui->cbCondition->addItem("Timeout",ENDCONDITION_TIMEOUT);
|
||||
ui->cbCondition->addItem("Distance to tgt",ENDCONDITION_DISTANCETOTARGET);
|
||||
ui->cbCondition->addItem("Leg remaining",ENDCONDITION_LEGREMAINING);
|
||||
ui->cbCondition->addItem("Above Altitude",ENDCONDITION_ABOVEALTITUDE);
|
||||
ui->cbCondition->addItem("Pointing towards next",ENDCONDITION_POINTINGTOWARDSNEXT);
|
||||
ui->cbCondition->addItem("Python script",ENDCONDITION_PYTHONSCRIPT);
|
||||
ui->cbCondition->addItem("Immediate",ENDCONDITION_IMMEDIATE);
|
||||
mapper = new QDataWidgetMapper(this);
|
||||
|
||||
mapper->setItemDelegate(new ComboBoxDelegate(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->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)));
|
||||
}
|
||||
void opmap_edit_waypoint_dialog::on_currentIndexChanged(int index)
|
||||
{
|
||||
ui->lbNumber->setText(QString::number(index));
|
||||
QModelIndex idx=mapper->model()->index(index,0);
|
||||
if(index==itemSelection->currentIndex().row())
|
||||
return;
|
||||
itemSelection->clear();
|
||||
itemSelection->setCurrentIndex(idx,QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
// destrutor
|
||||
@ -80,68 +98,36 @@ opmap_edit_waypoint_dialog::~opmap_edit_waypoint_dialog()
|
||||
|
||||
// *********************************************************************
|
||||
|
||||
void opmap_edit_waypoint_dialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_pushButtonOK_clicked()
|
||||
{
|
||||
int res = saveSettings();
|
||||
if (res < 0) return;
|
||||
|
||||
my_waypoint = NULL;
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_pushButtonApply_clicked()
|
||||
{
|
||||
saveSettings();
|
||||
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_pushButtonRevert_clicked()
|
||||
{
|
||||
loadFromWP(my_waypoint);
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::setupPositionWidgets(bool isRelative)
|
||||
{
|
||||
ui->lbLong->setVisible(!isRelative);
|
||||
ui->lbDegLong->setVisible(!isRelative);
|
||||
ui->doubleSpinBoxLongitude->setVisible(!isRelative);
|
||||
ui->lbLat->setVisible(!isRelative);
|
||||
ui->lbDegLat->setVisible(!isRelative);
|
||||
ui->doubleSpinBoxLatitude->setVisible(!isRelative);
|
||||
ui->lbDistance->setVisible(isRelative);
|
||||
ui->lbDistanceMeters->setVisible(isRelative);
|
||||
ui->lbBearing->setVisible(isRelative);
|
||||
ui->lbBearingDeg->setVisible(isRelative);
|
||||
ui->spinBoxDistance->setVisible(isRelative);
|
||||
ui->doubleSpinBoxBearing->setVisible(isRelative);
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::setupModeWidgets()
|
||||
{
|
||||
ModeOptions mode=(ModeOptions)ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt();
|
||||
ComboBoxDelegate::ModeOptions mode=(ComboBoxDelegate::ModeOptions)ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt();
|
||||
switch(mode)
|
||||
{
|
||||
case MODE_FLYENDPOINT:
|
||||
case MODE_FLYVECTOR:
|
||||
case MODE_FLYCIRCLERIGHT:
|
||||
case MODE_FLYCIRCLELEFT:
|
||||
case MODE_DRIVEENDPOINT:
|
||||
case MODE_DRIVEVECTOR:
|
||||
case MODE_DRIVECIRCLELEFT:
|
||||
case MODE_DRIVECIRCLERIGHT:
|
||||
case MODE_DISARMALARM:
|
||||
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:
|
||||
ui->modeParam1->setVisible(false);
|
||||
ui->modeParam2->setVisible(false);
|
||||
ui->modeParam3->setVisible(false);
|
||||
@ -151,7 +137,7 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
|
||||
ui->dsb_modeParam3->setVisible(false);
|
||||
ui->dsb_modeParam4->setVisible(false);
|
||||
break;
|
||||
case MODE_FIXEDATTITUDE:
|
||||
case ComboBoxDelegate::MODE_FIXEDATTITUDE:
|
||||
ui->modeParam1->setText("pitch");
|
||||
ui->modeParam2->setText("roll");
|
||||
ui->modeParam3->setText("yaw");
|
||||
@ -165,7 +151,7 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
|
||||
ui->dsb_modeParam3->setVisible(true);
|
||||
ui->dsb_modeParam4->setVisible(true);
|
||||
break;
|
||||
case MODE_SETACCESSORY:
|
||||
case ComboBoxDelegate::MODE_SETACCESSORY:
|
||||
ui->modeParam1->setText("Acc.channel");
|
||||
ui->modeParam2->setText("Value");
|
||||
ui->modeParam1->setVisible(true);
|
||||
@ -181,12 +167,12 @@ void opmap_edit_waypoint_dialog::setupModeWidgets()
|
||||
}
|
||||
void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
{
|
||||
EndConditionOptions mode=(EndConditionOptions)ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt();
|
||||
ComboBoxDelegate::EndConditionOptions mode=(ComboBoxDelegate::EndConditionOptions)ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt();
|
||||
switch(mode)
|
||||
{
|
||||
case ENDCONDITION_NONE:
|
||||
case ENDCONDITION_IMMEDIATE:
|
||||
case ENDCONDITION_PYTHONSCRIPT:
|
||||
case ComboBoxDelegate::ENDCONDITION_NONE:
|
||||
case ComboBoxDelegate::ENDCONDITION_IMMEDIATE:
|
||||
case ComboBoxDelegate::ENDCONDITION_PYTHONSCRIPT:
|
||||
ui->condParam1->setVisible(false);
|
||||
ui->condParam2->setVisible(false);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -196,7 +182,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
ui->dsb_condParam3->setVisible(false);
|
||||
ui->dsb_condParam4->setVisible(false);
|
||||
break;
|
||||
case ENDCONDITION_TIMEOUT:
|
||||
case ComboBoxDelegate::ENDCONDITION_TIMEOUT:
|
||||
ui->condParam1->setVisible(true);
|
||||
ui->condParam2->setVisible(false);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -207,7 +193,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
ui->dsb_condParam4->setVisible(false);
|
||||
ui->condParam1->setText("Timeout(ms)");
|
||||
break;
|
||||
case ENDCONDITION_DISTANCETOTARGET:
|
||||
case ComboBoxDelegate::ENDCONDITION_DISTANCETOTARGET:
|
||||
ui->condParam1->setVisible(true);
|
||||
ui->condParam2->setVisible(true);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -219,7 +205,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
ui->condParam1->setText("Distance(m)");
|
||||
ui->condParam2->setText("Flag(0=2D,1=3D)");//FIXME
|
||||
break;
|
||||
case ENDCONDITION_LEGREMAINING:
|
||||
case ComboBoxDelegate::ENDCONDITION_LEGREMAINING:
|
||||
ui->condParam1->setVisible(true);
|
||||
ui->condParam2->setVisible(false);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -230,7 +216,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
ui->dsb_condParam4->setVisible(false);
|
||||
ui->condParam1->setText("Relative Distance(0=complete,1=just starting)");
|
||||
break;
|
||||
case ENDCONDITION_ABOVEALTITUDE:
|
||||
case ComboBoxDelegate::ENDCONDITION_ABOVEALTITUDE:
|
||||
ui->condParam1->setVisible(true);
|
||||
ui->condParam2->setVisible(false);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -241,7 +227,7 @@ void opmap_edit_waypoint_dialog::setupConditionWidgets()
|
||||
ui->dsb_condParam4->setVisible(false);
|
||||
ui->condParam1->setText("Altitude in meters (negative)");
|
||||
break;
|
||||
case ENDCONDITION_POINTINGTOWARDSNEXT:
|
||||
case ComboBoxDelegate::ENDCONDITION_POINTINGTOWARDSNEXT:
|
||||
ui->condParam1->setVisible(true);
|
||||
ui->condParam2->setVisible(false);
|
||||
ui->condParam3->setVisible(false);
|
||||
@ -265,80 +251,57 @@ void opmap_edit_waypoint_dialog::on_pushButtonCancel_clicked()
|
||||
|
||||
int opmap_edit_waypoint_dialog::saveSettings()
|
||||
{
|
||||
int number = ui->spinBoxNumber->value();
|
||||
if (number < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
customData data;
|
||||
data.mode=ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt();
|
||||
data.mode_params[0]=ui->dsb_modeParam1->value();
|
||||
data.mode_params[1]=ui->dsb_modeParam2->value();
|
||||
data.mode_params[2]=ui->dsb_modeParam3->value();
|
||||
data.mode_params[3]=ui->dsb_modeParam4->value();
|
||||
|
||||
data.condition=ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt();
|
||||
data.condition_params[0]=ui->dsb_condParam1->value();
|
||||
data.condition_params[1]=ui->dsb_condParam2->value();
|
||||
data.condition_params[2]=ui->dsb_condParam3->value();
|
||||
data.condition_params[3]=ui->dsb_condParam4->value();
|
||||
|
||||
QVariant var;
|
||||
var.setValue(data);
|
||||
my_waypoint->setData(0,var);
|
||||
|
||||
my_waypoint->SetNumber(ui->spinBoxNumber->value());
|
||||
my_waypoint->SetCoord(internals::PointLatLng(ui->doubleSpinBoxLatitude->value(), ui->doubleSpinBoxLongitude->value()));
|
||||
my_waypoint->SetAltitude(ui->doubleSpinBoxAltitude->value());
|
||||
my_waypoint->SetDescription(ui->lineEditDescription->displayText().simplified());
|
||||
my_waypoint->setFlag(QGraphicsItem::ItemIsMovable, !ui->checkBoxLocked->isChecked());
|
||||
if(ui->rbAbsolute->isChecked())
|
||||
my_waypoint->setWPType(mapcontrol::WayPointItem::absolute);
|
||||
else
|
||||
my_waypoint->setWPType(mapcontrol::WayPointItem::relative);
|
||||
mapcontrol::distBearing pt;
|
||||
pt.distance=ui->spinBoxDistance->value();
|
||||
pt.bearing=ui->doubleSpinBoxBearing->value()/180*M_PI;
|
||||
my_waypoint->setRelativeCoord(pt);
|
||||
return 0; // all ok
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::loadFromWP(mapcontrol::WayPointItem *waypoint_item)
|
||||
{
|
||||
customData data=waypoint_item->data(0).value<customData>();
|
||||
ui->spinBoxNumber->setValue(waypoint_item->Number());
|
||||
ui->doubleSpinBoxLatitude->setValue(waypoint_item->Coord().Lat());
|
||||
ui->doubleSpinBoxLongitude->setValue(waypoint_item->Coord().Lng());
|
||||
ui->doubleSpinBoxAltitude->setValue(waypoint_item->Altitude());
|
||||
ui->lineEditDescription->setText(waypoint_item->Description());
|
||||
if(waypoint_item->WPType()==mapcontrol::WayPointItem::absolute)
|
||||
ui->rbAbsolute->setChecked(true);
|
||||
else
|
||||
ui->rbRelative->setChecked(true);
|
||||
ui->doubleSpinBoxBearing->setValue(waypoint_item->getRelativeCoord().bearing*180/M_PI);
|
||||
ui->spinBoxDistance->setValue(waypoint_item->getRelativeCoord().distance);
|
||||
|
||||
ui->cbMode->setCurrentIndex(ui->cbMode->findData(data.mode));
|
||||
ui->dsb_modeParam1->setValue(data.mode_params[0]);
|
||||
ui->dsb_modeParam2->setValue(data.mode_params[1]);
|
||||
ui->dsb_modeParam3->setValue(data.mode_params[2]);
|
||||
ui->dsb_modeParam4->setValue(data.mode_params[3]);
|
||||
|
||||
ui->cbCondition->setCurrentIndex(ui->cbCondition->findData(data.condition));
|
||||
ui->dsb_condParam1->setValue(data.condition_params[0]);
|
||||
ui->dsb_condParam2->setValue(data.condition_params[1]);
|
||||
ui->dsb_condParam3->setValue(data.condition_params[2]);
|
||||
ui->dsb_condParam4->setValue(data.condition_params[3]);
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::editWaypoint(mapcontrol::WayPointItem *waypoint_item)
|
||||
{
|
||||
if (!waypoint_item) return;
|
||||
|
||||
this->my_waypoint = waypoint_item;
|
||||
loadFromWP(waypoint_item);
|
||||
setupPositionWidgets(ui->rbRelative->isChecked());
|
||||
show();
|
||||
mapper->setCurrentIndex(waypoint_item->Number());
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_pushButton_clicked()
|
||||
{
|
||||
mapper->toPrevious();
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_pushButton_2_clicked()
|
||||
{
|
||||
mapper->toNext();
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::enableEditWidgets(bool value)
|
||||
{
|
||||
QWidget * w;
|
||||
foreach(QWidget * obj,this->findChildren<QWidget *>())
|
||||
{
|
||||
w=qobject_cast<QComboBox*>(obj);
|
||||
if(w)
|
||||
w->setEnabled(!value);
|
||||
w=qobject_cast<QLineEdit*>(obj);
|
||||
if(w)
|
||||
w->setEnabled(!value);
|
||||
w=qobject_cast<QDoubleSpinBox*>(obj);
|
||||
if(w)
|
||||
w->setEnabled(!value);
|
||||
w=qobject_cast<QCheckBox*>(obj);
|
||||
if(w && w!=ui->checkBoxLocked)
|
||||
w->setEnabled(!value);
|
||||
w=qobject_cast<QSpinBox*>(obj);
|
||||
if(w)
|
||||
w->setEnabled(!value);
|
||||
}
|
||||
}
|
||||
|
||||
void opmap_edit_waypoint_dialog::on_currentRowChanged(QModelIndex current, QModelIndex previous)
|
||||
{
|
||||
mapper->setCurrentIndex(current.row());
|
||||
}
|
||||
|
@ -29,19 +29,19 @@
|
||||
#define OPMAP_EDIT_WAYPOINT_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <QDataWidgetMapper>
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
|
||||
#include "flightdatamodel.h"
|
||||
namespace Ui {
|
||||
class opmap_edit_waypoint_dialog;
|
||||
}
|
||||
using namespace mapcontrol;
|
||||
|
||||
class opmap_edit_waypoint_dialog : public QDialog
|
||||
class opmap_edit_waypoint_dialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
opmap_edit_waypoint_dialog(QWidget *parent = 0);
|
||||
opmap_edit_waypoint_dialog(QWidget *parent,QAbstractItemModel * model,QItemSelectionModel * selection);
|
||||
~opmap_edit_waypoint_dialog();
|
||||
|
||||
/**
|
||||
@ -52,17 +52,18 @@ public:
|
||||
void editWaypoint(mapcontrol::WayPointItem *waypoint_item);
|
||||
|
||||
void loadFromWP(mapcontrol::WayPointItem *waypoint_item);
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::opmap_edit_waypoint_dialog *ui;
|
||||
mapcontrol::WayPointItem * my_waypoint;
|
||||
int saveSettings();
|
||||
|
||||
QDataWidgetMapper *mapper;
|
||||
QAbstractItemModel * model;
|
||||
QItemSelectionModel * itemSelection;
|
||||
private slots:
|
||||
|
||||
private slots:
|
||||
void on_currentIndexChanged(int index);
|
||||
void setupModeWidgets();
|
||||
void setupPositionWidgets(bool isRelative);
|
||||
void setupConditionWidgets();
|
||||
@ -70,6 +71,10 @@ private slots:
|
||||
void on_pushButtonRevert_clicked();
|
||||
void on_pushButtonApply_clicked();
|
||||
void on_pushButtonOK_clicked();
|
||||
void on_pushButton_clicked();
|
||||
void on_pushButton_2_clicked();
|
||||
void enableEditWidgets(bool);
|
||||
void on_currentRowChanged(QModelIndex,QModelIndex);
|
||||
};
|
||||
|
||||
#endif // OPMAP_EDIT_WAYPOINT_DIALOG_H
|
||||
|
@ -1,15 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>opmap_edit_waypoint_dialog</class>
|
||||
<widget class="QDialog" name="opmap_edit_waypoint_dialog">
|
||||
<widget class="QWidget" name="opmap_edit_waypoint_dialog">
|
||||
<property name="modal" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>571</width>
|
||||
<width>606</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -26,612 +29,711 @@
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<normaloff>:/core/images/openpilot_logo_128.png</normaloff>:/core/images/openpilot_logo_128.png</iconset>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Position</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>528</width>
|
||||
<height>266</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbLat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Latitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbLong">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Longitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Altitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>meters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEditDescription"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="spinBoxNumber">
|
||||
<property name="maximum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxLatitude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-90.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxLongitude">
|
||||
<property name="decimals">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-180.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxAltitude">
|
||||
<property name="minimum">
|
||||
<double>-5000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>5000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="lbDegLong">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="lbDegLat">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="Type">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rbRelative">
|
||||
<property name="text">
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QRadioButton" name="rbAbsolute">
|
||||
<property name="text">
|
||||
<string>Absolute</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="spinBoxDistance">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="lbDistanceMeters">
|
||||
<property name="text">
|
||||
<string>meters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="lbBearingDeg">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbBearing">
|
||||
<property name="text">
|
||||
<string>Bearing </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBearing">
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbDistance">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Distance </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="checkBoxLocked">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Locked</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Number </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbLat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Latitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbLong">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Longitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Altitude </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>meters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Description </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEditDescription"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxLatitude">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-90.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxLongitude">
|
||||
<property name="decimals">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-180.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxAltitude">
|
||||
<property name="minimum">
|
||||
<double>-5000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>5000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="lbDegLong">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="lbDegLat">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="Type">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Relative to Home </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="spinBoxDistance">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="lbDistanceMeters">
|
||||
<property name="text">
|
||||
<string>meters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="lbBearingDeg">
|
||||
<property name="text">
|
||||
<string>degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbBearing">
|
||||
<property name="text">
|
||||
<string>Bearing </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBearing">
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbDistance">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Distance </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="checkBoxLocked">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Locked</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Number </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lbNumber">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="checkBoxRelative">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Velocity </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxVelocity"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Mode</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
<width>511</width>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbMode"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam1">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="modeParam1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="modeParam2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="modeParam3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="modeParam4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam2">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam3">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam4">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbMode"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam1">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="modeParam1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="modeParam2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="modeParam3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="modeParam4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam2">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam3">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_modeParam4">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>End condition</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>551</width>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="Condition">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Condition</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbCondition"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam1">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="condParam1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="condParam2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="condParam3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="condParam4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam2">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam3">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam4">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="Condition">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Condition</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbCondition"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam1">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="condParam1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="condParam2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="condParam3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="condParam4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param4</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam2">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam3">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsb_condParam4">
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Page</string>
|
||||
<string>Command</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Command</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbCommand"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="jumpDest">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Jump Destination</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="condParam2_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Error Destination</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="sbJump"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbError"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Previous</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@ -652,27 +754,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonApply">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonRevert">
|
||||
<property name="text">
|
||||
<string>Revert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1,41 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_overlay_widget.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 "opmap_overlay_widget.h"
|
||||
#include "ui_opmap_overlay_widget.h"
|
||||
|
||||
opmap_overlay_widget::opmap_overlay_widget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::opmap_overlay_widget)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
opmap_overlay_widget::~opmap_overlay_widget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_overlay_widget.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 OPMAP_OVERLAY_WIDGET_H
|
||||
#define OPMAP_OVERLAY_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class opmap_overlay_widget;
|
||||
}
|
||||
|
||||
class opmap_overlay_widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit opmap_overlay_widget(QWidget *parent = 0);
|
||||
~opmap_overlay_widget();
|
||||
|
||||
private:
|
||||
Ui::opmap_overlay_widget *ui;
|
||||
};
|
||||
|
||||
#endif // OPMAP_OVERLAY_WIDGET_H
|
@ -1,184 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_waypointeditor_dialog.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 <QPainter>
|
||||
#include <QGraphicsSceneDragDropEvent>
|
||||
|
||||
#include "opmap_waypointeditor_dialog.h"
|
||||
#include "ui_opmap_waypointeditor_dialog.h"
|
||||
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
// ***************************************************************
|
||||
// Waypoint object
|
||||
|
||||
WaypointItem::WaypointItem(QString name, double latitude, double longitude, double height, int time, int hold) :
|
||||
waypoint_name(name),
|
||||
latitude_degress(latitude),
|
||||
longitude_degress(longitude),
|
||||
height_feet(height),
|
||||
time_seconds(time),
|
||||
hold_seconds(hold)
|
||||
{
|
||||
setToolTip(waypoint_name);
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
|
||||
|
||||
pixmap.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||
}
|
||||
|
||||
QRectF WaypointItem::boundingRect() const
|
||||
{
|
||||
// return QRectF(-6, -10, 12, 20);
|
||||
return QRectF(-pixmap.width() / 2, -pixmap.height(), pixmap.width(), pixmap.height());
|
||||
}
|
||||
/*
|
||||
QPainterPath WaypointItem::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
// path.addEllipse(QPointF(0, 0), 6, 10);
|
||||
path.addRect(pixmap.rect());
|
||||
return path;
|
||||
}
|
||||
*/
|
||||
void WaypointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||
{
|
||||
// painter->setPen(Qt::black);
|
||||
// painter->setBrush(QColor(255, 0, 0, 128));
|
||||
// painter->drawEllipse(QPointF(0, 0), 6, 10);
|
||||
|
||||
painter->drawPixmap(-pixmap.width() / 2, -pixmap.height(), pixmap);
|
||||
}
|
||||
|
||||
void WaypointItem::setPixmap(QPixmap pixmap)
|
||||
{
|
||||
this->pixmap = pixmap.copy(pixmap.rect());
|
||||
}
|
||||
|
||||
// ***************************************************************
|
||||
// Scene object
|
||||
|
||||
OurScene::OurScene(QObject *parent) : QGraphicsScene(parent)
|
||||
{
|
||||
movingItem = 0;
|
||||
}
|
||||
|
||||
void OurScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QPointF mousePos(event->buttonDownScenePos(Qt::LeftButton).x(), event->buttonDownScenePos(Qt::LeftButton).y());
|
||||
|
||||
movingItem = itemAt(mousePos.x(), mousePos.y());
|
||||
|
||||
if (movingItem != 0 && event->button() == Qt::LeftButton)
|
||||
{
|
||||
oldPos = movingItem->pos();
|
||||
}
|
||||
|
||||
clearSelection();
|
||||
|
||||
QGraphicsScene::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void OurScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (movingItem != 0 && event->button() == Qt::LeftButton)
|
||||
{
|
||||
if (oldPos != movingItem->pos())
|
||||
emit itemMoved(qgraphicsitem_cast<WaypointItem *>(movingItem), oldPos);
|
||||
|
||||
movingItem = 0;
|
||||
}
|
||||
|
||||
QGraphicsScene::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
// ***************************************************************
|
||||
// main dialogue
|
||||
|
||||
opmap_waypointeditor_dialog::opmap_waypointeditor_dialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::opmap_waypointeditor_dialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(Qt::Dialog);
|
||||
|
||||
view = ui->graphicsViewWaypointHeightAndTimeline;
|
||||
|
||||
scene = new OurScene();
|
||||
scene->setSceneRect(QRect(0, 0, 500, 500));
|
||||
view->setScene(scene);
|
||||
|
||||
waypoint_pixmap1.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||
waypoint_pixmap2.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||
|
||||
undoStack = new QUndoStack();
|
||||
|
||||
connect(scene, SIGNAL(itemMoved(WaypointItem *, const QPointF &)), this, SLOT(itemMoved(WaypointItem *, const QPointF &)));
|
||||
|
||||
// *****
|
||||
// test
|
||||
|
||||
WaypointItem *waypoint1 = new WaypointItem(tr("Waypoint 1"), 0, 0, 10, 5, 10);
|
||||
waypoint1->setPos(scene->width() / 2, scene->height() / 2);
|
||||
scene->addItem(waypoint1);
|
||||
|
||||
WaypointItem *waypoint2 = new WaypointItem(tr("Waypoint 2"), 0, 0, 50, 8, 5);
|
||||
waypoint2->setPos(scene->width() / 2 + 30, scene->height() / 2);
|
||||
scene->addItem(waypoint2);
|
||||
|
||||
WaypointItem *waypoint3 = new WaypointItem(tr("Waypoint 3"), 0, 0, 100, 8, 5);
|
||||
waypoint3->setPixmap(waypoint_pixmap2);
|
||||
waypoint3->setPos(scene->width() / 2 + 60, scene->height() / 2);
|
||||
scene->addItem(waypoint3);
|
||||
|
||||
// *****
|
||||
}
|
||||
|
||||
opmap_waypointeditor_dialog::~opmap_waypointeditor_dialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void opmap_waypointeditor_dialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void opmap_waypointeditor_dialog::itemMoved(WaypointItem *movedItem, const QPointF &oldPosition)
|
||||
{
|
||||
// undoStack->push(new MoveCommand(movedItem, oldPosition));
|
||||
}
|
||||
|
||||
// ***************************************************************
|
@ -1,130 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_waypointeditor_dialog.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 OPMAP_WAYPOINTEDITOR_DIALOG_H
|
||||
#define OPMAP_WAYPOINTEDITOR_DIALOG_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItem>
|
||||
#include <QPixmap>
|
||||
#include <QUndoStack>
|
||||
|
||||
#include "uavobjectmanager.h"
|
||||
#include "positionactual.h"
|
||||
|
||||
namespace Ui {
|
||||
class opmap_waypointeditor_dialog;
|
||||
}
|
||||
|
||||
// ***************************************************************
|
||||
// Waypoint object
|
||||
|
||||
class WaypointItem : public QObject, public QGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QGraphicsItem)
|
||||
|
||||
public:
|
||||
WaypointItem(QString name = "", double latitude = 0, double longitude = 0, double height_feet = 0, int time_seconds = 0, int hold_seconds = 0);
|
||||
|
||||
void setPixmap(QPixmap pixmap);
|
||||
|
||||
QString waypoint_name;
|
||||
double latitude_degress;
|
||||
double longitude_degress;
|
||||
double height_feet;
|
||||
int time_seconds;
|
||||
int hold_seconds;
|
||||
|
||||
QPixmap pixmap;
|
||||
|
||||
protected:
|
||||
QRectF boundingRect() const;
|
||||
// QPainterPath shape() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
// void timerEvent(QTimerEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************
|
||||
|
||||
class OurScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OurScene(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
void itemMoved(WaypointItem *movedItem, const QPointF &movedFromPosition);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
QGraphicsItem *movingItem;
|
||||
QPointF oldPos;
|
||||
};
|
||||
|
||||
// ***************************************************************
|
||||
// main dialog widget
|
||||
|
||||
class opmap_waypointeditor_dialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
opmap_waypointeditor_dialog(QWidget *parent = 0);
|
||||
~opmap_waypointeditor_dialog();
|
||||
|
||||
public slots:
|
||||
void itemMoved(WaypointItem *movedDiagram, const QPointF &moveStartPosition);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
QPixmap waypoint_pixmap1;
|
||||
QPixmap waypoint_pixmap2;
|
||||
|
||||
QGraphicsView *view;
|
||||
QGraphicsScene *scene;
|
||||
|
||||
QUndoStack *undoStack;
|
||||
|
||||
Ui::opmap_waypointeditor_dialog *ui;
|
||||
};
|
||||
|
||||
// ***************************************************************
|
||||
|
||||
#endif // OPMAP_WAYPOINTEDITOR_DIALOG_H
|
@ -1,248 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>opmap_waypointeditor_dialog</class>
|
||||
<widget class="QDialog" name="opmap_waypointeditor_dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenPilot GCS Waypoint Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<normaloff>:/core/images/openpilot_logo_128.png</normaloff>:/core/images/openpilot_logo_128.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QSplitter::handle {
|
||||
/* image: url(images/splitter.png); */
|
||||
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 255, 255, 80), stop:1 rgba(0, 0, 0, 80));
|
||||
}
|
||||
|
||||
QSplitter::handle:horizontal {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
QSplitter::handle:vertical {
|
||||
width: 5px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="opaqueResize">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBoxWaypoints">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Waypoints</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidgetWaypoints">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Num</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Locked</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Latitude</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Altitude</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Hold Time</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBoxHeightAndTimeline">
|
||||
<property name="title">
|
||||
<string>Height and Timeline</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGraphicsView" name="graphicsViewWaypointHeightAndTimeline">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(191, 191, 191);</string>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="renderHints">
|
||||
<set>QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>opmap_waypointeditor_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>opmap_waypointeditor_dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -48,7 +48,6 @@
|
||||
|
||||
#include "positionactual.h"
|
||||
#include "homelocation.h"
|
||||
#include "pathplanmanager.h"
|
||||
#define allow_manual_home_location_move
|
||||
|
||||
// *************************************************************************************
|
||||
@ -215,8 +214,15 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_map->GPS->SetUAVPos(m_home_position.coord, 0.0); // set the UAV position
|
||||
|
||||
|
||||
pathPlanManager * plan=new pathPlanManager(new QWidget(),m_map);
|
||||
plan->show();
|
||||
model=new flightDataModel(this);
|
||||
table=new pathPlanner();
|
||||
selectionModel=new QItemSelectionModel(model);
|
||||
proxy=new modelMapProxy(this,m_map,model,selectionModel);
|
||||
table->setModel(model,selectionModel);
|
||||
table->show();
|
||||
waypoint_edit_dialog=new opmap_edit_waypoint_dialog(NULL,model,selectionModel);
|
||||
|
||||
|
||||
/*
|
||||
distBearing db;
|
||||
db.distance=100;
|
||||
@ -1684,12 +1690,9 @@ void OPMapGadgetWidget::onUAVTrailDistanceActGroup_triggered(QAction *action)
|
||||
m_map->UAV->SetTrailDistance(trail_distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: unused for v1.0
|
||||
**/
|
||||
void OPMapGadgetWidget::onOpenWayPointEditorAct_triggered()
|
||||
{
|
||||
waypoint_editor_dialog.show();
|
||||
//TODO
|
||||
}
|
||||
void OPMapGadgetWidget::onAddWayPointAct_triggeredFromContextMenu()
|
||||
{
|
||||
@ -1708,8 +1711,8 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered(internals::PointLatLng coord)
|
||||
if (m_map_mode != Normal_MapMode)
|
||||
return;
|
||||
|
||||
m_map->WPCreate(coord, 0, "");
|
||||
|
||||
// m_map->WPCreate(coord, 0, "");
|
||||
proxy->createWayPoint(coord);
|
||||
|
||||
//wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||
//wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||
@ -1734,7 +1737,7 @@ void OPMapGadgetWidget::onEditWayPointAct_triggered()
|
||||
if (!m_mouse_waypoint)
|
||||
return;
|
||||
|
||||
waypoint_edit_dialog.editWaypoint(m_mouse_waypoint);
|
||||
waypoint_edit_dialog->editWaypoint(m_mouse_waypoint);
|
||||
|
||||
m_mouse_waypoint = NULL;
|
||||
}
|
||||
@ -1775,8 +1778,7 @@ void OPMapGadgetWidget::onDeleteWayPointAct_triggered()
|
||||
if (!m_mouse_waypoint)
|
||||
return;
|
||||
|
||||
// delete the waypoint from the map
|
||||
m_map->WPDelete(m_mouse_waypoint);
|
||||
proxy->deleteWayPoint(m_mouse_waypoint->Number());
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onClearWayPointsAct_triggered()
|
||||
@ -1787,7 +1789,7 @@ void OPMapGadgetWidget::onClearWayPointsAct_triggered()
|
||||
if (m_map_mode != Normal_MapMode)
|
||||
return;
|
||||
|
||||
m_map->WPDeleteAll();
|
||||
proxy->deleteAll();
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,11 @@
|
||||
|
||||
// ******************************************************
|
||||
|
||||
|
||||
#include "flightdatamodel.h"
|
||||
#include "pathplanner.h"
|
||||
#include "modelmapproxy.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QStringList>
|
||||
@ -39,11 +44,8 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QPointF>
|
||||
|
||||
#include "opmap_edit_waypoint_dialog.h"
|
||||
#include "opmap_waypointeditor_dialog.h"
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
|
||||
#include "opmap_overlay_widget.h"
|
||||
#include "opmap_zoom_slider_widget.h"
|
||||
#include "opmap_statusbar_widget.h"
|
||||
|
||||
@ -54,7 +56,8 @@
|
||||
#include "uavobjectmanager.h"
|
||||
#include "uavobject.h"
|
||||
#include "objectpersistence.h"
|
||||
|
||||
#include <QItemSelectionModel>
|
||||
#include "opmap_edit_waypoint_dialog.h"
|
||||
|
||||
// ******************************************************
|
||||
|
||||
@ -234,9 +237,8 @@ private:
|
||||
UAVObjectManager *obm;
|
||||
UAVObjectUtilManager *obum;
|
||||
|
||||
opmap_waypointeditor_dialog waypoint_editor_dialog;
|
||||
|
||||
opmap_edit_waypoint_dialog waypoint_edit_dialog;
|
||||
opmap_edit_waypoint_dialog * waypoint_edit_dialog;
|
||||
|
||||
QStandardItemModel wayPoint_treeView_model;
|
||||
|
||||
@ -329,6 +331,11 @@ private:
|
||||
QMenu contextMenu;
|
||||
internals::PointLatLng lastLatLngMouse;
|
||||
WayPointItem * magicWayPoint;
|
||||
|
||||
flightDataModel * model;
|
||||
pathPlanner * table;
|
||||
modelMapProxy * proxy;
|
||||
QItemSelectionModel * selectionModel;
|
||||
};
|
||||
|
||||
#endif /* OPMAP_GADGETWIDGET_H_ */
|
||||
|
@ -1,126 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file pathplanmanager.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 "pathplanmanager.h"
|
||||
#include "ui_pathplanmanager.h"
|
||||
|
||||
pathPlanManager::pathPlanManager(QWidget *parent,OPMapWidget *map):
|
||||
QDialog(parent, Qt::Dialog),myMap(map),
|
||||
ui(new Ui::pathPlanManager)
|
||||
{
|
||||
waypoints=new QList<QPointer<WayPointItem> >();
|
||||
ui->setupUi(this);
|
||||
connect(myMap,SIGNAL(WPDeleted(int,WayPointItem*)),this,SLOT(on_WPDeleted(int,WayPointItem*)),Qt::DirectConnection);
|
||||
connect(myMap,SIGNAL(WPInserted(int,WayPointItem*)),this,SLOT(on_WPInserted(int,WayPointItem*)));
|
||||
connect(myMap,SIGNAL(WPCreated(int,WayPointItem*)),this,SLOT(on_WPInserted(int,WayPointItem*)));
|
||||
connect(myMap,SIGNAL(WPNumberChanged(int,int,WayPointItem*)),this,SLOT(refreshOverlays()));
|
||||
connect(myMap,SIGNAL(WPValuesChanged(WayPointItem*)),this,SLOT(refreshOverlays()));
|
||||
}
|
||||
|
||||
pathPlanManager::~pathPlanManager()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void pathPlanManager::on_WPDeleted(int wp_numberint,WayPointItem * wp)
|
||||
{
|
||||
QMutexLocker locker(&wplistmutex);
|
||||
if(wp_numberint<0)
|
||||
return;
|
||||
waypoints->removeOne(wp);
|
||||
}
|
||||
|
||||
void pathPlanManager::on_WPInserted(int wp_number, WayPointItem * wp)
|
||||
{
|
||||
if(waypoints->contains(wp))
|
||||
return;
|
||||
wplistmutex.lock();
|
||||
waypoints->append(wp);
|
||||
wplistmutex.unlock();
|
||||
wp->setWPType(WayPointItem::relative);
|
||||
customData data;
|
||||
data.mode=PathAction::MODE_FLYENDPOINT;
|
||||
data.condition=PathAction::ENDCONDITION_NONE;
|
||||
data.velocity=0;
|
||||
QVariant var;
|
||||
var.setValue(data);
|
||||
wp->setData(0,var);
|
||||
refreshOverlays();
|
||||
}
|
||||
|
||||
void pathPlanManager::on_WPValuesChanged(WayPointItem * wp)
|
||||
{
|
||||
}
|
||||
//typedef enum { MODE_FLYENDPOINT=0, MODE_FLYVECTOR=1, MODE_FLYCIRCLERIGHT=2,
|
||||
//MODE_FLYCIRCLELEFT=3, MODE_DRIVEENDPOINT=4, MODE_DRIVEVECTOR=5, MODE_DRIVECIRCLELEFT=6,
|
||||
//MODE_DRIVECIRCLERIGHT=7, MODE_FIXEDATTITUDE=8, MODE_SETACCESSORY=9, MODE_DISARMALARM=10 } ModeOptions;
|
||||
void pathPlanManager::refreshOverlays()
|
||||
{
|
||||
QMutexLocker locker(&wplistmutex);
|
||||
myMap->deleteAllOverlays();
|
||||
foreach(WayPointItem * wp,*waypoints)
|
||||
{
|
||||
customData data=wp->data(0).value<customData>();
|
||||
switch(data.mode)
|
||||
{
|
||||
case PathAction::MODE_FLYENDPOINT:
|
||||
case PathAction::MODE_FLYVECTOR:
|
||||
case PathAction::MODE_DRIVEENDPOINT:
|
||||
case PathAction::MODE_DRIVEVECTOR:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPLineCreate((HomeItem*)myMap->Home,wp);
|
||||
else
|
||||
myMap->WPLineCreate(findWayPointNumber(wp->Number()-1),wp);
|
||||
break;
|
||||
case PathAction::MODE_FLYCIRCLERIGHT:
|
||||
case PathAction::MODE_DRIVECIRCLERIGHT:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPCircleCreate((HomeItem*)myMap->Home,wp,true);
|
||||
myMap->WPCircleCreate(findWayPointNumber(wp->Number()-1),wp,true);
|
||||
break;
|
||||
case PathAction::MODE_FLYCIRCLELEFT:
|
||||
case PathAction::MODE_DRIVECIRCLELEFT:
|
||||
if(wp->Number()==0)
|
||||
myMap->WPCircleCreate((HomeItem*)myMap->Home,wp,false);
|
||||
myMap->WPCircleCreate(findWayPointNumber(wp->Number()-1),wp,false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WayPointItem * pathPlanManager::findWayPointNumber(int number)
|
||||
{
|
||||
if(number<0)
|
||||
return NULL;
|
||||
foreach(WayPointItem * wp,*waypoints)
|
||||
{
|
||||
if(wp->Number()==number)
|
||||
return wp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file pathplanmanager.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 PATHPLANMANAGER_H
|
||||
#define PATHPLANMANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
#include "pathaction.h"
|
||||
#include "waypoint.h"
|
||||
#include "QMutexLocker"
|
||||
#include "QPointer"
|
||||
|
||||
namespace Ui {
|
||||
class pathPlanManager;
|
||||
}
|
||||
using namespace mapcontrol;
|
||||
class pathPlanManager : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit pathPlanManager(QWidget *parent,OPMapWidget * map);
|
||||
~pathPlanManager();
|
||||
WayPointItem *findWayPointNumber(int number);
|
||||
private slots:
|
||||
void refreshOverlays();
|
||||
void on_WPDeleted(int wp_numberint, WayPointItem *);
|
||||
void on_WPInserted(int,WayPointItem*);
|
||||
void on_WPValuesChanged(WayPointItem*);
|
||||
private:
|
||||
Ui::pathPlanManager *ui;
|
||||
OPMapWidget * myMap;
|
||||
QList<QPointer<WayPointItem> > * waypoints;
|
||||
QMutex wplistmutex;
|
||||
};
|
||||
|
||||
#endif // PATHPLANMANAGER_H
|
@ -1,21 +0,0 @@
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>pathPlanManager</class>
|
||||
<widget class="QWidget" name="pathPlanManager">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<connections/>
|
||||
</ui>
|
93
ground/openpilotgcs/src/plugins/opmap/pathplanner.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
#include "pathplanner.h"
|
||||
#include "ui_pathplanner.h"
|
||||
#include "widgetdelegates.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QFileDialog>
|
||||
|
||||
pathPlanner::pathPlanner(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::testTable),wid(NULL),myModel(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
pathPlanner::~pathPlanner()
|
||||
{
|
||||
delete ui;
|
||||
if(wid)
|
||||
delete wid;
|
||||
}
|
||||
void pathPlanner::setModel(flightDataModel *model,QItemSelectionModel *selection)
|
||||
{
|
||||
myModel=model;
|
||||
ui->tableView->setModel(model);
|
||||
ui->tableView->setSelectionModel(selection);
|
||||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->tableView->setItemDelegate(new ComboBoxDelegate(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();
|
||||
}
|
||||
|
||||
void pathPlanner::on_rowsInserted ( const QModelIndex & parent, int start, int end )
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
for(int x=start;x<end+1;x++)
|
||||
{
|
||||
QModelIndex index=ui->tableView->model()->index(x,flightDataModel::MODE);
|
||||
ui->tableView->openPersistentEditor(index);
|
||||
index=ui->tableView->model()->index(x,flightDataModel::CONDITION);
|
||||
ui->tableView->openPersistentEditor(index);
|
||||
index=ui->tableView->model()->index(x,flightDataModel::COMMAND);
|
||||
ui->tableView->openPersistentEditor(index);
|
||||
ui->tableView->size().setHeight(10);
|
||||
}
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbAdd_clicked()
|
||||
{
|
||||
ui->tableView->model()->insertRow(ui->tableView->model()->rowCount());
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbDelete_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbInsert_clicked()
|
||||
{
|
||||
ui->tableView->model()->insertRow(ui->tableView->selectionModel()->currentIndex().row());
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbReadFromFile_clicked()
|
||||
{
|
||||
if(!myModel)
|
||||
return;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"));
|
||||
myModel->readFromFile(fileName);
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbSaveToFile_clicked()
|
||||
{
|
||||
if(!myModel)
|
||||
return;
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"));
|
||||
myModel->writeToFile(fileName);
|
||||
}
|
||||
|
||||
void pathPlanner::on_groupBox_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void pathPlanner::on_groupBox_toggled(bool arg1)
|
||||
{
|
||||
// wid->close();
|
||||
wid->setVisible(arg1);
|
||||
}
|
||||
|
||||
void pathPlanner::on_tbDetails_clicked()
|
||||
{
|
||||
if(wid)
|
||||
wid->show();
|
||||
}
|
45
ground/openpilotgcs/src/plugins/opmap/pathplanner.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef TESTTABLE_H
|
||||
#define TESTTABLE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "flightdatamodel.h"
|
||||
#include "opmap_edit_waypoint_dialog.h"
|
||||
namespace Ui {
|
||||
class testTable;
|
||||
}
|
||||
|
||||
class pathPlanner : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit pathPlanner(QWidget *parent = 0);
|
||||
~pathPlanner();
|
||||
|
||||
void setModel(flightDataModel *model,QItemSelectionModel *selection);
|
||||
private slots:
|
||||
void on_rowsInserted ( const QModelIndex & parent, int start, int end );
|
||||
|
||||
void on_tbAdd_clicked();
|
||||
|
||||
void on_tbDelete_clicked();
|
||||
|
||||
void on_tbInsert_clicked();
|
||||
|
||||
void on_tbReadFromFile_clicked();
|
||||
|
||||
void on_tbSaveToFile_clicked();
|
||||
|
||||
void on_groupBox_clicked();
|
||||
|
||||
void on_groupBox_toggled(bool arg1);
|
||||
|
||||
void on_tbDetails_clicked();
|
||||
|
||||
private:
|
||||
Ui::testTable *ui;
|
||||
opmap_edit_waypoint_dialog * wid;
|
||||
flightDataModel * myModel;
|
||||
};
|
||||
|
||||
#endif // TESTTABLE_H
|
131
ground/openpilotgcs/src/plugins/opmap/pathplanner.ui
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>testTable</class>
|
||||
<widget class="QWidget" name="testTable">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>536</width>
|
||||
<height>262</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbAdd">
|
||||
<property name="toolTip">
|
||||
<string>Add Leg</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/plus3.png</normaloff>:/opmap/images/plus3.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete Leg</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/stopb.png</normaloff>:/opmap/images/stopb.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbInsert">
|
||||
<property name="toolTip">
|
||||
<string>Insert Leg</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/forward_alt.png</normaloff>:/opmap/images/forward_alt.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbReadFromFile">
|
||||
<property name="toolTip">
|
||||
<string>Read from file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/unarchive.png</normaloff>:/opmap/images/unarchive.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbSaveToFile">
|
||||
<property name="toolTip">
|
||||
<string>Save to file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/Ekisho Deep Ocean HD1.png</normaloff>:/opmap/images/Ekisho Deep Ocean HD1.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbDetails">
|
||||
<property name="toolTip">
|
||||
<string>Open Details</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/star.png</normaloff>:/opmap/images/star.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="opmap.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
133
ground/openpilotgcs/src/plugins/opmap/widgetdelegates.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
#include "widgetdelegates.h"
|
||||
#include <QComboBox>
|
||||
#include <QRadioButton>
|
||||
#include <QDebug>
|
||||
QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
int column=index.column();
|
||||
QComboBox * box;
|
||||
switch(column)
|
||||
{
|
||||
case flightDataModel::MODE:
|
||||
box=new QComboBox(parent);
|
||||
ComboBoxDelegate::loadComboBox(box,flightDataModel::MODE);
|
||||
return box;
|
||||
break;
|
||||
case flightDataModel::CONDITION:
|
||||
box=new QComboBox(parent);
|
||||
ComboBoxDelegate::loadComboBox(box,flightDataModel::CONDITION);
|
||||
return box;
|
||||
break;
|
||||
|
||||
case flightDataModel::COMMAND:
|
||||
box=new QComboBox(parent);
|
||||
ComboBoxDelegate::loadComboBox(box,flightDataModel::COMMAND);
|
||||
return box;
|
||||
break;
|
||||
default:
|
||||
return QItemDelegate::createEditor(parent,option,index);
|
||||
break;
|
||||
}
|
||||
|
||||
QComboBox *editor = new QComboBox(parent);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void ComboBoxDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QString className=editor->metaObject()->className();
|
||||
if (className.contains("QComboBox")) {
|
||||
int value = index.model()->data(index, Qt::EditRole).toInt();
|
||||
QComboBox *comboBox = static_cast<QComboBox*>(editor);
|
||||
int x=comboBox->findData(value);
|
||||
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,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QString className=editor->metaObject()->className();
|
||||
if (className.contains("QComboBox")) {
|
||||
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,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
|
||||
{
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
void ComboBoxDelegate::loadComboBox(QComboBox *combo, flightDataModel::pathPlanDataEnum type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case flightDataModel::MODE:
|
||||
combo->addItem("Fly Direct",MODE_FLYENDPOINT);
|
||||
combo->addItem("Fly Vector",MODE_FLYVECTOR);
|
||||
combo->addItem("Fly Circle Right",MODE_FLYCIRCLERIGHT);
|
||||
combo->addItem("Fly Circle Left",MODE_FLYCIRCLELEFT);
|
||||
|
||||
combo->addItem("Drive Direct",MODE_DRIVEENDPOINT);
|
||||
combo->addItem("Drive Vector",MODE_DRIVEVECTOR);
|
||||
combo->addItem("Drive Circle Right",MODE_DRIVECIRCLELEFT);
|
||||
combo->addItem("Drive Circle Left",MODE_DRIVECIRCLERIGHT);
|
||||
|
||||
combo->addItem("Fixed Attitude",MODE_FIXEDATTITUDE);
|
||||
combo->addItem("Set Accessory",MODE_SETACCESSORY);
|
||||
combo->addItem("Disarm Alarm",MODE_DISARMALARM);
|
||||
break;
|
||||
case flightDataModel::CONDITION:
|
||||
combo->addItem("None",ENDCONDITION_NONE);
|
||||
combo->addItem("Timeout",ENDCONDITION_TIMEOUT);
|
||||
combo->addItem("Distance to tgt",ENDCONDITION_DISTANCETOTARGET);
|
||||
combo->addItem("Leg remaining",ENDCONDITION_LEGREMAINING);
|
||||
combo->addItem("Above Altitude",ENDCONDITION_ABOVEALTITUDE);
|
||||
combo->addItem("Pointing towards next",ENDCONDITION_POINTINGTOWARDSNEXT);
|
||||
combo->addItem("Python script",ENDCONDITION_PYTHONSCRIPT);
|
||||
combo->addItem("Immediate",ENDCONDITION_IMMEDIATE);
|
||||
break;
|
||||
case flightDataModel::COMMAND:
|
||||
combo->addItem("On conditon next wp",COMMAND_ONCONDITIONNEXTWAYPOINT);
|
||||
combo->addItem("On NOT conditon next wp",COMMAND_ONNOTCONDITIONNEXTWAYPOINT);
|
||||
combo->addItem("On conditon jump wp",COMMAND_ONCONDITIONJUMPWAYPOINT);
|
||||
combo->addItem("On NOT conditon jump wp",COMMAND_ONNOTCONDITIONJUMPWAYPOINT);
|
||||
combo->addItem("On conditon jump wp else next wp",COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT);
|
||||
break;
|
||||
default:
|
||||
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)
|
||||
{
|
||||
}
|
38
ground/openpilotgcs/src/plugins/opmap/widgetdelegates.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef WIDGETDELEGATES_H
|
||||
#define WIDGETDELEGATES_H
|
||||
#include <QItemDelegate>
|
||||
#include <QComboBox>
|
||||
#include "flightdatamodel.h"
|
||||
|
||||
|
||||
class ComboBoxDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef enum { MODE_FLYENDPOINT=0, MODE_FLYVECTOR=1, MODE_FLYCIRCLERIGHT=2, MODE_FLYCIRCLELEFT=3,
|
||||
MODE_DRIVEENDPOINT=4, MODE_DRIVEVECTOR=5, MODE_DRIVECIRCLELEFT=6, MODE_DRIVECIRCLERIGHT=7,
|
||||
MODE_FIXEDATTITUDE=8, MODE_SETACCESSORY=9, MODE_DISARMALARM=10 } ModeOptions;
|
||||
typedef enum { ENDCONDITION_NONE=0, ENDCONDITION_TIMEOUT=1, ENDCONDITION_DISTANCETOTARGET=2,
|
||||
ENDCONDITION_LEGREMAINING=3, ENDCONDITION_ABOVEALTITUDE=4, ENDCONDITION_POINTINGTOWARDSNEXT=5,
|
||||
ENDCONDITION_PYTHONSCRIPT=6, ENDCONDITION_IMMEDIATE=7 } EndConditionOptions;
|
||||
typedef enum { COMMAND_ONCONDITIONNEXTWAYPOINT=0, COMMAND_ONNOTCONDITIONNEXTWAYPOINT=1,
|
||||
COMMAND_ONCONDITIONJUMPWAYPOINT=2, COMMAND_ONNOTCONDITIONJUMPWAYPOINT=3,
|
||||
COMMAND_IFCONDITIONJUMPWAYPOINTELSENEXTWAYPOINT=4 } CommandOptions;
|
||||
|
||||
ComboBoxDelegate(QObject *parent = 0);
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const;
|
||||
|
||||
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
|