Allows data to be selected. More...
#include <ilviews/charts/chartint.h>
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 IlvChartDataPointInfo * | makeSelectionInfo (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... | |
IlvChartDataSet * | getHandledDataSet () const |
Returns the handled data set. More... | |
IlvAbstractChartDisplayer * | getHandledDisplayer () 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 IlvChartInteractor * | Get (const char *name) |
Returns a shared interactor instance. More... | |
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".
IlvChartSelectInteractor::IlvChartSelectInteractor | ( | IlUShort | whichButton = IlvLeftButton | ) |
Constructor.
Initializes a new IlvChartSelectInteractor
object.
whichButton | The mouse button that should be used for the interaction. |
|
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.
At the end, the action method, if it exists, is called with the same parameters as the current method.
chart | The considered chart. |
disp | The displayer displaying the data set to which the selected data points belong. |
dataSet | The data set to which the selected data points belong. |
pointIndex | The 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. |
select | Indicates whether the data must be selected (IlTrue ) or unselected (IlFalse ). |
|
virtual |
Handles events received by the interactor.
This method is the entry point of all events dispatched to this interactor.
chart | The chart object that received the event. |
event | The received event. |
t | The transformer applied to the view in which the event occurred. |
IlTrue
if the event was successfully handled and IlFalse
otherwise. Implements IlvChartInteractor.
|
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.
chart | The chart object for which data are selected. |
disp | The displayer displaying the data set to which the selected data points belong. |
dataSet | The data set to which the selected data points belong. |
pointIndex | The 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. |
void IlvChartSelectInteractor::setAction | ( | Action | action | ) |
Sets the action to be triggered when data are selected or unselected.
action | The action to be triggered. |