00001 #ifndef FlowData_H
00002 #define FlowData_H
00003
00004 #include <QString>
00005 #include <QObject>
00006 #include <QSize>
00007
00008 #include <vector>
00009 #include "Vector3.h"
00010 #include "SharedArray.h"
00011
00012 #define QEVENT_CALCULATED ((QEvent::Type)1001)
00013
00014 struct GeometryData : public SharedArray<Vector3>
00015 {
00016 Vector3 min, max;
00017 };
00018
00019 struct VectorData : public SharedArray<Vector3>
00020 {
00021 float min, max;
00022 };
00023
00024 struct ScalarData : public SharedArray<float>
00025 {
00026 float min, max;
00027 };
00028
00029 class FlowData
00030 {
00031 friend FlowData* factoryLoadFlowData(QString fileName);
00032
00033 public:
00034 FlowData();
00035 FlowData(const FlowData &source);
00036 ~FlowData();
00037
00038 FlowData& operator=(const FlowData &source);
00039
00040 int getScalarCount();
00041 float getMaxHeight();
00042 float getWidthHeightAspectRatio();
00043
00044 virtual void calcScalar(int scalarIndex, QSize size, float *data);
00045 virtual void calcVector(QSize size, Vector3 *data);
00046
00047 virtual Vector3 getVectorAtPoint(QPointF point);
00048
00049 protected:
00050 void free();
00051 virtual void set(const FlowData &source);
00052
00053 GeometryData geometryData;
00054 VectorData vectorData;
00055 std::vector<ScalarData> scalarDatas;
00056 int width, height, depth, timeStepsCount;
00057 float timeStepDifference, aspectRatio;
00058
00059 private:
00060 bool loadFlowData(QString fileName);
00061 };
00062
00063 #endif // FlowData_H