Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::plot::BoxSelectionInteractionHandler Class Reference

Handles interaction for 2D rectangle selection/filtering Selection/Filtering callbacks are called when filtering changes. More...

#include <modules/plotting/interaction/boxselectioninteractionhandler.h>

Inheritance diagram for inviwo::plot::BoxSelectionInteractionHandler:

Public Types

using SelectionCallbackHandle = std::shared_ptr<std::function<SelectionFunc>>
using SelectionFunc = void(const std::vector<bool>&, bool)
 Selection/filtering-changed callback. The index of each element is given by its location (0, 1 ... n). Second argument specifies if the selection/filtering should be appended.

Public Member Functions

SelectionCallbackHandle addFilteringChangedCallback (std::function< SelectionFunc > callback)
 Added callbacks will be called when filtering changed.
SelectionCallbackHandle addSelectionChangedCallback (std::function< SelectionFunc > callback)
 Added callbacks will be called when selection changed.
 BoxSelectionInteractionHandler (const BoxSelectionProperty &boxSelectionSettings, std::shared_ptr< const BufferBase > xAxis, std::shared_ptr< const BufferBase > yAxis, std::function< dvec2(dvec2 p, const size2_t &dims)> screenToData)
 Handles interaction for 2D rectangle selection/filtering Selection/Filtering callbacks are called when filtering changes.
std::optional< std::array< dvec2, 2 > > getDragRectangle () const
 Returns (lower, upper) screen space coordinates of selection rectangle, null if not active.
virtual void invokeEvent (Event *event) override
void reset ()
 Reset the drag rectangle.
void setXAxisData (std::shared_ptr< const BufferBase > buffer)
void setYAxisData (std::shared_ptr< const BufferBase > buffer)

Protected Member Functions

std::vector< bool > boxFilter (const dvec2 &start, const dvec2 &end, const BufferBase *xAxis_, const BufferBase *yAxis_)
std::vector< bool > boxSelect (const dvec2 &start, const dvec2 &end, const BufferBase *xAxis_, const BufferBase *yAxis_)
void dragRectChanged (const dvec2 &start, const dvec2 &end, bool append)
 React to rectangle drag changes. Input is in data-space of each axis.

Protected Attributes

std::optional< std::array< dvec2, 2 > > dragRect_
const BoxSelectionPropertydragRectSettings_
Dispatcher< SelectionFuncfilteringChangedCallback_
std::function< dvec2(dvec2 p, const size2_t &dims)> screenToData_
Dispatcher< SelectionFuncselectionChangedCallback_
std::shared_ptr< const BufferBasexAxis_
 ! Selection/filtering
std::shared_ptr< const BufferBaseyAxis_

Detailed Description

Handles interaction for 2D rectangle selection/filtering Selection/Filtering callbacks are called when filtering changes.

The current drag rectangle is given by getDragRectangle.

See also
DragRectangleRenderer

Constructor & Destructor Documentation

◆ BoxSelectionInteractionHandler()

inviwo::plot::BoxSelectionInteractionHandler::BoxSelectionInteractionHandler ( const BoxSelectionProperty & boxSelectionSettings,
std::shared_ptr< const BufferBase > xAxis,
std::shared_ptr< const BufferBase > yAxis,
std::function< dvec2(dvec2 p, const size2_t &dims)> screenToData )

Handles interaction for 2D rectangle selection/filtering Selection/Filtering callbacks are called when filtering changes.

Parameters
boxSelectionSettingsuse for selection/filtering/none
xAxisdata
yAxisdata
screenToDataconverts screen coordinates to (x,y) data coordinates

Member Function Documentation

◆ invokeEvent()

virtual void inviwo::plot::BoxSelectionInteractionHandler::invokeEvent ( Event * event)
overridevirtual

Reimplemented from inviwo::EventListener.

◆ reset()

void inviwo::plot::BoxSelectionInteractionHandler::reset ( )

Reset the drag rectangle.

See also
getDragRectangle

The documentation for this class was generated from the following file:
  • modules/plotting/include/modules/plotting/interaction/boxselectioninteractionhandler.h