多机管理完成
This commit is contained in:
@@ -79,11 +79,25 @@ void UAVItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
qDebug() << "selected" << sysid << compid << this->isSelected();
|
||||
if(isEdit)
|
||||
{
|
||||
this->setZValue(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSelected)
|
||||
{
|
||||
this->setZValue(5);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setZValue(4);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->isSelected()) {
|
||||
qDebug() << "selected" << sysid << compid;
|
||||
painter->setPen(Qt::red);
|
||||
if (isSelected) {
|
||||
//qDebug() << "selected" << sysid << compid;
|
||||
painter->setPen(QColor(255*(1-sysid/255.0f),255*(1-sysid/255.0f),255*(1-sysid/255.0f)));
|
||||
painter->drawRect(QRectF(boundingRect()));
|
||||
}
|
||||
|
||||
@@ -170,12 +184,20 @@ void UAVItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
void UAVItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
qDebug() << "UAV mouseReleaseEvent";
|
||||
|
||||
//this->setSelected(true);
|
||||
|
||||
isSelected = true;
|
||||
//查找所有
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
UAVItem *uav = qgraphicsitem_cast<UAVItem *>(i);
|
||||
if (uav) {
|
||||
if(uav != this)
|
||||
{
|
||||
uav->setSelect(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug() << "emit select" << sysid << compid;
|
||||
emit selected(sysid,compid);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -196,6 +218,28 @@ void UAVItem::setID(int sys,int comp)
|
||||
compid = comp;
|
||||
}
|
||||
|
||||
void UAVItem::setSelect(bool select)
|
||||
{
|
||||
isSelected = select;
|
||||
qDebug() << "emit select" << sysid << compid;
|
||||
emit selected(sysid,compid);
|
||||
update();
|
||||
}
|
||||
|
||||
void UAVItem::setEdit(bool value)
|
||||
{
|
||||
isEdit = value;
|
||||
|
||||
if(isEdit)
|
||||
{
|
||||
this->setZValue(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setZValue(4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UAVItem::updateTextOverlay()
|
||||
{
|
||||
@@ -351,6 +395,7 @@ void UAVItem::SetUAVPos(const internals::PointLatLng &position, const int &altit
|
||||
if (mapfollowtype == UAVMapFollowType::CenterAndRotateMap || mapfollowtype == UAVMapFollowType::CenterMap) {
|
||||
mapwidget->SetCurrentPosition(coord);
|
||||
}
|
||||
|
||||
if (autosetreached) {
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *wp = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
@@ -363,6 +408,7 @@ void UAVItem::SetUAVPos(const internals::PointLatLng &position, const int &altit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mapwidget->Home != 0) {
|
||||
// verify if the UAV is inside the safety bouble
|
||||
if (Distance3D(mapwidget->Home->Coord(), mapwidget->Home->Altitude()) > mapwidget->Home->SafeArea()) {
|
||||
|
||||
Reference in New Issue
Block a user