[vtkusers] Point Selection on vtkChartXY
Giuseppe Marco Randazzo
gmrandazzo at gmail.com
Fri Sep 7 12:09:33 EDT 2012
ok thanks.... it works... but get me the selection the second time that
i select other points....
For example i select two point first time and the output is:
Selected Points
secont time i select 4 points and the output is:
Selected Points
Number of tuples : 2
18
272
now i reselect the same two point of the first time ad the output will be:
Selected Points
Number of tuples : 4
20
10
341
203
that correspond to the previous selection.
It's strange, maybe there is a pointer to update after selection and
before getting selection?
here is the code:
void ScatterPlot2D::getPointSelected()
{
qDebug() << "Selected Points";
vtkIdTypeArray *idarray =
vtkIdTypeArray::SafeDownCast(chart->GetPlot(0)->GetSelection());
if(idarray){
qDebug() << "Number of tuples :" << idarray->GetNumberOfTuples();
for(vtkIdType i = 0; i < idarray->GetNumberOfTuples(); i++){
qDebug() << idarray->GetValue(i);
}
}
}
Thank
Marco
On 09/04/2012 04:54 PM, Darshan Pai wrote:
> If yu have access to the vtkChartXY object in the getPointSelected
> function()
> you can retrieve the ID's using the following command
>
> vtkIdTypeArray *idarray = chartxy->GetPlot(0)->GetSelection();
>
> you can iterate through the Id's and retrieve the corresponding points .
>
> Regards
>
>
> On Mon, Sep 3, 2012 at 7:11 PM, Giuseppe Marco Randazzo
> <gmrandazzo at gmail.com <mailto:gmrandazzo at gmail.com>> wrote:
>
> Points are selected, but i'm not able to get these selected
> points... i'm not able to accesso to selection.
> vtkChartXY i know that is not a Qt Widget. I put a vtkchartXY into
> a qvtkwidget.
>
> My connection works, but i'm my slot getPointSelected() is empty
>
> getPointSelected()
> {
> // how to get point selected?
> }
>
> regards and thanks a lot :)
>
>
>
>
> On 09/04/2012 12:41 AM, Darshan Pai wrote:
>> What exactly is your error? Does it highlight or not?
>> vtkChartXY is not a Qt Widget , so I am not sure how were you
>> able to use vtkQtSlotConnect .
>>
>> Regards
>>
>>
>> On Mon, Sep 3, 2012 at 11:56 AM, Giuseppe Marco Randazzo
>> <gmrandazzo at gmail.com <mailto:gmrandazzo at gmail.com>> wrote:
>>
>> Hello,
>>
>> i've some questions about Rubberband selection on vtkchartxy.
>> I'm not able to use this features.
>>
>> I'm using vtk inside a qt widget, so i implemented a slot and
>> after connectet this through:
>>
>> Connections = vtkEventQtSlotConnect::New();
>> Connections->Connect(ui.qvtkWidget->GetRenderWindow()->GetInteractor(),
>> vtkCommand::RightButtonReleaseEvent,
>> this,
>> SLOT(getPointSelected()),0, 1.0);
>>
>>
>> When i select some points on plot with the rubberband
>> selector, the points are highlited and the slot
>> getPointSelected() work.
>> My questions are:
>>
>> Is possible get the points highlighted? and how?
>> is there a better solution than mine?
>>
>> Thanks
>>
>> Giuseppe Marco Randazzo
>>
>> _______________________________________________
>> Powered by www.kitware.com <http://www.kitware.com>
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120907/1d8894fb/attachment.htm>
More information about the vtkusers
mailing list