Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2dm precision #497

Merged
merged 12 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/coverage_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on: [push, pull_request]
jobs:
coverage_tests:
if: github.repository == 'lutraconsulting/MDAL'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout MDAL
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: install deps
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/osx_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ env:
QGIS_DEPS_VERSION: 0.4.0
jobs:
osx_tests:
runs-on: macos-12
runs-on: macos-13
steps:
- name: Checkout MDAL
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: install deps
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ QGIS contains internal copy of MDAL library in following versions:
| 3.30.0 | 1.0.2 | |
| 3.36.0 | 1.1.0 | Mike21 format support read/write |
| 3.38.0 | 1.2.0 | Groundwater / surface water meshes for 3Di format |
| 3.42.0 | 1.3.0 | Fix 2dm format coordinates saving |
| 3.42.0 | 1.3.1 | Fix 2dm format coordinates saving, allow precision up to 16 digits |
| | | XMDF loading Dataset Group fix, support for Mesh in XMDF files (as 2DMeshModule) |
| | | Support Dataset Group Removal From Mesh |

Expand Down
2 changes: 1 addition & 1 deletion mdal/frmts/mdal_2dm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void MDAL::Driver2dm::save( const std::string &fileName, const std::string &, MD
for ( size_t j = 0; j < 2; ++j )
{
line.append( " " );
line.append( MDAL::doubleToString( vertex[j], 8, true ) );
line.append( MDAL::doubleToString( vertex[j], 16 ) );
}
line.append( " " );
line.append( MDAL::doubleToString( vertex[2] ) );
Expand Down
2 changes: 1 addition & 1 deletion mdal/mdal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static const char *EMPTY_STR = "";

const char *MDAL_Version()
{
return "1.3.0";
return "1.3.1";
}

MDAL_Status MDAL_LastStatus()
Expand Down
8 changes: 8 additions & 0 deletions tests/data/2dm/quad_and_triangle_large_coordinates.2dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MESH2D 1000.000 2000.000 0.000000 200 300 1.000 1.000
ND 1 1000.001 2000.001 20.000
ND 2 2000.001 2000.001 30.000
ND 3 300000.001 200000.001 40.000
ND 4 2000000.001 3000000.001 50.000
ND 5 1000000000.001 3000000000.001 10.000
E4Q 1 1 2 4 5 1
E3T 2 2 3 4 1
9 changes: 9 additions & 0 deletions tests/test_2dm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,15 @@ TEST( Mesh2DMTest, QuadAndTriangleScientificNotationFile )
MDAL_CloseMesh( m_not_scientific );
}

TEST( Mesh2DMTest, QuadAndTriangleScientificNotationFileLargeValues )
{
saveAndCompareMesh(
test_file( "/2dm/quad_and_triangle_large_coordinates.2dm" ),
tmp_file( "/quad_and_triangle_large_coordinates_saved.2dm" ),
"2DM"
);
}

int main( int argc, char **argv )
{
testing::InitGoogleTest( &argc, argv );
Expand Down