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

Berk Geveci berk.geveci at kitware.com
Mon Oct 19 14:00:05 EDT 2009


I don't have any problems with committing the changes you described.
Would you mind adding a document element to the property XML though?

-berk

On Mon, Oct 19, 2009 at 10:50 AM, Jérôme <jerome.velut at gmail.com> wrote:
> Thanks for your precisions.
>
> Well you are right! ParaView's proxy mechanism is robust and giving too much
> freedom to developers could be really dangerous!
> And effectively, my first try to have access to VolumeMapper BlendMode
> property was to change the rendering.xml resource in order to expose it.
>
> What I did was:
>
> - adding a IntVectorProperty in FixedPointVolumeRayCastMapper SourceProxy
>       <IntVectorProperty
>         name="BlendMode"
>         command="SetBlendMode"
>         default_values="0"
>         number_of_elements="1"
>         animateable="0">
>         <EnumerationDomain name="enum">
>           <Entry value="0" text="Composite"/>
>           <Entry value="1" text="MaximumIntensity"/>
>           <Entry value="2" text="MinimumIntensity"/>
>         </EnumerationDomain>
>       </IntVectorProperty>
>
> - adding BlendMode as exposed property to
> UniformGridVolumeRepresentationProxy in FixedPoint(...) SubProxy
>           <Property name="BlendMode"/>
>
> - adding BlendMode as exposed property to UniformGridRepresentation
> PVRepresentationProxy in UniformGrid(...) SubProxy.
>
> I changed blend mode by using GetProperty("BlendMode") on the representation
> proxy, and it works as well. But in both case (bad unprotected way and
> exposing propoerty way), I have to change something in ParaView's tree and
> recompile it. It makes my plugin working on my computer only...
>
> Is this BlendMode exposure interesting you and do you want me to send a diff
> file of my local 'rendering.xml'?
>
> Thanks again!
>
> Best regards,
> Jerome
>
>
>
> 2009/10/19 Berk Geveci <berk.geveci at kitware.com>
>>
>> > - 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