92 {
93 boost::program_options::options_description boost_desc("Allowed options");
94 boost_desc.add_options()("help", "produce help message")(
95 "srcdir", boost::program_options::value<std::string>(),
96 "provide the data base dir")("dstdir",
97 boost::program_options::value<std::string>(),
98 "provide the lossy map destination dir");
99
100 boost::program_options::variables_map boost_args;
101 boost::program_options::store(
102 boost::program_options::parse_command_line(argc, argv, boost_desc),
103 boost_args);
104 boost::program_options::notify(boost_args);
105
106 if (boost_args.count("help") || !boost_args.count("srcdir") ||
107 !boost_args.count("dstdir")) {
109 return 0;
110 }
111
112 const std::string src_path = boost_args["srcdir"].as<std::string>();
113 const std::string dst_path = boost_args["dstdir"].as<std::string>();
114 std::string src_map_folder = src_path + "/";
115
118 lossless_map_node_pool.Initial(&lossless_config);
119
121 lossless_map.InitMapNodeCaches(12, 24);
122 lossless_map.AttachMapNodePool(&lossless_map_node_pool);
123 if (!lossless_map.SetMapFolderPath(src_map_folder)) {
124 AERROR <<
"Reflectance map folder is invalid!";
125 return -1;
126 }
127
128
129 std::string dst_map_folder = dst_path + "/lossy_map/";
130 if (!boost::filesystem::exists(dst_map_folder)) {
131 boost::filesystem::create_directory(dst_map_folder);
132 }
133
134 std::list<MapNodeIndex> buf;
136 &buf);
137 AINFO <<
"index size: " << buf.size();
138
140 config_transform_lossy.Load(src_map_folder + "config.xml");
141 config_transform_lossy.map_version_ = "lossy_map";
142 config_transform_lossy.Save(dst_map_folder + "config.xml");
143
144 AINFO <<
"lossy map directory structure has built.";
145
147 lossy_map_node_pool.Initial(&config_transform_lossy);
148 PyramidMap lossy_map(&config_transform_lossy);
149 lossy_map.InitMapNodeCaches(12, 24);
150 lossy_map.AttachMapNodePool(&lossy_map_node_pool);
151 if (!lossy_map.SetMapFolderPath(dst_map_folder)) {
152 AINFO <<
"lossy_map config xml not exist";
153 }
154
155 int index = 0;
156 auto itr = buf.begin();
157 for (; itr != buf.end(); ++itr, ++index) {
160 if (lossless_node == nullptr) {
161 AWARN <<
"index: " << index <<
" is a nullptr pointer!";
162 continue;
163 }
166
171
172 int rows = lossless_config.map_node_size_y_;
173 int cols = lossless_config.map_node_size_x_;
174 for (int row = 0; row < rows; ++row) {
175 for (int col = 0; col < cols; ++col) {
177 const float* intensity_var =
179 const unsigned int* count = lossless_matrix.
GetCountSafe(row, col);
180
182 const float* altitude_var =
184 const float* altitude_ground =
186 const unsigned int* ground_count =
188 if (intensity) {
190 }
191 if (intensity_var) {
193 }
194 if (count) {
196 }
197 if (altitude_avg) {
199 }
200 if (altitude_var) {
202 }
203 if (altitude_ground) {
205 }
206 if (ground_count) {
208 }
209 }
210 }
212 }
213
214 return 0;
215}
const BaseMapMatrix & GetMapCellMatrix() const
Get map cell matrix.
void SetIsChanged(bool is)
Set if the map node data has changed.
const unsigned int * GetGroundCountSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get a ground count value by check.
const float * GetIntensityVarSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get an intensity variance value by check.
const float * GetIntensitySafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get an intensity value by check.
void SetGroundAltitudeSafe(float ground_altitude, unsigned int row, unsigned int col, unsigned int level=0)
Set an altitude ground value by check.
const float * GetAltitudeSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get an altitude value by check.
void SetAltitudeSafe(float altitude, unsigned int row, unsigned int col, unsigned int level=0)
Set an altitude value by check.
void SetCountSafe(unsigned int count, unsigned int row, unsigned int col, unsigned int level=0)
Set a count value by check.
const unsigned int * GetCountSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get a count value by check.
void SetIntensityVarSafe(float intensity_var, unsigned int row, unsigned int col, unsigned int level=0)
Set an intensity variance value by check.
const float * GetAltitudeVarSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get an altitude variance value by check.
const float * GetGroundAltitudeSafe(unsigned int row, unsigned int col, unsigned int level=0) const
Get an altitude ground value by check.
void SetGroundCountSafe(unsigned int ground_count, unsigned int row, unsigned int col, unsigned int level=0)
Set a ground count value by check.
void SetIntensitySafe(float intensity, unsigned int row, unsigned int col, unsigned int level=0)
Set an intensity value by check.
void SetAltitudeVarSafe(float altitude_var, unsigned int row, unsigned int col, unsigned int level=0)
Set an altitude variance value by check.
bool GetAllMapIndex(const std::string &src_map_folder, const std::string &dst_map_folder, std::list< MapNodeIndex > *buf)