Skip to content

Commit d627859

Browse files
fix: issues/60,214,239,292,299,328,339,384,385,386 (#379)
* test whether split will take owner of string? meta.SRS.split() will take meta.SRS ? or meta.SRS.str().split() * Fix: file separator and runtime error (#340) * fix: file separator * fix: Result::unwrap() on an Err value: Error("control character (\\u0000-\\u001F) * feature: e2e * fix: coordinate offset * fix * fix: auto fix terrain height * fix: fbx drift * docs: update * refactor: coordinate system * fix: fbx texture * fix: shapefile supports more coordinate system * fix: shapefile * fix: windows compiler error * fix: windows compiler error * fix: windows compiler error --------- Co-authored-by: fanvanzh <fanvanzh@sina.com>
1 parent 19242b5 commit d627859

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+49864
-429
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
/.cache/
66
/build/
77
/.idea/
8-
.DS_Store
8+
.DS_Store
9+
10+
data
11+
output

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ target_link_libraries(_3dtile PUBLIC Eigen3::Eigen)
141141
find_package(unofficial-sqlite3 CONFIG REQUIRED)
142142
target_link_libraries(_3dtile PRIVATE unofficial::sqlite3::sqlite3)
143143

144+
# GeographicLib for geoid height calculation
145+
find_package(GeographicLib CONFIG REQUIRED)
146+
target_link_libraries(_3dtile PRIVATE ${GeographicLib_LIBRARIES})
147+
144148

145149
install(TARGETS _3dtile DESTINATION lib)
146150
install(TARGETS ufbx DESTINATION lib)

README_EN.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ _3dtile.exe -f shape -i E:\Data\aa.shp -o E:\Data\aa --height height
223223
# from single fbx file
224224
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model
225225

226+
# from fbx with geoid height conversion (China 1985 to WGS84)
227+
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model --lon 120.0 --lat 30.0 --alt 100 --geoid egm96
228+
229+
# from fbx with custom geoid data path
230+
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model --lon 120.0 --lat 30.0 --geoid egm96 --geoid-path geoids/geoids
231+
226232
# from single osgb file to glb file
227233
_3dtile.exe -f gltf -i E:\Data\TT\001.osgb -o E:\Data\TT\001.glb
228234

@@ -272,6 +278,30 @@ _3dtile.exe -f shape -i E:\Data\aa.shp -o E:\Data\aa \
272278

273279
- `--height <FIELD>` - Height attribute field name (required for shapefile conversion)
274280

281+
- `--lon <LON>` - Longitude
282+
Set the center longitude for FBX format positioning
283+
284+
- `--lat <LAT>` - Latitude
285+
Set the center latitude for FBX format positioning
286+
287+
- `--alt <ALT>` - Altitude
288+
Set the center altitude for FBX format positioning
289+
290+
- `--geoid <MODEL>` - Geoid model for height conversion
291+
Set the geoid model to convert orthometric height (e.g., China 1985) to ellipsoidal height (WGS84)
292+
- **Available values:** `none` (default), `egm84`, `egm96`, `egm2008`
293+
- **Applies to:** FBX format
294+
- **Use case:** Required when source data uses orthometric height (above sea level) instead of ellipsoidal height
295+
- **Example:** `--geoid egm96`
296+
297+
- `--geoid-path <PATH>` - Path to geoid data files
298+
Set the path to geoid data files (e.g., egm96-5.pgm)
299+
- **Default behavior:**
300+
1. First checks `GEOGRAPHICLIB_GEOID_PATH` environment variable
301+
2. Falls back to default path `/usr/local/share/GeographicLib/geoids`
302+
- **Applies to:** Used with `--geoid` option
303+
- **Example:** `--geoid-path /path/to/geoids`
304+
275305
- `-v, --verbose` - Enable verbose output for debugging
276306

277307
### Optimization Flags (New)

README_ZH.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ _3dtile.exe -f gltf -i E:\Data\TT\001.obj -o E:\Data\TT\001.glb
307307

308308
# convert single b3dm file to glb file
309309
_3dtile.exe -f b3dm -i E:\Data\aa.b3dm -o E:\Data\aa.glb
310+
311+
# from single fbx file
312+
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model
313+
314+
# from fbx with geoid height conversion (China 1985 to WGS84)
315+
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model --lon 120.0 --lat 30.0 --alt 100 --geoid egm96
316+
317+
# from fbx with custom geoid data path
318+
_3dtile.exe -f fbx -i E:\Data\model.fbx -o E:\Data\model --lon 120.0 --lat 30.0 --geoid egm96 --geoid-path geoids/geoids
310319
```
311320

312321
### 使用优化参数的高级选项
@@ -367,6 +376,30 @@ _3dtile.exe -f shape -i E:\Data\aa.shp -o E:\Data\aa \
367376
- `--height <FIELD>` 高度字段名称
368377
指定 shapefile 中的高度属性字段,转换 shp 时的必需参数
369378

379+
- `--lon <LON>` 经度
380+
设置中心点经度,用于 FBX 格式定位
381+
382+
- `--lat <LAT>` 纬度
383+
设置中心点纬度,用于 FBX 格式定位
384+
385+
- `--alt <ALT>` 高度
386+
设置中心点高度,用于 FBX 格式定位
387+
388+
- `--geoid <MODEL>` 大地水准面模型
389+
设置用于高度转换的大地水准面模型,将正高(如中国1985高程)转换为椭球高(WGS84)
390+
- **可选值:** `none`(默认), `egm84`, `egm96`, `egm2008`
391+
- **适用于:** FBX 格式
392+
- **使用场景:** 当源数据使用正高(海拔高)而非椭球高时,需要进行高程转换
393+
- **示例:** `--geoid egm96`
394+
395+
- `--geoid-path <PATH>` 大地水准面数据路径
396+
设置大地水准面数据文件的路径(如 egm96-5.pgm)
397+
- **默认行为:**
398+
1. 优先使用 `GEOGRAPHICLIB_GEOID_PATH` 环境变量
399+
2. 其次使用默认路径 `/usr/local/share/GeographicLib/geoids`
400+
- **适用于:**`--geoid` 配合使用
401+
- **示例:** `--geoid-path /path/to/geoids`
402+
370403
- `-v, --verbose` 启用详细输出用于调试
371404

372405
### 优化参数(新增)

build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ fn build_win_msvc() {
117117
let vcpkg_installed_lib_dir = vcpkg_installed_dir.join("lib");
118118
println!("cargo:rustc-link-search=native={}", vcpkg_installed_lib_dir.display());
119119

120+
// Determine if building in debug or release mode
121+
let profile = env::var("PROFILE").unwrap_or("release".to_string());
122+
let is_debug = profile == "debug";
123+
let geolib_lib_name = if is_debug {
124+
"GeographicLib_d-i"
125+
} else {
126+
"GeographicLib-i"
127+
};
128+
println!("cargo:warning=Building in {} mode, linking GeographicLib as: {}", profile, geolib_lib_name);
129+
120130
// 1. FFI static
121131
println!("cargo:rustc-link-lib=static=_3dtile");
122132
println!("cargo:rustc-link-lib=static=ufbx");
@@ -138,6 +148,9 @@ fn build_win_msvc() {
138148
// zstd is required by gdal/basisu when building KTX2 (supercompression) and some GDAL drivers
139149
println!("cargo:rustc-link-lib=zstd");
140150

151+
// GeographicLib for geoid height calculation
152+
println!("cargo:rustc-link-lib={}", geolib_lib_name);
153+
141154
// 5. sqlite
142155
println!("cargo:rustc-link-lib=sqlite3");
143156

@@ -285,6 +298,9 @@ fn build_linux_unknown() {
285298
// zstd is required by gdal/basisu when building KTX2 (supercompression) and some GDAL drivers
286299
println!("cargo:rustc-link-lib=zstd");
287300

301+
// GeographicLib for geoid height calculation
302+
println!("cargo:rustc-link-lib=GeographicLib");
303+
288304
let vcpkg_share_dir = vcpkg_installed_dir.join("share");
289305
copy_gdal_data(vcpkg_share_dir.to_str().unwrap());
290306
copy_proj_data(vcpkg_share_dir.to_str().unwrap());
@@ -412,6 +428,9 @@ fn build_macos() {
412428
// zstd is required by gdal/basisu when building KTX2 (supercompression) and some GDAL drivers
413429
println!("cargo:rustc-link-lib=zstd");
414430

431+
// GeographicLib for geoid height calculation
432+
println!("cargo:rustc-link-lib=GeographicLib");
433+
415434
// 7. System libraries / frameworks
416435
println!("cargo:rustc-link-lib=c++");
417436
println!("cargo:rustc-link-lib=z");
@@ -555,6 +574,9 @@ fn build_macos_x86_64() {
555574
// zstd is required by gdal/basisu when building KTX2 (supercompression) and some GDAL drivers
556575
println!("cargo:rustc-link-lib=zstd");
557576

577+
// GeographicLib for geoid height calculation
578+
println!("cargo:rustc-link-lib=GeographicLib");
579+
558580
// 7. System libraries / frameworks
559581
println!("cargo:rustc-link-lib=c++");
560582
println!("cargo:rustc-link-lib=z");

0 commit comments

Comments
 (0)