|
41 | 41 |
|
42 | 42 | #include "../ifcparse/utils.h" |
43 | 43 |
|
| 44 | +#ifdef IFOPSH_WITH_CGAL |
| 45 | +#include "./cityjson/geobim.h" |
| 46 | +#endif |
| 47 | + |
44 | 48 | #ifdef IFOPSH_WITH_OPENCASCADE |
45 | 49 |
|
46 | 50 | #include <Standard_Version.hxx> |
@@ -116,6 +120,9 @@ void print_usage(bool suggest_help = true) |
116 | 120 | << " .svg SVG Scalable Vector Graphics (2D floor plan)\n" |
117 | 121 | #ifdef WITH_HDF5 |
118 | 122 | << " .h5 HDF Hierarchical Data Format storing positions, normals and indices\n" |
| 123 | +#endif |
| 124 | +#ifdef IFOPSH_WITH_CGAL |
| 125 | + << " .city.json City JSON format for geospatial data\n" |
119 | 126 | #endif |
120 | 127 | << " .ifc IFC-SPF Industry Foundation Classes\n" |
121 | 128 | << "\n" |
@@ -730,6 +737,7 @@ int main(int argc, char** argv) { |
730 | 737 | CACHE = IfcUtil::path::from_utf8(".cache"), |
731 | 738 | HDF = IfcUtil::path::from_utf8(".h5"), |
732 | 739 | XML = IfcUtil::path::from_utf8(".xml"), |
| 740 | + CITY_JSON = IfcUtil::path::from_utf8(".cityjson"), |
733 | 741 | IFC = IfcUtil::path::from_utf8(".ifc"); |
734 | 742 |
|
735 | 743 | // @todo clean up serializer selection |
@@ -779,6 +787,36 @@ int main(int argc, char** argv) { |
779 | 787 | write_log(!quiet); |
780 | 788 | return exit_code; |
781 | 789 | } |
| 790 | +#ifdef IFOPSH_WITH_CGAL |
| 791 | + else if (output_extension == CITY_JSON) { |
| 792 | + geobim_settings settings; |
| 793 | + settings.input_filenames = { IfcUtil::path::to_utf8(input_filename) }; |
| 794 | + settings.cityjson_output_filename = IfcUtil::path::to_utf8(output_filename); |
| 795 | + // @todo |
| 796 | + settings.radii = { "0.05" }; |
| 797 | + settings.apply_openings = false; |
| 798 | + settings.apply_openings_posthoc = true; |
| 799 | + settings.debug = false; |
| 800 | + settings.exact_segmentation = false; |
| 801 | + settings.minkowski_triangles = false; |
| 802 | + settings.no_erosion = false; |
| 803 | + settings.spherical_padding = false; |
| 804 | + |
| 805 | + settings.settings.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, false); |
| 806 | + settings.settings.set(IfcGeom::IteratorSettings::WELD_VERTICES, false); |
| 807 | + settings.settings.set(IfcGeom::IteratorSettings::SEW_SHELLS, true); |
| 808 | + settings.settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true); |
| 809 | + settings.settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); |
| 810 | + settings.settings.set(IfcGeom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS, !settings.apply_openings); |
| 811 | + |
| 812 | + settings.entity_names = include_filter.values; |
| 813 | + settings.entity_names_included = true; |
| 814 | + |
| 815 | + perform(settings); |
| 816 | + |
| 817 | + return 0; |
| 818 | + } |
| 819 | +#endif |
782 | 820 |
|
783 | 821 | /// @todo Clean up this filter code further. |
784 | 822 | std::vector<geom_filter> used_filters; |
|
0 commit comments