Peter Petrik 50422a1165 [FEATURE] QgsMeshLayer part 1: Reading raw mesh
Introducting MDAL, QgsMeshLayer, mesh data providers (mesh_memory, mdal)
to read and visualize raw meshes: vertices and faces. Support dragging
2dm files from browser on canvas to visualize 2dm meshes.
Support for QgsMeshLayer in Python API.
2018-04-19 10:50:33 +02:00

92 lines
2.3 KiB
C

/*
MDAL - Mesh Data Abstraction Library (MIT License)
Copyright (C) 2018 Peter Petrik (zilolv at gmail dot com)
*/
#ifndef MDAL_H
#define MDAL_H
#ifdef MDAL_STATIC
# define MDAL_EXPORT
#else
# if defined _WIN32 || defined __CYGWIN__
# ifdef mdal_EXPORTS
# ifdef __GNUC__
# define MDAL_EXPORT __attribute__ ((dllexport))
# else
# define MDAL_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
# endif
# else
# ifdef __GNUC__
# define MDAL_EXPORT __attribute__ ((dllimport))
# else
# define MDAL_EXPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
# endif
# endif
# else
# if __GNUC__ >= 4
# define MDAL_EXPORT __attribute__ ((visibility ("default")))
# else
# define MDAL_EXPORT
# endif
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
/* Statuses */
enum Status
{
None,
// Errors
Err_NotEnoughMemory,
Err_FileNotFound,
Err_UnknownFormat,
Err_IncompatibleMesh,
Err_InvalidData,
Err_MissingDriver,
// Warnings
Warn_UnsupportedElement,
Warn_InvalidElements,
Warn_ElementWithInvalidNode,
Warn_ElementNotUnique,
Warn_NodeNotUnique
};
/* Mesh */
typedef void *MeshH;
//! Return MDAL version
MDAL_EXPORT const char *MDAL_Version();
//! Return last status message
MDAL_EXPORT Status MDAL_LastStatus();
//! Load mesh file. On error see MDAL_LastStatus for error type This effectively loads whole mesh in-memory
MDAL_EXPORT MeshH MDAL_LoadMesh( const char *meshFile );
//! Close mesh, free the memory
MDAL_EXPORT void MDAL_CloseMesh( MeshH mesh );
//! Return vertex count for the mesh
MDAL_EXPORT size_t MDAL_M_vertexCount( MeshH mesh );
//! Return vertex X coord for the mesh
MDAL_EXPORT double MDAL_M_vertexXCoordinatesAt( MeshH mesh, size_t index );
//! Return vertex Y coord for the mesh
MDAL_EXPORT double MDAL_M_vertexYCoordinatesAt( MeshH mesh, size_t index );
//! Return face count for the mesh
MDAL_EXPORT size_t MDAL_M_faceCount( MeshH mesh );
//! Return number of vertices face consist of, e.g. 3 for triangle
MDAL_EXPORT size_t MDAL_M_faceVerticesCountAt( MeshH mesh, size_t index );
//! Return vertex index for face
MDAL_EXPORT size_t MDAL_M_faceVerticesIndexAt( MeshH mesh, size_t face_index, size_t vertex_index );
#ifdef __cplusplus
}
#endif
#endif //MDAL_H