Skip to content

Commit fca90a7

Browse files
authoredMay 11, 2020
[MESH] scalar color settings depending on classification (#36313)
* [MESH] [FEATURE] Sets meh color ramp classification from metadata read by MDAL driver. Some mesh layer formats can provide values that can be compressed by categorizing values in consecutive intervals, each represent by an integer or byte. MDAL has the capabilities to recognize this dataset type and store the bounds of each class an the units in the metadata. QGIS uses this metadata to setup adapted color ramp shader. * [MDAL] update to pre-release 0.5.92
1 parent b6a7a10 commit fca90a7

23 files changed

+518
-61
lines changed
 

‎external/mdal/frmts/mdal_3di.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,16 @@ std::set<std::string> MDAL::Driver3Di::ignoreNetCDFVariables()
194194
return ignore_variables;
195195
}
196196

197-
void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string &variableName, std::string &name, bool *is_vector, bool *is_x )
197+
void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid,
198+
std::string &variableName,
199+
std::string &name,
200+
bool *is_vector,
201+
bool *isPolar,
202+
bool *is_x )
198203
{
199204
*is_vector = false;
200205
*is_x = true;
206+
*isPolar = false;
201207

202208
std::string long_name = mNcFile->getAttrStr( "long_name", varid );
203209
if ( long_name.empty() )
@@ -209,6 +215,7 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
209215
}
210216
else
211217
{
218+
variableName = standard_name;
212219
if ( MDAL::contains( standard_name, "_x_" ) )
213220
{
214221
*is_vector = true;
@@ -228,6 +235,7 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
228235
}
229236
else
230237
{
238+
variableName = long_name;
231239
if ( MDAL::contains( long_name, " in x direction" ) )
232240
{
233241
*is_vector = true;
@@ -245,3 +253,9 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
245253
}
246254
}
247255
}
256+
257+
std::vector<std::pair<double, double>> MDAL::Driver3Di::parseClassification( int varid ) const
258+
{
259+
MDAL_UNUSED( varid );
260+
return std::vector<std::pair<double, double>>();
261+
}

‎external/mdal/frmts/mdal_3di.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ namespace MDAL
5050
std::string getCoordinateSystemVariableName() override;
5151
std::string getTimeVariableName() const override;
5252
std::set<std::string> ignoreNetCDFVariables() override;
53-
void parseNetCDFVariableMetadata( int varid, const std::string &variableName,
54-
std::string &name, bool *is_vector, bool *is_x ) override;
53+
void parseNetCDFVariableMetadata( int varid,
54+
std::string &variableName,
55+
std::string &name,
56+
bool *is_vector,
57+
bool *isPolar,
58+
bool *is_x ) override;
59+
std::vector<std::pair<double, double>> parseClassification( int varid ) const override;
5560

5661
//! Returns number of vertices
5762
size_t parse2DMesh();

0 commit comments

Comments
 (0)
Please sign in to comment.