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 <boxselectioninteractionhandler.h>

+ Inheritance diagram for inviwo::plot::BoxSelectionInteractionHandler:

Public Types

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.
 
using SelectionCallbackHandle = std::shared_ptr<std::function<SelectionFunc>>
 

Public Member Functions

 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.
 
virtual void invokeEvent (Event *event) override
 
virtual std::string getClassIdentifier () const override
 
SelectionCallbackHandle addSelectionChangedCallback (std::function< SelectionFunc > callback)
 Added callbacks will be called when selection changed.
 
SelectionCallbackHandle addFilteringChangedCallback (std::function< SelectionFunc > callback)
 Added callbacks will be called when filtering changed.
 
void setXAxisData (std::shared_ptr< const BufferBase > buffer)
 
void setYAxisData (std::shared_ptr< const BufferBase > buffer)
 
std::optional< std::array< dvec2, 2 > > getDragRectangle () const
 Returns (lower, upper) screen space coordinates of selection rectangle, null if not active.
 
void reset ()
 Reset the drag rectangle.
 
- Public Member Functions inherited from inviwo::InteractionHandler
virtual void serialize (Serializer &s) const
 
virtual void deserialize (Deserializer &d)
 
- Public Member Functions inherited from inviwo::EventListener
- Public Member Functions inherited from inviwo::Serializable

Protected Member Functions

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

Protected Attributes

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

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

◆ getClassIdentifier()

virtual std::string inviwo::plot::BoxSelectionInteractionHandler::getClassIdentifier ( ) const
overridevirtual

◆ 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: