fastgpx 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastgpx-0.3.0 → fastgpx-0.4.0}/PKG-INFO +1 -1
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/source/conf.py +43 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/pyproject.toml +1 -1
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/fastgpx.cpp +10 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/fastgpx.hpp +2 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/fastgpx_test.cpp +6 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/python_fastgpx.cpp +1 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/fastgpx/__init__.pyi +1 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/tests/test_fastgpx.py +19 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/uv.lock +1 -1
- {fastgpx-0.3.0 → fastgpx-0.4.0}/.clang-format +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/.gitignore +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/.python-version +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/CMakeLists.txt +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/CMakeSettings.json +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/Development.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/GPX.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/LICENSE.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/README.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/benchmarks/benchmark_gpx.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/benchmarks/benchmark_polyline.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/benchmarks/gpx_parse.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/catch2.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/coverage.bat +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/datetime.md +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/Makefile +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/make.bat +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/source/api.rst +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/source/index.rst +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/docs/source/overview.rst +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/profiling/profile_polyline.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/pytest.ini +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/CMakeLists.txt +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/app.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/expected_gpx_data.json +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/datetime.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/datetime.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/datetime_test.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/errors.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/errors.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/errors_test.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/filesystem.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/filesystem.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/filesystem_test.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/geom.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/geom.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/geom_test.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/polyline.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/polyline.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/test_data.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/test_data.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/test_data.json +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/fastgpx/test_data_test.cpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/cpp/python_utc_chrono.hpp +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/__init__.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/__init__.pyi +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/fastgpx/geo.pyi +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/fastgpx/polyline.pyi +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/src/fastgpx/py.typed +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/tests/test_bounds.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/tests/test_polyline.py +0 -0
- {fastgpx-0.3.0 → fastgpx-0.4.0}/tests/test_time_bounds.py +0 -0
@@ -3,9 +3,12 @@
|
|
3
3
|
# For the full list of built-in configuration values, see the documentation:
|
4
4
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
5
5
|
|
6
|
+
import re
|
6
7
|
import os
|
7
8
|
import sys
|
8
9
|
import tomllib
|
10
|
+
import logging as std_logging
|
11
|
+
from sphinx.util import logging
|
9
12
|
|
10
13
|
PROJECT_ROOT = os.path.abspath('../../')
|
11
14
|
|
@@ -49,3 +52,43 @@ autosummary_generate = True
|
|
49
52
|
|
50
53
|
html_theme = 'sphinx_rtd_theme'
|
51
54
|
html_static_path = ['_static']
|
55
|
+
|
56
|
+
|
57
|
+
# -- Adjust formatting for overloaded methods --------------------------------
|
58
|
+
|
59
|
+
logger = logging.getLogger(__name__)
|
60
|
+
|
61
|
+
|
62
|
+
def format_overloaded_docstring(app, what, name, obj, options, lines):
|
63
|
+
logger.info(f"[fastgpx-doc] Processing docstring for {name}")
|
64
|
+
if not lines:
|
65
|
+
return
|
66
|
+
|
67
|
+
logger.info(f"[fastgpx-doc] First line: {lines[0]}")
|
68
|
+
if lines[0].strip().startswith("Overloaded function"):
|
69
|
+
logger.info(f"[fastgpx-doc] Detected overloaded function in {name}")
|
70
|
+
|
71
|
+
new_lines = [".. rubric:: Overloads", ""]
|
72
|
+
|
73
|
+
for line in lines[1:]:
|
74
|
+
match = re.match(r"^\d+\.\s+(.*)", line.strip())
|
75
|
+
if match:
|
76
|
+
new_lines.extend([
|
77
|
+
".. code-block:: python",
|
78
|
+
"",
|
79
|
+
f" {match.group(1)}",
|
80
|
+
""
|
81
|
+
])
|
82
|
+
|
83
|
+
lines.clear()
|
84
|
+
lines.extend(new_lines)
|
85
|
+
|
86
|
+
|
87
|
+
def setup(app):
|
88
|
+
if app.verbosity >= 1:
|
89
|
+
logger.setLevel(std_logging.INFO)
|
90
|
+
else:
|
91
|
+
logger.setLevel(std_logging.WARNING)
|
92
|
+
|
93
|
+
logger.info("[fastgpx-doc] Setting up overloaded docstring formatting")
|
94
|
+
app.connect("autodoc-process-docstring", format_overloaded_docstring)
|
@@ -384,6 +384,16 @@ Gpx ParseGpx(const std::filesystem::path& path)
|
|
384
384
|
pugi::xml_node root = doc.child("gpx");
|
385
385
|
Gpx gpx;
|
386
386
|
|
387
|
+
const auto metadata = root.child("metadata");
|
388
|
+
if (metadata)
|
389
|
+
{
|
390
|
+
const auto name = metadata.child("name");
|
391
|
+
if (name)
|
392
|
+
{
|
393
|
+
gpx.name.emplace(name.text().as_string());
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
387
397
|
// Iterate over each <trk> element
|
388
398
|
for (pugi::xml_node track = root.child("trk"); track; track = track.next_sibling("trk"))
|
389
399
|
{
|
@@ -33,6 +33,8 @@ TEST_CASE("Parse two-point single segment track", "[parse][simple]")
|
|
33
33
|
REQUIRE(gpx.tracks.size() == 1);
|
34
34
|
REQUIRE(gpx.tracks[0].segments.size() == 1);
|
35
35
|
|
36
|
+
CHECK(!gpx.name.has_value());
|
37
|
+
|
36
38
|
CHECK_THAT(gpx.tracks[0].segments[0].GetLength2D(), WithinAbs(1.3839, kMETERS_TOL));
|
37
39
|
CHECK_THAT(gpx.tracks[0].GetLength2D(), WithinAbs(1.3839, kMETERS_TOL));
|
38
40
|
CHECK_THAT(gpx.GetLength2D(), WithinAbs(1.3839, kMETERS_TOL));
|
@@ -74,6 +76,8 @@ TEST_CASE("Parse time bounds of real world GPX file", "[parse][simple]")
|
|
74
76
|
"gpx/2024 TopCamp/Connected_20240529_091916_Harald_Bothners_Veg_36_7052_Trondheim.gpx";
|
75
77
|
const auto gpx = fastgpx::ParseGpx(path);
|
76
78
|
|
79
|
+
CHECK(gpx.name.value() == "Harald Bothners Veg 36, 7052 Trondheim");
|
80
|
+
|
77
81
|
REQUIRE(gpx.tracks.size() == 1);
|
78
82
|
|
79
83
|
// TimeBounds
|
@@ -97,6 +101,8 @@ TEST_CASE("Parse bounds of real world GPX file", "[parse][simple]")
|
|
97
101
|
"gpx/2024 TopCamp/Connected_20240529_091916_Harald_Bothners_Veg_36_7052_Trondheim.gpx";
|
98
102
|
const auto gpx = fastgpx::ParseGpx(path);
|
99
103
|
|
104
|
+
CHECK(gpx.name.value() == "Harald Bothners Veg 36, 7052 Trondheim");
|
105
|
+
|
100
106
|
REQUIRE(gpx.tracks.size() == 1);
|
101
107
|
|
102
108
|
const fastgpx::LatLong expected_min(61.841507, 9.090457);
|
@@ -203,6 +203,7 @@ PYBIND11_MODULE(fastgpx, m)
|
|
203
203
|
py::class_<fastgpx::Gpx>(m, "Gpx")
|
204
204
|
.def(py::init<>()) // Default constructor
|
205
205
|
.def_readwrite("tracks", &fastgpx::Gpx::tracks)
|
206
|
+
.def_readwrite("name", &fastgpx::Gpx::name)
|
206
207
|
.def("bounds", &fastgpx::Gpx::GetBounds)
|
207
208
|
.def("get_bounds", &fastgpx::Gpx::GetBounds) // gpxpy compatiblity
|
208
209
|
.def("time_bounds", &fastgpx::Gpx::GetTimeBounds)
|
@@ -52,6 +52,25 @@ def test_segment_length2d(gpx_path: str):
|
|
52
52
|
distance = gpx.tracks[0].segments[0].length_2d()
|
53
53
|
assert distance == pytest.approx(17809.2701, abs=METERS_TOL)
|
54
54
|
|
55
|
+
# fastgpx.Gpx.name
|
56
|
+
|
57
|
+
|
58
|
+
def test_gpx_name_missing():
|
59
|
+
path = 'gpx/test/debug-segment.gpx'
|
60
|
+
gpx = fastgpx.parse(path)
|
61
|
+
assert gpx.name is None
|
62
|
+
|
63
|
+
|
64
|
+
def test_gpx_name_empty_string(gpx_path: str):
|
65
|
+
gpx = fastgpx.parse(gpx_path)
|
66
|
+
assert gpx.name == ''
|
67
|
+
|
68
|
+
|
69
|
+
def test_gpx_name():
|
70
|
+
path = 'gpx/test/two-points.gpx'
|
71
|
+
gpx = fastgpx.parse(path)
|
72
|
+
assert gpx.name == 'Two Point Segment'
|
73
|
+
|
55
74
|
# fastgpx.Gpx.bounds
|
56
75
|
|
57
76
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|