How to make vtkChartXY non-interactive?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to make vtkChartXY non-interactive?

Elvis Stansvik
I'm using a

   vtkChartXY
   vtkColorTransferControlPointsItem
   vtkColorTransferFunctionItem

trio for editing a vtkColorTransferFunction.

I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.

How can I make it non-interactive?

I'm using VTK 8.0.0.rc1.

Thanks in advance,
Elvis

_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Elvis Stansvik
2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
I'm using a

   vtkChartXY
   vtkColorTransferControlPointsItem
   vtkColorTransferFunctionItem

trio for editing a vtkColorTransferFunction.

I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.

How can I make it non-interactive?

I'm using VTK 8.0.0.rc1.

I know I could always override and swallow mouse events, but that seems like the wrong approach?

I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.

Elvis
 

Thanks in advance,
Elvis


_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Marcus D. Hanwell-2
On Tue, Jun 13, 2017 at 9:16 AM, Elvis Stansvik <[hidden email]> wrote:
2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
I'm using a

   vtkChartXY
   vtkColorTransferControlPointsItem
   vtkColorTransferFunctionItem

trio for editing a vtkColorTransferFunction.

I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.

How can I make it non-interactive?

I'm using VTK 8.0.0.rc1.

I know I could always override and swallow mouse events, but that seems like the wrong approach?

I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.

So I would use the SetActionToButton method in vtkChart, and set each action to -1 (no button). Looking at the vtkControlPointsItem the press event is not configurable, and so you would really have to derive from it, and override it that way as far as I can see. It could be modified, but that ability doesn't appear to be present. I am trying to remember how we propagate mouse events from the containing chart, but am a little rusty on that logic.

We don't have the equivalent of an event filter as far as I am aware, but in the Qt world I would use that to intercept events before they get to the chart.

_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Elvis Stansvik

Den 13 juni 2017 5:53 em skrev "Marcus D. Hanwell" <[hidden email]>:
>
> On Tue, Jun 13, 2017 at 9:16 AM, Elvis Stansvik <[hidden email]> wrote:
>>
>> 2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
>>>
>>> I'm using a
>>>
>>>    vtkChartXY
>>>    vtkColorTransferControlPointsItem
>>>    vtkColorTransferFunctionItem
>>>
>>> trio for editing a vtkColorTransferFunction.
>>>
>>> I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.
>>>
>>> How can I make it non-interactive?
>>>
>>> I'm using VTK 8.0.0.rc1.
>>
>>
>> I know I could always override and swallow mouse events, but that seems like the wrong approach?
>>
>> I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.
>>
> So I would use the SetActionToButton method in vtkChart, and set each action to -1 (no button).

Ah thanks, I'll take a look at that.

> Looking at the vtkControlPointsItem the press event is not configurable, and so you would really have to derive from it, and override it that way as far as I can see. It could be modified, but that ability doesn't appear to be present. I am trying to remember how we propagate mouse events from the containing chart, but am a little rusty on that logic.
>
> We don't have the equivalent of an event filter as far as I am aware, but in the Qt world I would use that to intercept events before they get to the chart.

Alright, thanks a lot for the info.

What surprised me most was that neither SetInteractive(false) on the control points item, nor hiding it with SetVisible(false) would prevent interaction with the points. Should either of those be considered bugs?

The heavy-handed approach I came up with yesterday was to simply remove the  control points item from the chart temporarily when I want to disable interaction. This was OK for me since having the points also disappear was actually my ultimate goal. Just thought SetVisible(false) would be enough.

Elvis


_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Elvis Stansvik
2017-06-14 8:37 GMT+02:00 Elvis Stansvik <[hidden email]>:

Den 13 juni 2017 5:53 em skrev "Marcus D. Hanwell" <[hidden email]>:
>
> On Tue, Jun 13, 2017 at 9:16 AM, Elvis Stansvik <[hidden email]> wrote:
>>
>> 2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
>>>
>>> I'm using a
>>>
>>>    vtkChartXY
>>>    vtkColorTransferControlPointsItem
>>>    vtkColorTransferFunctionItem
>>>
>>> trio for editing a vtkColorTransferFunction.
>>>
>>> I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.
>>>
>>> How can I make it non-interactive?
>>>
>>> I'm using VTK 8.0.0.rc1.
>>
>>
>> I know I could always override and swallow mouse events, but that seems like the wrong approach?
>>
>> I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.
>>
> So I would use the SetActionToButton method in vtkChart, and set each action to -1 (no button).

Ah thanks, I'll take a look at that.

> Looking at the vtkControlPointsItem the press event is not configurable, and so you would really have to derive from it, and override it that way as far as I can see. It could be modified, but that ability doesn't appear to be present. I am trying to remember how we propagate mouse events from the containing chart, but am a little rusty on that logic.
>
> We don't have the equivalent of an event filter as far as I am aware, but in the Qt world I would use that to intercept events before they get to the chart.

Alright, thanks a lot for the info.

What surprised me most was that neither SetInteractive(false) on the control points item, nor hiding it with SetVisible(false) would prevent interaction with the points. Should either of those be considered bugs?

The heavy-handed approach I came up with yesterday was to simply remove the  control points item from the chart temporarily when I want to disable interaction. This was OK for me since having the points also disappear was actually my ultimate goal. Just thought SetVisible(false) would be enough.

