19 #ifndef SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_VIEWER_H_
20 #define SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_VIEWER_H_
24 #define BOOST_FILESYSTEM_VERSION 3
32 #include <boost/filesystem/operations.hpp>
33 #include <boost/lexical_cast.hpp>
34 #include <boost/scoped_ptr.hpp>
35 #include <boost/optional.hpp>
36 #include <comma/string/string.h>
38 #include <snark/graphics/qt3d/view.h>
40 #include "./Dataset.h"
41 #include "./PointWithId.h"
44 namespace snark {
namespace graphics {
namespace View {
46 static const long double pi_ = 3.14159265358979323846l;
48 class Viewer :
public qt3d::view
53 Tools::Navigate navigate;
55 Tools::SelectPartition selectPartition;
56 Tools::SelectId selectId;
57 Tools::SelectClip selectClip;
60 Viewer(
const std::vector< comma::csv::options >& options
61 ,
bool labelDuplicated
62 ,
const QColor4ub& background_color
63 ,
bool orthographic =
false,
double fieldOfView = pi_ / 4 );
65 void show( std::size_t i,
bool visible );
66 void setWritable( std::size_t i,
bool writable );
69 const std::vector< boost::shared_ptr< Dataset > >& datasets()
const;
70 Dataset& dataset( std::size_t index );
71 const Dataset& dataset( std::size_t index )
const;
74 void handleId( comma::uint32
id );
80 void saveStateToFile();
81 void initializeGL( QGLPainter *painter );
82 void paintGL( QGLPainter *painter );
83 void mousePressEvent( QMouseEvent* e );
84 void mouseReleaseEvent( QMouseEvent* e );
85 void mouseMoveEvent( QMouseEvent* e );
86 boost::optional< std::pair< Eigen::Vector3d, comma::uint32 > > pointSelection(
const QPoint& point,
bool writableOnly =
false );
89 friend class Tools::Tool;
90 friend class Tools::PickId;
91 friend struct Tools::SelectPartition;
92 friend struct Tools::SelectId;
93 friend class Tools::SelectClip;
94 friend struct Tools::Fill;
97 Tools::Tool* m_currentTool;
98 std::vector< boost::shared_ptr< Dataset > > m_datasets;
99 boost::optional< comma::uint32 > m_id;
100 const QColor4ub m_background_color;
101 std::vector< comma::csv::options > m_options;
102 bool m_labelDuplicated;
104 double m_fieldOfView;
105 boost::optional< QPoint > m_startPan;
106 boost::optional< QPoint > m_startRotate;
107 double m_sceneRadius;
112 #endif // SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_VIEWER_H_