00001
00032 #ifndef __vtkGDBStructReader_h
00033 #define __vtkGDBStructReader_h
00034
00035 #include "vtkPolyDataSource.h"
00036
00037 extern "C"
00038 {
00039 #include "gdb/struct.h"
00040 }
00041
00042 class VTK_EXPORT vtkGDBStructReader : public vtkPolyDataSource
00043 {
00044 public:
00046 static vtkGDBStructReader *New();
00047 vtkTypeMacro(vtkGDBStructReader,vtkPolyDataSource);
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049
00051 vtkSetMacro(GDBStruct,GDB*);
00052 vtkGetMacro(GDBStruct,GDB*);
00053
00055 vtkPolyData* GetVerticesOutput();
00056 vtkPolyData* GetEdgesOutput();
00057 vtkPolyData* GetSurfacesOutput();
00058 vtkPolyData* GetSurfacesPickOutput();
00059
00062 int* GetSurfaceCellIds(int surfaceId);
00063
00065 int GetSurfaceId(int pickId);
00066
00070 static void GetCellCenter(float center[3], vtkCell *cell);
00071
00074 vtkSetMacro(MergePoints,int);
00075 vtkGetMacro(MergePoints,int);
00076 vtkBooleanMacro(MergePoints,int);
00077
00080 vtkSetMacro(MergeSurfacePoints,int);
00081 vtkGetMacro(MergeSurfacePoints,int);
00082 vtkBooleanMacro(MergeSurfacePoints,int);
00083
00086 B2SPLINE_POINTS GetGrid(int sid);
00087
00090 int HaveGrid(int sid);
00091
00094 int InsertNextGrid(int sid, B2SPLINE_POINTS grid);
00095
00098 void SetGrid(int loc, B2SPLINE_POINTS grid);
00099
00101 void CleanGridList();
00102
00103 void UpdateInformation();
00104 void UpdateData(vtkDataObject *output);
00105
00106 protected:
00107 vtkGDBStructReader();
00108 ~vtkGDBStructReader();
00109 vtkGDBStructReader(const vtkGDBStructReader&) {};
00110 void operator=(const vtkGDBStructReader&) {};
00111
00112 void Execute();
00113
00114 GDB *GDBStruct;
00115 int MergePoints;
00116 int MergeSurfacePoints;
00117
00118 B2SPLINE_POINTS *gridList;
00119 vtkIdList *gridId;
00120 int gridListSize;
00121
00122 vtkIntArray *Ia;
00123 vtkIdList *Id;
00124 vtkTimeStamp ExecuteTime;
00125 };
00126
00127 inline B2SPLINE_POINTS vtkGDBStructReader::GetGrid(int sid)
00128 {
00129 int gid = this->gridId->IsId( sid );
00130 if (gid == -1)
00131 {
00132 vtkErrorMacro(<<"GetGrid(): sid not in the list");
00133 gid = 0;
00134 }
00135 return this->gridList[gid];
00136 }
00137
00138 inline void vtkGDBStructReader::SetGrid(int loc, B2SPLINE_POINTS grid)
00139 { this->gridList[loc] = grid; }
00140
00141 inline int vtkGDBStructReader::HaveGrid(int sid)
00142 { return (this->gridId->IsId(sid) == -1) ? 0 : 1; }
00143
00144 inline int vtkGDBStructReader::GetSurfaceId(int pickId)
00145 { return this->Id->GetId(pickId); }
00146
00147 inline vtkPolyData* vtkGDBStructReader::GetVerticesOutput()
00148 { return this->GetOutput(0); }
00149
00150 inline vtkPolyData* vtkGDBStructReader::GetEdgesOutput()
00151 { return this->GetOutput(1); }
00152
00153 inline vtkPolyData* vtkGDBStructReader::GetSurfacesOutput()
00154 { return this->GetOutput(2); }
00155
00156 inline vtkPolyData* vtkGDBStructReader::GetSurfacesPickOutput()
00157 { return this->GetOutput(3); }
00158
00159 #endif // __vtkGDBStructReader_h
00160
00161