[Paraview-developers] Access to the color legend and its modification
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Thu Dec 11 17:21:21 EST 2014
Well I am a little lost what you're trying to do. In any case, attached is
simple plugin to add a push-button to the ColorEditorWidget by extending
it. Now when I show any data in the render view, its "Coloring" widget has
my button on it.
Utkarsh
On Thu, Dec 11, 2014 at 7:03 AM, Maxim Glibin <maxim.glibin at gmail.com>
wrote:
> Thank you, Utkarsh.
> I already resolved this problem yesterday.
>
> I have registered my widget:
> ADD_PARAVIEW_PROPERTY_GROUP_WIDGET(IFACES1 IFACE_SRC1
> TYPE "ColorEditor"
> CLASS_NAME pqExtraColorEditorPropertyWidget
> )
> How should I initialize the property group and property widget in
> representation of server manager XML?
>
> Are there any examples that utilize a similar logic.
>
> How can I add a property widget to the property group? (via XML or on the
> level of propertyWidget class)
>
> At the moment I did the following:
> <ProxyGroup name="representations">
> <RepresentationProxy name="MyRepresentation"
> class="vtkPVMyRepresentation"
> processes="client|renderserver|dataserver"
> base_proxygroup="representations"
> base_proxyname="SurfaceRepresentation">
> <Property name="Annotation"
> label="Annotation"
> command="Annotate"
> panel_widget="AnnotationButton">
> </Property>
> </RepresentationProxy>
>
> <Extension name="UnstructuredGridRepresentation">
> <RepresentationType subproxy="MyRepresentation"
> subtype="Surface"
> text="Annotation" />
> <SubProxy>
> <Proxy name="MyRepresentation"
> proxygroup="representations"
> proxyname="MyRepresentation">
> </Proxy>
> <ShareProperties subproxy="SurfaceRepresentation">
> <Exception name="Input" />
> <Exception name="Visibility" />
> <Exception name="Representation" />
> </ShareProperties>
> <ExposedProperties>
> <PropertyGroup panel_visibility="default"
> panel_widget="ColorEditor" label="Coloring">
> <Property name="Ambient" />
> <Property name="AmbientColor" />
> <Property name="ColorArrayName" />
> <Property name="Diffuse" />
> <Property name="DiffuseColor" />
> <Property name="LookupTable" />
> <Property name="AnnotationGroups" />
> </PropertyGroup>
> </ExposedProperties>
> </SubProxy>
> </Extension>
> </ProxyGroup>
>
> Where did I go wrong?
>
> Thanks,
> Maxim
>
> 2014-12-09 16:19 GMT+03:00 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>:
>
>> To overcome the build issue, just add the following line to your
>> CMakeLists.txt file after the add_paraview_plugin() call.
>>
>> target_link_libraries(<pluginname> pqApplicationComponents)
>>
>> Utkarsh
>>
>> On Mon, Dec 8, 2014 at 8:05 AM, Maxim Glibin <maxim.glibin at gmail.com>
>> wrote:
>>
>>> Dear Utkarsh,
>>>
>>> Thanks a lot for your help.
>>> But I am not still understand how you can create a widget in the
>>> "Display" panel without overriding the standard widgets (like Color Editor).
>>> Is it possible to show a widget only within the selected filter?
>>>
>>> I have tried to subclass pqColorEditorPropertyWidget and I have
>>> compilation problems:
>>> 2>moc_pqMyColorEditorPropertyWidget.obj : error LNK2019: unresolved
>>> external symbol "__declspec(dllimport) public: virtual void * __thiscall
>>> pqColorEditorPropertyWidget::qt_metacast(char const *)" (__
>>> imp_?qt_metacast at pqColorEditorPropertyWidget@@UAEPAXPBD at Z) referenced
>>> in function "public: virtual void * __thiscall
>>> pqMyColorEditorPropertyWidget::qt_metacast(char const *)"
>>> (?qt_metacast at pqMyColorEditorPropertyWidget@@UAEPAXPBD at Z)
>>> 2>moc_pqMyColorEditorPropertyWidget.obj : error LNK2019: unresolved
>>> external symbol "__declspec(dllimport) public: virtual int __thiscall
>>> pqColorEditorPropertyWidget::qt_metacall(enum QMetaObject::Cal
>>> l,int,void * *)" (__imp_?qt_metacall at pqColorEditorPropertyWidget
>>> @@UAEHW4Call at QMetaObject@@HPAPAX at Z) referenced in function "public:
>>> virtual int __thiscall pqMyColorEditorPropertyWidget::qt_metacall(en
>>> um QMetaObject::Call,int,void * *)"
>>> (?qt_metacall at pqMyColorEditorPropertyWidget@@UAEHW4Call at QMetaObject
>>> @@HPAPAX at Z)
>>> 2>moc_pqMyColorEditorPropertyWidget.obj : error LNK2001: unresolved
>>> external symbol "__declspec(dllimport) public: static struct QMetaObject
>>> const pqColorEditorPropertyWidget::staticMetaObject" (__imp
>>> _?staticMetaObject at pqColorEditorPropertyWidget@@2UQMetaObject@@B)
>>> 2>pqMyColorEditorPropertyWidget.obj : error LNK2019: unresolved external
>>> symbol "__declspec(dllimport) public: __thiscall
>>> pqColorEditorPropertyWidget::pqColorEditorPropertyWidget(class vtkSMProxy
>>> *,cl
>>> ass QWidget *)" (__imp_??0pqColorEditorPropertyWidget@@QAE at PAVvtkSMProxy
>>> @@PAVQWidget@@@Z) referenced in function "public: __thiscall
>>> pqMyColorEditorPropertyWidget::pqMyColorEditorPropertyWidget(class
>>> vtkSMProxy *,class vtkSMProperty *,class QWidget *)"
>>> (??pqMyColorEditorPropertyWidget@@QAE at PAVvtkSMProxy@@PAVvtkSMProperty@
>>> @PAVQWidget@@@Z)
>>> 2>pqMyColorEditorPropertyWidget.obj : error LNK2019: unresolved external
>>> symbol "__declspec(dllimport) public: virtual __thiscall
>>> pqColorEditorPropertyWidget::~pqColorEditorPropertyWidget(void)" (__im
>>> p_??1pqColorEditorPropertyWidget@@UAE at XZ) referenced in function
>>> "public: virtual __thiscall
>>> pqMyColorEditorPropertyWidget::~pqMyColorEditorPropertyWidget(void)"
>>> (??1pqMyColorEditorPropertyWidget@@UAE
>>> @XZ)
>>>
>>> Best regards,
>>> Maxim
>>>
>>>
>>> 2014-12-07 19:55 GMT+03:00 Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
>>> :
>>>
>>>> > 1. How can I assign my custom button into 'Display' panel?
>>>>
>>>> I am assuming you're using ParaView 4.2. There's no "Display" panel in
>>>> ParaView 4.2, but simply the Properties panel that shows
>>>> pqPropertyWidget instances for properties on proxies. The widget that
>>>> allows users to pick the array to color with is called
>>>> pqColorEditorPropertyWidget [1]. The Panel creates this widget when it
>>>> encounters a property group that requests 'ColorEditor' as the
>>>> "panel_widget" [2]. In your plugin, you can either subclass
>>>> pqColorEditorPropertyWidget or create a new one that you'd want to use
>>>> whenever "ColorEditor" widget is requested by any proxy. You can
>>>> register your widget for the TYPE set to "ColorEditor" in
>>>> add_paraview_property_group_widget() [3] and your widget will be used
>>>> instead of the default pqColorEditorPropertyWidget in the panel.
>>>>
>>>> > 2. How can I get an instance of color legend to change annotations by
>>>> using
>>>> > input or output information of filter?
>>>>
>>>> Now entirely sure what you're looking for, but here's a way:
>>>>
>>>> a). first track down the lookup-table ( transfer function) proxy of
>>>> interest. You can get it several ways: using the "LookupTable"
>>>> property on the "representation" proxy providing the data being
>>>> colored, or by using vtkSMTransferFunctionManager [4]. Once you have
>>>> the transfer function proxy, you can locate the legend for that in a
>>>> view using vtkSMTransferFunctionProxy::FindScalarBarRepresentation()
>>>> [5]. Look at the implementation for
>>>> vtkSMPVRepresentationProxy::SetScalarBarVisibility(); that'll give you
>>>> some hints.
>>>>
>>>> [1]
>>>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classpqColorEditorPropertyWidget.html
>>>> [2]
>>>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classpqStandardPropertyWidgetInterface.html#a83531c3804ae704d71dc917706e2e40e
>>>> [3]
>>>> http://www.paraview.org/Wiki/Plugin_HowTo#Adding_Customizations_for_Properties_Panel
>>>> [4]
>>>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classvtkSMTransferFunctionManager.html
>>>> [5]
>>>> http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classvtkSMTransferFunctionProxy.html#ac50a4c96be88696ca032048efc6c965a
>>>>
>>>>
>>>> On Fri, Dec 5, 2014 at 2:05 AM, Maxim Glibin <maxim.glibin at gmail.com>
>>>> wrote:
>>>> > Hello all,
>>>> >
>>>> > I am interested in creating a plugin filter that will change the color
>>>> > legend by pressing a button as shown at the attached picture.
>>>> >
>>>> > And I have a few questions:
>>>>
>>>> > 2. How can I get an instance of color legend to change annotations by
>>>> using
>>>> > input or output information of filter?
>>>> >
>>>> > Best regards,
>>>> > Maxim
>>>> >
>>>> > --
>>>> > Yours Sincerely,
>>>> > GLIBIN Maxim O. - Developer
>>>> > Phone : +7 (987) 533 00 55
>>>> > Email: maxim.glibin at gmail.com
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Paraview-developers mailing list
>>>> > Paraview-developers at paraview.org
>>>> > http://public.kitware.com/mailman/listinfo/paraview-developers
>>>> >
>>>>
>>>
>>>
>>>
>>> --
>>> Yours Sincerely,
>>> *GLIBIN Maxim O.* - Developer
>>> Phone : +7 (987) 533 00 55
>>> Email: maxim.glibin at gmail.com
>>>
>>>
>>
>
>
> --
> Yours Sincerely,
> *GLIBIN Maxim O.* - Developer
> Phone : +7 (987) 533 00 55
> Email: maxim.glibin at gmail.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20141211/8c2bf15d/attachment-0001.html>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8.8)
find_package(ParaView REQUIRED)
include(${PARAVIEW_USE_FILE})
set (sources)
set (ifaces)
if (PARAVIEW_BUILD_QT_GUI)
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
qt5_wrap_cpp(moc_srcs pqCustomColorEditorPropertyWidget.h)
else ()
qt4_wrap_cpp(moc_srcs pqCustomColorEditorPropertyWidget.h)
endif()
add_paraview_property_group_widget(outifaces outsrcs
TYPE "ColorEditor"
CLASS_NAME pqCustomColorEditorPropertyWidget)
set (sources pqCustomColorEditorPropertyWidget.cxx ${moc_srcs} ${outsrcs})
set (ifaces ${outifaces})
endif()
add_paraview_plugin(pqCustomColorEditorPropertyWidget "1.0"
GUI_INTERFACES ${ifaces}
SOURCES ${sources}
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pqCustomColorEditorPropertyWidget.cxx
Type: text/x-c++src
Size: 2004 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20141211/8c2bf15d/attachment-0001.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pqCustomColorEditorPropertyWidget.h
Type: text/x-chdr
Size: 1916 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20141211/8c2bf15d/attachment-0001.h>
More information about the Paraview-developers
mailing list