Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ipadjen committed Jan 3, 2025
2 parents 2d0dbc9 + afdf116 commit 967ae62
Show file tree
Hide file tree
Showing 55 changed files with 131 additions and 101 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libgmp-dev libmpfr-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
- name: Download CGAL
- name: Download CGAL 6.0
run: |
wget https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.tar.xz -P ${{ github.workspace }}
wget https://github.com/CGAL/cgal/releases/download/v6.0/CGAL-6.0-library.tar.xz -P ${{ github.workspace }}
cd ${{ github.workspace }}
tar -xvf CGAL-5.6.1-library.tar.xz
tar -xvf CGAL-6.0-library.tar.xz
- name: Build
run: |
mkdir build && cd build
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-5.6.1 && make -j4
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-6.0 && make -j4
build_linux_2004:
runs-on: ubuntu-20.04
build_linux_2204:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgmp-dev libmpfr-dev libboost-all-dev libeigen3-dev libomp-dev libgdal-dev
- name: Download CGAL
- name: Download CGAL 6.0
run: |
wget https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1-library.tar.xz -P ${{ github.workspace }}
wget https://github.com/CGAL/cgal/releases/download/v6.0/CGAL-6.0-library.tar.xz -P ${{ github.workspace }}
cd ${{ github.workspace }}
tar -xvf CGAL-5.6.1-library.tar.xz
tar -xvf CGAL-6.0-library.tar.xz
- name: Build
run: |
mkdir build && cd build
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-5.6.1 && make -j4
cmake .. -DCGAL_DIR=${{ github.workspace }}/CGAL-6.0 && make -j4
build_macos:
runs-on: macos-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.6.0] - 2025-01-03
### Changed
- Updated to CGAL 6

## [0.5.0] - 2024-07-29 - breaking changes
### Added
- LoD2.2 and LoD1.3 reconstruction
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ set(CMAKE_BUILD_TYPE "Release")
# cmake_policy(SET CMP0003 NEW)
#endif()

if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()

if (MSVC)
add_definitions(-DNOMINMAX)
add_definitions("/EHsc")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It enables us to reconstruct buildings from different sources and their combinat
- Extrusion of footprints containing height or floor number attributes,
- The import of existing building models.

