Visualization 2 - Lab Course
 All Classes Functions Enumerations Enumerator
Public Member Functions | Protected Member Functions | List of all members
TransferPoint Class Reference

#include <TransferPoint.hpp>

Inherits QGraphicsItem.

Public Member Functions

 TransferPoint (qreal relX, qreal relY, qreal sigma=0.2)
 
QRectF boundingRect () const
 
void updateScene ()
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
void setFixed (bool fixed)
 
void setRelativePos (qreal x, qreal y)
 
qreal getRelativeX ()
 
qreal getRelativeY ()
 
qreal getSigma ()
 
void setSigma (qreal sigma)
 
void setColor (QColor _color)
 
void setColorFromDialog ()
 
QColor getColor ()
 

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 

Detailed Description

Class which represents a point at the transfer function. Holds a color, alpha value and the position.

Author
Christian Hirsch
Clemens Roegner

Constructor & Destructor Documentation

TransferPoint::TransferPoint ( qreal  relX,
qreal  relY,
qreal  sigma = 0.2 
)

Constructor. Creates a new point at the transfer function at the relative x and y position.

Parameters
relXThe relative x position. If position is 1.0 or 0.0 then the point can't be moved along the x axis.
relYThe relative y position. Represents the alpha value of a point.

Member Function Documentation

QRectF TransferPoint::boundingRect ( ) const

Returns the bounding rectangle of the point.

Returns
The bounding rectangle of the point.
QColor TransferPoint::getColor ( )

Getter for the color. return The representing color.

qreal TransferPoint::getRelativeX ( )

Getter for relative x position.

Returns
Relative x position.
qreal TransferPoint::getRelativeY ( )

Getter for relative y position.

Returns
Relative y position.
qreal TransferPoint::getSigma ( )

Getter for sigma value.

Returns
Sigma value of control point.
void TransferPoint::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protected

Handles the mouse move event. Moves a point on the transfer widget.

void TransferPoint::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

Handles the mouse press event. (Nothing is done, but mousemove event needs this).

Parameters
eventPointer to the called event.
void TransferPoint::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)

Paints the point with a black bounding box, filled with its color, which is represented.

void TransferPoint::setColor ( QColor  _color = Qt::white)

Sets the representing color of the point.

Parameters
_colorNew representing color.
void TransferPoint::setColorFromDialog ( )

Opens a color-dialog, in which the user can decide which color to use.

void TransferPoint::setFixed ( bool  fixed)

Sets if a point is fixed (can't be moved along x axis) or not.

Parameters
fixedIf true, then the point is fixed.
void TransferPoint::setRelativePos ( qreal  x,
qreal  y 
)

Setter for the relative x and y Position, where x = 1.0 is the right side, and y = 1.0 is at the top.

Parameters
xNew relative x position.
yNew relative y position.
void TransferPoint::setSigma ( qreal  sigma)

Setter for sigma value.

Parameters
sigmaSigma value of control point.
void TransferPoint::updateScene ( )

Redraws the scene of the transfer widget.


The documentation for this class was generated from the following files: