QGIS/external/mdal/frmts/mdal_ugrid.hpp
Peter Petrik 0675c0b697
[FEATURE] Mesh 1D Renderer (#34848)
* MDAL 0.5.90 : support for custom Logger and 1D meshes
* [FEATURE] [MESH] Support rendering of 1D meshes, see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/164

1D mesh consist of edges (edge is straight line segment with 2 vertices) and the data that is defined on either
vertices or edges. Such data can be loaded by MDAL and rendered as mesh layer in QGIS.
2020-03-09 05:59:51 +01:00

61 lines
1.9 KiB
C++

/*
MDAL - Mesh Data Abstraction Library (MIT License)
Copyright (C) 2019 Peter Petrik (zilolv at gmail dot com)
*/
#ifndef MDAL_UGRID_HPP
#define MDAL_UGRID_HPP
#include <map>
#include <string>
#include <stddef.h>
#include "mdal_cf.hpp"
#include "mdal_driver.hpp"
namespace MDAL
{
/**
* Driver of UGRID file format.
*
* The result UGRID NetCDF file is strictly based on CF-conventions 1.6
*/
class DriverUgrid: public DriverCF
{
public:
DriverUgrid();
~DriverUgrid() override = default;
DriverUgrid *create() override;
void save( const std::string &uri, Mesh *mesh ) override;
private:
CFDimensions populateDimensions( ) override;
void populateFacesAndVertices( Vertices &vertices, Faces &faces ) override;
void populateVertices( Vertices &vertices );
void populateFaces( Faces &faces );
void addBedElevation( MemoryMesh *mesh ) override;
std::string getCoordinateSystemVariableName() 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;
std::string getTimeVariableName() const override;
void parse2VariablesFromAttribute( const std::string &name, const std::string &attr_name,
std::string &var1, std::string &var2,
bool optional ) const;
std::string findMeshName( int dimension, bool optional ) const;
std::string mMesh2dName;
std::string mMesh1dName;
std::string nodeZVariableName() const;
void writeDimensions( MDAL::Mesh *mesh );
void writeVariables( MDAL::Mesh *mesh );
void writeGlobals();
int faceVerticesMaximumCount() const override
{ return std::numeric_limits<int>::max(); }
};
} // namespace MDAL
#endif // MDAL_UGRID_HPP