96 lines
2.5 KiB
C++
96 lines
2.5 KiB
C++
#ifndef CIRCLEPOINTITEM_H
|
|
#define CIRCLEPOINTITEM_H
|
|
|
|
#include "mapgraphicitem.h"
|
|
#include "waypointparamdialog.h"
|
|
#include <QGraphicsEllipseItem>
|
|
#include <QObject>
|
|
#include "qapplication.h"
|
|
#include <QScreen>
|
|
|
|
class CirclePointItem : public QObject, public QGraphicsEllipseItem
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum { Type = UserType + 13 };
|
|
|
|
static int number;
|
|
|
|
CirclePointItem(mapcontrol::MapGraphicItem *map, QPointF const &p);
|
|
~CirclePointItem();
|
|
|
|
virtual int type() const override
|
|
{
|
|
return Type;
|
|
}
|
|
|
|
void autoParamDialogExex() const; //根据航点所在位置显示对话框
|
|
|
|
bool paramDialogExec() const //以模态的方式显示参数对话框
|
|
{
|
|
autoParamDialogExex();
|
|
|
|
return paramItem->isOk;
|
|
}
|
|
|
|
QPointF screenPos(QPointF const &pos) const; //返回pos在屏幕中的位置,pos只能是map(地图图形项)中的局部坐标
|
|
int radiusPixelLength(double angle) const; //计算外圆在地图上的像素半径
|
|
void setCircleEdit(bool v);
|
|
void setLngLat(double lng, double lat); //设置经纬度
|
|
bool getIsRemove() const
|
|
{
|
|
return isRemove;
|
|
}
|
|
|
|
double getHeight() const
|
|
{
|
|
return height;
|
|
}
|
|
|
|
internals::PointLatLng getLatLng() const
|
|
{
|
|
return latLng;
|
|
}
|
|
|
|
double getRadius() const
|
|
{
|
|
return outsideRadius * direction;
|
|
}
|
|
|
|
public slots:
|
|
void acceptedSlot();
|
|
void refreshPos();
|
|
void refreshOutSideEllipse(); //刷新外圆
|
|
|
|
signals:
|
|
void accepted();
|
|
void rejected();
|
|
void remove();
|
|
|
|
void cmd_long( float param1,float param2,float param3,float param4,float param5,float param6,float param7,uint16_t command,uint8_t confirmation);
|
|
|
|
|
|
protected:
|
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; //在航点上右击显示参数对话框
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) override;
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
|
//void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
|
|
private:
|
|
bool isRemove = false;
|
|
bool isCircleEdit = true;
|
|
double height; //高度
|
|
double outsideRadius;//外圈半径,单位:米
|
|
int direction; //方向,-1左盘旋,1右盘旋
|
|
internals::PointLatLng latLng; //经纬度
|
|
mapcontrol::MapGraphicItem *_parentMap; //行单所在的地图
|
|
QGraphicsEllipseItem *outside; //外圆
|
|
WayPointParamDialog *paramItem; //航点参数框
|
|
|
|
int privatenumber = 0;
|
|
};
|
|
|
|
#endif // CIRCLEPOINTITEM_H
|