Sorry, it's a little early. This was not the approach I ended up with (I tried that though, but had problems adding the control points item back). What I did do was to simply disable (in the Qt sense) the entire QVTKOpenGLWidget that holds the chart (in addition to hiding the control points items with SetVisible(false)). This works, but is less than optimal of course, since now it's impossible to interact with the widget in any way. This is OK for now, but I may need to reconsider, since I might want to e.g. support zoom/panning in the chart (and only disallow interaction with the control points item).

Elvis

Elvis



_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Marcus D. Hanwell-2
In reply to this post by Elvis Stansvik
On Wed, Jun 14, 2017 at 2:37 AM, Elvis Stansvik <[hidden email]> wrote:

Den 13 juni 2017 5:53 em skrev "Marcus D. Hanwell" <[hidden email]>:
>
> On Tue, Jun 13, 2017 at 9:16 AM, Elvis Stansvik <[hidden email]> wrote:
>>
>> 2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
>>>
>>> I'm using a
>>>
>>>    vtkChartXY
>>>    vtkColorTransferControlPointsItem
>>>    vtkColorTransferFunctionItem
>>>
>>> trio for editing a vtkColorTransferFunction.
>>>
>>> I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.
>>>
>>> How can I make it non-interactive?
>>>
>>> I'm using VTK 8.0.0.rc1.
>>
>>
>> I know I could always override and swallow mouse events, but that seems like the wrong approach?
>>
>> I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.
>>
> So I would use the SetActionToButton method in vtkChart, and set each action to -1 (no button).

Ah thanks, I'll take a look at that.

> Looking at the vtkControlPointsItem the press event is not configurable, and so you would really have to derive from it, and override it that way as far as I can see. It could be modified, but that ability doesn't appear to be present. I am trying to remember how we propagate mouse events from the containing chart, but am a little rusty on that logic.
>
> We don't have the equivalent of an event filter as far as I am aware, but in the Qt world I would use that to intercept events before they get to the chart.

Alright, thanks a lot for the info.

What surprised me most was that neither SetInteractive(false) on the control points item, nor hiding it with SetVisible(false) would prevent interaction with the points. Should either of those be considered bugs?

Yes, I think these are bugs, and we should try and get them fixed up. 

The heavy-handed approach I came up with yesterday was to simply remove the  control points item from the chart temporarily when I want to disable interaction. This was OK for me since having the points also disappear was actually my ultimate goal. Just thought SetVisible(false) would be enough.

Agreed, I think it should be, although reading through the code it is clear that is not supported.

Marcus 

_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make vtkChartXY non-interactive?

Elvis Stansvik
2017-06-14 17:01 GMT+02:00 Marcus D. Hanwell <[hidden email]>:
On Wed, Jun 14, 2017 at 2:37 AM, Elvis Stansvik <[hidden email]> wrote:

Den 13 juni 2017 5:53 em skrev "Marcus D. Hanwell" <[hidden email]>:
>
> On Tue, Jun 13, 2017 at 9:16 AM, Elvis Stansvik <[hidden email]> wrote:
>>
>> 2017-06-13 15:10 GMT+02:00 Elvis Stansvik <[hidden email]>:
>>>
>>> I'm using a
>>>
>>>    vtkChartXY
>>>    vtkColorTransferControlPointsItem
>>>    vtkColorTransferFunctionItem
>>>
>>> trio for editing a vtkColorTransferFunction.
>>>
>>> I'm now trying to make it non-editable (I want this for system "built-in" color functions). I've tried calling SetInteractive(false) on all three of them. I even tried hiding the control points item, but still I can interact with the points using the mouse.
>>>
>>> How can I make it non-interactive?
>>>
>>> I'm using VTK 8.0.0.rc1.
>>
>>
>> I know I could always override and swallow mouse events, but that seems like the wrong approach?
>>
>> I'm only interested in disabling interaction with the control points item. Even hiding it as well would be OK.
>>
> So I would use the SetActionToButton method in vtkChart, and set each action to -1 (no button).

Ah thanks, I'll take a look at that.

> Looking at the vtkControlPointsItem the press event is not configurable, and so you would really have to derive from it, and override it that way as far as I can see. It could be modified, but that ability doesn't appear to be present. I am trying to remember how we propagate mouse events from the containing chart, but am a little rusty on that logic.
>
> We don't have the equivalent of an event filter as far as I am aware, but in the Qt world I would use that to intercept events before they get to the chart.

Alright, thanks a lot for the info.

What surprised me most was that neither SetInteractive(false) on the control points item, nor hiding it with SetVisible(false) would prevent interaction with the points. Should either of those be considered bugs?

Yes, I think these are bugs, and we should try and get them fixed up. 

Alright, I filed issues #17066 [1] and #17067 [2].

Elvis

The heavy-handed approach I came up with yesterday was to simply remove the  control points item from the chart temporarily when I want to disable interaction. This was OK for me since having the points also disappear was actually my ultimate goal. Just thought SetVisible(false) would be enough.

Agreed, I think it should be, although reading through the code it is clear that is not supported.

Marcus 


_______________________________________________
Powered by 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Loading...