Renderer2D
Qualified name: mv::Renderer2D
-
class Renderer2D : public mv::Renderer
Renderer 2D class.
Supports two-dimensional rendering:
Orchestrates panning and zooming using Navigator2D
Sets up the matrix transformations
Renders 2D data
- Author
Thomas Kroes
Subclassed by mv::gui::DensityRenderer, mv::gui::PointRenderer
Public Functions
-
explicit Renderer2D(QObject *parent = nullptr)
Construct with pointer to
parentobject.- Parameters:
parent – Pointer to parent object
-
virtual void resize(QSize renderSize) override
Resize the renderer to
renderSize.- Parameters:
renderSize – New size of the renderer
-
virtual QSize getRenderSize() const override
Get the render size.
- Returns:
Render size
Get the 2D navigator.
- Returns:
Reference to the 2D navigator
Get the 2D navigator.
- Returns:
Reference to the 2D navigator
-
void setSourceWidget(QWidget *sourceWidget)
Initializes the source widget used for setting the renderer view.
- Parameters:
sourceWidget – Pointer to the renderer widget
Get custom navigator.
- Returns:
Pointer to custom navigator
Set custom navigator to
customNavigator.- Parameters:
customNavigator – Pointer to custom navigator
-
QVector3D getScreenPointToWorldPosition(const QMatrix4x4 &modelViewMatrix, const QPoint &screenPoint) const
Convert
screenPointto point in world coordinates usingmodelViewMatrix.- Parameters:
modelViewMatrix – Model-view matrix
screenPoint – Point in screen coordinates [0..width, 0..height]
- Returns:
Position in world coordinates
-
QVector2D getWorldPositionToNormalizedScreenPoint(const QVector3D &position) const
Convert
positionin world coordinates to point in normalized screen coordinates.- Parameters:
position – Position in world coordinates
- Returns:
Point in normalized screen coordinates [-1..1, -1..1]
-
QPoint getWorldPositionToScreenPoint(const QVector3D &position) const
Convert
positionin world coordinates to point in screen coordinates.- Parameters:
position – Position in world coordinates
- Returns:
Point in screen coordinates [0..width, 0..height]
-
QVector2D getScreenPointToNormalizedScreenPoint(const QVector2D &screenPoint) const
Convert
screenPointto point in normalized screen coordinates.- Parameters:
screenPoint – Point in screen coordinates [0..width, 0..height]
- Returns:
Point in normalized screen coordinates [-1..1, -1..1]
-
QMatrix4x4 getScreenToNormalizedScreenMatrix() const
Returns the matrix that converts screen coordinates [0..width, 0..height] to normalized screen coordinates [-1..1, -1..1].
-
QMatrix4x4 getNormalizedScreenToScreenMatrix() const
Returns the matrix that converts normalized screen coordinates [-1..1, -1..1] to screen coordinates [0..width, 0..height].
-
QMatrix4x4 getProjectionMatrix() const
Returns the projection matrix.
-
QRect getScreenRectangleFromWorldRectangle(const QRectF &worldBoundingRectangle) const
Get screen bounding rectangle from world bounding rectangle.
- Parameters:
worldBoundingRectangle – World bounding rectangle
-
QMatrix4x4 getModelMatrix() const
Get model matrix.
- Returns:
Model matrix
-
void setModelMatrix(const QMatrix4x4 &modelMatrix)
Set model matrix to
modelMatrix.- Parameters:
modelMatrix – Model matrix
-
QMatrix4x4 getModelViewProjectionMatrix() const
Get model-view-projection matrix.
- Returns:
Model-view-projection matrix
-
QRectF getDataBounds() const
Get data bounds.
- Returns:
Data bounds
-
virtual void setDataBounds(const QRectF &dataBounds)
Set data bounds to
dataBounds.- Parameters:
dataBounds – Data bounds
-
QRectF getWorldBounds() const
Get world bounds.
- Returns:
World bounds
-
virtual void setWorldBounds(const QRectF &worldBounds)
Set world bounds to
worldBounds.- Parameters:
worldBounds – World bounds
-
void dataBoundsChanged(const QRectF &previousDataBounds, const QRectF ¤tDataBounds)
Signals that the data bounds have changed from
previousDataBoundstocurrentDataBounds.- Parameters:
previousDataBounds – Previous data bounds
currentDataBounds – Current data bounds
-
void worldBoundsChanged(const QRectF &previousWorldBounds, const QRectF ¤tWorldBounds)
Signals that the world bounds have changed from
previousWorldBoundstocurrentWorldBounds.- Parameters:
previousWorldBounds – Previous world bounds
currentWorldBounds – Current world bounds