17 #ifndef GAZEBO_GUI_VIEWERS_LASERVIEW_HH_
18 #define GAZEBO_GUI_VIEWERS_LASERVIEW_HH_
49 public:
virtual void SetTopic(
const std::string &_topicName);
52 private:
virtual void UpdateImpl();
56 protected:
virtual void resizeEvent(QResizeEvent *_event);
60 private:
void OnScan(ConstLaserScanStampedPtr &_msg);
63 private slots:
void OnFitInView();
66 private slots:
void OnDegree(
bool _toggled);
69 private:
class LaserItem :
public QGraphicsItem
79 public:
unsigned int GetRangeCount();
83 public:
void AddRange(
double _range);
88 public:
void SetRange(
unsigned int _index,
double _range);
91 public: QRectF GetBoundingRect()
const;
96 public:
double GetHoverRange()
const;
101 public:
double GetHoverAngle()
const;
109 public:
void Update(
double _angleMin,
double _angleMax,
110 double _angleStep,
double _rangeMax,
114 public:
void UpdateGeometry();
118 private:
virtual QRectF boundingRect()
const;
127 private:
virtual void paint(QPainter *_painter,
128 const QStyleOptionGraphicsItem *_option,
134 private:
virtual void hoverEnterEvent(
135 QGraphicsSceneHoverEvent *_event);
140 private:
virtual void hoverLeaveEvent(
141 QGraphicsSceneHoverEvent *_event);
146 private:
void hoverMoveEvent(QGraphicsSceneHoverEvent *_event);
149 private: std::vector<QPointF> points;
152 private: std::vector<QPointF> noHitPoints;
156 private: std::vector<double> ranges;
159 private:
double angleMin;
162 private:
double angleMax;
165 private:
double angleStep;
168 private:
double rangeMax;
171 private:
double rangeMin;
174 private:
double indexAngle;
177 private:
double scale;
180 public:
bool radians;
183 private:
mutable std::mutex mutex;
186 private:
bool dirty =
false;
191 private:
class CustomView :
public QGraphicsView
195 public: CustomView(QWidget *_parent)
196 : QGraphicsView(_parent), viewZoomed(
false) {}
200 private:
void wheelEvent(QWheelEvent *_event)
202 this->viewZoomed =
true;
203 _event->delta() > 0 ? this->scale(1.15, 1.15) :
204 this->scale(1.0 / 1.15, 1.0 / 1.15);
209 public:
bool viewZoomed;
213 private: LaserItem *laserItem;
216 private: CustomView *view;
219 private:
bool firstMsg;
222 private: QLineEdit *rangeEdit;
225 private: QLineEdit *angleEdit;
228 private: QSpinBox *vertScanSpin;
Forward declarations for transport.
Base class for widgets that display topic data.
Definition: TopicView.hh:78
#define NULL
Definition: CommonTypes.hh:31
Definition: LaserView.hh:37