fastdb4py 0.1.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.
- fastdb4py-0.1.0/LICENSE +21 -0
- fastdb4py-0.1.0/MANIFEST.in +9 -0
- fastdb4py-0.1.0/PKG-INFO +28 -0
- fastdb4py-0.1.0/README.md +18 -0
- fastdb4py-0.1.0/fastcarto/CMakeLists.txt +46 -0
- fastdb4py-0.1.0/fastcarto/cmake/FastdbCMakeMinimumRequired.cmake +2 -0
- fastdb4py-0.1.0/fastcarto/dump-fastdb/CMakeLists.txt +26 -0
- fastdb4py-0.1.0/fastcarto/dump-fastdb/dump-fastdb-ex.cpp +95 -0
- fastdb4py-0.1.0/fastcarto/fastdb/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/fastdb/CMakeLists.txt +135 -0
- fastdb4py-0.1.0/fastcarto/fastdb/include/fastdb-config.h +32 -0
- fastdb4py-0.1.0/fastcarto/fastdb/include/fastdb-geometry-utils.h +175 -0
- fastdb4py-0.1.0/fastcarto/fastdb/include/fastdb.h +478 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDb.cpp +177 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbBuild.cpp +329 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbBuild_p.h +201 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbLayer.cpp +694 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbLayerBuild.cpp +696 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbLayerBuild_p.h +195 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDbLayer_p.h +114 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorDb_p.h +27 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorTileDb.cpp +188 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/FastVectorTileDb_p.h +63 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/TileBoxTake.cpp +204 -0
- fastdb4py-0.1.0/fastcarto/fastdb/src/TileBoxTake_p.hpp +24 -0
- fastdb4py-0.1.0/fastcarto/fastdb/swig/fastdb4py.i +296 -0
- fastdb4py-0.1.0/fastcarto/fastdb/swig/numpy.i +2970 -0
- fastdb4py-0.1.0/fastcarto/lib/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/CMakeLists.txt +4 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/.gitignore +1 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/BenchMark/CMakeLists.txt +80 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/BenchMark/GetIntersectPtBenchmark.cpp +579 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/BenchMark/PointInPolygonBenchmark.cpp +524 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/BenchMark/README.md +6 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/BenchMark/StripDuplicateBenchmark.cpp +73 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/CMakeLists.txt +371 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2.pc.cmakein +12 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Config.cmake.in +6 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.core.h +1134 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.engine.h +635 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.export.h +832 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.h +795 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.minkowski.h +117 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.offset.h +125 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.rectclip.h +80 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/include/clipper2/clipper.version.h +6 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/src/clipper.engine.cpp +3161 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/src/clipper.offset.cpp +661 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Clipper2Lib/src/clipper.rectclip.cpp +1027 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/Benchmarks/Benchmarks.cpp +133 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/Inflate/Inflate.cpp +137 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/Inflate/rabbit.svg +15 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/MemLeakTest/MemLeakTest.cpp +80 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/PolygonSamples/PolygonSamples.cpp +102 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/RandomClipping/RandomClipping.cpp +153 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/RectClipping/RectClipping.cpp +215 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/SimpleClipping/SimpleClipping.cpp +63 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/UnionClipping/UnionClipping.cpp +168 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/UsingZ/UsingZ.cpp +112 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Examples/VariableOffset/VariableOffset.cpp +161 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/GoogleTest in Visual Studio.txt +13 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestExportHeaders.cpp +203 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestIsCollinear.cpp +52 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestLines.cpp +55 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestOffsetOrientation.cpp +29 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestOffsets.cpp +700 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestOrientation.cpp +16 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestPolygons.cpp +125 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestPolytreeHoles.cpp +319 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestPolytreeIntersection.cpp +24 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestPolytreeUnion.cpp +51 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestRandomPaths.cpp +83 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestRect.cpp +62 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestRectClip.cpp +76 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestSimplifyPath.cpp +11 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestTrimCollinear.cpp +27 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Tests/TestWindows.cpp +5 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/ClipFileLoad.cpp +121 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/ClipFileLoad.h +37 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/ClipFileSave.cpp +326 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/ClipFileSave.h +18 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/Colors.h +56 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/CommonUtils.h +38 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/Timer.h +98 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/clipper.svg.cpp +444 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/clipper.svg.h +124 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/Utils/clipper.svg.utils.h +141 -0
- fastdb4py-0.1.0/fastcarto/lib/clipper/clipper.version.in +6 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/CMakeLists.txt +21 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/Makefile.am +36 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/Makefile.in +627 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/config-msvc.h +1 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/config.h +5 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/control_points.h +259 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/debug.h +77 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiaaux.h +540 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiaconfig-msvc.h +61 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiaconfig.h +61 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiaconfig.h.in +61 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiaexif.h +669 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gaiageo.h +89 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/geojson.h +586 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_advanced.h +4566 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_const.h +606 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_core.h +2294 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_dxf.h +993 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_dynamic.h +416 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_formats.h +2045 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_mbr.h +606 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_sequence.h +173 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_structs.h +880 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_wfs.h +581 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/gg_xml.h +818 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite/stored_procedures.h +641 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/headers/spatialite_private.h +1548 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/.DS_Store +0 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Ewkt.h +19 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Ewkt.inl +2843 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Gml.h +8 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Gml.inl +1500 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Kml.h +8 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Kml.inl +1500 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Makefile.am +48 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/Makefile.in +1090 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/geoJSON.h +25 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/geoJSON.inl +2632 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_advanced.c +4285 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_endian.c +754 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_ewkt.c +2086 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_extras.c +1473 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_geoJSON.c +1780 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_geometries.c +5683 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_kml.c +2141 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_shape.cx +5634 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_vanuatu.c +2081 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_voronoj.c +1924 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_wkb.c +6637 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/gg_wkt.c +4369 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/lex.Ewkt.inl +2328 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/lex.GeoJson.inl +2382 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/lex.Gml.inl +2181 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/lex.Kml.inl +2181 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/lex.VanuatuWkt.inl +2460 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/sqlite.c +28 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/vanuatuWkt.h +33 -0
- fastdb4py-0.1.0/fastcarto/lib/gaiageo/src/vanuatuWkt.inl +2861 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/CMakeLists.txt +16 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/Makefile.am +11 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/VERSIONS.TXT +123 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/copying.txt +22 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/gpc.c +2472 -0
- fastdb4py-0.1.0/fastcarto/lib/gpc/gpc.h +139 -0
- fastdb4py-0.1.0/fastcarto/make-fastdb/CMakeLists.txt +28 -0
- fastdb4py-0.1.0/fastcarto/make-fastdb/make-fast-db-ex.cpp +326 -0
- fastdb4py-0.1.0/pyproject.toml +34 -0
- fastdb4py-0.1.0/python/.gitignore +186 -0
- fastdb4py-0.1.0/python/__init__.py +1 -0
- fastdb4py-0.1.0/python/fastdb/__init__.py +6 -0
- fastdb4py-0.1.0/python/fastdb/feature/__init__.py +2 -0
- fastdb4py-0.1.0/python/fastdb/feature/base.py +4 -0
- fastdb4py-0.1.0/python/fastdb/feature/feature.py +165 -0
- fastdb4py-0.1.0/python/fastdb/feature/utils.py +40 -0
- fastdb4py-0.1.0/python/fastdb/orm/__init__.py +363 -0
- fastdb4py-0.1.0/python/fastdb/orm/table.py +164 -0
- fastdb4py-0.1.0/python/fastdb/type.py +82 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/PKG-INFO +28 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/SOURCES.txt +177 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/dependency_links.txt +1 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/not-zip-safe +1 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/requires.txt +1 -0
- fastdb4py-0.1.0/python/fastdb4py.egg-info/top_level.txt +1 -0
- fastdb4py-0.1.0/setup.cfg +4 -0
- fastdb4py-0.1.0/setup.py +62 -0
fastdb4py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 world-in-progress
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
include fastcarto/cmake/*.cmake
|
|
2
|
+
include fastcarto/CMakeLists.txt
|
|
3
|
+
recursive-include fastcarto/lib *
|
|
4
|
+
recursive-include fastcarto/fastdb *
|
|
5
|
+
recursive-include fastcarto/make-fastdb *
|
|
6
|
+
recursive-include fastcarto/dump-fastdb *
|
|
7
|
+
recursive-include python *
|
|
8
|
+
global-exclude *.py[cod]
|
|
9
|
+
global-exclude *.so *.dylib *.dll
|
fastdb4py-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastdb4py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: FastCarto database bindings
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# fastdb (v0.0.0 WIP)
|
|
12
|
+
|
|
13
|
+
A C++ local database library with cross language bindings. Aiming to be a fast, lightweight, and easy-to-use data communication solution for RPC and coupled modeling in scientific computing.
|
|
14
|
+
|
|
15
|
+
Wait and hope for the best...
|
|
16
|
+
|
|
17
|
+
## Building
|
|
18
|
+
|
|
19
|
+
Fastdb uses CMake as its build system. Below are instructions for building the core library and cross language bindings.
|
|
20
|
+
|
|
21
|
+
### Python Bindings
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mkdir build
|
|
25
|
+
cd build
|
|
26
|
+
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SWIG_PYTHON=ON
|
|
27
|
+
cmake --build . --config Release --parallel
|
|
28
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# fastdb (v0.0.0 WIP)
|
|
2
|
+
|
|
3
|
+
A C++ local database library with cross language bindings. Aiming to be a fast, lightweight, and easy-to-use data communication solution for RPC and coupled modeling in scientific computing.
|
|
4
|
+
|
|
5
|
+
Wait and hope for the best...
|
|
6
|
+
|
|
7
|
+
## Building
|
|
8
|
+
|
|
9
|
+
Fastdb uses CMake as its build system. Below are instructions for building the core library and cross language bindings.
|
|
10
|
+
|
|
11
|
+
### Python Bindings
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
mkdir build
|
|
15
|
+
cd build
|
|
16
|
+
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SWIG_PYTHON=ON
|
|
17
|
+
cmake --build . --config Release --parallel
|
|
18
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
include(cmake/FastdbCMakeMinimumRequired.cmake)
|
|
2
|
+
cmake_minimum_required(VERSION ${FASTDB_CMAKE_VERSION_MIN}...${FASTDB_CMAKE_VERSION_MAX})
|
|
3
|
+
|
|
4
|
+
project(FastCarto)
|
|
5
|
+
|
|
6
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
7
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if(WIN32)
|
|
11
|
+
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
|
|
12
|
+
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/source-charset:utf-8>")
|
|
13
|
+
endif()
|
|
14
|
+
|
|
15
|
+
function( add_source_by_dir cur_dir return_list)
|
|
16
|
+
file(GLOB_RECURSE new_files
|
|
17
|
+
${cur_dir}/*.c
|
|
18
|
+
${cur_dir}/*.cpp
|
|
19
|
+
${cur_dir}/*.cxx
|
|
20
|
+
${cur_dir}/*.h
|
|
21
|
+
${cur_dir}/*.hpp
|
|
22
|
+
${cur_dir}/*.hxx
|
|
23
|
+
)
|
|
24
|
+
set(${return_list} ${new_files} PARENT_SCOPE)
|
|
25
|
+
|
|
26
|
+
endfunction(add_source_by_dir)
|
|
27
|
+
|
|
28
|
+
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
|
29
|
+
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
30
|
+
|
|
31
|
+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
|
32
|
+
set(is_emscripten ON)
|
|
33
|
+
endif()
|
|
34
|
+
|
|
35
|
+
add_subdirectory(lib)
|
|
36
|
+
add_subdirectory(fastdb)
|
|
37
|
+
option(BUILD_TOOLS "Build CLI tools" ON)
|
|
38
|
+
|
|
39
|
+
if (NOT is_emscripten AND BUILD_TOOLS)
|
|
40
|
+
add_subdirectory(make-fastdb)
|
|
41
|
+
add_subdirectory(dump-fastdb)
|
|
42
|
+
endif()
|
|
43
|
+
|
|
44
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
|
45
|
+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
|
46
|
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
project(dump-fastdb)
|
|
2
|
+
set(PROJECT_NAME dump-fastdb)
|
|
3
|
+
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native -DNDEBUG")
|
|
6
|
+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=native -DNDEBUG")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
10
|
+
include_directories(${ROOT_DIR}/fastdb/include)
|
|
11
|
+
include_directories(${GDAL_INCLUDE_DIRS})
|
|
12
|
+
|
|
13
|
+
add_source_by_dir(${PROJECT_DIR} SOURCES)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
add_executable(${PROJECT_NAME} ${SOURCES} )
|
|
17
|
+
|
|
18
|
+
target_link_libraries(${PROJECT_NAME} fastdb)
|
|
19
|
+
|
|
20
|
+
#message(STATUS ${GDAL_INCLUDE_DIRS})
|
|
21
|
+
#message(STATUS ${GDAL_LIBRARIES})
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#include "fastdb.h"
|
|
2
|
+
using namespace wx;
|
|
3
|
+
|
|
4
|
+
const char* get_field_type_name(int ft)
|
|
5
|
+
{
|
|
6
|
+
switch(ft)
|
|
7
|
+
{
|
|
8
|
+
case ftF32:
|
|
9
|
+
return "F32";
|
|
10
|
+
case ftF64:
|
|
11
|
+
return "F64";
|
|
12
|
+
case ftI32:
|
|
13
|
+
return "I32";
|
|
14
|
+
case ftSTR:
|
|
15
|
+
return "STR";
|
|
16
|
+
case ftU16:
|
|
17
|
+
return "U16";
|
|
18
|
+
case ftU16n:
|
|
19
|
+
return "U16n";
|
|
20
|
+
case ftU32:
|
|
21
|
+
return "U32";
|
|
22
|
+
case ftU8:
|
|
23
|
+
return "U8";
|
|
24
|
+
case ftU8n:
|
|
25
|
+
return "U8n";
|
|
26
|
+
case ftREF:
|
|
27
|
+
return "REF";
|
|
28
|
+
}
|
|
29
|
+
return "UNKNOWN";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const char* get_geometry_type_name(int gt)
|
|
33
|
+
{
|
|
34
|
+
switch(gt)
|
|
35
|
+
{
|
|
36
|
+
case gtAny:
|
|
37
|
+
return "Any";
|
|
38
|
+
case gtLineString:
|
|
39
|
+
return "LineString";
|
|
40
|
+
case gtPoint:
|
|
41
|
+
return "Point";
|
|
42
|
+
case gtPolygon:
|
|
43
|
+
return "Polygon";
|
|
44
|
+
case gtNone:
|
|
45
|
+
return "None";
|
|
46
|
+
}
|
|
47
|
+
return "UNKNOWN";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
int main(int argc,char** argv) {
|
|
51
|
+
printf("\n\
|
|
52
|
+
****************************************************\n\
|
|
53
|
+
fastdb dumpping utility\n\
|
|
54
|
+
****************************************************\n");
|
|
55
|
+
|
|
56
|
+
FastVectorDb* db = FastVectorDb::load(argv[1]);
|
|
57
|
+
if (db) {
|
|
58
|
+
for(int ix=0;ix<db->getLayerCount();ix++)
|
|
59
|
+
{
|
|
60
|
+
FastVectorDbLayer* layer = db->getLayer(ix);
|
|
61
|
+
//枚举图层信息
|
|
62
|
+
printf("\nLayer[%d]:%s geometry type:%s\n",ix,layer->name(),get_geometry_type_name(layer->getGeometryType()));
|
|
63
|
+
double minx,miny,maxx,maxy;
|
|
64
|
+
layer->getExtent(minx,miny,maxx,maxy);
|
|
65
|
+
printf("\textent:(%lf,%lf,%lf,%lf)\n",minx,miny,maxx,maxy);
|
|
66
|
+
int fc = layer->getFeatureCount();
|
|
67
|
+
printf("\tfeature count:%d\n",fc);
|
|
68
|
+
for(int fi=0;fi<layer->getFieldCount();fi++)
|
|
69
|
+
{
|
|
70
|
+
const char* name;
|
|
71
|
+
FieldTypeEnum ft;
|
|
72
|
+
double vmin,vmax;
|
|
73
|
+
name = layer->getFieldDefn(fi,ft,vmin,vmax);
|
|
74
|
+
printf("\tField[%d]:%s type:%s range(%lf,%lf)\n",fi,name,get_field_type_name(ft),vmin,vmax);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
layer->rewind();
|
|
78
|
+
printf("\tvalidate geometry.");
|
|
79
|
+
int irec=0;
|
|
80
|
+
while(layer->next())
|
|
81
|
+
{
|
|
82
|
+
if(irec%100==0)
|
|
83
|
+
printf(".%d.",irec);
|
|
84
|
+
irec++;
|
|
85
|
+
}
|
|
86
|
+
printf("...done!\n\tfeature count:%d\n",irec);
|
|
87
|
+
}
|
|
88
|
+
delete db;
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
{
|
|
92
|
+
printf("Can't open %s\n",argv[1]);
|
|
93
|
+
}
|
|
94
|
+
fflush(stdout);
|
|
95
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
project(fastdb)
|
|
2
|
+
set(PROJECT_NAME fastdb)
|
|
3
|
+
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
4
|
+
|
|
5
|
+
option(USE_SWIG_PYTHON "use swig python wrapper" OFF)
|
|
6
|
+
option(USE_SWIG_NODE "use swig node wrapper" OFF)
|
|
7
|
+
|
|
8
|
+
add_definitions(-DFASTDB_EXPORT)
|
|
9
|
+
|
|
10
|
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
11
|
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
12
|
+
include_directories(${LIB_DIR}/gaiageo/headers)
|
|
13
|
+
include_directories(${LIB_DIR}/gaiageo/headers/spatialite)
|
|
14
|
+
include_directories(${LIB_DIR}/clipper/Clipper2Lib/include)
|
|
15
|
+
include_directories(${LIB_DIR}/clipper/Clipper2Lib/include/clipper2)
|
|
16
|
+
|
|
17
|
+
add_source_by_dir(${PROJECT_DIR} SOURCES)
|
|
18
|
+
|
|
19
|
+
file(GLOB_RECURSE EXCLUED_FILES ${PROJECT_DIR}/swig/*.*)
|
|
20
|
+
list(REMOVE_ITEM SOURCES ${EXCLUED_FILES})
|
|
21
|
+
|
|
22
|
+
if(is_emscripten)
|
|
23
|
+
set(BUILD_TYPE STATIC)
|
|
24
|
+
else()
|
|
25
|
+
set(BUILD_TYPE SHARED)
|
|
26
|
+
endif(is_emscripten)
|
|
27
|
+
|
|
28
|
+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
|
|
29
|
+
target_link_libraries(${PROJECT_NAME} PRIVATE gaiageo Clipper2)
|
|
30
|
+
|
|
31
|
+
get_target_property(swig_out_dir ${PROJECT_NAME} SWIG_OUTPUT_DIR)
|
|
32
|
+
|
|
33
|
+
set(swig_dir ${PROJECT_DIR}/swig)
|
|
34
|
+
set(script_dir ${ROOT_DIR}/scripts)
|
|
35
|
+
|
|
36
|
+
if (NOT is_emscripten)
|
|
37
|
+
if(USE_SWIG_PYTHON)
|
|
38
|
+
set(script_dir ${ROOT_DIR}/../python/fastdb/core)
|
|
39
|
+
set(SWIG_GENERATED_DIR ${CMAKE_BINARY_DIR}/swig_generated)
|
|
40
|
+
|
|
41
|
+
# Copy SWIG generated files to the build directory
|
|
42
|
+
add_custom_command(
|
|
43
|
+
OUTPUT ${SWIG_GENERATED_DIR}/fastdb4py_wrap.cxx
|
|
44
|
+
${SWIG_GENERATED_DIR}/fastdb4py.py
|
|
45
|
+
COMMAND ${CMAKE_COMMAND} -E make_directory ${SWIG_GENERATED_DIR}
|
|
46
|
+
COMMAND swig -c++ -python
|
|
47
|
+
-I${PROJECT_DIR}/include
|
|
48
|
+
-I${PROJECT_DIR}/swig
|
|
49
|
+
-outdir ${SWIG_GENERATED_DIR}
|
|
50
|
+
-o ${SWIG_GENERATED_DIR}/fastdb4py_wrap.cxx
|
|
51
|
+
${PROJECT_DIR}/swig/fastdb4py.i
|
|
52
|
+
DEPENDS ${PROJECT_DIR}/swig/fastdb4py.i
|
|
53
|
+
${PROJECT_DIR}/include/fastdb.h
|
|
54
|
+
${PROJECT_DIR}/include/fastdb-geometry-utils.h
|
|
55
|
+
COMMENT "Generating SWIG Python bindings"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
set(Python3_FIND_VIRTUALENV FIRST)
|
|
59
|
+
find_package(Python3 ${PYTHON_VERSION_STRING} COMPONENTS Interpreter Development NumPy)
|
|
60
|
+
include_directories(${Python3_INCLUDE_DIRS} )
|
|
61
|
+
include_directories(${Python3_NumPy_INCLUDE_DIRS} )
|
|
62
|
+
message(STATUS "building fastdb with swig python wrapper support!")
|
|
63
|
+
message(STATUS numpy_dir=${Python3_NumPy_INCLUDE_DIRS})
|
|
64
|
+
message(STATUS python_libs=${Python3_LIBRARY_DIRS})
|
|
65
|
+
add_definitions(-DUSE_SWIG_PYTHON -DSWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
|
66
|
+
|
|
67
|
+
add_library(fastdb4py SHARED ${SWIG_GENERATED_DIR}/fastdb4py_wrap.cxx)
|
|
68
|
+
target_link_libraries(fastdb4py PRIVATE ${PROJECT_NAME})
|
|
69
|
+
target_link_directories(fastdb4py PRIVATE ${Python3_LIBRARY_DIRS})
|
|
70
|
+
|
|
71
|
+
target_link_options(fastdb4py
|
|
72
|
+
PUBLIC
|
|
73
|
+
$<$<BOOL:${APPLE}>:-undefineddynamic_lookup>)
|
|
74
|
+
if(WIN32)
|
|
75
|
+
set(pyd pyd)
|
|
76
|
+
else()
|
|
77
|
+
set(pyd so)
|
|
78
|
+
endif(WIN32)
|
|
79
|
+
|
|
80
|
+
add_custom_command(TARGET fastdb4py POST_BUILD
|
|
81
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:fastdb4py> ${script_dir}/_fastdb4py.${pyd}
|
|
82
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${PROJECT_NAME}> ${script_dir}/$<TARGET_FILE_NAME:${PROJECT_NAME}>
|
|
83
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIG_GENERATED_DIR}/fastdb4py.py ${script_dir}/__init__.py
|
|
84
|
+
COMMENT "updating fastdb4py into scripts directory"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
else()
|
|
88
|
+
message(STATUS "if you want swig python support please check USE_SWIG_PYTHON!")
|
|
89
|
+
endif(USE_SWIG_PYTHON)
|
|
90
|
+
|
|
91
|
+
if(USE_SWIG_NODE)
|
|
92
|
+
include_directories(${ROOT_DIR}/node_modules/node-addon-api)
|
|
93
|
+
include_directories(${ROOT_DIR}/node_modules/node-api-headers/include/)
|
|
94
|
+
add_library(fastdb4node SHARED ${PROJECT_DIR}/swig/fastdb4node.cxx)
|
|
95
|
+
target_link_libraries(fastdb4node PRIVATE ${PROJECT_NAME})
|
|
96
|
+
|
|
97
|
+
target_link_options(fastdb4node
|
|
98
|
+
PUBLIC
|
|
99
|
+
$<$<BOOL:${APPLE}>:-undefineddynamic_lookup>)
|
|
100
|
+
|
|
101
|
+
if(WIN32)
|
|
102
|
+
target_link_libraries(fastdb4node PRIVATE ${ROOT_DIR}/node_modules/node-api-headers/lib/node_api.lib)
|
|
103
|
+
target_link_libraries(fastdb4node PRIVATE ${ROOT_DIR}/node_modules/node-api-headers/lib/js_native_api.lib)
|
|
104
|
+
endif()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
add_custom_command(TARGET fastdb4node POST_BUILD
|
|
108
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:fastdb4node> ${script_dir}/_fastdb.node
|
|
109
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${PROJECT_NAME}> ${script_dir}/$<TARGET_FILE_NAME:${PROJECT_NAME}>
|
|
110
|
+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${swig_dir}/fastdb.js ${script_dir}/fastdb.js
|
|
111
|
+
|
|
112
|
+
COMMENT "updating fastdb4node into swig directory"
|
|
113
|
+
)
|
|
114
|
+
endif(USE_SWIG_NODE)
|
|
115
|
+
else()
|
|
116
|
+
message(STATUS "linking swig wrapper...")
|
|
117
|
+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
118
|
+
COMMAND emcc
|
|
119
|
+
"-O2"
|
|
120
|
+
"-s" "WASM=0"
|
|
121
|
+
#"-s" "MODULARIZE=1"
|
|
122
|
+
#"-s" EXPORT_NAME="'fastdb'"
|
|
123
|
+
#"-s" 'EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap","_free","_malloc"]'
|
|
124
|
+
"-s" "ALLOW_MEMORY_GROWTH=1"
|
|
125
|
+
"-s" "INITIAL_MEMORY=16777216"
|
|
126
|
+
"-s" "TOTAL_MEMORY=16777216"
|
|
127
|
+
"-s" "TOTAL_STACK=5242880"
|
|
128
|
+
"-s" "ERROR_ON_UNDEFINED_SYMBOLS=0"
|
|
129
|
+
"--post-js" "${swig_dir}/fastdb4em_i.js"
|
|
130
|
+
"-I" ${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
131
|
+
"$<TARGET_FILE:${PROJECT_NAME}>" "${swig_dir}/fastdb4em.cxx"
|
|
132
|
+
"-o" "${script_dir}/fastdb4em.js"
|
|
133
|
+
COMMENT "emcc linking fastdb.js"
|
|
134
|
+
)
|
|
135
|
+
endif()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
//FastVectorDB:A fast vector database for local cache
|
|
3
|
+
//Author: wenyongning@njnu.edu.cn
|
|
4
|
+
#include <stdlib.h>
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <cstring>
|
|
7
|
+
namespace wx{
|
|
8
|
+
typedef char i8;
|
|
9
|
+
typedef unsigned char u8;
|
|
10
|
+
typedef unsigned int i32;
|
|
11
|
+
typedef unsigned int u32;
|
|
12
|
+
typedef short i16;
|
|
13
|
+
typedef unsigned short u16;
|
|
14
|
+
typedef float f32;
|
|
15
|
+
typedef double f64;
|
|
16
|
+
typedef u16 uchar_t;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#ifdef SWIG
|
|
20
|
+
#define fastdb_api
|
|
21
|
+
#else
|
|
22
|
+
#ifdef _WIN32
|
|
23
|
+
#ifdef FASTDB_EXPORT
|
|
24
|
+
#define fastdb_api __declspec(dllexport)
|
|
25
|
+
#else
|
|
26
|
+
#define fastdb_api __declspec(dllimport)
|
|
27
|
+
#endif
|
|
28
|
+
#else
|
|
29
|
+
#define fastdb_api __attribute__((visibility("default")))
|
|
30
|
+
#endif
|
|
31
|
+
#endif
|
|
32
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <vector>
|
|
3
|
+
#include <string>
|
|
4
|
+
#include "fastdb.h"
|
|
5
|
+
using namespace std;
|
|
6
|
+
|
|
7
|
+
#ifndef WIN32
|
|
8
|
+
#include <cmath>
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
namespace wx
|
|
12
|
+
{
|
|
13
|
+
class GeometryUtils : public GeometryReturn
|
|
14
|
+
{
|
|
15
|
+
public:
|
|
16
|
+
double minx;
|
|
17
|
+
double miny;
|
|
18
|
+
double maxx;
|
|
19
|
+
double maxy;
|
|
20
|
+
GeometryLikeEnum gtype;
|
|
21
|
+
point2_t point;
|
|
22
|
+
std::vector<point2_t> points;
|
|
23
|
+
std::vector<int> part_length;
|
|
24
|
+
std::vector<size_t> part_first_point;
|
|
25
|
+
std::vector<GeometryPartEnum> part_type;
|
|
26
|
+
std::vector<int> polygon_part_count;
|
|
27
|
+
std::vector<int> polygon_first_part;
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
inline int get_point_count()
|
|
31
|
+
{
|
|
32
|
+
return points.size();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
template <class pointT = point2_t>
|
|
36
|
+
inline const pointT *point_data(int ix = 0)
|
|
37
|
+
{
|
|
38
|
+
if (sizeof(pointT) == sizeof(point2_t))
|
|
39
|
+
return (const pointT *)points.data() + get_part_first_point(ix);
|
|
40
|
+
else
|
|
41
|
+
return NULL;
|
|
42
|
+
}
|
|
43
|
+
inline const int *part_data()
|
|
44
|
+
{
|
|
45
|
+
return part_length.data();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
inline int get_part_count()
|
|
49
|
+
{
|
|
50
|
+
return part_length.size();
|
|
51
|
+
}
|
|
52
|
+
inline int get_part_length(int ix)
|
|
53
|
+
{
|
|
54
|
+
return part_length[ix];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
inline const point2_t &get_point_at(int ix)
|
|
58
|
+
{
|
|
59
|
+
return points[ix];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
inline int get_part_first_point(int ix)
|
|
63
|
+
{
|
|
64
|
+
return part_first_point[ix];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
inline int get_polygon_part_count(int ix)
|
|
68
|
+
{
|
|
69
|
+
return polygon_part_count[ix];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
inline int get_polygon_count()
|
|
73
|
+
{
|
|
74
|
+
return polygon_part_count.size();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
inline int get_polygon_first_part(int ix)
|
|
78
|
+
{
|
|
79
|
+
return polygon_first_part[ix];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
inline int np()
|
|
83
|
+
{
|
|
84
|
+
return points.size();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public:
|
|
88
|
+
template <typename pprocT>
|
|
89
|
+
void post_process_points(pprocT proc)
|
|
90
|
+
{
|
|
91
|
+
if (points.size())
|
|
92
|
+
for (auto &p : points)
|
|
93
|
+
proc(p);
|
|
94
|
+
else
|
|
95
|
+
{
|
|
96
|
+
proc(point);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
void udpate_bounding_box()
|
|
100
|
+
{
|
|
101
|
+
minx = points[0].x;
|
|
102
|
+
miny = points[0].y;
|
|
103
|
+
maxx = points[0].x;
|
|
104
|
+
maxy = points[0].y;
|
|
105
|
+
|
|
106
|
+
for (int i = 1, np = points.size(); i < np; i++)
|
|
107
|
+
{
|
|
108
|
+
if (points[i].x < minx)
|
|
109
|
+
minx = points[i].x;
|
|
110
|
+
if (points[i].x > maxx)
|
|
111
|
+
maxx = points[i].x;
|
|
112
|
+
if (points[i].y < miny)
|
|
113
|
+
miny = points[i].y;
|
|
114
|
+
if (points[i].y > maxy)
|
|
115
|
+
maxy = points[i].y;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public:
|
|
120
|
+
virtual bool begin(const double aabbox[4])
|
|
121
|
+
{
|
|
122
|
+
if (aabbox)
|
|
123
|
+
{
|
|
124
|
+
minx = aabbox[0];
|
|
125
|
+
miny = aabbox[1];
|
|
126
|
+
maxx = aabbox[2];
|
|
127
|
+
maxy = aabbox[3];
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
{
|
|
131
|
+
minx = miny = maxx = maxy = NAN;
|
|
132
|
+
}
|
|
133
|
+
points.clear();
|
|
134
|
+
part_length.clear();
|
|
135
|
+
part_type.clear();
|
|
136
|
+
part_first_point.clear();
|
|
137
|
+
polygon_first_part.clear();
|
|
138
|
+
polygon_part_count.clear();
|
|
139
|
+
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
virtual void returnGeomrtryPart(GeometryPartEnum partType, point2_t *pts, int np)
|
|
143
|
+
{
|
|
144
|
+
if (partType == gptPoint2)
|
|
145
|
+
{
|
|
146
|
+
gtype = gtPoint;
|
|
147
|
+
point = pts[0];
|
|
148
|
+
}
|
|
149
|
+
else if (partType == gptLineString)
|
|
150
|
+
{
|
|
151
|
+
gtype = gtLineString;
|
|
152
|
+
}
|
|
153
|
+
else if (partType == gptRingExternal)
|
|
154
|
+
{
|
|
155
|
+
gtype = gtPolygon;
|
|
156
|
+
polygon_first_part.push_back(part_length.size());
|
|
157
|
+
polygon_part_count.push_back(1);
|
|
158
|
+
}
|
|
159
|
+
else if (partType == gptRingInternal)
|
|
160
|
+
{
|
|
161
|
+
polygon_part_count.back() += 1;
|
|
162
|
+
}
|
|
163
|
+
if (gtype != gtPoint)
|
|
164
|
+
{
|
|
165
|
+
part_first_point.push_back(points.size());
|
|
166
|
+
part_length.push_back(np);
|
|
167
|
+
part_type.push_back(partType);
|
|
168
|
+
points.insert(points.end(), pts, pts + np);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
virtual void end()
|
|
172
|
+
{
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|