00001
00002
00004
00005 #if !defined(AFX_FLOWDATASET_H__D420469A_1FD1_4BFC_AB78_0E6B8EFF1944__INCLUDED_)
00006 #define AFX_FLOWDATASET_H__D420469A_1FD1_4BFC_AB78_0E6B8EFF1944__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012
00013 class CFlowVisApp;
00014
00016 struct GridData
00017 {
00018 float gridX;
00019 float gridY;
00020 float gridZ;
00021 };
00022
00024 struct FlowData
00025 {
00026 float dataX;
00027 float dataY;
00028 float dataZ;
00029 };
00030
00032 struct RsFlowData
00033 {
00034 float dataX;
00035 float dataY;
00036 };
00037
00039 struct RsData
00040 {
00041 RsFlowData flowData;
00042 float speed;
00043 float speedGradient;
00044 float addData[MAX_ADDITIONAL_DATA];
00045 };
00046
00047
00049 class RsAddData
00050 {
00051 public:
00052 float getDataNormalized(float x, float y);
00053 float getData(float x, float y);
00054 int getHistogramValue(int index);
00055 int getHistogramMaxIndex();
00056 int getHistogramMaxValue();
00057 void calculateHistogram();
00058
00059 int getMax();
00060 int getMin();
00061 RsAddData(int xSize, int ySize, float gridX, float gridY);
00062 virtual ~RsAddData();
00063
00064 float *data;
00065 protected:
00066 float gridY;
00067 float gridX;
00068 int rsSizeY;
00069 int rsSizeX;
00070 int elements;
00071 float min;
00072 float max;
00073
00074 int histogramMaxValue;
00075 int histogramMaxIndex;
00076 int histogram[HISTOGRAM_RESOLUTION];
00077 };
00078
00079
00081 class FlowDataSet
00082 {
00083 public:
00084
00085 RsAddData * getRsAddData(int index);
00086
00087 RsData getRsData(float x, float y);
00088
00089 int getAddCount();
00090
00091 float getDataAspectRatio();
00092
00093 float getGridY();
00094 float getGridX();
00095 float getGridAspectRatio();
00096
00097 int loadDataset(CString geomPathName, CString dataPathName);
00098
00099 FlowDataSet(CString geomPathName, CString dataPathName);
00100 FlowDataSet();
00101 virtual ~FlowDataSet();
00102
00103 protected:
00104
00105 CFlowVisApp* m_App;
00106
00107 RsData calcRsData(float x, float y);
00108
00109 float * getAddDataPointer(int dataindex, int x, int y, int z = 0);
00110 GridData * getGridDataPointer(int x,int y, int z = 0);
00111 FlowData * getFlowDataPointer(int x,int y, int z = 0);
00112
00113 void deallocateResampleMemory();
00114 void allocateResampleMemory();
00115 int deallocateMemory();
00116 int allocateMemory();
00117
00118 int dataX;
00119 int dataY;
00120 int dataZ;
00121 float dataAspect;
00122
00123 float minX;
00124 float minY;
00125 float maxX;
00126 float maxY;
00127
00128 float gridX;
00129 float gridY;
00130 float gridAspect;
00131
00132 int elements;
00133
00134 int stepNumber;
00135 float stepSize;
00136
00137 int rsSizeX;
00138 int rsSizeY;
00139
00140 int rsElements;
00141
00142 int addCount;
00143
00144 RsFlowData *rsFlowData;
00145
00146 RsAddData *rsSpeed;
00147 RsAddData *rsSpeedGradient;
00148
00149 RsAddData *rsAddData[MAX_ADDITIONAL_DATA];
00150
00151 GridData *gData;
00152 FlowData *fData;
00153 float *aData[MAX_ADDITIONAL_DATA];
00154
00155 private:
00156 bool checkCoordinates(int x, int y, int z);
00157 };
00158
00159 #endif // !defined(AFX_FLOWDATASET_H__D420469A_1FD1_4BFC_AB78_0E6B8EFF1944__INCLUDED_)