[Paraview] vtkSMProxy: GetSubProxy is protected, but I need it outside the class

Berk Geveci berk.geveci at kitware.com
Mon Oct 19 09:59:19 EDT 2009


> - Is there a reason (software design, maybe?) to protect the functions that
> give access to subproxies, whereas the access to properties are
> -fortunately- public?
> - Is there another way to access SubProxy without modifying ParaView's
> sources?

Yes, there is a reason for not exposing the sub-proxies. We wanted the
access to the sub-proxies to be only through exposed properties
because we want all proxies (whether they have sub-proxies or not) to
behave exactly the same way. Allowing access to the sub-proxies makes
it almost impossible to make sure that developers don't shoot
themselves in the foot by changing properties of the sub-proxies that
are supposed to be controlled by the super-proxy. For example, a
property in the super-proxy may end up setting multiple properties in
the sub-proxy.

Isn't there another way of doing this? Maybe expose the property you
are setting? Something like VolumeMapperBlendMode?

-berk

On Mon, Oct 19, 2009 at 2:50 AM, Jérôme <jerome.velut at gmail.com> wrote:
> Hi,
>
> I wrote a plugin that enable a toggle between different BlendMode of the
> FixedPointVolumeRayCastMapper that is used by ParaView for volume rendering.
> It catches a key event on a render window ('B' pressed) and toggle
> BlendMode: Composite -> MaximumIntensity -> MinimumIntensity ->
> Composite->...
>
> Here is my way:
> - When button 'B' pressed:
>    - get view manager from core instance
>    - get active view from view manager
>    - for each representation 'rep' of active view:
>       - check if 'rep' has a VolumeRepresentation SubProxy
>       - if yes:
>          - check if VolumeRepresentation has a VolumeFixedPointRayCastMapper
> SubProxy
>          - if yes:
>             - get the vtkFixedPointVolumeRayCastMapper ('mapper') from this
> latter SubProxy
>             - mapper->SetBlendMode( (++mapper->GetBlendMode(  ))%3 );
>             - Update and render.
>
>
> For this to work, I need to call vtkSMProxy::GetSubProxy( char* ) from my
> plugin class. But unfortunately, these functions are protected member. I
> modified the ParaView sources to make it public, and it work just... fine.
> My questions are:
> - Is there a reason (software design, maybe?) to protect the functions that
> give access to subproxies, whereas the access to properties are
> -fortunately- public?
> - Is there another way to access SubProxy without modifying ParaView's
> sources?
>
> Thanks!
>
> Jerome
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>


More information about the ParaView mailing list