Skip to content

Commit

Permalink
Merge branch 'release-0.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ipadjen committed Jan 13, 2024
2 parents 99ace13 + 6ef47bb commit e698762
Show file tree
Hide file tree
Showing 51 changed files with 529 additions and 240 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build Docker

on:
push:
workflow_dispatch:

jobs:
build_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker registry login
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Build the Docker image
run: docker build --build-arg JOBS=2 . --file docker/city4cfd.dockerfile --tag tudelft3d/city4cfd:latest
26 changes: 18 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI
name: build

on:
push:
pull_request:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 6 1 * *' # Run on the first day of every month at 06:00 UTC
Expand Down Expand Up @@ -48,11 +48,21 @@ jobs:
mkdir build && cd build
cmake .. && make -j4
build_docker:
runs-on: ubuntu-latest
build_win64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Docker registry login
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Build the Docker image
run: docker build --build-arg JOBS=2 . --file docker/city4cfd.dockerfile --tag tudelft3d/city4cfd:latest
- name: vcpkg build
uses: johnwason/vcpkg-action@v5
id: vcpkg
with:
pkgs: boost-program-options boost-geometry boost-locale boost-chrono boost-system boost-filesystem eigen3 cgal gdal
triplet: x64-windows-release
token: ${{ github.token }}
extra-args: --clean-after-build
- name: Build
run: |
mkdir Release
cd Release
cmake .. ${{ steps.vcpkg.outputs.vcpkg-cmake-config }}
cmake --build . --parallel 4 --config Release
54 changes: 54 additions & 0 deletions .github/workflows/release-win64-exe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a basic workflow to help you get started with Actions

name: Release Windows Executable

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
release:
types: [created]
pull_request:
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release_win64:
if: false
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: vcpkg build
uses: johnwason/vcpkg-action@v5
id: vcpkg
with:
pkgs: boost-program-options boost-geometry boost-locale boost-chrono boost-system boost-filesystem eigen3 cgal gdal
triplet: x64-windows-release
token: ${{ github.token }}
extra-args: --clean-after-build
- name: Build
run: |
mkdir Release
cd Release
cmake .. ${{ steps.vcpkg.outputs.vcpkg-cmake-config }}
cmake --build . --parallel 4 --config Release
- name: Package binary files
run: |
mkdir city4cfd-win64
xcopy Release\Release\* city4cfd-win64\
mkdir city4cfd-win64\tools\city4cfd_las2las
xcopy Release\tools\LASTools\Release\* city4cfd-win64\tools\city4cfd_las2las
mkdir city4cfd-win64\tools\prepare_point_cloud
xcopy Release\tools\prepare_point_cloud\Release\* city4cfd-win64\tools\prepare_point_cloud\
xcopy vcpkg\installed\x64-windows-release\share\proj\proj.db city4cfd-win64\
tar -zcvf city4cfd-win64.zip city4cfd-win64\*
- name: Upload binary files as artifact
uses: actions/upload-artifact@master
with:
name: city4cfd-win64
path: city4cfd-win64.zip
- name: Add binaries as an asset to the release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
city4cfd-win64.zip
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.4.4] - 2024-01-13
### Changed
- Improved fallbacks in case building import fails in late stages
- Improved polygon flattening when buildings are adjacent
### Fixed
- Minor bugfixes

## [0.4.3] - 2023-08-25
### Fixed
- Issue with GDAL on Ubuntu 20.04
Expand Down
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,29 @@ project(city4cfd)

#set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )

set(CMAKE_CXX_FLAGS "-O3")
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_BUILD_TYPE "Release")

