BIE |
/home/weinberg/src/BIE/include/TessToolVTK.h00001 #ifndef TessToolVTK_H 00002 #define TessToolVTK_H 00003 00004 #include <string> 00005 #include <vector> 00006 #include <cc++/thread.h> 00007 #include <iterator> 00008 #include <sstream> 00009 00010 #include "PersistenceControl.h" 00011 #include "StateTransClosure.h" 00012 #include "StateTransClosure_Test.h" 00013 #include "TestUserState.h" 00014 #include "gvariable.h" 00015 00016 #include <Node.h> 00017 #include <QuadGrid.h> 00018 #include <SquareTile.h> 00019 #include <RecordInputStream_MPI.h> 00020 #include <bieTags.h> 00021 00022 #include <vtk/vtkActor.h> 00023 #include <vtk/vtkCamera.h> 00024 #include <vtk/vtkProperty.h> 00025 #include <vtk/vtkRenderWindow.h> 00026 #include <vtk/vtkRenderer.h> 00027 #include <vtk/vtkRenderWindowInteractor.h> 00028 #include <vtk/vtkXRenderWindowInteractor.h> 00029 #include "vtkGtkRenderWindowInteractor.h" 00030 00031 #include <vtk/vtkCellArray.h> 00032 #include <vtk/vtkPolyData.h> 00033 #include <vtk/vtkOutlineFilter.h> 00034 #include <vtk/vtkFeatureEdges.h> 00035 #include <vtk/vtkExtractEdges.h> 00036 #include <vtk/vtkCleanPolyData.h> 00037 #include <vtk/vtkClipPolyData.h> 00038 #include <vtk/vtkSelectPolyData.h> 00039 #include <vtk/vtkShrinkPolyData.h> 00040 00041 00042 #include <vtk/vtkFloatArray.h> 00043 #include <vtk/vtkPolyDataMapper.h> 00044 #include <vtk/vtkStructuredGrid.h> 00045 #include <vtk/vtkStructuredGridToPolyDataFilter.h> 00046 #include <vtk/vtkStructuredGridGeometryFilter.h> 00047 #include <vtk/vtkLookupTable.h> 00048 00049 #include <vtk/vtkCallbackCommand.h> 00050 #include <vtk/vtkCamera.h> 00051 00052 #include <vtk/vtkCellPicker.h> 00053 #include <vtk/vtkTextMapper.h> 00054 #include <vtk/vtkTextProperty.h> 00055 #include <vtk/vtkActor2D.h> 00056 #include <vtk/vtkPoints.h> 00057 00058 #include <vtk/vtkGenericCell.h> 00059 #include <vtk/vtkCellData.h> 00060 00061 #ifdef CCXX_NAMESPACES 00062 using namespace std; 00063 using namespace ost; 00064 #endif 00065 00066 namespace BIE { 00067 00068 static ofstream tterr; 00069 00070 class TessToolVTKInteractor; 00071 00073 class vtkGtkCallback : public vtkCallbackCommand { 00074 public: 00075 static vtkGtkCallback *New() {return new vtkGtkCallback; } 00076 virtual void Execute(vtkObject *caller, unsigned long eid, void *cdata); 00077 00078 vtkTextMapper *textMapper; 00079 vtkActor2D *textActor; 00080 vtkRenderWindow *renWin; 00081 }; 00082 00083 00085 class TessToolVTK : public Thread { 00086 00087 typedef enum {TESS_POINT=0, TESS_QUADGRID} TessType; 00088 00089 public: 00090 00091 static int default_height; 00092 static int default_width; 00093 00094 TessToolVTK(); 00095 TessToolVTK(string persistencedir); 00096 TessToolVTK(int w, int h); 00097 TessToolVTK(string pdir, int w, int h); 00098 ~TessToolVTK(); 00099 void run(); 00100 void SetSourceStream(RecordInputStream_MPI *mpistrm) {_mpistrm = mpistrm;}; 00101 void Render(); 00102 Semaphore *getSemaphore() {return _vtksem;}; 00103 void setProducerSemaphore(Semaphore *sem) {_producer = sem;}; 00104 bool isTessellationInitialized() { return _initTessellation; }; 00105 00106 void setHueLow(float l); 00107 void setHueHigh(float l); 00108 void setSaturationLow(float l); 00109 void setSaturationHigh(float l); 00110 void setValueLow(float l); 00111 void setValueHigh(float l); 00112 void setAlphaLow(float l); 00113 void setAlphaHigh(float l); 00114 void setPersistenceDir(char* dir) { _persistencedir = string(dir); } 00115 00116 void initVTK(); 00117 vtkCellPicker *getVTKCellPicker() {return _picker;}; 00118 vtkRenderer *getVTKRenderer() {return _renderer;}; 00119 vtkRenderWindow *getVTKRenderWindow() {return _renWin;}; 00120 vtkGtkRenderWindowInteractor *getVTKRenderWindowInteractor() {return iren;}; 00121 00122 void setScalarName(string sn); 00123 void setScalarName(char *sn); 00124 void setScalarInfoName(string sinf); 00125 void setScalarInfoName(char *sinf); 00126 00127 private: 00128 00129 int addTileToPoints(Node *node, int offset, vtkPoints *points, 00130 vtkCellArray *cells, vtkFloatArray *scalars, double scalar); 00131 void initialize(); 00132 void initializeVTK(); 00133 void initializeTessellation(); 00134 00135 double getScalar(); 00136 double getScalarInfo(); 00137 00138 int getIndex(string s); 00139 void updateScalarIndices(); 00140 void createNewDataSet(); 00141 void RenderNewData(); 00142 00143 Tessellation *_tess; 00144 TessType _tessType; // Point, QuadGrid, ..... 00145 RecordInputStream_MPI *_mpistrm; 00146 Semaphore *_vtksem; 00147 Semaphore *_producer; 00148 00149 vtkPolyData *_polydata; 00150 vtkPolyDataMapper* _polymapper; 00151 vtkLookupTable *_lut; 00152 vtkRenderWindow *_renWin; 00153 void *_Xid; 00154 int _XWinHeight, _XWinWidth; 00155 vtkRenderer *_renderer; 00156 vtkCellPicker *_picker; 00157 vtkGtkRenderWindowInteractor *iren; 00158 vtkGtkCallback *_annotatePick; 00159 00160 TessToolVTKInteractor *vtkInteractor; 00161 00162 vtkStructuredGrid *sgrid; 00163 vtkPolyDataMapper *sgridMapper; 00164 vtkActor *sgridActor; 00165 00166 float _hueLow, _hueHigh, _saturationLow, _saturationHigh, _valueLow, _valueHigh, 00167 _alphaLow, _alphaHigh; 00168 00169 00170 bool _initTessellation, _initVTK; 00171 00172 string _scalarNameString, _scalarInfoNameString, _persistencedir; 00173 int _scalarIndex, _scalarInfoIndex; 00174 string _tmpScalarNameString, _tmpScalarInfoNameString; 00175 bool _scalarNameInitialized, _scalarInfoNameInitialized, 00176 _scalarNameChanged, _scalarInfoNameChanged; // indices will be recomputed 00177 00178 bool _firstDataSet; 00179 int _sampleNum; 00180 }; 00181 00183 class vtkBIECallback : public vtkCallbackCommand { 00184 public: 00185 static vtkBIECallback *New() {return new vtkBIECallback; } 00186 virtual void Execute(vtkObject *caller, unsigned long eid, void *cdata); 00187 00188 vtkTextMapper *textMapper; 00189 vtkActor2D *textActor; 00190 vtkRenderWindow *renWin; 00191 }; 00192 00193 } 00194 #endif Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU. Documentation generated at Fri Mar 26 00:35:11 2010 by
|