-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MiraMonRaster driver (reading part) #12841
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
base: master
Are you sure you want to change the base?
Conversation
466f60a
to
845dc38
Compare
845dc38
to
a5bf252
Compare
MiraMon Raster | ||
============== | ||
|
||
.. shortname:: MiraMonRaster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. shortname:: MiraMonRaster | |
.. versionadded:: 3.12 | |
.. shortname:: MiraMonRaster |
/************************************************************************/ | ||
/* MMRBand() */ | ||
/************************************************************************/ | ||
MMRBand::MMRBand(MMRRel &fRel, CPLString osBandSectionIn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MMRBand::MMRBand(MMRRel &fRel, CPLString osBandSectionIn) | |
MMRBand::MMRBand(MMRRel &fRel, const CPLString &osBandSectionIn) |
nHeight = 0; | ||
CPLError(CE_Failure, CPLE_AssertionFailed, | ||
"The REL file '%s' contains a documented \ | ||
band with no explicit name. Section [%s] or [%s:%s].\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
band with no explicit name. Section [%s] or [%s:%s].\n", | |
band with no explicit name. Section [%s] or [%s:%s].", |
{ | ||
osBandName = CPLGetBasenameSafe(osRawBandFileName); | ||
CPLString osAux = | ||
CPLGetPathSafe(static_cast<const char *>(pfRel->GetRELNameChar())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPLGetPathSafe(static_cast<const char *>(pfRel->GetRELNameChar())); | |
CPLGetPathSafe(pfRel->GetRELNameChar()); |
nHeight = 0; | ||
CPLError(CE_Failure, CPLE_AssertionFailed, | ||
"The REL file '%s' contains a documented \ | ||
band with no explicit name. Section [%s] or [%s:%s].\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
band with no explicit name. Section [%s] or [%s:%s].\n", | |
band with no explicit name. Section [%s] or [%s:%s].", |
int nBands = 0; | ||
MMRBand **papoBand = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a std::vector<std::unique_ptr<MMRBand>>
could avoid manual memory management
// Preserving metadata | ||
|
||
// Domain | ||
const char *kMetadataDomain = "MIRAMON"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const char *kMetadataDomain = "MIRAMON"; | |
static constexpr const char *kMetadataDomain = "MIRAMON"; |
|
||
// Used to join Section and Key in a single | ||
// name for SetMetadataItem(Name, Value) | ||
const char *SecKeySeparator = "[$$$]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const char *SecKeySeparator = "[$$$]"; | |
static constexpr const char *SecKeySeparator = "[$$$]"; |
@@ -482,6 +482,13 @@ if ((GDAL_BUILD_OPTIONAL_DRIVERS AND NOT DEFINED GDAL_ENABLE_DRIVER_ADRG AND NOT | |||
add_subdirectory(frmts/iso8211) | |||
endif() | |||
|
|||
# Build frmts/miramon_common conditionally to drivers requiring it | |||
if ((GDAL_BUILD_OPTIONAL_DRIVERS AND NOT DEFINED GDAL_ENABLE_DRIVER_MIRAMONVECTOR AND NOT DEFINED GDAL_ENABLE_DRIVER_MIRAMONRASTER) OR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's likely something wrong in this condition, as the variable for the vector driver is OGR_ENABLE_DRIVER_MIRAMONRASTER . You should likely test OGR_BUILD_OPTIONAL_DRIVERS too. See above test for frmts/iso8211
#ifdef MSVC | ||
#include "..\..\..\frmts\miramon_common\mm_gdal_functions.h" | ||
#include "..\..\..\frmts\miramon_common\mm_gdal_constants.h" | ||
#else | ||
#include "../../../frmts/miramon_common/mm_gdal_functions.h" | ||
#include "../../../frmts/miramon_common/mm_gdal_constants.h" | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe MSVC test is not needed:
#ifdef MSVC | |
#include "..\..\..\frmts\miramon_common\mm_gdal_functions.h" | |
#include "..\..\..\frmts\miramon_common\mm_gdal_constants.h" | |
#else | |
#include "../../../frmts/miramon_common/mm_gdal_functions.h" | |
#include "../../../frmts/miramon_common/mm_gdal_constants.h" | |
#endif | |
#include "../../../frmts/miramon_common/mm_gdal_functions.h" | |
#include "../../../frmts/miramon_common/mm_gdal_constants.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same in other locations
|
import pytest | ||
|
||
from osgeo import gdal | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove all @pytest.mark.require_driver("MiraMonRaster")
if you just add
pytestmark = pytest.mark.require_driver("MiraMonRaster") | |
|
||
gdal_target_link_libraries(gdal_MiraMon PRIVATE PROJ::proj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be needed:
gdal_target_link_libraries(gdal_MiraMon PRIVATE PROJ::proj) |
What does this PR do?
Implements reading part for the MiraMonRaster driver.
I hope the code is clear. I’ve reused some logic from the vector side, particularly for reading DBF files and certain metadata handling.
AI assistance was used only for consultation purposes — mainly for generating small Python snippets, which I subsequently reviewed and fully understood, as well as for improving the clarity of the English writing.
New code is in C++.
If any part is unclear or needs adjustment, I’ll be available in September to answer questions or consider any suggestions reviewers may have.
Tests covers a 98.7% of functions (missing test for GetColorInterpretation() and AssignRGBColorDirectly()) and a 82.2% of the lines. I have made an effort in "error cases" but sometimes you would need very bad data to get one.
What are related issues/pull requests?
#12293
Tasklist