Skip to content
Permalink
Browse files

[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
  • Loading branch information
vcloarec committed May 11, 2020
1 parent b6a7a10 commit fca90a7bfbf49a96a73613706adda11b30803aee
@@ -194,10 +194,16 @@ std::set<std::string> MDAL::Driver3Di::ignoreNetCDFVariables()
return ignore_variables;
}

void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string &variableName, std::string &name, bool *is_vector, bool *is_x )
void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid,
std::string &variableName,
std::string &name,
bool *is_vector,
bool *isPolar,
bool *is_x )
{
*is_vector = false;
*is_x = true;
*isPolar = false;

std::string long_name = mNcFile->getAttrStr( "long_name", varid );
if ( long_name.empty() )
@@ -209,6 +215,7 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
}
else
{
variableName = standard_name;
if ( MDAL::contains( standard_name, "_x_" ) )
{
*is_vector = true;
@@ -228,6 +235,7 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
}
else
{
variableName = long_name;
if ( MDAL::contains( long_name, " in x direction" ) )
{
*is_vector = true;
@@ -245,3 +253,9 @@ void MDAL::Driver3Di::parseNetCDFVariableMetadata( int varid, const std::string
}
}
}

std::vector<std::pair<double, double>> MDAL::Driver3Di::parseClassification( int varid ) const
{
MDAL_UNUSED( varid );
return std::vector<std::pair<double, double>>();
}
@@ -50,8 +50,13 @@ namespace MDAL
std::string getCoordinateSystemVariableName() override;
std::string getTimeVariableName() const override;
std::set<std::string> ignoreNetCDFVariables() override;
void parseNetCDFVariableMetadata( int varid, const std::string &variableName,
std::string &name, bool *is_vector, bool *is_x ) override;
void parseNetCDFVariableMetadata( int varid,
std::string &variableName,
std::string &name,
bool *is_vector,
bool *isPolar,
bool *is_x ) override;
std::vector<std::pair<double, double>> parseClassification( int varid ) const override;

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

0 comments on commit fca90a7

Please sign in to comment.
You can’t perform that action at this time.