26 #ifndef vtkChartSelectionHelper_h 27 #define vtkChartSelectionHelper_h 54 assert(link !=
nullptr && selectionIds !=
nullptr);
66 if (selectionPlot == plot)
102 std::vector<vtkIdType> output;
112 while (i <
size && iOld < oldSize)
114 if (ptrSelection[i] > ptrOldSelection[iOld])
116 output.push_back(ptrOldSelection[iOld++]);
118 else if (ptrSelection[i] == ptrOldSelection[iOld])
123 else if (ptrSelection[i] < ptrOldSelection[iOld])
128 while (iOld < oldSize)
130 output.push_back(ptrOldSelection[iOld++]);
133 ptrSelection = static_cast<vtkIdType *>(selection->
GetVoidPointer(0));
134 for (std::vector<vtkIdType>::iterator it = output.begin();
135 it != output.end(); ++it, ++ptrSelection)
153 std::vector<vtkIdType>::iterator it;
154 it = std::set_union(ptrSelection,
159 int newSize =
int(it - output.begin());
161 ptrSelection = static_cast<vtkIdType *>(selection->
GetVoidPointer(0));
162 for (std::vector<vtkIdType>::iterator i = output.begin(); i != it;
175 std::vector<vtkIdType> output;
184 while (i <
size && iOld < oldSize)
186 if (ptrSelection[i] > ptrOldSelection[iOld])
188 output.push_back(ptrOldSelection[iOld++]);
190 else if (ptrSelection[i] == ptrOldSelection[iOld])
195 else if (ptrSelection[i] < ptrOldSelection[iOld])
197 output.push_back(ptrSelection[i++]);
202 output.push_back(ptrSelection[i++]);
204 while (iOld < oldSize)
206 output.push_back(ptrOldSelection[iOld++]);
209 ptrSelection = static_cast<vtkIdType *>(selection->
GetVoidPointer(0));
210 for (std::vector<vtkIdType>::iterator it = output.begin();
211 it != output.end(); ++it, ++ptrSelection)
226 if (!plotSelection || !oldSelection)
232 switch(selectionMode)
275 return selectionMode;
280 #endif // vtkChartSelectionHelper_h A node in a selection tree.
virtual vtkSelection * GetCurrentSelection()
Set or get the current selection in the annotation layers.
unsigned int GetNumberOfNodes()
Returns the number of nodes in this selection.
virtual void SetFieldType(int type)
Get or set the field type of the selection.
static void AddSelection(vtkIdTypeArray *selection, vtkIdTypeArray *oldSelection)
Add the supplied selection from the oldSelection.
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
vtkIdType GetNumberOfTuples()
Get the number of complete tuples (a component group) in the array.
The selection data provided is point-data.
virtual void AddNode(vtkSelectionNode *)
Adds a selection node.
static void MinusSelection(vtkIdTypeArray *selection, vtkIdTypeArray *oldSelection)
Subtract the supplied selection from the oldSelection.
A node in a selection tree.
static void MakeSelection(vtkAnnotationLink *link, vtkIdTypeArray *selectionIds, vtkPlot *plot)
Populate the annotation link with the supplied selectionIds array, and set the appropriate node prope...
dynamic, self-adjusting array of vtkIdType
Hold a reference to a vtkObjectBase instance.
virtual vtkInformation * GetProperties()
Returns the property map.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
static vtkPlot * SafeDownCast(vtkObjectBase *o)
helper functions for making selections in charts.
int GetModifiers() const
Return the modifier keys, if any, ORed together.
data structure to represent mouse events.
static vtkInformationObjectBaseKey * PROP()
Pointer to the prop the selection belongs to.
virtual vtkSelectionNode * GetNode(unsigned int idx)
Returns a node given it's index.
virtual void SetContentType(int type)
Get or set the content type of the selection.
Abstract class for 2D plots.
virtual vtkTable * GetInput()
Get the input table used by the plot.
static void BuildSelection(vtkAnnotationLink *link, int selectionMode, vtkIdTypeArray *plotSelection, vtkIdTypeArray *oldSelection, vtkPlot *plot)
Build a selection based on the supplied selectionMode using the new plotSelection and combining it wi...
static int GetMouseSelectionMode(const vtkContextMouseEvent &mouse, int selectionMode)
Combine the SelectionMode with any mouse modifiers to get an effective selection mode for this click ...
Allocate and hold a VTK object.
Select entities by their offsets into the dataset.
virtual void SetNumberOfTuples(vtkIdType numTuples)=0
Set the number of tuples (a component group) in the array.
static vtkInformationObjectBaseKey * SOURCE()
Pointer to the data or algorithm the selection belongs to.
virtual void SetSelectionList(vtkAbstractArray *)
Sets the selection list.
static void ToggleSelection(vtkIdTypeArray *selection, vtkIdTypeArray *oldSelection)
Toggle the supplied selection from the oldSelection.
T * GetPointer() const
Get the contained pointer.
virtual void SetCurrentSelection(vtkSelection *sel)
Set or get the current selection in the annotation layers.
An algorithm for linking annotations among objects.