Skip to content

Commit 230a383

Browse files
author
peng.li24
committed
refactor: numpycpp-style native/pycpp split, remove _impl.h, drop non-Python APIs
- shapely/geometry/*.h: pure native C++ (zero pybind11), raw pointer ctors - shapely/ops/nearest_points.h: native ops - Deleted old geometry/, ops/ dirs (pybind11-dependent) - Deleted ext/distance_to_multigeom (not in Python shapely) - Deleted Polygon::exterior_coords(), intersection_area() (not in Python) - Renamed Point::x_/y_ to x/y - All _impl.h merged into single headers (matching numpycpp pattern) - Fixed abbreviated variable names, added per-function Python source comments - All 101 tests pass
1 parent 5535521 commit 230a383

19 files changed

Lines changed: 823 additions & 992 deletions

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ target_include_directories(shapelycpp INTERFACE
2828
target_compile_features(shapelycpp INTERFACE cxx_std_17)
2929

3030
# ---- Install — header-only C++ library --------------------------------------
31-
install(DIRECTORY geometry ops
31+
# shapely/ — pure native C++ (zero pybind11 dependency)
32+
install(DIRECTORY shapely
3233
DESTINATION include/shapelycpp
3334
FILES_MATCHING PATTERN "*.h"
3435
)

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,20 @@ Add `-Ipath/to/shapelycpp` to your compiler flags and include the headers direct
7171

7272
```
7373
shapelycpp/
74-
├── geometry/ # shapely.geometry.* equivalents
75-
│ ├── point.h
76-
│ ├── point_impl.h
77-
│ ├── linestring.h
78-
│ ├── linestring_impl.h
79-
│ ├── polygon.h
80-
│ └── polygon_impl.h
81-
├── ops/ # shapely.ops.* equivalents
82-
│ ├── nearest_points.h
83-
│ ├── nearest_points_impl.h
84-
│ ├── distance_to_multigeom.h
85-
│ └── distance_to_multigeom_impl.h
86-
├── example/ # usage examples
74+
├── shapely/ # pure native C++ (zero pybind11 dependency)
75+
│ ├── geometry/
76+
│ │ ├── point.h
77+
│ │ ├── linestring.h
78+
│ │ └── polygon.h
79+
│ └── ops/
80+
│ └── nearest_points.h
81+
├── example/ # native C++ usage examples
8782
│ ├── CMakeLists.txt
8883
│ └── main.cpp
84+
├── tests/ # Python precision alignment tests
85+
│ ├── module.cpp # pybind11 test module
86+
│ ├── test_geometry.py
87+
│ └── test_ops.py
8988
├── CMakeLists.txt # build & .deb packaging
9089
└── README.md
9190
```

example/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// C++ 特有文件,Python 端无直接对应。
2+
// shapelycpp pure native C++ 使用示例 (zero pybind11 dependency).
3+
14
#include <iostream>
25
#include "shapely/geometry/point.h"
36
#include "shapely/geometry/linestring.h"

geometry/linestring.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

geometry/linestring_impl.h

Lines changed: 0 additions & 141 deletions
This file was deleted.

geometry/point.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)