19 #ifndef SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_DATASET_H_
20 #define SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_DATASET_H_
23 #include <comma/base/types.h>
24 #include <comma/csv/options.h>
25 #include <snark/math/interval.h>
26 #include <snark/graphics/qt3d/vertex_buffer.h>
27 #include "./PointMap.h"
28 #include "./PointWithId.h"
29 #include <Qt3D/qglpainter.h>
31 namespace snark {
namespace graphics {
namespace View {
41 Data(
const Data& rhs ) { operator=( rhs ); }
42 Data( comma::uint32
id, std::size_t index ) : id( id ), index( index ) {}
44 typedef PointMap< Eigen::Vector3d, Data > Points;
45 typedef std::map< comma::uint32, Points > Partitions;
47 BasicDataset(
const Eigen::Vector3d& offset );
48 const Points& points()
const;
49 const Partitions& partitions()
const;
50 const Eigen::Vector3d& offset()
const;
51 const math::closed_interval< double, 3 >& extents()
const;
53 void draw( QGLPainter* painter )
const;
54 void visible(
bool visible );
57 void insert(
const Points& m );
58 void erase(
const Points& m );
63 Partitions m_partitions;
64 boost::scoped_ptr< qt3d::vertex_buffer > m_vertices;
65 boost::optional< Eigen::Vector3d > m_offset;
66 boost::optional< math::closed_interval< double, 3 > > m_extents;
67 void insert(
const Eigen::Vector3d& p,
const Data& data );
70 class Dataset :
public BasicDataset
73 Dataset(
const std::string& filename,
const comma::csv::options& options,
bool relabelDuplicated );
74 Dataset(
const std::string& filename,
const comma::csv::options& options,
const Eigen::Vector3d& offset,
bool relabelDuplicated );
76 void saveAs(
const std::string& f );
78 void label(
const Eigen::Vector3d& p, comma::uint32
id );
79 void label(
const Points& p, comma::uint32
id );
80 void writable(
bool enabled );
81 bool writable()
const;
82 bool modified()
const;
84 BasicDataset& selection();
85 const BasicDataset& selection()
const;
86 const std::string& filename()
const;
87 const comma::csv::options& options()
const;
89 static void repair(
const comma::csv::options& options );
93 void insert(
const Points& m );
94 void erase(
const Points& m );
96 std::size_t labelimpl(
const Eigen::Vector3d& p, comma::uint32
id );
97 void labelDuplicated();
99 typedef std::deque< std::pair< PointWithId, std::string > > Deque;
101 std::string m_filename;
102 const comma::csv::options m_options;
103 boost::scoped_ptr< BasicDataset > m_selection;
111 #endif // SNARK_GRAPHICS_APPLICATIONS_LABELPOINTS_DATASET_H_