Integerate cityjson converter

This commit is contained in:
Thomas Krijnen
2023-03-30 11:29:09 +02:00
parent f1ce5f17e8
commit 5b2f7653eb
4 changed files with 61 additions and 1 deletions
+4 -1
View File
@@ -10,4 +10,7 @@
url = https://github.com/IfcOpenShell/svgfill
[submodule "src/ifcopenshell-python/test/Sample-BIM-Files"]
path = src/ifcopenshell-python/test/Sample-BIM-Files
url = https://github.com/IfcOpenShell/ids-test-files
url = https://github.com/IfcOpenShell/ids-test-files
[submodule "src/ifcconvert/cityjson"]
path = src/ifcconvert/cityjson
url = https://github.com/IfcOpenShell/ifc-to-cityjson
+18
View File
@@ -919,6 +919,23 @@ endif()
if (BUILD_CONVERT)
if (WITH_CGAL)
set(CITYJSON_CONVERT_FILES
../src/ifcconvert/cityjson/geobim.cpp
../src/ifcconvert/cityjson/global_execution_context.cpp
../src/ifcconvert/cityjson/opening_collector.cpp
../src/ifcconvert/cityjson/processing.cpp
../src/ifcconvert/cityjson/radius_comparison.cpp
../src/ifcconvert/cityjson/radius_execution_context.cpp
../src/ifcconvert/cityjson/settings.cpp
../src/ifcconvert/cityjson/writer.cpp
)
add_library(cityjson_converter ${CITYJSON_CONVERT_FILES})
target_include_directories(cityjson_converter PRIVATE ../src)
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} cityjson_converter)
endif()
# IfcConvert
file(GLOB IFCCONVERT_CPP_FILES ../src/ifcconvert/*.cpp)
file(GLOB IFCCONVERT_H_FILES ../src/ifcconvert/*.h)
@@ -1010,6 +1027,7 @@ ENDIF()
IF(NOT MINIMAL_BUILD AND BUILD_IFCMAX)
ADD_SUBDIRECTORY(../src/ifcmax ifcmax)
ENDIF()
if (NOT MINIMAL_BUILD)
if (WITH_CGAL)
ADD_SUBDIRECTORY(../src/svgfill svgfill)
+38
View File
@@ -41,6 +41,10 @@
#include "../ifcparse/utils.h"
#ifdef IFOPSH_WITH_CGAL
#include "./cityjson/geobim.h"
#endif
#ifdef IFOPSH_WITH_OPENCASCADE
#include <Standard_Version.hxx>
@@ -116,6 +120,9 @@ void print_usage(bool suggest_help = true)
<< " .svg SVG Scalable Vector Graphics (2D floor plan)\n"
#ifdef WITH_HDF5
<< " .h5 HDF Hierarchical Data Format storing positions, normals and indices\n"
#endif
#ifdef IFOPSH_WITH_CGAL
<< " .city.json City JSON format for geospatial data\n"
#endif
<< " .ifc IFC-SPF Industry Foundation Classes\n"
<< "\n"
@@ -730,6 +737,7 @@ int main(int argc, char** argv) {
CACHE = IfcUtil::path::from_utf8(".cache"),
HDF = IfcUtil::path::from_utf8(".h5"),
XML = IfcUtil::path::from_utf8(".xml"),
CITY_JSON = IfcUtil::path::from_utf8(".cityjson"),
IFC = IfcUtil::path::from_utf8(".ifc");
// @todo clean up serializer selection
@@ -779,6 +787,36 @@ int main(int argc, char** argv) {
write_log(!quiet);
return exit_code;
}
#ifdef IFOPSH_WITH_CGAL
else if (output_extension == CITY_JSON) {
geobim_settings settings;
settings.input_filenames = { IfcUtil::path::to_utf8(input_filename) };
settings.cityjson_output_filename = IfcUtil::path::to_utf8(output_filename);
// @todo
settings.radii = { "0.05" };
settings.apply_openings = false;
settings.apply_openings_posthoc = true;
settings.debug = false;
settings.exact_segmentation = false;
settings.minkowski_triangles = false;
settings.no_erosion = false;
settings.spherical_padding = false;
settings.settings.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, false);
settings.settings.set(IfcGeom::IteratorSettings::WELD_VERTICES, false);
settings.settings.set(IfcGeom::IteratorSettings::SEW_SHELLS, true);
settings.settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true);
settings.settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
settings.settings.set(IfcGeom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS, !settings.apply_openings);
settings.entity_names = include_filter.values;
settings.entity_names_included = true;
perform(settings);
return 0;
}
#endif
/// @todo Clean up this filter code further.
std::vector<geom_filter> used_filters;