Views
Charts Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Types | Public Member Functions | Protected Member Functions
IlvChartSelectInteractor Class Reference

Allows data to be selected. More...

#include <ilviews/charts/chartint.h>

Inheritance diagram for IlvChartSelectInteractor:
IlvChartDataInteractor IlvChartInteractor IlvInteractor

Public Types

typedef void(* Action) (IlvChartGraphic *chart, IlvAbstractChartDisplayer *disp, IlvChartDataSet *dataSet, IlUInt pointIndex, IlBoolean select)
 Defines the type of the action to be triggered when data are selected or unselected.
 
- Public Types inherited from IlvChartDataInteractor
enum  PickingMode
 

Public Member Functions

 IlvChartSelectInteractor (IlUShort whichButton=IlvLeftButton)
 Constructor. More...
 
virtual IlBoolean handleEvent (IlvGraphic *chart, IlvEvent &ev, const IlvTransformer *t=0)
 Handles events received by the interactor. More...
 
void setAction (Action action)
 Sets the action to be triggered when data are selected or unselected. More...
 
- Public Member Functions inherited from IlvChartDataInteractor
PickingMode getPickingMode () const
 Returns the current picking mode of the interactor. More...
 
void setPickingMode (PickingMode m)
 Sets the current picking mode of the interactor. More...
 
- Public Member Functions inherited from IlvChartInteractor
virtual void endSequence (IlvChartGraphic *chart, const IlvEvent &event, const IlvTransformer *t)
 Performs the actions needed when an interactor leaves an event sequence. More...
 
IlBoolean isShared () const
 Indicates whether the current object is a shared instance. More...
 
virtual IlBoolean isShowingAbscissaCursor () const
 Indicates whether the interactor uses a cursor on the abscissa. More...
 
virtual IlBoolean isShowingOrdinateCursor () const
 Indicates whether the interactor uses a cursor on the ordinate. More...
 
virtual void startSequence (IlvChartGraphic *chart, const IlvEvent &event, const IlvTransformer *t)
 Performs the actions needed when an interactor enters an event sequence. More...
 

Protected Member Functions

virtual void doIt (IlvChartGraphic *chart, IlvAbstractChartDisplayer *disp, IlvChartDataSet *dataSet, IlUInt pointIndex, IlBoolean select)
 Selects or unselects data. More...
 
virtual IlvChartDataPointInfomakeSelectionInfo (const IlvChartGraphic *chart, IlvAbstractChartDisplayer *disp, IlvChartDataSet *dataSet, IlUInt pointIndex) const
 Creates the point information object that is associated with the selected data to mark them as selected. More...
 
- Protected Member Functions inherited from IlvChartDataInteractor
 IlvChartDataInteractor ()
 Constructor. More...
 
IlvChartDataSetgetHandledDataSet () const
 Returns the handled data set. More...
 
IlvAbstractChartDisplayergetHandledDisplayer () const
 Returns the chart displayer representing the handled data. More...
 
IlUInt getHandledPointIndex () const
 Returns the index of the handled data point. More...
 
IlBoolean isHandlingData () const
 Checks whether valid information about a data point has been stored. More...
 
virtual IlBoolean queryData (IlvChartGraphic *chart, IlvPoint &evp, const IlvTransformer *t)
 Retrieves and stores information about a data point. More...
 
- Protected Member Functions inherited from IlvChartInteractor
 IlvChartInteractor ()
 Constructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvChartDataInteractor
static IlvDim GetPrecision ()
 Returns the precision used to find the data point corresponding to a given screen point. More...
 
static void SetPrecicion (IlvDim dim)
 Deprecated misspelling of SetPrecision()
 
static void SetPrecision (IlvDim dim)
 Sets the precision used to find the data point corresponding to a given screen point. More...
 
- Static Public Member Functions inherited from IlvChartInteractor
static IlvChartInteractorGet (const char *name)
 Returns a shared interactor instance. More...
 

Detailed Description

Allows data to be selected.

Library: ilvcharts

This class allows the user to select data by clicking on a projected point in the data display area and then trigger an action on the selected data item(s). At the first click on a projected point, all the data points of the data set to which the projected point belongs are selected. These data points are marked as selected with markers by default. At the second click on a projected point that belongs to the same data set, only the corresponding data point is then selected. This data point is marked as selected with a marker by default. The graphic objects drawn to mark data points as selected can be redefined in a subclass.

The registered name of this interactor class is "ChartSelect".

Constructor & Destructor Documentation

◆ IlvChartSelectInteractor()

IlvChartSelectInteractor::IlvChartSelectInteractor ( IlUShort  whichButton = IlvLeftButton)

Constructor.

Initializes a new IlvChartSelectInteractor object.

Parameters
whichButtonThe mouse button that should be used for the interaction.

Member Function Documentation

◆ doIt()

virtual void IlvChartSelectInteractor::doIt ( IlvChartGraphic chart,
IlvAbstractChartDisplayer disp,
IlvChartDataSet dataSet,
IlUInt  pointIndex,
IlBoolean  select 
)
protectedvirtual

Selects or unselects data.

This method is called when the user clicks a projected point to select or unselect data. The Boolean select indicates whether the method is called to select or to unselect data. If pointIndex is equal to IlvBadIndex, all the data points of the data set dataSet are selected or unselected, otherwise only the data point at the index pointIndex is selected or unselected.

If select is equal to IlTrue, the point information object to be added in order to mark the selected data points as selected is created by calling the IlvChartSelectInteractor::makeSelectionInfo() method. The returned point information is then set on each selected data point.

If select is equal to IlFalse, the point information objects that have been set on the selected data point(s) are removed.

Note
The point information objects are set at the level of the displayer that displays the selected data.

At the end, the action method, if it exists, is called with the same parameters as the current method.

Parameters
chartThe considered chart.
dispThe displayer displaying the data set to which the selected data points belong.
dataSetThe data set to which the selected data points belong.
pointIndexThe index of the selected data point if only one data point is selected or IlvBadIndex if all the data points of the data set are selected.
selectIndicates whether the data must be selected (IlTrue) or unselected (IlFalse).

◆ handleEvent()

virtual IlBoolean IlvChartSelectInteractor::handleEvent ( IlvGraphic chart,
IlvEvent event,
const IlvTransformer t = 0 
)
virtual

Handles events received by the interactor.

This method is the entry point of all events dispatched to this interactor.

Parameters
chartThe chart object that received the event.
eventThe received event.
tThe transformer applied to the view in which the event occurred.
Returns
IlTrue if the event was successfully handled and IlFalse otherwise.

Implements IlvChartInteractor.

◆ makeSelectionInfo()

virtual IlvChartDataPointInfo* IlvChartSelectInteractor::makeSelectionInfo ( const IlvChartGraphic chart,
IlvAbstractChartDisplayer disp,
IlvChartDataSet dataSet,
IlUInt  pointIndex 
) const
protectedvirtual

Creates the point information object that is associated with the selected data to mark them as selected.

The default implementation creates an IlvChartDataGraphicInfo object as the point information object and sets a marker as the graphic object.

Parameters
chartThe chart object for which data are selected.
dispThe displayer displaying the data set to which the selected data points belong.
dataSetThe data set to which the selected data points belong.
pointIndexThe index of the selected data point if only one data point is selected or IlvBadIndex if all the data points of the data set are selected.

◆ setAction()

void IlvChartSelectInteractor::setAction ( Action  action)

Sets the action to be triggered when data are selected or unselected.

Parameters
actionThe action to be triggered.