21 #ifndef SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_READER_H_
22 #define SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_READER_H_
29 #include <boost/scoped_ptr.hpp>
30 #include <boost/thread.hpp>
31 #include <comma/base/types.h>
32 #include <comma/csv/options.h>
33 #include <comma/csv/stream.h>
34 #include <comma/io/file_descriptor.h>
35 #include <comma/io/stream.h>
36 #include <comma/sync/synchronized.h>
37 #include <snark/math/interval.h>
38 #include "./Coloured.h"
39 #include "./PointWithId.h"
40 #include <snark/graphics/qt3d/vertex_buffer.h>
41 #include <Qt3D/qglview.h>
43 class QGLAbstractScene;
45 namespace snark {
namespace graphics {
namespace View {
52 const std::size_t size;
53 const unsigned int pointSize;
54 const comma::csv::options options;
56 Reader( QGLView& viewer, comma::csv::options& options, std::size_t size, coloured* c,
unsigned int pointSize,
const std::string& label,
const QVector3D& offset = QVector3D( 0, 0, 0 ) );
60 virtual void start() = 0;
61 virtual void update(
const Eigen::Vector3d& offset ) = 0;
62 virtual const Eigen::Vector3d& somePoint()
const = 0;
63 virtual bool readOnce() = 0;
64 virtual void render( QGLPainter *painter ) = 0;
65 virtual bool empty()
const = 0;
69 bool isShutdown()
const;
70 bool isStdIn()
const {
return m_isStdIn; }
75 void updatePoint(
const Eigen::Vector3d& offset );
76 void drawLabel( QGLPainter* painter,
const QVector3D& position,
const std::string& label );
77 void drawLabel( QGLPainter* painter,
const QVector3D& position );
81 boost::optional< snark::math::closed_interval< float, 3 > > m_extents;
82 unsigned int m_num_points;
83 boost::scoped_ptr< coloured > m_colored;
87 comma::io::istream m_istream;
88 boost::scoped_ptr< boost::thread > m_thread;
89 mutable boost::mutex m_mutex;
90 boost::optional< Eigen::Vector3d > m_point;
91 boost::optional< Eigen::Vector3d > m_orientation;
93 QVector3D m_translation;
94 QQuaternion m_quaternion;
99 void drawText( QGLPainter *painter,
const QString&
string,
const QColor4ub& color );