97 lines
1.9 KiB
C++
97 lines
1.9 KiB
C++
#ifndef ALTITUDEITEM_H
|
|
#define ALTITUDEITEM_H
|
|
|
|
#include <QGraphicsItem>
|
|
#include <QPainter>
|
|
#include <QLabel>
|
|
#include "pointlatlng.h"
|
|
#include "mapgraphicitem.h"
|
|
#include "waypointitem.h"
|
|
#include <QObject>
|
|
#include <QPoint>
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
//#pragma execution_character_set("utf-8")
|
|
|
|
namespace mapcontrol {
|
|
//class OPMapWidget;
|
|
|
|
#ifdef QtopmapWidget
|
|
#include <mapwidgetglobal.h>
|
|
class OPMAPWIDGETSHARED_EXPORT AltitudeItem : public QObject, public QGraphicsItem {
|
|
#else
|
|
class AltitudeItem : public QObject, public QGraphicsItem {
|
|
#endif
|
|
|
|
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
|
|
|
public:
|
|
|
|
|
|
AltitudeItem(MapGraphicItem *map, QColor background = Qt::green);
|
|
|
|
QRectF boundingRect() const;
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
void setColor(const QColor &color)
|
|
{
|
|
myColor = color;
|
|
}
|
|
|
|
int Number(void)
|
|
{
|
|
return number;
|
|
}
|
|
|
|
static float max;
|
|
static float min;
|
|
|
|
private:
|
|
MapGraphicItem *myMap;
|
|
QColor myColor;
|
|
|
|
QColor AltColor = "#00ff33";
|
|
QColor EleColor = "#ffcc00";
|
|
|
|
|
|
QMap<int,float> Altitude;//离开地面高度
|
|
QMap<int,float> Elevation;//离开海平面高度
|
|
|
|
int currentPoint = -1;
|
|
|
|
|
|
bool isDragging;
|
|
|
|
|
|
int number;
|
|
|
|
QPointF pos_old;
|
|
|
|
|
|
void Bezier(QPainter *painter);
|
|
|
|
protected:
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
|
|
public slots:
|
|
|
|
void setCurrentPoint(int value);
|
|
void setNumber(int value);
|
|
void setElevation(QMap<int, float> value);
|
|
void setAltitude(QMap<int,float> value);
|
|
|
|
void RefreshPos();
|
|
void setOpacitySlot(qreal opacity);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} //NAME SPACE
|
|
#endif // ALTITUDEITEM_H
|