Commit 918921da authored by Mario Hlawitschka's avatar Mario Hlawitschka
Browse files

[DOC] added most documentation

parent bcf11bef
......@@ -55,13 +55,15 @@ private:
/**
* comparison by isovalue
* \param rhs entry to compare t
* \returns true if this->iso <= rhs.iso
*/
bool operator <= ( const Entry &rhs ) const
{
return iso <= rhs.iso;
}
double iso; //< the isovalue
/** the isovalue */
double iso;
};
/**
......@@ -80,13 +82,15 @@ private:
/**
* comparison operator to check for changes
* \param rhs ColorEntry to compare to
* \returns true if rhs equals this
*/
bool operator==( const ColorEntry& rhs ) const
{
return iso == rhs.iso && color == rhs.color;
}
WColor color; //< holds the current color at isovalue Entry::iso
/** holds the current color at isovalue Entry::iso */
WColor color;
};
/**
......@@ -108,13 +112,15 @@ private:
/**
* comparison operator to check for changes
* \param rhs AlphaEntry to compare to
* \returns true if rhs is equal to this
*/
bool operator==( const AlphaEntry& rhs ) const
{
return iso == rhs.iso && alpha == rhs.alpha;
}
double alpha; //< holds the current alpha at isovalue Entry::iso
/** holds the current alpha at isovalue Entry::iso */
double alpha;
};
/**
......@@ -123,17 +129,24 @@ private:
template<typename T>
struct LessPred
{
/** constructs a predicate that compares for less than iso
* \param iso: used iso value
*/
explicit LessPred( double iso ) : iso( iso )
{
}
/** isovalue-based comparison */
/** isovalue-based comparison
* \param t the object to compare to
* \returns true if iso is less than t.iso
*/
bool operator()( const T& t )
{
return iso < t.iso;
}
double iso; //< the isovalue to compare to
/** the isovalue to compare to */
double iso;
};
public:
......@@ -142,13 +155,19 @@ public:
{
}
/** deep copy constructor */
/** deep copy constructor
* \param rhs the value to histogram
*/
WTransferFunction( const WTransferFunction &rhs )
: colors( rhs.colors ), alphas( rhs.alphas ), isomin( rhs.isomin ), isomax( rhs.isomax ), histogram( rhs.histogram )
{
}
/** deep copy operator */
/** deep copy operator
* \param rhs the value to copy
* \returns reference to current object
* \returns reference to current object
*/
WTransferFunction& operator=( const WTransferFunction &rhs )
{
this->colors = rhs.colors;
......@@ -168,6 +187,7 @@ public:
/**
* \returns negated result of operator==
* \param rhs the value to compare with
*/
bool operator!=( const WTransferFunction &rhs ) const;
......@@ -176,31 +196,54 @@ public:
{
}
/**
* \returns the number of alpha points
*/
size_t numAlphas() const
{
return alphas.size();
}
/**
* \returns the number of color points
*/
size_t numColors() const
{
return colors.size();
}
/**
* \param i the index of the point to query
* \returns the alpha values position/isovalue at index i
*/
double getAlphaIsovalue( size_t i ) const
{
return alphas.at( i ).iso;
}
/**
* \param i the index of the point to query
* \returns the color values position/isovalue at index i
*/
double getColorIsovalue( size_t i ) const
{
return colors.at( i ).iso;
}
/**
* \param i the index to query
* \returns the alpha value at index i
*/
double getAlpha( size_t i ) const
{
return alphas.at( i ).alpha;
}
/**
* \param i the index to query
* \returns the color at index i
*/
const WColor& getColor( size_t i ) const
{
return colors.at( i ).color;
......@@ -208,11 +251,15 @@ public:
/**
* insert a new color point
* \param iso the new iso value
* \param color the new color at the given iso value
*/
void addColor( double iso, const WColor& color );
/**
* insert a new alpha point
* \param iso the new iso value
* \param alpha the new alpha value at the given iso value
*/
void addAlpha( double iso, double alpha );
......@@ -222,6 +269,8 @@ public:
* This should be changed in the future to be handled in a different
* way. A good option would be to introduce an object encapsulating
* a transfer function and histogram information.
*
* \param data the histogram data between isomin and isomax
*/
void setHistogram( std::vector< double > & data )
{
......@@ -236,6 +285,10 @@ public:
histogram.clear();
}
/**
* returns the histogram
* \returns a reference to the internal representation of the histogram
*/
const std::vector< double >& getHistogram() const
{
return histogram;
......@@ -243,10 +296,12 @@ public:
/**
* sample/render the transfer function linearly between min and max in an RGBA texture.
* \param array pointer to an allocated data structure
* \param width is the number of RGBA samples.
* \param min the lowest value to be sampled
* \param max the hightes value to be sampled
* \post array contains the sampled data
* \pre array is allocated and has space for width elements
*/
void sample1DTransferFunction( unsigned char*array, int width, double min, double max ) const;
......@@ -258,14 +313,21 @@ public:
*/
static WTransferFunction createFromRGBA( unsigned char const * const rgba, size_t size );
private:
std::vector<ColorEntry> colors; //< sorted list of colors
std::vector<AlphaEntry> alphas; //< sorted list of alpha values
/** sorted list of colors */
std::vector<ColorEntry> colors;
double isomin; //< smallest iso value
double isomax; //< largest iso value
/** sorted list of alpha values */
std::vector<AlphaEntry> alphas;
std::vector< double > histogram; //< store a histogram. This is used for property-handling only
// and does not change the transfer function at all.
/** the smallest used iso value */
double isomin;
/** the largest used iso value */
double isomax;
/** stores a histogram. This is used for property-handling only
* and does not change the transfer function at all.
*/
std::vector< double > histogram;
friend std::ostream& operator << ( std::ostream& out, const WTransferFunction& tf );
};
......@@ -275,7 +337,7 @@ private:
* This code should only be used for debugging and you should not realy on the interface.
* \param tf The transfer function to output
* \param out The stream to which we write
* \returns reference to \param out
* \returns reference to out
*/
std::ostream& operator << ( std::ostream& out, const WTransferFunction& tf );
......
......@@ -107,6 +107,7 @@ public:
* \param mat the matrix transforming the vertices from canonical space
* \param vals the values at the vertices
* \param isoValue The surface will run through all positions with this value.
* \param progress parent's WProgressCombiner. May be empty if no status report is requested
*
* \return the created triangle mesh
*/
......
......@@ -171,6 +171,7 @@ public:
*
* \param offscreen use this offscreen node to add your texture pass'
* \param gbuffer the input textures you should use
* \returns shared pointer to the created instance
*/
virtual SPtr create( osg::ref_ptr< WGEOffscreenRenderNode > offscreen, const PostprocessorInput& gbuffer ) const = 0;
......
......@@ -60,6 +60,7 @@ public:
*
* \param offscreen use this offscreen node to add your texture pass'
* \param gbuffer the input textures you should use
* \returns shared pointer to the created instance
*/
virtual WGEPostprocessor::SPtr create( osg::ref_ptr< WGEOffscreenRenderNode > offscreen, const PostprocessorInput& gbuffer ) const;
protected:
......
......@@ -60,6 +60,7 @@ public:
*
* \param offscreen use this offscreen node to add your texture pass'
* \param gbuffer the input textures you should use
* \returns shared pointer to the created insteance
*/
virtual WGEPostprocessor::SPtr create( osg::ref_ptr< WGEOffscreenRenderNode > offscreen, const PostprocessorInput& gbuffer ) const;
protected:
......
......@@ -86,6 +86,7 @@ public:
*
* \param offscreen use this offscreen node to add your texture pass'
* \param gbuffer the input textures you should use
* \returns shared pointer to the created instance
*/
virtual WGEPostprocessor::SPtr create( osg::ref_ptr< WGEOffscreenRenderNode > offscreen,
const PostprocessorInput& gbuffer ) const;
......
......@@ -90,6 +90,7 @@ public:
*
* \param offscreen use this offscreen node to add your texture pass'
* \param gbuffer the input textures you should use
* \returns shared pointer to the created insteance
*/
virtual WGEPostprocessor::SPtr create( osg::ref_ptr< WGEOffscreenRenderNode > offscreen,
const PostprocessorInput& gbuffer ) const;
......
......@@ -100,21 +100,33 @@ class WReaderVTK : public WReader // NOLINT
* Read VTK SCALARS field
* \post the data set pointer is set to the data set constructed of the current grid
* and the read scalar values
* \param nbScalars
* the number of scalars to read
* \param name
* the name of the data set that may be overwritten by information in the scalars line
*/
void readScalars( size_t nbScalars, const std::string & name );
/**
* Read VTK SCALARS field
* \post the data set pointer is set to the data set constructed of the current grid
* and the read scalar values
*/
* and the read vector values
* \param nbVectors
* the number of vectors to read
* \param name
* the name of the data set that may be overwritten by information in the vectors line
*/
void readVectors( size_t nbVectors, const std::string & name );
/**
* Read VTK TENSORS field
* \post the data set pointer is set to the data set constructed of the current grid
* and the read scalar values
*/
* and the read tensor values
* \param nbTensors
* the number of tensors to read
* \param name
* the name of the data set that may be overwritten by information in the tensors line
*/
void readTensors( size_t nbTensors, const std::string & name );
......@@ -164,9 +176,19 @@ class WReaderVTK : public WReader // NOLINT
/**
* reference to the currently loading data set
*/
boost::shared_ptr< WDataSet > newDataSet;
/**
* reference to the currently loading grid
*/
boost::shared_ptr< WGridRegular3D > newGrid;
/**
* internal flag whether we read ascii or binary
*/
bool isAscii;
};
......
......@@ -103,7 +103,11 @@ protected:
virtual void requirements();
private:
/**
* The transfer function as an input data set
*/
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction;
/**
* An input connector used to get datasets from other modules. The connection management between connectors must not be handled by the module.
*/
......
......@@ -205,21 +205,26 @@ protected:
* Called for each project save request.
*
* \param writer the list of writers to use.
*
* \returns true if saving was successful
*/
virtual bool projectSave( const std::vector< boost::shared_ptr< WProjectFileIO > >& writer );
/**
* drag and drop implementation
* drag and drop implementation for loading files
* \param event the event to handle
*/
void dropEvent( QDropEvent* event );
/**
* drag and drop implementation
* drag and drop implementation for loading files
* \param event the event to handle
*/
void dragMoveEvent( QDragMoveEvent* event );
/**
* drag and drop implementation
* drag and drop implementation for loading files
* \param event the event to handle
*/
void dragEnterEvent( QDragEnterEvent* event );
......
......@@ -56,6 +56,7 @@ public:
protected:
/**
* Internal helper, called to set the color
* \param color the new color
*/
virtual void setColor( const QColor& color );
......@@ -66,11 +67,13 @@ protected:
/**
* Reimplemented to accept color drops
* \param event the handled event
*/
virtual void dragEnterEvent( QDragEnterEvent* event );
/**
* Reimplemented to accept color drops
* \param event the handled event
*/
virtual void dropEvent( QDropEvent* event );
......
......@@ -109,8 +109,11 @@ protected:
*/
QHBoxLayout m_infoLayout;
WTransferFunctionWidget m_transferFunction; //< the current transfer function
WTransferFunction lastTransferFunction; //< the previous transfer function used for comparison when updated
/** the current transfer function */
WTransferFunctionWidget m_transferFunction;
/** the previously used transfer function */
WTransferFunction lastTransferFunction;
/**
* internal synchronization flag
......
......@@ -39,13 +39,30 @@ class WTransferFunctionWidget;
class WTransferFunctionBackground : public QGraphicsPixmapItem
{
public:
/** type of base class */
typedef QGraphicsPixmapItem BaseClass;
/** default constructor
* \param parent pointer to parent widget
*/
explicit WTransferFunctionBackground( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
*/
virtual ~WTransferFunctionBackground();
/**
* get the bounding rectangle
* \returns the bounding rectangle
*/
QRectF boundingRect() const;
/**
* Set the background pixmap that will be displayed.
* In our case, this is the transfer function
* \param pixmap the pixmap to display
*/
void setMyPixmap( const QPixmap& pixmap );
};
......
......@@ -39,56 +39,150 @@ class WTransferFunctionWidget;
*/
class WTransferFunctionColorPoint : public QObject, public QGraphicsItem
{
Q_OBJECT // NOLINT
Q_INTERFACES( QGraphicsItem ) // NOLINT
Q_OBJECT // NOLINT
Q_INTERFACES( QGraphicsItem ) // NOLINT
public:
public:
/** type of our base class */
typedef QGraphicsItem BaseClass;
/** default constructor
* \param parent the parent widget
*/
explicit WTransferFunctionColorPoint( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
*/
virtual ~WTransferFunctionColorPoint();
/**
* returns the item left of the this item
* \returns the item left of us
*/
WTransferFunctionColorPoint *getLeft() const;
/**
* returns the item right of this item
* \returns the item right of us
*/
WTransferFunctionColorPoint *getRight() const;
void setLeft( WTransferFunctionColorPoint* );
void setRight( WTransferFunctionColorPoint* );
/**
* set the item left of us
* \param left the item left of us
*/
void setLeft( WTransferFunctionColorPoint* left);
/**
* set the item right of us
* \param right the item right of us
*/
void setRight( WTransferFunctionColorPoint* right);
/**
* the bounding rectangle used for paint and click events
* \returns the bounding rectangle
*/
QRectF boundingRect() const;
/**
* paint the handle and additional item hints
* \param painter the painter used
* \param option the paint options used
* \param widget the widget used for painting
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* widget = 0x0 );
/** \returns the color of the entry */
QColor getColor() const;
/**
* drag enter implementation for items that contain a color
* \param event the event to handle
*/
virtual void dragEnterEvent( QGraphicsSceneDragDropEvent* event );
/**
* drop implementation for items that contain a color
* \param event the event to handle
*/
virtual void dropEvent( QGraphicsSceneDragDropEvent* event );
/**
* handler for context menu envents. Currently disabled because it
* conflicts with other mouse interactions
* \param event the event to hanlde
*/
void contextMenuEvent( QGraphicsSceneContextMenuEvent* event );
public slots:
public slots:
/**
* Called by the color dialog every time the user changes the color.
* \param color the new color
*/
void colorSelected( const QColor& );
void colorSelected( const QColor& color);
protected:
protected:
/** helper for item changed
* \param rectangle a rectangel
*/
void clampToRectangle( const QRectF& rectangle );
/** helper for item changed */
void clampToLeftAndRight( );
/**
* handles change notifications
* \param change the requrested change
* \param value the requested value
* \returns the proposed value
*/
QVariant itemChange( GraphicsItemChange change, const QVariant &value );
/**
* handles mouse move events
* \param event the event
*/
void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
/**
* handles press move events
* \param event the event
*/
void mousePressEvent( QGraphicsSceneMouseEvent *event );
/**
* handles mouse move events
* \param event the event
*/
void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
/**
* handles mouse double click events by opening a color selector
* if the item is clicked.
* \param event the event
*/
void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event );
/** show the color picker dialog */
void showColorPicker();
private:
private:
/** the radius used for paining of the handle */
double radius;