Kitware / trame-vtk

VTK/ParaView widgets for trame
BSD 3-Clause "New" or "Revised" License
17 stars 8 forks source link

Feature request: add TextActor or CornerAnnotations serializer #67

Open FelipeCybis opened 6 months ago

FelipeCybis commented 6 months ago

It would be awsome to be able to serialize pyvista title/text objects. I've looked a little bit in the vtkjs side (https://kitware.github.io/vtk-js/api/Interaction_UI_CornerAnnotation.html) but I must confess it is quite different from other classes I looked up before. Not quite sure what would it need.

I see it has all this methods:

    'annotationContainer',
    'northWestContainer',
    'northContainer',
    'northEastContainer',
    'westContainer',
    'eastContainer',
    'southWestContainer',
    'southContainer',
    'southEastContainer',

that are divs. I assume it would work just passing innerHtml to them? Have you guys already thought about text or annotations serialization?

Would love to help in my free time, but definitely need guidance :)

jourdain commented 6 months ago

the issue here is that vtk.js use plain HTML to handle those and therefore don't really match what VTK/C++ is capturing/doing.

But with WASM, we should be able to capture it properly. Do you have a simple PyVista example illustrating such scene you would like to see on the client side? (that will help with testing/validation)

FelipeCybis commented 6 months ago

I see, I imagined, seeing the differences from other classes...

I guess this pyvista example in the end of the documentation would be enough? https://docs.pyvista.org/version/stable/api/plotting/_autosummary/pyvista.Plotter.add_title.html

import pyvista as pv
pl = pv.Plotter()
pl.background_color = 'grey'
actor = pl.add_title(
    'Plot Title', font='courier', color='k', font_size=40
)
pl.show()
jourdain commented 6 months ago

Perfect, thx...