e7cf44504c
## 架构升级:Service Registry + Bridge 模式 - 新增 PluginSDK/IPluginServices.h:10 个纯虚服务接口(IDataProvider/ILinkProvider/...) - 新增 MavLinkServiceBridge:单 QObject 实现全部服务,隔离 MavLinkNode 依赖 - 升级 PluginManifest:支持 plugin.json 的 provides/consumes 声明式依赖 - 实现 ExtensionHost::autoWire():元对象自省自动连接信号槽 - 集成到 AppController:initModules() 中创建桥接器并注册到 ServiceRegistry - CockpitPlugin 演示服务发现:initialize() 中通过 PluginContext 查找服务 ## 代码清理 - Plugins/opmap:~280 行死代码(waypointsetting 100行注释块/tilematrix 54行/等27个文件) - Plugins/MavLinkNode:~200 行 GBK 乱码注释翻译为 UTF-8 + 12 行注释死代码 - Plugins/ToolsUI:~222 行死代码(ECU.cpp 82行/INS.cpp 113行/Parse/ToolsUI 等) - StatusUI/Setting/MissionUI:~65 行注释死代码 - Cockpit/leftladder.cpp:10 处 GBK 乱码翻译为中文 - 清理头文件注释掉的 #include(19 处)、空 if-else 分支、注释变量声明 ## 编译验证 - [100%] Built target GCS 零错误 - 运行时 timeout 3s 正常退出,无崩溃
155 lines
3.1 KiB
C++
155 lines
3.1 KiB
C++
#ifndef GEOFENCEITEM_H
|
|
#define GEOFENCEITEM_H
|
|
|
|
#include <QGraphicsItem>
|
|
#include <QPainter>
|
|
#include <QLabel>
|
|
#include "pointlatlng.h"
|
|
#include <QObject>
|
|
#include "mapgraphicitem.h"
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
namespace mapcontrol {
|
|
|
|
#ifdef QtopmapWidget
|
|
#include <mapwidgetglobal.h>
|
|
class OPMAPWIDGETSHARED_EXPORT geoFenceitem : public QObject, public QGraphicsPolygonItem {
|
|
#else
|
|
class geoFenceitem : public QObject, public QGraphicsPolygonItem {
|
|
#endif
|
|
|
|
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
|
public:
|
|
enum { Type = UserType + 5 };
|
|
geoFenceitem(int group,bool inclusion,int version,internals::PointLatLng const & coord, QBrush color, MapGraphicItem *map, bool dashed = false, int width = 3);
|
|
|
|
int type() const;
|
|
internals::PointLatLng coord;
|
|
int number;
|
|
|
|
|
|
QList<internals::PointLatLng> points;
|
|
|
|
void setPoints(QList<internals::PointLatLng> p);
|
|
QList<internals::PointLatLng> Points(void)
|
|
{
|
|
return points;
|
|
}
|
|
|
|
|
|
int Group(void)
|
|
{
|
|
return m_group;
|
|
}
|
|
|
|
void setGroup(int value)
|
|
{
|
|
m_group = value;
|
|
|
|
QList<QPointF> latlng;
|
|
|
|
|
|
for(internals::PointLatLng p:points)
|
|
{
|
|
latlng.push_back(QPointF(p.Lat(),p.Lng()));
|
|
}
|
|
|
|
//emit updateFencePolygon(m_group,m_Vertex,m_inclusion,latlng);
|
|
|
|
RefreshPos();
|
|
}
|
|
|
|
bool Inclusion(void)
|
|
{
|
|
return m_inclusion;
|
|
}
|
|
|
|
void setInclusion(int value)
|
|
{
|
|
m_inclusion = value;
|
|
RefreshPos();
|
|
}
|
|
|
|
qreal Vertex(void)
|
|
{
|
|
return m_Vertex;
|
|
}
|
|
|
|
void setVertex(qreal value)
|
|
{
|
|
m_Vertex = value;
|
|
RefreshPos();
|
|
}
|
|
|
|
qreal Latitude(void)
|
|
{
|
|
return m_latitude;
|
|
}
|
|
|
|
void setLatitude(qreal value)
|
|
{
|
|
m_latitude = value;
|
|
coord.SetLat(m_latitude);
|
|
RefreshPos();
|
|
}
|
|
qreal Longitude(void)
|
|
{
|
|
return m_longitide;
|
|
}
|
|
|
|
void setLongitude(qreal value)
|
|
{
|
|
m_longitide = value;
|
|
coord.SetLng(m_longitide);
|
|
RefreshPos();
|
|
qDebug() << "set logitide";
|
|
}
|
|
|
|
protected:
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
|
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
private:
|
|
QBrush m_brush;
|
|
MapGraphicItem *m_map;
|
|
|
|
|
|
int m_version = 0;//-1
|
|
|
|
bool m_inclusion = true;
|
|
qreal m_Vertex = 0;//1
|
|
int m_group = 0; //2
|
|
qreal m_latitude = 0;//5
|
|
qreal m_longitide = 0;//6
|
|
|
|
bool dashed;
|
|
int lineWidth;
|
|
|
|
QPolygonF m_polygon;
|
|
|
|
bool isDragging = false;
|
|
|
|
|
|
bool enter = false;
|
|
|
|
public slots:
|
|
void setPosSLOT();
|
|
|
|
void RefreshPos();
|
|
|
|
signals:
|
|
void updateFencePolygon(int group,qreal vertex,bool inclusion,QList<QPointF> latlng);
|
|
|
|
void localPositionChanged(QPointF point, geoFenceitem *p);
|
|
void aboutToBeDeleted(geoFenceitem *);
|
|
|
|
};
|
|
}
|
|
#endif // GEOFENCEITEM_H
|