Skip to content

Move from custom geometry module to boost-geometry - #512

Open
Grufoony wants to merge 1 commit into
mainfrom
boost-geometry
Open

Grufoony wants to merge 1 commit into
mainfrom
boost-geometry

Conversation

@Grufoony

Copy link
Copy Markdown
Owner

No description provided.

std::size_t countWktCoordinates(std::string const& wkt) {
auto const open = wkt.find('(');
auto const close = wkt.rfind(')');
if (open == std::string::npos || close == std::string::npos || close <= open) {
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.93617% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.80%. Comparing base (89a404f) to head (e4e5cb4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/dsf/geometry/Point.cpp 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
+ Coverage   83.70%   83.80%   +0.09%     
==========================================
  Files          55       55              
  Lines        8837     8859      +22     
  Branches     1057     1056       -1     
==========================================
+ Hits         7397     7424      +27     
+ Misses       1419     1414       -5     
  Partials       21       21              
Flag Coverage Δ
unittests 83.80% <98.93%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Moderate issues remain with Boost dependency propagation, public API compatibility, and malformed WKT parsing.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request replaces the custom geometry types and parsers with Boost.Geometry, updating consumers, tests, dependencies, CI, and documentation.

Changes:

  • Adds Boost.Geometry-based Point and PolyLine aliases with parsing and formatting helpers.
  • Updates geometry usage, tests, and distance calculations.
  • Adds Boost requirements across builds, packaging, CI, and documentation.
File summaries
File Summary
test/mdt/Test_PointsCluster.cpp Updates point comparisons.
test/geometry/Test_PolyLine.cpp Tests Boost WKT parsing and formatting.
test/geometry/Test_Point.cpp Tests parsing, formatting, and distance behavior.
src/dsf/mobility/RoadNetwork.cpp Uses the new WKT parsing helpers.
src/dsf/geometry/PolyLine.hpp Defines the Boost linestring alias and formatter.
src/dsf/geometry/PolyLine.cpp Implements linestring parsing.
src/dsf/geometry/Point.hpp Defines the Boost point alias and formatter.
src/dsf/geometry/Point.cpp Implements point parsing and haversine distance.
setup.py Adds Homebrew Boost discovery.
README.md Documents Boost installation requirements.
pyproject.toml Adds Boost to wheel build dependencies.
CMakeLists.txt Locates and links Boost headers.
.github/workflows/pytest.yml Adds Ubuntu Boost dependencies.
.github/workflows/codeql.yml Adds Ubuntu Boost dependencies.
.github/workflows/cmake_tests.yml Adds Boost across test platforms.
.github/workflows/cmake_examples.yml Adds Boost across example platforms.
.github/workflows/binding.yml Adds Boost across binding platforms.
.github/workflows/benchmark_release.yml Adds Ubuntu Boost dependencies.
.claude/README.md Adds repository agent guidance.
.claude/data-formats.md Documents geometry data formats.
.claude/conventions.md Documents repository conventions.
.claude/build-and-test.md Documents build and test procedures.
.claude/architecture.md Documents project architecture.
.claude/api-reference.md Documents the public API.
Review details

Suppressed comments (3)

src/dsf/geometry/Point.cpp:24

  • When cursor is on a nonnumeric character inside the parentheses, strtod scans the whole null-terminated WKT and can find a number after bodyEnd; that number is then counted as an in-body coordinate. A malformed input with a missing coordinate and a trailing numeric token can therefore pass this guard while Boost has zero-filled the missing value. Reject parses where next > bodyEnd before incrementing the count.
        std::strtod(cursor, &next);
        if (next == cursor) {

src/dsf/geometry/Point.hpp:25

  • Replacing the class with an alias removes the public WKT constructor, operator==, and structured-binding support that downstream C++ callers could use. The in-tree tests were rewritten around the new APIs, but DSF_VERSION remains 7.1.0, so this is an unannounced source-breaking change; retain compatibility or explicitly version and document the break.
  using Point = boost::geometry::model::d2::
      point_xy<double, boost::geometry::cs::spherical_equatorial<boost::geometry::degree>>;

src/dsf/geometry/PolyLine.hpp:16

  • Replacing PolyLine with this alias removes the public PolyLine(std::string const&, std::string const&) constructor. Existing downstream calls no longer compile and polyLineFromWkt is not source-compatible; because DSF_VERSION remains 7.1.0, this break should either be preserved through a compatibility API or explicitly versioned and documented.
  using PolyLine = boost::geometry::model::linestring<Point>;
  • Files reviewed: 24/24 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CMakeLists.txt

# Link other libraries
target_link_libraries(dsf PUBLIC TBB::tbb SQLiteCpp
target_link_libraries(dsf PUBLIC TBB::tbb SQLiteCpp $<BUILD_INTERFACE:Boost::headers>
Comment thread README.md
### Requirements
The project requires `C++20` or greater, `cmake`, `tbb` `simdjson`, `spdlog`, `csv-parser` and `SQLiteCpp`.
The project requires `C++20` or greater, `cmake`, `tbb`, `boost` (headers only, for Boost.Geometry), `simdjson`, `spdlog`, `csv-parser` and `SQLiteCpp`.
`tbb` and `boost` must be installed system-wide; the remaining dependencies are fetched automatically at configure time.
Comment thread .claude/api-reference.md
Comment on lines +195 to +197
- **`geometry::Point`** — immutable `(x, y)`, structured-binding enabled, parses WKT
`POINT (...)`; free function `haversine_km(p1, p2)` treats coordinates as (lon, lat).
**`geometry::PolyLine`** — `std::vector<Point>` subclass that parses WKT `LINESTRING (...)`.
Comment thread .claude/build-and-test.md
Comment on lines +5 to +9
C++20 compiler, CMake >= 3.16, and **TBB installed system-wide** (`libtbb-dev` on Debian/
Ubuntu, `brew install tbb` on macOS, `vcpkg install tbb:x64-windows` on Windows).
Everything else — csv-parser 5.3.0, spdlog 1.17.0, simdjson 4.6.8, SQLiteCpp 3.3.3,
doctest 2.5.3, nanobind 2.15.0 — is pulled by `FetchContent` at configure time, so the
first configure needs network access and takes a while.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants