| 203 | //////////////////////////////////////////////////////////////////////////////// |
| 204 | |
| 205 | void |
| 206 | OutofcoreOctreeNodeMetadata::serializeMetadataToDisk () |
| 207 | { |
| 208 | std::shared_ptr<cJSON> idx (cJSON_CreateObject (), cJSON_Delete); |
| 209 | |
| 210 | cJSON* cjson_outofcore_version = cJSON_CreateNumber (outofcore_version_); |
| 211 | |
| 212 | double min_array[3]; |
| 213 | double max_array[3]; |
| 214 | |
| 215 | for(int i=0; i<3; i++) |
| 216 | { |
| 217 | min_array[i] = min_bb_[i]; |
| 218 | max_array[i] = max_bb_[i]; |
| 219 | } |
| 220 | |
| 221 | cJSON* cjson_bb_min = cJSON_CreateDoubleArray (min_array, 3); |
| 222 | cJSON* cjson_bb_max = cJSON_CreateDoubleArray (max_array, 3); |
| 223 | |
| 224 | std::string binary_point_filename_string = binary_point_filename_.filename ().generic_string (); |
| 225 | cJSON* cjson_bin_point_filename = cJSON_CreateString (binary_point_filename_string.c_str ()); |
| 226 | |
| 227 | cJSON_AddItemToObject (idx.get (), "version", cjson_outofcore_version); |
| 228 | cJSON_AddItemToObject (idx.get (), "bb_min", cjson_bb_min); |
| 229 | cJSON_AddItemToObject (idx.get (), "bb_max", cjson_bb_max); |
| 230 | cJSON_AddItemToObject (idx.get (), "bin", cjson_bin_point_filename); |
| 231 | |
| 232 | char* idx_txt = cJSON_Print (idx.get ()); |
| 233 | |
| 234 | std::ofstream f (metadata_filename_.string ().c_str (), std::ios::out | std::ios::trunc); |
| 235 | f << idx_txt; |
| 236 | f.close (); |
| 237 | |
| 238 | free (idx_txt); |
| 239 | } |
| 240 | |
| 241 | //////////////////////////////////////////////////////////////////////////////// |
| 242 |
no test coverage detected