| 3311 | #include <nlohmann/json.hpp> |
| 3312 | |
| 3313 | int main(int argc, char** argv) { |
| 3314 | std::vector<Polygon_2> input_polygons, output; |
| 3315 | |
| 3316 | if (argc == 2) { |
| 3317 | using json = nlohmann::json; |
| 3318 | std::ifstream file(argv[1]); |
| 3319 | json jsonData; |
| 3320 | file >> jsonData; |
| 3321 | size_t i = 0; |
| 3322 | for (const auto& item : jsonData.items()) { |
| 3323 | std::cout << "i " << i << std::endl; |
| 3324 | i++; |
| 3325 | input_polygons.clear(); |
| 3326 | const auto& polygonsData = item.value(); |
| 3327 | for (const auto& polygonData : polygonsData) { |
| 3328 | input_polygons.emplace_back(); |
| 3329 | for (const auto& pointData : polygonData) { |
| 3330 | double x = pointData[0]; |
| 3331 | double y = pointData[1]; |
| 3332 | input_polygons.back().push_back(CGAL::Point_2<K>(x, y)); |
| 3333 | } |
| 3334 | } |
| 3335 | arrange_cgal_polygons(arrange_polygon_settings{}, input_polygons, output); |
| 3336 | break; |
| 3337 | } |
| 3338 | return 0; |
| 3339 | } else { |
| 3340 | Polygon_2 rect1 = create_rectangle<typename Polygon_2::FT>(0, 0, 2, 1); |
| 3341 | Polygon_2 rect2 = create_rectangle<typename Polygon_2::FT>(2.2, 0, 4, 1.1); |
| 3342 | Polygon_2 rect3 = create_rectangle<typename Polygon_2::FT>(0, 1.2, 2, 4); |
| 3343 | Polygon_2 rect4 = create_rectangle<typename Polygon_2::FT>(2.2, 1.2, 6, 4); |
| 3344 | Polygon_2 rect5 = create_rectangle<typename Polygon_2::FT>(4.2, 0, 6, 1.1); |
| 3345 | |
| 3346 | input_polygons = { rect1, rect2, rect3, rect4, rect5 }; |
| 3347 | } |
| 3348 | arrange_cgal_polygons(arrange_polygon_settings{}, input_polygons, output); |
| 3349 | |
| 3350 | return 0; |
| 3351 | } |
| 3352 | |
| 3353 | #endif |
nothing calls this directly
no test coverage detected