diff --git a/particle-track-and-trace/src/Program.h b/particle-track-and-trace/src/Program.h index 38b8411..57f1494 100644 --- a/particle-track-and-trace/src/Program.h +++ b/particle-track-and-trace/src/Program.h @@ -6,10 +6,9 @@ #include #include -#include "layers/Layer.h" #include "layers/Technique.h" -/** This class manages the upper levels of the vtk pipeline; it has attributes for the vtkrenderWindow and a vector of Layers to represent a variable number of vtkRenderers. +/** This class manages the upper levels of the vtk pipeline; it has attributes for the vtkrenderWindow and a vector of Techniques to represent a variable number of vtkRenderers. * It can also set up a vtkTimer by connecting an instance of TimerCallbackCommand with its contained vtkRenderWindowInteractor. */ class Program : public QVTKOpenGLNativeWidget { @@ -67,18 +66,26 @@ public: */ void updateData(int t); - // TODO: commenting + /** This function calls the instance's renderWindow->Render() method. + */ void requestRender(); + /** This function switches the active technique of the instance. + * To do so it unbinds the current active technique, then binds the new one. + */ void setActiveTechnique(ActiveTechnique tech); + /** Getter for the cam attribute. + */ vtkSmartPointer getCamera(); + /** Getter for the techniques attribute. + */ std::vector getTechniques(); - + /** Getter for the interact attribute. + */ vtkSmartPointer getInteractor(); - }; #endif diff --git a/particle-track-and-trace/src/layers/LColLayer.cpp b/particle-track-and-trace/src/layers/LColLayer.cpp index 4bd2ddf..9d990b0 100644 --- a/particle-track-and-trace/src/layers/LColLayer.cpp +++ b/particle-track-and-trace/src/layers/LColLayer.cpp @@ -155,17 +155,6 @@ void LColLayer::spoofPoints() { this->points->Modified(); } -// FIXME: delete this once done testing -void printArray(vtkSmartPointer data, int numLons, int numLats, int latsize) { - for (int i=0; i < numLons-1; i++) { - for (int j=0; j < numLats-1; j++) { - int value = data->GetValue(j+i*latsize); - if (value > 1) - cout << "(" << i << ", " << j << ") ("<< j+i*latsize << "): " << value << endl; - } - } - cout << endl; -} void LColLayer::updateData(int t) { const int SUPERSAMPLINGRATE = 4; diff --git a/particle-track-and-trace/src/layers/LColLayer.h b/particle-track-and-trace/src/layers/LColLayer.h index dad5ff3..1f2c291 100644 --- a/particle-track-and-trace/src/layers/LColLayer.h +++ b/particle-track-and-trace/src/layers/LColLayer.h @@ -49,23 +49,31 @@ public: */ void updateData(int t) override; + /** This function sets up the spawnpointcallback. + * @return pointer to a new spawnpointcallback. + */ vtkSmartPointer createSpawnPointCallback(); + /** Sets a custom DT value, needed for advect calls to the simulation logic. */ + void setDt(int dt); + + void addObservers(vtkSmartPointer interactor) override; void removeObservers(vtkSmartPointer interactor) override; - - void setColourMode(ColourMode mode) override; void setSaturationMode(SaturationMode mode) override; - /** - * Sets a custom DT value, needed for advect calls to the simulation logic. - */ - void setDt(int dt); }; -// TODO: comments + /** calculates the LookupTableIndex for a given particle age and density. + * Assumes a 10x10 lookupTable where each column is a separate age-index and each row is a separate density-index. + * @param age : int representing particle age. + * @param density : int representing particle density in a given cell. + * @return the index in a 10x10 lookupTable + */ int calcIndex(const int age, const int density); + + int calcCellIndex(const double u, const double v, const std::shared_ptr uvGrid); #endif diff --git a/particle-track-and-trace/src/layers/Layer.h b/particle-track-and-trace/src/layers/Layer.h index 2b9f96d..45f7b12 100644 --- a/particle-track-and-trace/src/layers/Layer.h +++ b/particle-track-and-trace/src/layers/Layer.h @@ -41,10 +41,29 @@ public: virtual void setCamera(vtkSmartPointer cam); - // TODO: Comments + /** Sets the colour mode used by this layer. + * Actual effect is implementation dependent, but can be expected to change the used lookupTable of the layer in some way. + * Note that not all layers are required to implement this function, if they do not support changing colour configuration. + */ virtual void setColourMode(ColourMode mode); + + + /** Sets the saturation mode used by this layer. + * Actual effect is implementation dependent, but can be expected to change the used lookupTable of the layer in some way. + * Note that not all layers are required to implement this function, if they do not support changing saturation configuration. + */ virtual void setSaturationMode(SaturationMode mode); + + /** Sets the glyph style used by this layer. + * Actual effect is implementation dependent, but can be expected to change the shape of used glyphs in some way. + * Note that not all layers are required to implement this function, if they do not render glyphs or do not support changing their style. + */ virtual void setGlyphStyle(GlyphStyle style); + + /** Sets the sampling mode used by this layer. + * Actual effect is implementation dependent, but can be expected to change the sampling function used in some manner. + * Note that not all layers are required to implement this function, if they do not support different sampling modes. + */ virtual void setSamplingMode(SamplingMode mode); }; diff --git a/particle-track-and-trace/src/layers/Technique.h b/particle-track-and-trace/src/layers/Technique.h index af8a183..f96ceb6 100644 --- a/particle-track-and-trace/src/layers/Technique.h +++ b/particle-track-and-trace/src/layers/Technique.h @@ -6,26 +6,74 @@ #include #include "enums.h" +/** This class models one complete 'package' of layers. + * It has a number of associated layers that, when put together, form one cohesive visualisation. + * The class manages these layers itself, including un/rebinding to a given renderWindow and managing various settings. + */ class Technique { - //TODO: comments private: + /** vector of associated layers */ std::vector layers; + + /** associated camera instance, added to all associated layers */ vtkSmartPointer cam; public: + /** Constructor. */ Technique(vtkSmartPointer cam); + + /** This function adds a new layer to the technique. + * @ @param t : pointer to the layer to be added + */ void addLayer(Layer *l); + + /** This function removes a layer from the technique. + * @ param t : pointer to the layer to be removed + */ void removeLayer(Layer *l); + + /** This function simply passes through to every layer's updateData function. + * @ param t : the timestamp to update to. + */ void updateData(int t); + + /** Gets the number of layers in this technique. + * @return : number of layers + */ int numberOfLayers(); + + /** Binds every layer in the technique to the given window and interactor. + * @param win : renderWindow to bind the layers to. + * @param intr : interactor to bind the layers to. + */ void bind(vtkSmartPointer win, vtkSmartPointer intr); + + + /** Unbinds every layer in the technique to the given window and interactor. + * @param win : renderWindow to unbind the layers from. + * @param intr : interactor to unbind the layers from. + */ void unbind(vtkSmartPointer win, vtkSmartPointer intr); + /** Sets the colour mode for every associated layer. + * @param mode : the mode to set the layers to. + */ void setColourMode(ColourMode mode); - void setSaturationMode(SaturationMode mode); - void setGlyphStyle(GlyphStyle style); - void setSamplingMode(SamplingMode mode); + /** Sets the saturation mode for every associated layer. + * @param mode : the mode to set the layers to. + */ + void setSaturationMode(SaturationMode mode); + + /** Sets the glyph style for every associated layer. + * @param style : the style to set the layers to. + */ + void setGlyphStyle(GlyphStyle style); + + /** Sets the sampling mode for every associated layer. + * @param mode : the mode to set the layers to. + */ + void setSamplingMode(SamplingMode mode); };