// File Export.h by az

#ifndef EXPORT_H
#define EXPORT_H

#include <map>

class QString;
class RTMSimulator;
class QDataStream;
class SimNode;

#pragma pack(push,1)

/**
 * @brief Structure that is used to store the camera position to a file.
 */
struct CameraPosition
{
    float val0, val1, val2, val3;
    float x,y,z;
};

/**
 * @brief Structure that is used to store all scene settings to a file.
 */
struct SceneSettings
{
    double q,r,s;
    double viscosity;
    double pictureTimeInterval;
    double timeOfLastSnapshot;
    double currentTime;
    double vacuumPressure;
    float cellSize;
    int numRelevantNeighbors;
    int currentCycle;
    bool showSweptNodes;
    bool markNeighbors;
    bool markDirectNeighbors;
    bool takePictures;
    double translationFactor;
    double spacing_for_future_implementations[10];
};

/**
 * @brief Structure that is used to save all node specific settings to a file.
 */
struct NodeSettings
{
    int nodeId;
    double x,y,z;
    double permeability;
    double cavityHeight;
    double porosity;
    double pressure;
    double injectionPressure;
    double injectionDiameter;
    bool injectionPoint;
    bool markedForSweep;
    bool markedGreen;
};

/**
 * @brief Structure that is used to save all triangle specific settings to a file.
 */
struct TriangleSettings
{
    int triangleId;
    double Ax,Ay,Az;
    double Bx,By,Bz;
    double Cx,Cy,Cz;
};

/**
 * @brief Structure that is used to save a neighborhood relation to a file.
 */
struct Neighborhood
{
    int node1;
    int node2;
};

#pragma pack(pop)

/**
 * @brief Class that creates temporary export objects for writing the whole scene graph and simulation settings to a file.
 */
class ExportRTMS
{
public:
    static const char* CURRENT_VERSION; //DO NOT CHANGE THIS FORMAT, JUST UPDATE THE VALUE!
    static void writeToRTMSFile(QString strFile, RTMSimulator* pSimulator);
    static void writeCameraPosition(RTMSimulator* pSimulator, QDataStream& out);
    static void writeSettings(RTMSimulator* pSimulator, QDataStream& out);
    static void writeNodes(std::map<int,SimNode*>* nodes, QDataStream& out);
    static void writeNodesNeighbors(std::map<int,SimNode*>* nodes, QDataStream& out);
    static void writeTriangles(RTMSimulator* pSimulator, QDataStream& out);
    static void writeTriangleVertices(RTMSimulator* pSimulator, QDataStream& out);
};

#endif
