[vtkusers] Chart: coordinate conversions

Marcus D. Hanwell marcus.hanwell at kitware.com
Mon Dec 27 12:37:17 EST 2010


On Sun, Dec 26, 2010 at 8:43 PM, nclemeur <nclemeur at gmail.com> wrote:
>
>
> Marcus D. Hanwell-2 wrote:
>>
>> I am not clear about which world coordinates you mean - pixel
>> coordinates in screen space? The vtkContextMouseEvent object contains
>> the item position (Pos), then the Scene and Screen positions, see,
>>
>> http://www.vtk.org/doc/nightly/html/classvtkContextMouseEvent.html
>>
>> It also contains the last position of each of the above. You can of
>> course use the 2D transforms, but in many cases there is no need.
>>
>
> Sorry I should have been more clear, what I was after was not really
> coordinates, but I was after the "real value" in the plot (the one of
> interest by the end-user). I am not really sure what's the name for that (I
> though it was world coordinates). I am actually, displaying the x,y "value"
> in the status bar of my wxWidgets application when the mouse is moving. I
> don't think these values are available directly in the vtkContextMouseEvent
> object (at least I could not find them when breaking in that function). I
> guess this similar to what I was posting at:

They are available to the plot items in their paint event, Pos is
always the transformed position, but not to anything else.
>
> http://vtk.1045678.n5.nabble.com/vtkChartXY-picking-tp3297279p3298834.html
> http://vtk.1045678.n5.nabble.com/vtkChartXY-picking-tp3297279p3298834.html
>
> I am trying to add a bit of interactivity within my chart window and I am
> not really sure that the API allow to do that yet. But I am still in the
> process of discovering it (so far I had to modify the vtkChartXY to make
> vtkChartXYPrivate protected instead of private, this is not really the way I
> want to do it, but I don't think I have access to this data elsewhere).

I could certainly add accessors for the vtkTransform2D objects, or the
entire vtkContextTransform object for each of the corners. I have been
looking at this class with a critical eye as adding the support for
multiple plot corners (feature required by ParaView) has made the code
significantly more complex.

It would not be a problem to add a little API to get at the objects you need.

Marcus



More information about the vtkusers mailing list