17 #ifndef _LASERVIEW_HH_
18 #define _LASERVIEW_HH_
22 #include <boost/thread/mutex.hpp>
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,
115 private:
virtual QRectF boundingRect()
const;
124 private:
virtual void paint(QPainter *_painter,
125 const QStyleOptionGraphicsItem *_option,
131 private:
virtual void hoverEnterEvent(
132 QGraphicsSceneHoverEvent *_event);
137 private:
virtual void hoverLeaveEvent(
138 QGraphicsSceneHoverEvent *_event);
143 private:
void hoverMoveEvent(QGraphicsSceneHoverEvent *_event);
146 private: std::vector<QPointF> points;
149 private: std::vector<QPointF> noHitPoints;
153 private: std::vector<double> ranges;
156 private:
double angleMin;
159 private:
double angleMax;
162 private:
double angleStep;
165 private:
double rangeMax;
168 private:
double rangeMin;
171 private:
double indexAngle;
174 private:
double scale;
177 public:
bool radians;
180 private:
mutable boost::mutex mutex;
185 private:
class CustomView :
public QGraphicsView
189 public: CustomView(QWidget *_parent)
190 : QGraphicsView(_parent), viewZoomed(
false) {}
194 private:
void wheelEvent(QWheelEvent *_event)
196 this->viewZoomed =
true;
197 _event->delta() > 0 ? this->scale(1.15, 1.15) :
198 this->scale(1.0 / 1.15, 1.0 / 1.15);
203 public:
bool viewZoomed;
207 private: LaserItem *laserItem;
210 private: CustomView *view;
213 private:
bool firstMsg;
216 private: QLineEdit *rangeEdit;
219 private: QLineEdit *angleEdit;
222 private: QSpinBox *vertScanSpin;
#define GZ_GUI_VISIBLE
Definition: system.hh:284
Forward declarations for transport.
Base class for widgets that display topic data.
Definition: TopicView.hh:76
#define NULL
Definition: CommonTypes.hh:31
Definition: LaserView.hh:37