#if (COMMAND cmake_policy)
# cmake_policy(SET CMP0003 NEW)
#endif()
if (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif()

if (MSVC)
add_definitions(-DNOMINMAX)
add_definitions("/EHsc")
endif (MSVC)

# BOOST
find_package(Boost 1.66 REQUIRED COMPONENTS filesystem locale)
if (WIN32)
FIND_PACKAGE(Boost)
if (Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ADD_DEFINITIONS( "-DHAS_BOOST" )
set(Boost_USE_STATIC_LIBS ON)
set(Boost_ARCHITECTURE "-x64")
endif()
endif (WIN32)

# CGAL
find_package(CGAL REQUIRED QUIET COMPONENTS)
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[![docs](https://img.shields.io/badge/docs-Wiki-brightgreen?style=flat-square)](https://github.com/tudelft3d/City4CFD/wiki)
# City4CFD

[![build](https://img.shields.io/github/actions/workflow/status/tudelft3d/City4CFD/build.yml?branch=main&style=flat-square)](https://github.com/tudelft3d/City4CFD/actions/workflows/build.yml)
[![docs](https://img.shields.io/badge/docs-Wiki-yellow?style=flat-square)](https://github.com/tudelft3d/City4CFD/wiki)
[![GitHub license](https://img.shields.io/github/license/tudelft3d/City4CFD?style=flat-square)](https://github.com/tudelft3d/City4CFD/blob/master/LICENSE)
[![DOI:10.3389/fbuil.2022.899332](http://img.shields.io/badge/DOI-10.3389/fbuil.2022.899332-B62030.svg?style=flat-square)](https://doi.org/10.3389/fbuil.2022.899332)


# City4CFD

![welcome_figure](https://github.com/tudelft3d/City4CFD/blob/main/docs/images/workflow.png)

City4CFD--*City for CFD*--is a tool that aims to automatically reconstruct 3D city geometries tailored for microscale urban flow simulations.
City4CFD--*City for CFD*--is a cross-platform tool that aims to automatically reconstruct 3D city geometries tailored for microscale urban flow simulations.

It can create automatically a terrain from a point cloud and imprint different surfaces (e.g. green areas, water, roads).

Expand All @@ -34,7 +34,7 @@ City4CFD is developed by the [3D Geoinformation Research Group](https://3d.bk.tu
**Output** is in the following formats: OBJ, STL, and CityJSON. The ID of each polygon is preserved, and there is a 1-to-1 mapping between the input and the output.

## Installation
You can directly compile City4CFD on your system using cmake, run it through a Docker container, or install using Homebrew in the case of macOS.
You can directly compile City4CFD on your system using cmake, run it through a Docker container, install using Homebrew in the case of macOS, or use a precompiled binary on Windows.

### Build from source
The following libraries are required to build the project:
Expand Down Expand Up @@ -77,6 +77,9 @@ Mac users can install City4CFD through Homebrew:
brew install tudelft3d/software/city4cfd
```

### Windows
Windows users can use a precompiled binary in [Releases](https://github.com/tudelft3d/City4CFD/releases).

## Getting started

The folder *examples* contains example datasets you can run for your first reconstruction. You can run your first reconstruction from the `/examples/TUD_Campus` folder by typing:
Expand Down
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-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 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-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 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-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
20 changes: 5 additions & 15 deletions src/Building.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -42,30 +42,16 @@ Building::Building()
: PolyFeature(1), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}

Building::Building(const int internalID)
: PolyFeature(1, internalID), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}

Building::Building(const nlohmann::json& poly)
: PolyFeature(poly, true, 1), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}
// 'true' here to check for polygon simplicity

Building::Building(const nlohmann::json& poly, const int internalID)
: PolyFeature(poly, true, 1, internalID), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}
// 'true' here to check for polygon simplicity

Building::Building(const Polygon_with_attr& poly)
: PolyFeature(poly, true, 1), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}
// 'true' here to check for polygon simplicity

Building::Building(const Polygon_with_attr& poly, const int internalID)
: PolyFeature(poly, true, 1, internalID), _elevation(-global::largnum), _height(-global::largnum),
_ptsPtr(std::make_shared<Point_set_3>()), _hasFailed(false) {}
// 'true' here to check for polygon simplicity

Building::~Building() = default;

void Building::insert_point(const Point_3& pt) {
Expand Down Expand Up @@ -275,6 +261,10 @@ double Building::sq_max_dim() {
return *(std::max_element(dims.begin(), dims.end()));
}

PointSet3Ptr Building::get_points() const {
return _ptsPtr;
}

void Building::get_cityjson_info(nlohmann::json& b) const {
b["type"] = "Building";
// b["attributes"];
Expand Down
6 changes: 2 additions & 4 deletions src/Building.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -34,11 +34,8 @@
class Building : public PolyFeature {
public:
Building();
Building(const int internalID);
Building(const nlohmann::json& poly);
Building(const nlohmann::json& poly, const int internalID);
Building(const Polygon_with_attr& poly);
Building(const Polygon_with_attr& poly, const int internalID);
~Building();

static void alpha_wrap(const BuildingsPtr& buildings, Mesh& newMesh);
Expand All @@ -59,6 +56,7 @@ class Building : public PolyFeature {
bool has_self_intersections() const;
void set_to_zero_terrain();
double sq_max_dim();
PointSet3Ptr get_points() const;

virtual void get_cityjson_info(nlohmann::json& b) const override;
virtual void get_cityjson_semantics(nlohmann::json& g) const override;
Expand Down
23 changes: 19 additions & 4 deletions src/CGALTypes.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down Expand Up @@ -62,6 +62,13 @@ typedef CGAL::Polygon_2<eProjection_traits> Polygon_3;

//- CGAL's Polygon_with_holes container expanded
struct Polygon_with_holes_2 {
Polygon_with_holes_2() = default;

Polygon_with_holes_2(const CGAL::Polygon_with_holes_2<EPICK>& cgalPoly) {
_rings.push_back(cgalPoly.outer_boundary());
for (auto& hole : cgalPoly.holes()) _rings.push_back(hole);
}

std::vector<Polygon_2> _rings;

std::vector<Polygon_2>& rings() {return _rings;}
Expand Down Expand Up @@ -92,12 +99,20 @@ struct Polygon_with_holes_2 {
}
return cgalPoly;
}
const CGAL::Polygon_with_holes_2<EPECK> get_exact() const {

const CGAL::Polygon_2<EPECK> get_exact_outer_boundary() const {
Converter<EPICK, EPECK> to_exact;
CGAL::Polygon_with_holes_2<EPECK> cgalPoly;
CGAL::Polygon_2<EPECK> cgalOuterPoly;
for (auto& pt : _rings.front()) {
cgalPoly.outer_boundary().push_back(to_exact(pt));
cgalOuterPoly.push_back(to_exact(pt));
}
return cgalOuterPoly;
}

const CGAL::Polygon_with_holes_2<EPECK> get_exact() const {
Converter<EPICK, EPECK> to_exact;
CGAL::Polygon_with_holes_2<EPECK> cgalPoly;
cgalPoly.outer_boundary() = get_exact_outer_boundary();
for (auto hole = holes_begin(); hole != holes_end(); ++hole) {
CGAL::Polygon_2<EPECK> holePoly;
for (auto& pt : *hole) {
Expand Down
2 changes: 1 addition & 1 deletion src/Config.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
City4CFD
Copyright (c) 2021-2023, 3D Geoinformation Research Group, TU Delft
Copyright (c) 2021-2024, 3D Geoinformation Research Group, TU Delft
This file is part of City4CFD.
Expand Down
Loading

0 comments on commit e698762

Please sign in to comment.