Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef CARTOGRAPHER_IO_SUBMAP_PAINTER_H_
00018 #define CARTOGRAPHER_IO_SUBMAP_PAINTER_H_
00019
00020 #include "Eigen/Geometry"
00021 #include "cairo/cairo.h"
00022 #include "cartographer/io/image.h"
00023 #include "cartographer/io/proto_stream_deserializer.h"
00024 #include "cartographer/mapping/id.h"
00025 #include "cartographer/mapping/proto/serialization.pb.h"
00026 #include "cartographer/mapping/value_conversion_tables.h"
00027 #include "cartographer/transform/rigid_transform.h"
00028
00029 namespace cartographer {
00030 namespace io {
00031
00032 struct PaintSubmapSlicesResult {
00033 PaintSubmapSlicesResult(::cartographer::io::UniqueCairoSurfacePtr surface,
00034 Eigen::Array2f origin)
00035 : surface(std::move(surface)), origin(origin) {}
00036 ::cartographer::io::UniqueCairoSurfacePtr surface;
00037
00038
00039 Eigen::Array2f origin;
00040 };
00041
00042 struct SubmapSlice {
00043 SubmapSlice()
00044 : surface(::cartographer::io::MakeUniqueCairoSurfacePtr(nullptr)) {}
00045
00046
00047 int width;
00048 int height;
00049 int version;
00050 double resolution;
00051 ::cartographer::transform::Rigid3d slice_pose;
00052 ::cartographer::io::UniqueCairoSurfacePtr surface;
00053
00054 std::vector<uint32_t> cairo_data;
00055
00056
00057 ::cartographer::transform::Rigid3d pose;
00058 int metadata_version = -1;
00059 };
00060
00061 struct SubmapTexture {
00062 struct Pixels {
00063 std::vector<char> intensity;
00064 std::vector<char> alpha;
00065 };
00066 Pixels pixels;
00067 int width;
00068 int height;
00069 double resolution;
00070 ::cartographer::transform::Rigid3d slice_pose;
00071 };
00072
00073 struct SubmapTextures {
00074 int version;
00075 std::vector<SubmapTexture> textures;
00076 };
00077
00078 PaintSubmapSlicesResult PaintSubmapSlices(
00079 const std::map<::cartographer::mapping::SubmapId, SubmapSlice>& submaps,
00080 double resolution);
00081
00082 void FillSubmapSlice(
00083 const ::cartographer::transform::Rigid3d& global_submap_pose,
00084 const ::cartographer::mapping::proto::Submap& proto,
00085 SubmapSlice* const submap_slice,
00086 mapping::ValueConversionTables* conversion_tables);
00087
00088 void DeserializeAndFillSubmapSlices(
00089 ProtoStreamDeserializer* deserializer,
00090 std::map<::cartographer::mapping::SubmapId, SubmapSlice>* submap_slices,
00091 mapping::ValueConversionTables* conversion_tables);
00092
00093
00094 SubmapTexture::Pixels UnpackTextureData(const std::string& compressed_cells,
00095 int width, int height);
00096
00097
00098
00099 UniqueCairoSurfacePtr DrawTexture(const std::vector<char>& intensity,
00100 const std::vector<char>& alpha, int width,
00101 int height,
00102 std::vector<uint32_t>* cairo_data);
00103
00104 }
00105 }
00106
00107 #endif // CARTOGRAPHER_IO_SUBMAP_PAINTER_H_