Commit 55bbb9a3 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[DOC][STYLE] - the stylechecker misses a lot of style violations :-/

parent 7260a732
......@@ -38,32 +38,36 @@ class WTransferFunctionWidget;
*/
class WTransferFunctionBackground : public QGraphicsPixmapItem
{
public:
/** type of base class */
typedef QGraphicsPixmapItem BaseClass;
public:
/** type of base class */
typedef QGraphicsPixmapItem BaseClass;
/** default constructor
* \param parent pointer to parent widget
*/
explicit WTransferFunctionBackground( WTransferFunctionWidget* parent = 0x0 );
/**
* Default constructor.
*
* \param parent pointer to parent widget
*/
explicit WTransferFunctionBackground( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
*/
virtual ~WTransferFunctionBackground();
/**
* Default destructor.
*/
virtual ~WTransferFunctionBackground();
/**
* get the bounding rectangle
* \returns the bounding rectangle
*/
QRectF boundingRect() const;
/**
* 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 );
/**
* 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 );
};
#endif // WTRANSFERFUNCTIONBACKGROUND_H
......
......@@ -44,54 +44,60 @@ class WTransferFunctionColorPoint : public QObject, public QGraphicsItem
Q_INTERFACES( QGraphicsItem ) // NOLINT
// \endcond
public:
/** type of our base class */
typedef QGraphicsItem BaseClass;
/** default constructor
/**
* Default constructor.
*
* \param parent the parent widget
*/
explicit WTransferFunctionColorPoint( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
* Default destructor
*/
virtual ~WTransferFunctionColorPoint();
/**
* returns the item left of the this item
* 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 this item.
*
* \returns the item right of us
*/
WTransferFunctionColorPoint *getRight() const;
/**
* set the item left of us
* Set the item left of us.
*
* \param left the item left of us
*/
void setLeft( WTransferFunctionColorPoint* left );
/**
* set the item right of us
* 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
* The bounding rectangle used for paint and click events.
*
* \returns the bounding rectangle
*/
QRectF boundingRect() const;
/**
* paint the handle and additional item hints
* 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
......@@ -102,42 +108,50 @@ public:
QColor getColor() const;
/**
* drag enter implementation for items that contain a color
* 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
* 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
* 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:
/**
* Called by the color dialog every time the user changes the color.
* \param color the new color
*/
* Called by the color dialog every time the user changes the color.
*
* \param color the new color
*/
void colorSelected( const QColor& color );
protected:
/** helper for item changed
* \param rectangle a rectangel
/**
* Helper for item changed.
*
* \param rectangle a rectangle
*/
void clampToRectangle( const QRectF& rectangle );
/** helper for item changed */
void clampToLeftAndRight( );
/**
* Helper for item changed.
**/
void clampToLeftAndRight();
/**
* handles change notifications
* Handles change notifications.
*
* \param change the requrested change
* \param value the requested value
* \returns the proposed value
......@@ -145,31 +159,37 @@ protected:
QVariant itemChange( GraphicsItemChange change, const QVariant &value );
/**
* handles mouse move events
* Handles mouse move events.
*
* \param event the event
*/
void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
/**
* handles press move events
* Handles press move events.
*
* \param event the event
*/
void mousePressEvent( QGraphicsSceneMouseEvent *event );
/**
* handles mouse move events
* Handles mouse move events.
*
* \param event the event
*/
void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
/**
* handles mouse double click events by opening a color selector
* 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 */
/**
* Show the color picker dialog.
**/
void showColorPicker();
private:
......
......@@ -51,10 +51,10 @@ QRectF WTransferFunctionHistogram::boundingRect() const
void WTransferFunctionHistogram::paint( QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget* )
{
const int steps = data.size();
const int steps = m_data.size();
if( steps > 0 )
{
double maxval = *std::max_element( data.begin(), data.end() );
double maxval = *std::max_element( m_data.begin(), m_data.end() );
if( maxval > 0.0 )
{
QRadialGradient gradient( 0.0, 0.0, 10 );
......@@ -74,9 +74,20 @@ void WTransferFunctionHistogram::paint( QPainter *painter, const QStyleOptionGra
// logarithmic mapping of histogram to values
// the added 1.001 is to avoid numerical problems but should work for most data sets
histogram << QPoint( bb.left()+ ( double )bb.width()*( double )i/( double )steps,
bb.bottom() - ( double )bb.height() * std::log( data[ i ]+1 )/std::log( maxval+1.001 ) );
bb.bottom() - ( double )bb.height() * std::log( m_data[ i ]+1 )/std::log( maxval+1.001 ) );
}
painter->drawPolygon( histogram );
}
}
}
const std::vector< double >& WTransferFunctionHistogram::getData() const
{
return m_data;
}
std::vector< double >& WTransferFunctionHistogram::getData()
{
return m_data;
}
......@@ -35,35 +35,55 @@ class WTransferFunctionWidget;
*/
class WTransferFunctionHistogram : public QGraphicsItem
{
public:
/** type of the base class */
typedef QGraphicsItem BaseClass;
public:
/** type of the base class */
typedef QGraphicsItem BaseClass;
/**
* default constructor
* \param parent the parent widget
*/
explicit WTransferFunctionHistogram( WTransferFunctionWidget* parent = 0x0 );
/**
* Default constructor.
*
* \param parent the parent widget
*/
explicit WTransferFunctionHistogram( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
*/
virtual ~WTransferFunctionHistogram();
/**
* Default destructor.
*/
virtual ~WTransferFunctionHistogram();
/** \returns the bounding rectange */
QRectF boundingRect() const;
/**
* Get the bounding rect of the histogram.
*
* \returns the bounding rectangle
**/
QRectF boundingRect() const;
/**
* Paint a semi-transparent histogram on top of the transfer function but below the
* input handles.
*
* \param painter Painter that does the low-level painting of the histogram item
* \param option Style of the graphics histogram graphics item (currently not used in the function)
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* );
/**
* Paint a semi-transparent histogram on top of the transfer function but below the
* input handles.
*
* \param painter Painter that does the low-level painting of the histogram item
* \param option Style of the graphics histogram graphics item (currently not used in the function)
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* );
/** the histogram data */
std::vector< double > data;
/**
* Get histogram data.
*
* \return histogram data as double vector.
*/
const std::vector< double >& getData() const;
/**
* Get histogram data.
*
* \return histogram data as double vector.
*/
std::vector< double >& getData();
private:
/** the histogram data */
std::vector< double > m_data;
};
#endif // WTRANSFERFUNCTIONHISTOGRAM_H
......
......@@ -35,68 +35,79 @@ class WTransferFunctionPoint;
*/
class WTransferFunctionLine : public QGraphicsLineItem
{
public:
/** type of the base class */
typedef QGraphicsLineItem BaseClass;
/** default constructor
* \param parent parent widget
*/
explicit WTransferFunctionLine( WTransferFunctionWidget* parent = 0x0 );
/** default destructor */
virtual ~WTransferFunctionLine();
/**
* \returns point to the left
*/
WTransferFunctionPoint *getLeft() const;
/**
* \returns point to the right
*/
WTransferFunctionPoint *getRight() const;
/**
* sets point to the left
* \param left new point to the left
*/
void setLeft( WTransferFunctionPoint* left );
/**
* sets point to the right
* \param right new point to the right
*/
void setRight( WTransferFunctionPoint* right );
/**
* paint the line
* \param painter the painter used
* \param option the style option used for painting
* \param widget the widget used for painting
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* widget );
protected:
// to be implemented: how do we want to handle moves of lines?
// I think a vertical move may be nice, but may even be implemented using
// itemChange(...)
//void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
//void mousePressEvent( QGraphicsSceneMouseEvent *event );
//void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
private:
/** the width of the line used for painting */
double lineWidth;
/** the point to the left */
WTransferFunctionPoint *left;
/** the point to the right */
WTransferFunctionPoint *right;
/** our parent widget */
WTransferFunctionWidget* _parent;
public:
/** type of the base class */
typedef QGraphicsLineItem BaseClass;
/**
* Default constructor.
*
* \param parent parent widget
*/
explicit WTransferFunctionLine( WTransferFunctionWidget* parent = 0x0 );
/**
* Default destructor.
**/
virtual ~WTransferFunctionLine();
/**
* Get the point to the left.
*
* \returns point to the left
*/
WTransferFunctionPoint* getLeft() const;
/**
* Get the point to the right.
*
* \returns point to the right
*/
WTransferFunctionPoint* getRight() const;
/**
* Sets point to the left.
*
* \param left new point to the left
*/
void setLeft( WTransferFunctionPoint* left );
/**
* Sets point to the right.
*
* \param right new point to the right
*/
void setRight( WTransferFunctionPoint* right );
/**
* Paint the line.
*
* \param painter the painter used
* \param option the style option used for painting
* \param widget the widget used for painting
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* widget );
protected:
// to be implemented: how do we want to handle moves of lines?
// I think a vertical move may be nice, but may even be implemented using
// itemChange(...)
//void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
//void mousePressEvent( QGraphicsSceneMouseEvent *event );
//void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
private:
/** the width of the line used for painting */
double lineWidth;
/** the point to the left */
WTransferFunctionPoint *left;
/** the point to the right */
WTransferFunctionPoint *right;
/** our parent widget */
WTransferFunctionWidget* _parent;
};
#endif // WTRANSFERFUNCTIONLINE_H
......
......@@ -39,115 +39,132 @@ class WTransferFunctionLine;
*/
class WTransferFunctionPoint : public QGraphicsItem
{
public:
/** type of the base class */
typedef QGraphicsItem BaseClass;
/** default constructor
*
* \param parent pointer to parent widget
*/
explicit WTransferFunctionPoint( WTransferFunctionWidget* parent = 0x0 );
/**
* default destructor
*/
virtual ~WTransferFunctionPoint();
/**
* set point to the left
* \param left new point to the left
*/
void setLeft( WTransferFunctionPoint* left );
/**
* get point to the left
* \returns point to the left
*/
WTransferFunctionPoint *getLeft() const;
/**
* set point to the right
* \param right new point to the right
*/
void setRight( WTransferFunctionPoint* right );
/**
* get point to the right
* \returns point to the right
*/
WTransferFunctionPoint *getRight() const;
/**
* set the line pointing to the right
* \param line the new line
*/
void setLine( WTransferFunctionLine* line );
/**
* \returns the line if any has been set (i.e., may be 0)
*/
WTransferFunctionLine* getLine() const;
/**
* get the bounding rectangle
* \returns the bounding rect of this object
*/
QRectF boundingRect() const;
/**
* paint the object
* \param painter the painter to use
* \param option the options for painting
*/
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* );
//! overloaded form base class for debugging
//! \param point the point that should be set
virtual void setPos( QPointF point );
protected:
/**
* helper to itemChange
* \param pos position that is clamped to rectangle
* \param rectangle the rectangle
*/
void clampToRectangle( QPointF* const pos, const QRectF& rectangle ) const;
/**
* helper to itemChange
* \param pos the position that is clamped between the left and right neighbors
*/
void clampToLeftAndRight( QPointF* const pos ) const;
/**
* handle item changes and change requests
* \param change the proposed change
* \param value the proposed value
* \returns the requested change
*/
QVariant itemChange( GraphicsItemChange change, const QVariant &value );
/**
* handle mouse press events for selections and highlighting
* \param event the handled event
*/
void mousePressEvent( QGraphicsSceneMouseEvent *event );
private:
/** the radius of the object */
double radius;
/** pointer to point to the left*/
WTransferFunctionPoint *left;
/** pointer to point to the right*/