kDB: Knowledge DataBase
Loading...
Searching...
No Matches
Patch.h
1#pragma once
2
3#include <QFlags>
4#include <QSharedDataPointer>
5
6#include <kDBGIS/Forward.h>
7
8#include <knowCore/ReturnValue.h>
9#include <knowValues/Forward.h>
10
11#include "Point.h"
12
13namespace kDBPointClouds
14{
15 class Patch
16 {
17 public:
18 enum class PGWKBFlag
19 {
20 Default = 0,
21 IgnorePCID = 1
22 };
23 Q_DECLARE_FLAGS(PGWKBFlags, PGWKBFlag)
24 public:
25 Patch();
26 Patch(const PointSpecification& _specification, const QByteArray& _data = QByteArray());
27 Patch(const Patch& _rhs);
28 Patch& operator=(const Patch& _rhs);
29 ~Patch();
30 bool operator==(const Patch& _rhs) const;
42 Cartography::CoordinateSystem coordinateSystem() const;
46 void reserve(std::size_t _pts);
47 void append(const Point& _point);
48 template<typename... Types>
49 inline void append(const std::tuple<Types...>& _values);
50 template<typename... Types>
51 void append(Types... _values) {
52 append(std::make_tuple(_values...));
53 }
54 std::size_t pointsCount() const;
55 template<typename... Types>
56 inline std::tuple<Types...> get(std::size_t _index) const;
57 Point get(std::size_t _index) const;
63 QByteArray toPGWKB(PGWKBFlags _flags = PGWKBFlag::Default) const;
64 static knowCore::ReturnValue<Patch> fromPGWKB(const QByteArray& , const PointSpecification& _pointSpecification, PGWKBFlags _flags = PGWKBFlag::Default);
72 static knowCore::ReturnValue<Patch> fromPGWKB(const QByteArray& _data, const kDB::Repository::Connection& _connection, PGWKBFlags _flags = PGWKBFlag::Default);
76 bool isValid() const;
80 QByteArray data() const;
84 Patch transform(const Cartography::CoordinateSystem& _coordinateSystem, double _tx = 0.0, double _ty = 0.0, double _tz = 0.0) const;
85 knowCore::ReturnValue<QByteArray> md5() const;
86 public:
90 knowValues::Values::PointCloud toValuesPointCloud(const knowGIS::Pose& _pose, const knowGIS::GeometryObject& _geometry, const knowCore::Timestamp& _timestamp);
94 knowValues::Values::Lidar3DScan toValuesLidar3DScan(const knowGIS::Pose& _pose, const knowCore::Timestamp& _timestamp);
98 static Patch create(const knowValues::Values::PointCloud& _rhs);
99 private:
103 std::size_t prepareNextPointInsertion();
104 std::size_t pointSize() const;
105 QByteArray& data_ref();
106 private:
107 struct Private;
108 QSharedDataPointer<Private> d;
109 };
110
111 template<typename... Types>
112 void Patch::append(const std::tuple<Types...>& _values)
113 {
114 Point::setter<sizeof...(Types)>::doit(prepareNextPointInsertion(), data_ref(), _values);
115 }
116 template<typename... Types>
117 inline std::tuple<Types...> Patch::get(std::size_t _index) const
118 {
119 std::tuple<Types...> values;
120 Point::getter<sizeof...(Types)>::doit(_index * pointSize(), data(), values);
121 return values;
122 }
123}
124
125#include <knowCore/MetaType.h>
126KNOWCORE_DECLARE_FULL_METATYPE(kDBPointClouds, Patch)
Definition Patch.h:16
bool isValid() const
Definition Patch.cpp:224
static Patch create(const knowValues::Values::PointCloud &_rhs)
Definition Patch.cpp:335
Cartography::CoordinateSystem coordinateSystem() const
bool synchroniseSpecification(const kDB::Repository::Connection &_connection)
Definition Patch.cpp:73
knowValues::Values::PointCloud toValuesPointCloud(const knowGIS::Pose &_pose, const knowGIS::GeometryObject &_geometry, const knowCore::Timestamp &_timestamp)
Definition Patch.cpp:324
QByteArray toPGWKB(PGWKBFlags _flags=PGWKBFlag::Default) const
Definition Patch.cpp:195
QByteArray data() const
Definition Patch.cpp:115
void reserve(std::size_t _pts)
Definition Patch.cpp:78
Patch transform(const Cartography::CoordinateSystem &_coordinateSystem, double _tx=0.0, double _ty=0.0, double _tz=0.0) const
Definition Patch.cpp:229
PointSpecification specification() const
Definition Patch.cpp:68
knowValues::Values::Lidar3DScan toValuesLidar3DScan(const knowGIS::Pose &_pose, const knowCore::Timestamp &_timestamp)
Definition Patch.cpp:330
Definition PointSpecification.h:12
Definition Point.h:14
Definition Connection.h:25
Definition Timestamp.h:39
Definition GeometryObject.h:24
Definition Pose.h:10