The reconstruction using the combination of point clouds and 2D polygons can be done in [LoD2.2, LoD1.3, and LoD1.2](https://3d.bk.tudelft.nl/lod/). You can use the [complexity factor](https://github.com/tudelft3d/City4CFD/wiki/Features#buildings) to tune the overall complexity of the reconstructed geometry.
The reconstruction using the combination of point clouds and 2D polygons can be done in [LoD2.2, LoD1.3, and LoD1.2](https://3d.bk.tudelft.nl/lod/). You can use the [complexity factor](https://github.com/tudelft3d/City4CFD/wiki/Features#buildings) to tune the overall complexity of the reconstructed geometry. The LoD2.2 and LoD1.3 reconstructions are based on [roofer](https://github.com/3DBAG/roofer).

The resulting geometry is watertight -- buildings and surfaces are seamlessly integrated into a terrain.

Expand All @@ -39,7 +39,7 @@ You can directly compile City4CFD on your system using cmake, run it through a D

### Build from source
The following libraries are required to build the project:
- [CGAL](https://www.cgal.org/) 5.5.x or 5.6.x
- [CGAL](https://www.cgal.org/) >= 6.0.1
- Boost >= 1.66
- Eigen >= 3.3.4
- GMP >= 4.2
Expand Down
19 changes: 17 additions & 2 deletions docker/city4cfd-build-base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,26 @@ LABEL org.opencontainers.image.description="Base image for building City4CFD"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
LABEL org.opencontainers.image.url="https://github.com/tudelft3d/city4cfd"

# Install required packages and clean up
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
libboost-all-dev \
libcgal-dev \
libgmp-dev \
libmpfr-dev \
libeigen3-dev \
libomp-dev \
libgdal-dev
libgdal-dev \
wget \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*

# Download and extract CGAL
RUN wget https://github.com/CGAL/cgal/releases/download/v6.0/CGAL-6.0-library.tar.xz \
&& tar -xf CGAL-6.0-library.tar.xz -C /opt \
&& rm CGAL-6.0-library.tar.xz

# Set environment variable for CGAL
ENV CGAL_DIR=/opt/CGAL-6.0
2 changes: 1 addition & 1 deletion src/Boundary.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/Boundary.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2022, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/BoundingRegion.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/BoundingRegion.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
10 changes: 5 additions & 5 deletions src/Building.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -296,10 +296,10 @@ void Building::get_cityjson_info(nlohmann::json& b) const {

void Building::get_cityjson_semantics(nlohmann::json& g) const { // Temp for checking CGAL mesh properties
Face_property semantics;
bool foundProperty;
boost::tie(semantics, foundProperty) = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
// auto semantics = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
if (!foundProperty) throw city4cfd_error("Semantic property map not found!");
auto semanticsMap = m_mesh.property_map<face_descriptor, std::string>("f:semantics");
if (semanticsMap.has_value()) {
semantics = semanticsMap.value();
} else throw city4cfd_error("Semantic property map not found!");

std::unordered_map<std::string, int> surfaceId;
surfaceId["RoofSurface"] = 0; g["semantics"]["surfaces"][0]["type"] = "RoofSurface";
Expand Down
2 changes: 1 addition & 1 deletion src/Building.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/CGALTypes.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
12 changes: 6 additions & 6 deletions src/Config.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -141,7 +141,7 @@ void Config::set_config(nlohmann::json& j) {
//- Domain boundaries
Config::get().set_region(domainBndConfig, "domain_bnd", j);
// Define domain type if using BPG
if (domainBndConfig.type() == typeid(bool)) {
if (std::holds_alternative<bool>(domainBndConfig)) {
if (j.contains("flow_direction"))
flowDirection = Vector_2(j["flow_direction"][0], j["flow_direction"][1]);

Expand All @@ -165,13 +165,13 @@ void Config::set_config(nlohmann::json& j) {
}

// Set domain side and top
if (domainBndConfig.type() == typeid(Polygon_2)) {
Polygon_2 poly = boost::get<Polygon_2>(domainBndConfig);
if (std::holds_alternative<Polygon_2>(domainBndConfig)) {
Polygon_2 poly = std::get<Polygon_2>(domainBndConfig);
numSides = poly.size();
for (int i = 0; i < poly.size(); ++i) {
outputSurfaces.emplace_back("Side_" + std::to_string(i % poly.size()));
}
} else if (domainBndConfig.type() == typeid(double) || bpgDomainType != RECTANGLE) {
} else if (std::holds_alternative<double>(domainBndConfig) || bpgDomainType != RECTANGLE) {
outputSurfaces.emplace_back("Sides");
} else if (bpgDomainType == RECTANGLE) { // Expand output surfaces with front and back
numSides = 4;
Expand Down Expand Up @@ -327,7 +327,7 @@ void Config::set_config(nlohmann::json& j) {
}

//-- influRegion and domainBndConfig flow control
void Config::set_region(boost::variant<bool, double, Polygon_2>& regionType,
void Config::set_region(std::variant<bool, double, Polygon_2>& regionType,
const std::string regionName,
nlohmann::json& j) {
if (j[regionName].is_string()) { // Search for GeoJSON polygon
Expand Down
8 changes: 4 additions & 4 deletions src/Config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -50,7 +50,7 @@ class Config {
public:
void validate(nlohmann::json& j);
void set_config(nlohmann::json& j);
void set_region(boost::variant<bool, double, Polygon_2>& regionType,
void set_region(std::variant<bool, double, Polygon_2>& regionType,
const std::string regionName,
nlohmann::json& j);
static void write_to_log(const std::string& msg);
Expand All @@ -65,7 +65,7 @@ class Config {
//-- Domain setup
Point_2 pointOfInterest;
double topHeight = 0.;
boost::variant<bool, double, Polygon_2> domainBndConfig;
std::variant<bool, double, Polygon_2> domainBndConfig;
DomainType bpgDomainType;
bool bpgBlockageRatioFlag = false;
double bpgBlockageRatio = 0.03;
Expand Down Expand Up @@ -134,7 +134,7 @@ class Config {

//-- Struct for reconstruction regions (part of Buildings)
struct ReconRegion{
boost::variant<bool, double, Polygon_2> influRegionConfig;
std::variant<bool, double, Polygon_2> influRegionConfig;
std::string lod;
double bpgInfluExtra = 0.;
bool importAdvantage = true;
Expand Down
2 changes: 1 addition & 1 deletion src/ImportedBuilding.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/ImportedBuilding.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/LoD12.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/LoD12.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/LoD22.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/LoD22.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
10 changes: 5 additions & 5 deletions src/Map3d.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -198,7 +198,7 @@ void Map3d::set_features() {
for (auto& reconRegion : Config::get().reconRegions) {
m_reconRegions.emplace_back(reconRegion);
}
if (Config::get().domainBndConfig.type() == typeid(bool)) m_bndBPG = true;
if (std::holds_alternative<bool>(Config::get().domainBndConfig)) m_bndBPG = true;

//-- Apply area filtering
if (Config::get().minArea > 0.) {
Expand Down Expand Up @@ -256,15 +256,15 @@ void Map3d::set_influ_region() {
//-- Set the reconstruction (influence) regions --//
double maxDim = -1.; // this works if there's one point of interest
for (int i = 0; i < m_reconRegions.size(); ++i) {
if (m_reconRegions[i].m_reconSettings->influRegionConfig.type() == typeid(bool)) {// bool defines BPG request
if (std::holds_alternative<bool>(m_reconRegions[i].m_reconSettings->influRegionConfig)) {// bool defines BPG request
std::cout << "INFO: Reconstruction region "<< i << " not defined in config. "
<< "Calculating with BPG." << std::endl;
if (maxDim < 0.)
maxDim = m_reconRegions[i].calc_influ_region_bpg(m_dt, m_buildingsPtr);
else
m_reconRegions[i].calc_influ_region_bpg(maxDim);
} else
boost::apply_visitor(m_reconRegions[i], Config::get().reconRegions[i]->influRegionConfig);
std::visit(m_reconRegions[i], Config::get().reconRegions[i]->influRegionConfig);
}
// Check if regions get larger with increasing index
for (int i = 0; i < m_reconRegions.size(); ++i) {
Expand Down Expand Up @@ -303,7 +303,7 @@ void Map3d::set_bnd() {
m_domainBnd.calc_bnd_bpg(m_reconRegions.back().get_bounding_region(), m_buildingsPtr);
} else {
//-- Define boundary region with values set in config
boost::apply_visitor(m_domainBnd, Config::get().domainBndConfig);
std::visit(m_domainBnd, Config::get().domainBndConfig);
}
this->bnd_sanity_check(); // Check if outer bnd is larger than the influ region

Expand Down
2 changes: 1 addition & 1 deletion src/Map3d.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2025, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
Loading

0 comments on commit 967ae62

Please sign in to comment.